{- | 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 data passed to a \"gst-copy\" transform 'GI.Gst.Callbacks.MetaTransformFunction'. -} #define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \ && !defined(__HADDOCK_VERSION__)) module GI.Gst.Structs.MetaTransformCopy ( -- * Exported types MetaTransformCopy(..) , newZeroMetaTransformCopy , noMetaTransformCopy , -- * Properties -- ** offset #attr:offset# {- | the offset to copy, 0 if /@region@/ is 'False', otherwise > 0 -} getMetaTransformCopyOffset , #if ENABLE_OVERLOADING metaTransformCopy_offset , #endif setMetaTransformCopyOffset , -- ** region #attr:region# {- | 'True' if only region is copied -} getMetaTransformCopyRegion , #if ENABLE_OVERLOADING metaTransformCopy_region , #endif setMetaTransformCopyRegion , -- ** size #attr:size# {- | the size to copy, -1 or the buffer size when /@region@/ is 'False' -} getMetaTransformCopySize , #if ENABLE_OVERLOADING metaTransformCopy_size , #endif setMetaTransformCopySize , ) 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 -- | Memory-managed wrapper type. newtype MetaTransformCopy = MetaTransformCopy (ManagedPtr MetaTransformCopy) instance WrappedPtr MetaTransformCopy where wrappedPtrCalloc = callocBytes 24 wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 24 >=> wrapPtr MetaTransformCopy) wrappedPtrFree = Just ptr_to_g_free -- | Construct a `MetaTransformCopy` struct initialized to zero. newZeroMetaTransformCopy :: MonadIO m => m MetaTransformCopy newZeroMetaTransformCopy = liftIO $ wrappedPtrCalloc >>= wrapPtr MetaTransformCopy instance tag ~ 'AttrSet => Constructible MetaTransformCopy tag where new _ attrs = do o <- newZeroMetaTransformCopy GI.Attributes.set o attrs return o -- | A convenience alias for `Nothing` :: `Maybe` `MetaTransformCopy`. noMetaTransformCopy :: Maybe MetaTransformCopy noMetaTransformCopy = Nothing {- | Get the value of the “@region@” field. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.get' metaTransformCopy #region @ -} getMetaTransformCopyRegion :: MonadIO m => MetaTransformCopy -> m Bool getMetaTransformCopyRegion s = liftIO $ withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 0) :: IO CInt let val' = (/= 0) val return val' {- | Set the value of the “@region@” field. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.set' metaTransformCopy [ #region 'Data.GI.Base.Attributes.:=' value ] @ -} setMetaTransformCopyRegion :: MonadIO m => MetaTransformCopy -> Bool -> m () setMetaTransformCopyRegion s val = liftIO $ withManagedPtr s $ \ptr -> do let val' = (fromIntegral . fromEnum) val poke (ptr `plusPtr` 0) (val' :: CInt) #if ENABLE_OVERLOADING data MetaTransformCopyRegionFieldInfo instance AttrInfo MetaTransformCopyRegionFieldInfo where type AttrAllowedOps MetaTransformCopyRegionFieldInfo = '[ 'AttrSet, 'AttrGet] type AttrSetTypeConstraint MetaTransformCopyRegionFieldInfo = (~) Bool type AttrBaseTypeConstraint MetaTransformCopyRegionFieldInfo = (~) MetaTransformCopy type AttrGetType MetaTransformCopyRegionFieldInfo = Bool type AttrLabel MetaTransformCopyRegionFieldInfo = "region" type AttrOrigin MetaTransformCopyRegionFieldInfo = MetaTransformCopy attrGet _ = getMetaTransformCopyRegion attrSet _ = setMetaTransformCopyRegion attrConstruct = undefined attrClear _ = undefined metaTransformCopy_region :: AttrLabelProxy "region" metaTransformCopy_region = AttrLabelProxy #endif {- | Get the value of the “@offset@” field. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.get' metaTransformCopy #offset @ -} getMetaTransformCopyOffset :: MonadIO m => MetaTransformCopy -> m Word64 getMetaTransformCopyOffset s = liftIO $ withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 8) :: IO Word64 return val {- | Set the value of the “@offset@” field. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.set' metaTransformCopy [ #offset 'Data.GI.Base.Attributes.:=' value ] @ -} setMetaTransformCopyOffset :: MonadIO m => MetaTransformCopy -> Word64 -> m () setMetaTransformCopyOffset s val = liftIO $ withManagedPtr s $ \ptr -> do poke (ptr `plusPtr` 8) (val :: Word64) #if ENABLE_OVERLOADING data MetaTransformCopyOffsetFieldInfo instance AttrInfo MetaTransformCopyOffsetFieldInfo where type AttrAllowedOps MetaTransformCopyOffsetFieldInfo = '[ 'AttrSet, 'AttrGet] type AttrSetTypeConstraint MetaTransformCopyOffsetFieldInfo = (~) Word64 type AttrBaseTypeConstraint MetaTransformCopyOffsetFieldInfo = (~) MetaTransformCopy type AttrGetType MetaTransformCopyOffsetFieldInfo = Word64 type AttrLabel MetaTransformCopyOffsetFieldInfo = "offset" type AttrOrigin MetaTransformCopyOffsetFieldInfo = MetaTransformCopy attrGet _ = getMetaTransformCopyOffset attrSet _ = setMetaTransformCopyOffset attrConstruct = undefined attrClear _ = undefined metaTransformCopy_offset :: AttrLabelProxy "offset" metaTransformCopy_offset = AttrLabelProxy #endif {- | Get the value of the “@size@” field. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.get' metaTransformCopy #size @ -} getMetaTransformCopySize :: MonadIO m => MetaTransformCopy -> m Word64 getMetaTransformCopySize s = liftIO $ withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 16) :: IO Word64 return val {- | Set the value of the “@size@” field. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.set' metaTransformCopy [ #size 'Data.GI.Base.Attributes.:=' value ] @ -} setMetaTransformCopySize :: MonadIO m => MetaTransformCopy -> Word64 -> m () setMetaTransformCopySize s val = liftIO $ withManagedPtr s $ \ptr -> do poke (ptr `plusPtr` 16) (val :: Word64) #if ENABLE_OVERLOADING data MetaTransformCopySizeFieldInfo instance AttrInfo MetaTransformCopySizeFieldInfo where type AttrAllowedOps MetaTransformCopySizeFieldInfo = '[ 'AttrSet, 'AttrGet] type AttrSetTypeConstraint MetaTransformCopySizeFieldInfo = (~) Word64 type AttrBaseTypeConstraint MetaTransformCopySizeFieldInfo = (~) MetaTransformCopy type AttrGetType MetaTransformCopySizeFieldInfo = Word64 type AttrLabel MetaTransformCopySizeFieldInfo = "size" type AttrOrigin MetaTransformCopySizeFieldInfo = MetaTransformCopy attrGet _ = getMetaTransformCopySize attrSet _ = setMetaTransformCopySize attrConstruct = undefined attrClear _ = undefined metaTransformCopy_size :: AttrLabelProxy "size" metaTransformCopy_size = AttrLabelProxy #endif #if ENABLE_OVERLOADING instance O.HasAttributeList MetaTransformCopy type instance O.AttributeList MetaTransformCopy = MetaTransformCopyAttributeList type MetaTransformCopyAttributeList = ('[ '("region", MetaTransformCopyRegionFieldInfo), '("offset", MetaTransformCopyOffsetFieldInfo), '("size", MetaTransformCopySizeFieldInfo)] :: [(Symbol, *)]) #endif #if ENABLE_OVERLOADING type family ResolveMetaTransformCopyMethod (t :: Symbol) (o :: *) :: * where ResolveMetaTransformCopyMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolveMetaTransformCopyMethod t MetaTransformCopy, O.MethodInfo info MetaTransformCopy p) => OL.IsLabel t (MetaTransformCopy -> 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