gi-gst-1.0.18: GI/Gst/Structs/StaticPadTemplate.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)
Structure describing the 'GI.Gst.Structs.StaticPadTemplate.StaticPadTemplate'.
-}
#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gst.Structs.StaticPadTemplate
(
-- * Exported types
StaticPadTemplate(..) ,
newZeroStaticPadTemplate ,
noStaticPadTemplate ,
-- * Methods
-- ** get #method:get#
#if ENABLE_OVERLOADING
StaticPadTemplateGetMethodInfo ,
#endif
staticPadTemplateGet ,
-- ** getCaps #method:getCaps#
#if ENABLE_OVERLOADING
StaticPadTemplateGetCapsMethodInfo ,
#endif
staticPadTemplateGetCaps ,
-- * Properties
-- ** direction #attr:direction#
{- | the direction of the template
-}
getStaticPadTemplateDirection ,
setStaticPadTemplateDirection ,
#if ENABLE_OVERLOADING
staticPadTemplate_direction ,
#endif
-- ** nameTemplate #attr:nameTemplate#
{- | the name of the template
-}
clearStaticPadTemplateNameTemplate ,
getStaticPadTemplateNameTemplate ,
setStaticPadTemplateNameTemplate ,
#if ENABLE_OVERLOADING
staticPadTemplate_nameTemplate ,
#endif
-- ** presence #attr:presence#
{- | the presence of the template
-}
getStaticPadTemplatePresence ,
setStaticPadTemplatePresence ,
#if ENABLE_OVERLOADING
staticPadTemplate_presence ,
#endif
-- ** staticCaps #attr:staticCaps#
{- | the caps of the template.
-}
getStaticPadTemplateStaticCaps ,
#if ENABLE_OVERLOADING
staticPadTemplate_staticCaps ,
#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 {-# SOURCE #-} qualified GI.Gst.Enums as Gst.Enums
import {-# SOURCE #-} qualified GI.Gst.Objects.PadTemplate as Gst.PadTemplate
import {-# SOURCE #-} qualified GI.Gst.Structs.Caps as Gst.Caps
import {-# SOURCE #-} qualified GI.Gst.Structs.StaticCaps as Gst.StaticCaps
-- | Memory-managed wrapper type.
newtype StaticPadTemplate = StaticPadTemplate (ManagedPtr StaticPadTemplate)
instance WrappedPtr StaticPadTemplate where
wrappedPtrCalloc = callocBytes 64
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 64 >=> wrapPtr StaticPadTemplate)
wrappedPtrFree = Just ptr_to_g_free
-- | Construct a `StaticPadTemplate` struct initialized to zero.
newZeroStaticPadTemplate :: MonadIO m => m StaticPadTemplate
newZeroStaticPadTemplate = liftIO $ wrappedPtrCalloc >>= wrapPtr StaticPadTemplate
instance tag ~ 'AttrSet => Constructible StaticPadTemplate tag where
new _ attrs = do
o <- newZeroStaticPadTemplate
GI.Attributes.set o attrs
return o
-- | A convenience alias for `Nothing` :: `Maybe` `StaticPadTemplate`.
noStaticPadTemplate :: Maybe StaticPadTemplate
noStaticPadTemplate = Nothing
{- |
Get the value of the “@name_template@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' staticPadTemplate #nameTemplate
@
-}
getStaticPadTemplateNameTemplate :: MonadIO m => StaticPadTemplate -> m (Maybe T.Text)
getStaticPadTemplateNameTemplate s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO CString
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- cstringToText val'
return val''
return result
{- |
Set the value of the “@name_template@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' staticPadTemplate [ #nameTemplate 'Data.GI.Base.Attributes.:=' value ]
@
-}
setStaticPadTemplateNameTemplate :: MonadIO m => StaticPadTemplate -> CString -> m ()
setStaticPadTemplateNameTemplate s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 0) (val :: CString)
{- |
Set the value of the “@name_template@” field to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.clear' #nameTemplate
@
-}
clearStaticPadTemplateNameTemplate :: MonadIO m => StaticPadTemplate -> m ()
clearStaticPadTemplateNameTemplate s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 0) (FP.nullPtr :: CString)
#if ENABLE_OVERLOADING
data StaticPadTemplateNameTemplateFieldInfo
instance AttrInfo StaticPadTemplateNameTemplateFieldInfo where
type AttrAllowedOps StaticPadTemplateNameTemplateFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint StaticPadTemplateNameTemplateFieldInfo = (~) CString
type AttrBaseTypeConstraint StaticPadTemplateNameTemplateFieldInfo = (~) StaticPadTemplate
type AttrGetType StaticPadTemplateNameTemplateFieldInfo = Maybe T.Text
type AttrLabel StaticPadTemplateNameTemplateFieldInfo = "name_template"
type AttrOrigin StaticPadTemplateNameTemplateFieldInfo = StaticPadTemplate
attrGet _ = getStaticPadTemplateNameTemplate
attrSet _ = setStaticPadTemplateNameTemplate
attrConstruct = undefined
attrClear _ = clearStaticPadTemplateNameTemplate
staticPadTemplate_nameTemplate :: AttrLabelProxy "nameTemplate"
staticPadTemplate_nameTemplate = AttrLabelProxy
#endif
{- |
Get the value of the “@direction@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' staticPadTemplate #direction
@
-}
getStaticPadTemplateDirection :: MonadIO m => StaticPadTemplate -> m Gst.Enums.PadDirection
getStaticPadTemplateDirection s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO CUInt
let val' = (toEnum . fromIntegral) val
return val'
{- |
Set the value of the “@direction@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' staticPadTemplate [ #direction 'Data.GI.Base.Attributes.:=' value ]
@
-}
setStaticPadTemplateDirection :: MonadIO m => StaticPadTemplate -> Gst.Enums.PadDirection -> m ()
setStaticPadTemplateDirection s val = liftIO $ withManagedPtr s $ \ptr -> do
let val' = (fromIntegral . fromEnum) val
poke (ptr `plusPtr` 8) (val' :: CUInt)
#if ENABLE_OVERLOADING
data StaticPadTemplateDirectionFieldInfo
instance AttrInfo StaticPadTemplateDirectionFieldInfo where
type AttrAllowedOps StaticPadTemplateDirectionFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint StaticPadTemplateDirectionFieldInfo = (~) Gst.Enums.PadDirection
type AttrBaseTypeConstraint StaticPadTemplateDirectionFieldInfo = (~) StaticPadTemplate
type AttrGetType StaticPadTemplateDirectionFieldInfo = Gst.Enums.PadDirection
type AttrLabel StaticPadTemplateDirectionFieldInfo = "direction"
type AttrOrigin StaticPadTemplateDirectionFieldInfo = StaticPadTemplate
attrGet _ = getStaticPadTemplateDirection
attrSet _ = setStaticPadTemplateDirection
attrConstruct = undefined
attrClear _ = undefined
staticPadTemplate_direction :: AttrLabelProxy "direction"
staticPadTemplate_direction = AttrLabelProxy
#endif
{- |
Get the value of the “@presence@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' staticPadTemplate #presence
@
-}
getStaticPadTemplatePresence :: MonadIO m => StaticPadTemplate -> m Gst.Enums.PadPresence
getStaticPadTemplatePresence s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 12) :: IO CUInt
let val' = (toEnum . fromIntegral) val
return val'
{- |
Set the value of the “@presence@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' staticPadTemplate [ #presence 'Data.GI.Base.Attributes.:=' value ]
@
-}
setStaticPadTemplatePresence :: MonadIO m => StaticPadTemplate -> Gst.Enums.PadPresence -> m ()
setStaticPadTemplatePresence s val = liftIO $ withManagedPtr s $ \ptr -> do
let val' = (fromIntegral . fromEnum) val
poke (ptr `plusPtr` 12) (val' :: CUInt)
#if ENABLE_OVERLOADING
data StaticPadTemplatePresenceFieldInfo
instance AttrInfo StaticPadTemplatePresenceFieldInfo where
type AttrAllowedOps StaticPadTemplatePresenceFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint StaticPadTemplatePresenceFieldInfo = (~) Gst.Enums.PadPresence
type AttrBaseTypeConstraint StaticPadTemplatePresenceFieldInfo = (~) StaticPadTemplate
type AttrGetType StaticPadTemplatePresenceFieldInfo = Gst.Enums.PadPresence
type AttrLabel StaticPadTemplatePresenceFieldInfo = "presence"
type AttrOrigin StaticPadTemplatePresenceFieldInfo = StaticPadTemplate
attrGet _ = getStaticPadTemplatePresence
attrSet _ = setStaticPadTemplatePresence
attrConstruct = undefined
attrClear _ = undefined
staticPadTemplate_presence :: AttrLabelProxy "presence"
staticPadTemplate_presence = AttrLabelProxy
#endif
{- |
Get the value of the “@static_caps@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' staticPadTemplate #staticCaps
@
-}
getStaticPadTemplateStaticCaps :: MonadIO m => StaticPadTemplate -> m Gst.StaticCaps.StaticCaps
getStaticPadTemplateStaticCaps s = liftIO $ withManagedPtr s $ \ptr -> do
let val = ptr `plusPtr` 16 :: (Ptr Gst.StaticCaps.StaticCaps)
val' <- (newPtr Gst.StaticCaps.StaticCaps) val
return val'
#if ENABLE_OVERLOADING
data StaticPadTemplateStaticCapsFieldInfo
instance AttrInfo StaticPadTemplateStaticCapsFieldInfo where
type AttrAllowedOps StaticPadTemplateStaticCapsFieldInfo = '[ 'AttrGet]
type AttrSetTypeConstraint StaticPadTemplateStaticCapsFieldInfo = (~) (Ptr Gst.StaticCaps.StaticCaps)
type AttrBaseTypeConstraint StaticPadTemplateStaticCapsFieldInfo = (~) StaticPadTemplate
type AttrGetType StaticPadTemplateStaticCapsFieldInfo = Gst.StaticCaps.StaticCaps
type AttrLabel StaticPadTemplateStaticCapsFieldInfo = "static_caps"
type AttrOrigin StaticPadTemplateStaticCapsFieldInfo = StaticPadTemplate
attrGet _ = getStaticPadTemplateStaticCaps
attrSet _ = undefined
attrConstruct = undefined
attrClear _ = undefined
staticPadTemplate_staticCaps :: AttrLabelProxy "staticCaps"
staticPadTemplate_staticCaps = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList StaticPadTemplate
type instance O.AttributeList StaticPadTemplate = StaticPadTemplateAttributeList
type StaticPadTemplateAttributeList = ('[ '("nameTemplate", StaticPadTemplateNameTemplateFieldInfo), '("direction", StaticPadTemplateDirectionFieldInfo), '("presence", StaticPadTemplatePresenceFieldInfo), '("staticCaps", StaticPadTemplateStaticCapsFieldInfo)] :: [(Symbol, *)])
#endif
-- method StaticPadTemplate::get
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad_template", argType = TInterface (Name {namespace = "Gst", name = "StaticPadTemplate"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the static pad template", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "PadTemplate"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_static_pad_template_get" gst_static_pad_template_get ::
Ptr StaticPadTemplate -> -- pad_template : TInterface (Name {namespace = "Gst", name = "StaticPadTemplate"})
IO (Ptr Gst.PadTemplate.PadTemplate)
{- |
Converts a 'GI.Gst.Structs.StaticPadTemplate.StaticPadTemplate' into a 'GI.Gst.Objects.PadTemplate.PadTemplate'.
-}
staticPadTemplateGet ::
(B.CallStack.HasCallStack, MonadIO m) =>
StaticPadTemplate
{- ^ /@padTemplate@/: the static pad template -}
-> m (Maybe Gst.PadTemplate.PadTemplate)
{- ^ __Returns:__ a new 'GI.Gst.Objects.PadTemplate.PadTemplate'. -}
staticPadTemplateGet padTemplate = liftIO $ do
padTemplate' <- unsafeManagedPtrGetPtr padTemplate
result <- gst_static_pad_template_get padTemplate'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (newObject Gst.PadTemplate.PadTemplate) result'
return result''
touchManagedPtr padTemplate
return maybeResult
#if ENABLE_OVERLOADING
data StaticPadTemplateGetMethodInfo
instance (signature ~ (m (Maybe Gst.PadTemplate.PadTemplate)), MonadIO m) => O.MethodInfo StaticPadTemplateGetMethodInfo StaticPadTemplate signature where
overloadedMethod _ = staticPadTemplateGet
#endif
-- method StaticPadTemplate::get_caps
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "templ", argType = TInterface (Name {namespace = "Gst", name = "StaticPadTemplate"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstStaticPadTemplate to get capabilities of.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Gst", name = "Caps"}))
-- throws : False
-- Skip return : False
foreign import ccall "gst_static_pad_template_get_caps" gst_static_pad_template_get_caps ::
Ptr StaticPadTemplate -> -- templ : TInterface (Name {namespace = "Gst", name = "StaticPadTemplate"})
IO (Ptr Gst.Caps.Caps)
{- |
Gets the capabilities of the static pad template.
-}
staticPadTemplateGetCaps ::
(B.CallStack.HasCallStack, MonadIO m) =>
StaticPadTemplate
{- ^ /@templ@/: a 'GI.Gst.Structs.StaticPadTemplate.StaticPadTemplate' to get capabilities of. -}
-> m Gst.Caps.Caps
{- ^ __Returns:__ the 'GI.Gst.Structs.Caps.Caps' of the static pad template.
Unref after usage. Since the core holds an additional
ref to the returned caps, use @/gst_caps_make_writable()/@
on the returned caps to modify it. -}
staticPadTemplateGetCaps templ = liftIO $ do
templ' <- unsafeManagedPtrGetPtr templ
result <- gst_static_pad_template_get_caps templ'
checkUnexpectedReturnNULL "staticPadTemplateGetCaps" result
result' <- (wrapBoxed Gst.Caps.Caps) result
touchManagedPtr templ
return result'
#if ENABLE_OVERLOADING
data StaticPadTemplateGetCapsMethodInfo
instance (signature ~ (m Gst.Caps.Caps), MonadIO m) => O.MethodInfo StaticPadTemplateGetCapsMethodInfo StaticPadTemplate signature where
overloadedMethod _ = staticPadTemplateGetCaps
#endif
#if ENABLE_OVERLOADING
type family ResolveStaticPadTemplateMethod (t :: Symbol) (o :: *) :: * where
ResolveStaticPadTemplateMethod "get" o = StaticPadTemplateGetMethodInfo
ResolveStaticPadTemplateMethod "getCaps" o = StaticPadTemplateGetCapsMethodInfo
ResolveStaticPadTemplateMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveStaticPadTemplateMethod t StaticPadTemplate, O.MethodInfo info StaticPadTemplate p) => OL.IsLabel t (StaticPadTemplate -> 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