{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

Extra buffer metadata describing image cropping.
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.GstVideo.Structs.VideoCropMeta
    (

-- * Exported types
    VideoCropMeta(..)                       ,
    newZeroVideoCropMeta                    ,
    noVideoCropMeta                         ,


 -- * Methods
-- ** getInfo #method:getInfo#

    videoCropMetaGetInfo                    ,




 -- * Properties
-- ** height #attr:height#
{- | the cropped height
-}
    getVideoCropMetaHeight                  ,
    setVideoCropMetaHeight                  ,
#if ENABLE_OVERLOADING
    videoCropMeta_height                    ,
#endif


-- ** meta #attr:meta#
{- | parent 'GI.Gst.Structs.Meta.Meta'
-}
    getVideoCropMetaMeta                    ,
#if ENABLE_OVERLOADING
    videoCropMeta_meta                      ,
#endif


-- ** width #attr:width#
{- | the cropped width
-}
    getVideoCropMetaWidth                   ,
    setVideoCropMetaWidth                   ,
#if ENABLE_OVERLOADING
    videoCropMeta_width                     ,
#endif


-- ** x #attr:x#
{- | the horizontal offset
-}
    getVideoCropMetaX                       ,
    setVideoCropMetaX                       ,
#if ENABLE_OVERLOADING
    videoCropMeta_x                         ,
#endif


-- ** y #attr:y#
{- | the vertical offset
-}
    getVideoCropMetaY                       ,
    setVideoCropMetaY                       ,
#if ENABLE_OVERLOADING
    videoCropMeta_y                         ,
#endif




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import qualified GI.Gst.Structs.Meta as Gst.Meta
import qualified GI.Gst.Structs.MetaInfo as Gst.MetaInfo

-- | Memory-managed wrapper type.
newtype VideoCropMeta = VideoCropMeta (ManagedPtr VideoCropMeta)
instance WrappedPtr VideoCropMeta where
    wrappedPtrCalloc = callocBytes 32
    wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 32 >=> wrapPtr VideoCropMeta)
    wrappedPtrFree = Just ptr_to_g_free

-- | Construct a `VideoCropMeta` struct initialized to zero.
newZeroVideoCropMeta :: MonadIO m => m VideoCropMeta
newZeroVideoCropMeta = liftIO $ wrappedPtrCalloc >>= wrapPtr VideoCropMeta

instance tag ~ 'AttrSet => Constructible VideoCropMeta tag where
    new _ attrs = do
        o <- newZeroVideoCropMeta
        GI.Attributes.set o attrs
        return o


-- | A convenience alias for `Nothing` :: `Maybe` `VideoCropMeta`.
noVideoCropMeta :: Maybe VideoCropMeta
noVideoCropMeta = Nothing

{- |
Get the value of the “@meta@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' videoCropMeta #meta
@
-}
getVideoCropMetaMeta :: MonadIO m => VideoCropMeta -> m Gst.Meta.Meta
getVideoCropMetaMeta s = liftIO $ withManagedPtr s $ \ptr -> do
    let val = ptr `plusPtr` 0 :: (Ptr Gst.Meta.Meta)
    val' <- (newPtr Gst.Meta.Meta) val
    return val'

#if ENABLE_OVERLOADING
data VideoCropMetaMetaFieldInfo
instance AttrInfo VideoCropMetaMetaFieldInfo where
    type AttrAllowedOps VideoCropMetaMetaFieldInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint VideoCropMetaMetaFieldInfo = (~) (Ptr Gst.Meta.Meta)
    type AttrBaseTypeConstraint VideoCropMetaMetaFieldInfo = (~) VideoCropMeta
    type AttrGetType VideoCropMetaMetaFieldInfo = Gst.Meta.Meta
    type AttrLabel VideoCropMetaMetaFieldInfo = "meta"
    type AttrOrigin VideoCropMetaMetaFieldInfo = VideoCropMeta
    attrGet _ = getVideoCropMetaMeta
    attrSet _ = undefined
    attrConstruct = undefined
    attrClear _ = undefined

videoCropMeta_meta :: AttrLabelProxy "meta"
videoCropMeta_meta = AttrLabelProxy

#endif


{- |
Get the value of the “@x@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' videoCropMeta #x
@
-}
getVideoCropMetaX :: MonadIO m => VideoCropMeta -> m Word32
getVideoCropMetaX s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 16) :: IO Word32
    return val

{- |
Set the value of the “@x@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' videoCropMeta [ #x 'Data.GI.Base.Attributes.:=' value ]
@
-}
setVideoCropMetaX :: MonadIO m => VideoCropMeta -> Word32 -> m ()
setVideoCropMetaX s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 16) (val :: Word32)

#if ENABLE_OVERLOADING
data VideoCropMetaXFieldInfo
instance AttrInfo VideoCropMetaXFieldInfo where
    type AttrAllowedOps VideoCropMetaXFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint VideoCropMetaXFieldInfo = (~) Word32
    type AttrBaseTypeConstraint VideoCropMetaXFieldInfo = (~) VideoCropMeta
    type AttrGetType VideoCropMetaXFieldInfo = Word32
    type AttrLabel VideoCropMetaXFieldInfo = "x"
    type AttrOrigin VideoCropMetaXFieldInfo = VideoCropMeta
    attrGet _ = getVideoCropMetaX
    attrSet _ = setVideoCropMetaX
    attrConstruct = undefined
    attrClear _ = undefined

videoCropMeta_x :: AttrLabelProxy "x"
videoCropMeta_x = AttrLabelProxy

#endif


{- |
Get the value of the “@y@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' videoCropMeta #y
@
-}
getVideoCropMetaY :: MonadIO m => VideoCropMeta -> m Word32
getVideoCropMetaY s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 20) :: IO Word32
    return val

{- |
Set the value of the “@y@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' videoCropMeta [ #y 'Data.GI.Base.Attributes.:=' value ]
@
-}
setVideoCropMetaY :: MonadIO m => VideoCropMeta -> Word32 -> m ()
setVideoCropMetaY s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 20) (val :: Word32)

#if ENABLE_OVERLOADING
data VideoCropMetaYFieldInfo
instance AttrInfo VideoCropMetaYFieldInfo where
    type AttrAllowedOps VideoCropMetaYFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint VideoCropMetaYFieldInfo = (~) Word32
    type AttrBaseTypeConstraint VideoCropMetaYFieldInfo = (~) VideoCropMeta
    type AttrGetType VideoCropMetaYFieldInfo = Word32
    type AttrLabel VideoCropMetaYFieldInfo = "y"
    type AttrOrigin VideoCropMetaYFieldInfo = VideoCropMeta
    attrGet _ = getVideoCropMetaY
    attrSet _ = setVideoCropMetaY
    attrConstruct = undefined
    attrClear _ = undefined

videoCropMeta_y :: AttrLabelProxy "y"
videoCropMeta_y = AttrLabelProxy

#endif


{- |
Get the value of the “@width@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' videoCropMeta #width
@
-}
getVideoCropMetaWidth :: MonadIO m => VideoCropMeta -> m Word32
getVideoCropMetaWidth s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 24) :: IO Word32
    return val

{- |
Set the value of the “@width@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' videoCropMeta [ #width 'Data.GI.Base.Attributes.:=' value ]
@
-}
setVideoCropMetaWidth :: MonadIO m => VideoCropMeta -> Word32 -> m ()
setVideoCropMetaWidth s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 24) (val :: Word32)

#if ENABLE_OVERLOADING
data VideoCropMetaWidthFieldInfo
instance AttrInfo VideoCropMetaWidthFieldInfo where
    type AttrAllowedOps VideoCropMetaWidthFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint VideoCropMetaWidthFieldInfo = (~) Word32
    type AttrBaseTypeConstraint VideoCropMetaWidthFieldInfo = (~) VideoCropMeta
    type AttrGetType VideoCropMetaWidthFieldInfo = Word32
    type AttrLabel VideoCropMetaWidthFieldInfo = "width"
    type AttrOrigin VideoCropMetaWidthFieldInfo = VideoCropMeta
    attrGet _ = getVideoCropMetaWidth
    attrSet _ = setVideoCropMetaWidth
    attrConstruct = undefined
    attrClear _ = undefined

videoCropMeta_width :: AttrLabelProxy "width"
videoCropMeta_width = AttrLabelProxy

#endif


{- |
Get the value of the “@height@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' videoCropMeta #height
@
-}
getVideoCropMetaHeight :: MonadIO m => VideoCropMeta -> m Word32
getVideoCropMetaHeight s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 28) :: IO Word32
    return val

{- |
Set the value of the “@height@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' videoCropMeta [ #height 'Data.GI.Base.Attributes.:=' value ]
@
-}
setVideoCropMetaHeight :: MonadIO m => VideoCropMeta -> Word32 -> m ()
setVideoCropMetaHeight s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 28) (val :: Word32)

#if ENABLE_OVERLOADING
data VideoCropMetaHeightFieldInfo
instance AttrInfo VideoCropMetaHeightFieldInfo where
    type AttrAllowedOps VideoCropMetaHeightFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint VideoCropMetaHeightFieldInfo = (~) Word32
    type AttrBaseTypeConstraint VideoCropMetaHeightFieldInfo = (~) VideoCropMeta
    type AttrGetType VideoCropMetaHeightFieldInfo = Word32
    type AttrLabel VideoCropMetaHeightFieldInfo = "height"
    type AttrOrigin VideoCropMetaHeightFieldInfo = VideoCropMeta
    attrGet _ = getVideoCropMetaHeight
    attrSet _ = setVideoCropMetaHeight
    attrConstruct = undefined
    attrClear _ = undefined

videoCropMeta_height :: AttrLabelProxy "height"
videoCropMeta_height = AttrLabelProxy

#endif



#if ENABLE_OVERLOADING
instance O.HasAttributeList VideoCropMeta
type instance O.AttributeList VideoCropMeta = VideoCropMetaAttributeList
type VideoCropMetaAttributeList = ('[ '("meta", VideoCropMetaMetaFieldInfo), '("x", VideoCropMetaXFieldInfo), '("y", VideoCropMetaYFieldInfo), '("width", VideoCropMetaWidthFieldInfo), '("height", VideoCropMetaHeightFieldInfo)] :: [(Symbol, *)])
#endif

-- method VideoCropMeta::get_info
-- method type : MemberFunction
-- Args : []
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "MetaInfo"}))
-- throws : False
-- Skip return : False

foreign import ccall "gst_video_crop_meta_get_info" gst_video_crop_meta_get_info ::
    IO (Ptr Gst.MetaInfo.MetaInfo)

{- |
/No description available in the introspection data./
-}
videoCropMetaGetInfo ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Gst.MetaInfo.MetaInfo
videoCropMetaGetInfo  = liftIO $ do
    result <- gst_video_crop_meta_get_info
    checkUnexpectedReturnNULL "videoCropMetaGetInfo" result
    result' <- (newPtr Gst.MetaInfo.MetaInfo) result
    return result'

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
type family ResolveVideoCropMetaMethod (t :: Symbol) (o :: *) :: * where
    ResolveVideoCropMetaMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveVideoCropMetaMethod t VideoCropMeta, O.MethodInfo info VideoCropMeta p) => OL.IsLabel t (VideoCropMeta -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

#endif