gi-gst-1.0.18: GI/Gst/Objects/PadTemplate.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)
Padtemplates describe the possible media types a pad or an elementfactory can
handle. This allows for both inspection of handled types before loading the
element plugin as well as identifying pads on elements that are not yet
created (request or sometimes pads).
Pad and PadTemplates have 'GI.Gst.Structs.Caps.Caps' attached to it to describe the media type
they are capable of dealing with. 'GI.Gst.Objects.PadTemplate.padTemplateGetCaps' or
@/GST_PAD_TEMPLATE_CAPS()/@ are used to get the caps of a padtemplate. It\'s not
possible to modify the caps of a padtemplate after creation.
PadTemplates have a 'GI.Gst.Enums.PadPresence' property which identifies the lifetime
of the pad and that can be retrieved with @/GST_PAD_TEMPLATE_PRESENCE()/@. Also
the direction of the pad can be retrieved from the 'GI.Gst.Objects.PadTemplate.PadTemplate' with
@/GST_PAD_TEMPLATE_DIRECTION()/@.
The GST_PAD_TEMPLATE_NAME_TEMPLATE () is important for GST_PAD_REQUEST pads
because it has to be used as the name in the 'GI.Gst.Objects.Element.elementGetRequestPad'
call to instantiate a pad from this template.
Padtemplates can be created with 'GI.Gst.Objects.PadTemplate.padTemplateNew' or with
gst_static_pad_template_get (), which creates a 'GI.Gst.Objects.PadTemplate.PadTemplate' from a
'GI.Gst.Structs.StaticPadTemplate.StaticPadTemplate' that can be filled with the
convenient @/GST_STATIC_PAD_TEMPLATE()/@ macro.
A padtemplate can be used to create a pad (see 'GI.Gst.Objects.Pad.padNewFromTemplate'
or gst_pad_new_from_static_template ()) or to add to an element class
(see gst_element_class_add_static_pad_template ()).
The following code example shows the code to create a pad from a padtemplate.
=== /C code/
>
> GstStaticPadTemplate my_template =
> GST_STATIC_PAD_TEMPLATE (
> "sink", // the name of the pad
> GST_PAD_SINK, // the direction of the pad
> GST_PAD_ALWAYS, // when this pad will be present
> GST_STATIC_CAPS ( // the capabilities of the padtemplate
> "audio/x-raw, "
> "channels = (int) [ 1, 6 ]"
> )
> );
> void
> my_method (void)
> {
> GstPad *pad;
> pad = gst_pad_new_from_static_template (&my_template, "sink");
> ...
> }
The following example shows you how to add the padtemplate to an
element class, this is usually done in the class_init of the class:
=== /C code/
>
> static void
> my_element_class_init (GstMyElementClass *klass)
> {
> GstElementClass *gstelement_class = GST_ELEMENT_CLASS (klass);
>
> gst_element_class_add_static_pad_template (gstelement_class, &my_template);
> }
-}
#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gst.Objects.PadTemplate
(
-- * Exported types
PadTemplate(..) ,
IsPadTemplate ,
toPadTemplate ,
noPadTemplate ,
-- * Methods
-- ** getCaps #method:getCaps#
#if ENABLE_OVERLOADING
PadTemplateGetCapsMethodInfo ,
#endif
padTemplateGetCaps ,
-- ** new #method:new#
padTemplateNew ,
-- ** newFromStaticPadTemplateWithGtype #method:newFromStaticPadTemplateWithGtype#
padTemplateNewFromStaticPadTemplateWithGtype,
-- ** newWithGtype #method:newWithGtype#
padTemplateNewWithGtype ,
-- ** padCreated #method:padCreated#
#if ENABLE_OVERLOADING
PadTemplatePadCreatedMethodInfo ,
#endif
padTemplatePadCreated ,
-- * Properties
-- ** caps #attr:caps#
{- | The capabilities of the pad described by the pad template.
-}
#if ENABLE_OVERLOADING
PadTemplateCapsPropertyInfo ,
#endif
constructPadTemplateCaps ,
getPadTemplateCaps ,
#if ENABLE_OVERLOADING
padTemplateCaps ,
#endif
-- ** direction #attr:direction#
{- | The direction of the pad described by the pad template.
-}
#if ENABLE_OVERLOADING
PadTemplateDirectionPropertyInfo ,
#endif
constructPadTemplateDirection ,
getPadTemplateDirection ,
#if ENABLE_OVERLOADING
padTemplateDirection ,
#endif
-- ** gtype #attr:gtype#
{- | The type of the pad described by the pad template.
/Since: 1.14/
-}
#if ENABLE_OVERLOADING
PadTemplateGtypePropertyInfo ,
#endif
constructPadTemplateGtype ,
getPadTemplateGtype ,
#if ENABLE_OVERLOADING
padTemplateGtype ,
#endif
-- ** nameTemplate #attr:nameTemplate#
{- | The name template of the pad template.
-}
#if ENABLE_OVERLOADING
PadTemplateNameTemplatePropertyInfo ,
#endif
constructPadTemplateNameTemplate ,
getPadTemplateNameTemplate ,
#if ENABLE_OVERLOADING
padTemplateNameTemplate ,
#endif
-- ** presence #attr:presence#
{- | When the pad described by the pad template will become available.
-}
#if ENABLE_OVERLOADING
PadTemplatePresencePropertyInfo ,
#endif
constructPadTemplatePresence ,
getPadTemplatePresence ,
#if ENABLE_OVERLOADING
padTemplatePresence ,
#endif
-- * Signals
-- ** padCreated #signal:padCreated#
C_PadTemplatePadCreatedCallback ,
PadTemplatePadCreatedCallback ,
#if ENABLE_OVERLOADING
PadTemplatePadCreatedSignalInfo ,
#endif
afterPadTemplatePadCreated ,
genClosure_PadTemplatePadCreated ,
mk_PadTemplatePadCreatedCallback ,
noPadTemplatePadCreatedCallback ,
onPadTemplatePadCreated ,
wrap_PadTemplatePadCreatedCallback ,
) 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.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gst.Enums as Gst.Enums
import {-# SOURCE #-} qualified GI.Gst.Objects.Object as Gst.Object
import {-# SOURCE #-} qualified GI.Gst.Objects.Pad as Gst.Pad
import {-# SOURCE #-} qualified GI.Gst.Structs.Caps as Gst.Caps
import {-# SOURCE #-} qualified GI.Gst.Structs.StaticPadTemplate as Gst.StaticPadTemplate
-- | Memory-managed wrapper type.
newtype PadTemplate = PadTemplate (ManagedPtr PadTemplate)
foreign import ccall "gst_pad_template_get_type"
c_gst_pad_template_get_type :: IO GType
instance GObject PadTemplate where
gobjectType = c_gst_pad_template_get_type
-- | Type class for types which can be safely cast to `PadTemplate`, for instance with `toPadTemplate`.
class (GObject o, O.IsDescendantOf PadTemplate o) => IsPadTemplate o
instance (GObject o, O.IsDescendantOf PadTemplate o) => IsPadTemplate o
instance O.HasParentTypes PadTemplate
type instance O.ParentTypes PadTemplate = '[Gst.Object.Object, GObject.Object.Object]
-- | Cast to `PadTemplate`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toPadTemplate :: (MonadIO m, IsPadTemplate o) => o -> m PadTemplate
toPadTemplate = liftIO . unsafeCastTo PadTemplate
-- | A convenience alias for `Nothing` :: `Maybe` `PadTemplate`.
noPadTemplate :: Maybe PadTemplate
noPadTemplate = Nothing
#if ENABLE_OVERLOADING
type family ResolvePadTemplateMethod (t :: Symbol) (o :: *) :: * where
ResolvePadTemplateMethod "addControlBinding" o = Gst.Object.ObjectAddControlBindingMethodInfo
ResolvePadTemplateMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolvePadTemplateMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolvePadTemplateMethod "defaultError" o = Gst.Object.ObjectDefaultErrorMethodInfo
ResolvePadTemplateMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolvePadTemplateMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolvePadTemplateMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolvePadTemplateMethod "hasActiveControlBindings" o = Gst.Object.ObjectHasActiveControlBindingsMethodInfo
ResolvePadTemplateMethod "hasAncestor" o = Gst.Object.ObjectHasAncestorMethodInfo
ResolvePadTemplateMethod "hasAsAncestor" o = Gst.Object.ObjectHasAsAncestorMethodInfo
ResolvePadTemplateMethod "hasAsParent" o = Gst.Object.ObjectHasAsParentMethodInfo
ResolvePadTemplateMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolvePadTemplateMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolvePadTemplateMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolvePadTemplateMethod "padCreated" o = PadTemplatePadCreatedMethodInfo
ResolvePadTemplateMethod "ref" o = Gst.Object.ObjectRefMethodInfo
ResolvePadTemplateMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolvePadTemplateMethod "removeControlBinding" o = Gst.Object.ObjectRemoveControlBindingMethodInfo
ResolvePadTemplateMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolvePadTemplateMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolvePadTemplateMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolvePadTemplateMethod "suggestNextSync" o = Gst.Object.ObjectSuggestNextSyncMethodInfo
ResolvePadTemplateMethod "syncValues" o = Gst.Object.ObjectSyncValuesMethodInfo
ResolvePadTemplateMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolvePadTemplateMethod "unparent" o = Gst.Object.ObjectUnparentMethodInfo
ResolvePadTemplateMethod "unref" o = Gst.Object.ObjectUnrefMethodInfo
ResolvePadTemplateMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolvePadTemplateMethod "getCaps" o = PadTemplateGetCapsMethodInfo
ResolvePadTemplateMethod "getControlBinding" o = Gst.Object.ObjectGetControlBindingMethodInfo
ResolvePadTemplateMethod "getControlRate" o = Gst.Object.ObjectGetControlRateMethodInfo
ResolvePadTemplateMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolvePadTemplateMethod "getGValueArray" o = Gst.Object.ObjectGetGValueArrayMethodInfo
ResolvePadTemplateMethod "getName" o = Gst.Object.ObjectGetNameMethodInfo
ResolvePadTemplateMethod "getParent" o = Gst.Object.ObjectGetParentMethodInfo
ResolvePadTemplateMethod "getPathString" o = Gst.Object.ObjectGetPathStringMethodInfo
ResolvePadTemplateMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolvePadTemplateMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolvePadTemplateMethod "getValue" o = Gst.Object.ObjectGetValueMethodInfo
ResolvePadTemplateMethod "setControlBindingDisabled" o = Gst.Object.ObjectSetControlBindingDisabledMethodInfo
ResolvePadTemplateMethod "setControlBindingsDisabled" o = Gst.Object.ObjectSetControlBindingsDisabledMethodInfo
ResolvePadTemplateMethod "setControlRate" o = Gst.Object.ObjectSetControlRateMethodInfo
ResolvePadTemplateMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolvePadTemplateMethod "setName" o = Gst.Object.ObjectSetNameMethodInfo
ResolvePadTemplateMethod "setParent" o = Gst.Object.ObjectSetParentMethodInfo
ResolvePadTemplateMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolvePadTemplateMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolvePadTemplateMethod t PadTemplate, O.MethodInfo info PadTemplate p) => OL.IsLabel t (PadTemplate -> 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
-- signal PadTemplate::pad-created
{- |
This signal is fired when an element creates a pad from this template.
-}
type PadTemplatePadCreatedCallback =
Gst.Pad.Pad
{- ^ /@pad@/: the pad that was created. -}
-> IO ()
-- | A convenience synonym for @`Nothing` :: `Maybe` `PadTemplatePadCreatedCallback`@.
noPadTemplatePadCreatedCallback :: Maybe PadTemplatePadCreatedCallback
noPadTemplatePadCreatedCallback = Nothing
-- | Type for the callback on the (unwrapped) C side.
type C_PadTemplatePadCreatedCallback =
Ptr () -> -- object
Ptr Gst.Pad.Pad ->
Ptr () -> -- user_data
IO ()
-- | Generate a function pointer callable from C code, from a `C_PadTemplatePadCreatedCallback`.
foreign import ccall "wrapper"
mk_PadTemplatePadCreatedCallback :: C_PadTemplatePadCreatedCallback -> IO (FunPtr C_PadTemplatePadCreatedCallback)
-- | Wrap the callback into a `GClosure`.
genClosure_PadTemplatePadCreated :: MonadIO m => PadTemplatePadCreatedCallback -> m (GClosure C_PadTemplatePadCreatedCallback)
genClosure_PadTemplatePadCreated cb = liftIO $ do
let cb' = wrap_PadTemplatePadCreatedCallback cb
mk_PadTemplatePadCreatedCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `PadTemplatePadCreatedCallback` into a `C_PadTemplatePadCreatedCallback`.
wrap_PadTemplatePadCreatedCallback ::
PadTemplatePadCreatedCallback ->
C_PadTemplatePadCreatedCallback
wrap_PadTemplatePadCreatedCallback _cb _ pad _ = do
pad' <- (newObject Gst.Pad.Pad) pad
_cb pad'
{- |
Connect a signal handler for the “@pad-created@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.on' padTemplate #padCreated callback
@
-}
onPadTemplatePadCreated :: (IsPadTemplate a, MonadIO m) => a -> PadTemplatePadCreatedCallback -> m SignalHandlerId
onPadTemplatePadCreated obj cb = liftIO $ do
let cb' = wrap_PadTemplatePadCreatedCallback cb
cb'' <- mk_PadTemplatePadCreatedCallback cb'
connectSignalFunPtr obj "pad-created" cb'' SignalConnectBefore
{- |
Connect a signal handler for the “@pad-created@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.after' padTemplate #padCreated callback
@
-}
afterPadTemplatePadCreated :: (IsPadTemplate a, MonadIO m) => a -> PadTemplatePadCreatedCallback -> m SignalHandlerId
afterPadTemplatePadCreated obj cb = liftIO $ do
let cb' = wrap_PadTemplatePadCreatedCallback cb
cb'' <- mk_PadTemplatePadCreatedCallback cb'
connectSignalFunPtr obj "pad-created" cb'' SignalConnectAfter
-- VVV Prop "caps"
-- Type: TInterface (Name {namespace = "Gst", name = "Caps"})
-- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
-- Nullable: (Nothing,Nothing)
{- |
Get the value of the “@caps@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' padTemplate #caps
@
-}
getPadTemplateCaps :: (MonadIO m, IsPadTemplate o) => o -> m (Maybe Gst.Caps.Caps)
getPadTemplateCaps obj = liftIO $ B.Properties.getObjectPropertyBoxed obj "caps" Gst.Caps.Caps
{- |
Construct a `GValueConstruct` with valid value for the “@caps@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructPadTemplateCaps :: (IsPadTemplate o) => Gst.Caps.Caps -> IO (GValueConstruct o)
constructPadTemplateCaps val = B.Properties.constructObjectPropertyBoxed "caps" (Just val)
#if ENABLE_OVERLOADING
data PadTemplateCapsPropertyInfo
instance AttrInfo PadTemplateCapsPropertyInfo where
type AttrAllowedOps PadTemplateCapsPropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint PadTemplateCapsPropertyInfo = (~) Gst.Caps.Caps
type AttrBaseTypeConstraint PadTemplateCapsPropertyInfo = IsPadTemplate
type AttrGetType PadTemplateCapsPropertyInfo = (Maybe Gst.Caps.Caps)
type AttrLabel PadTemplateCapsPropertyInfo = "caps"
type AttrOrigin PadTemplateCapsPropertyInfo = PadTemplate
attrGet _ = getPadTemplateCaps
attrSet _ = undefined
attrConstruct _ = constructPadTemplateCaps
attrClear _ = undefined
#endif
-- VVV Prop "direction"
-- Type: TInterface (Name {namespace = "Gst", name = "PadDirection"})
-- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
-- Nullable: (Nothing,Nothing)
{- |
Get the value of the “@direction@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' padTemplate #direction
@
-}
getPadTemplateDirection :: (MonadIO m, IsPadTemplate o) => o -> m Gst.Enums.PadDirection
getPadTemplateDirection obj = liftIO $ B.Properties.getObjectPropertyEnum obj "direction"
{- |
Construct a `GValueConstruct` with valid value for the “@direction@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructPadTemplateDirection :: (IsPadTemplate o) => Gst.Enums.PadDirection -> IO (GValueConstruct o)
constructPadTemplateDirection val = B.Properties.constructObjectPropertyEnum "direction" val
#if ENABLE_OVERLOADING
data PadTemplateDirectionPropertyInfo
instance AttrInfo PadTemplateDirectionPropertyInfo where
type AttrAllowedOps PadTemplateDirectionPropertyInfo = '[ 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint PadTemplateDirectionPropertyInfo = (~) Gst.Enums.PadDirection
type AttrBaseTypeConstraint PadTemplateDirectionPropertyInfo = IsPadTemplate
type AttrGetType PadTemplateDirectionPropertyInfo = Gst.Enums.PadDirection
type AttrLabel PadTemplateDirectionPropertyInfo = "direction"
type AttrOrigin PadTemplateDirectionPropertyInfo = PadTemplate
attrGet _ = getPadTemplateDirection
attrSet _ = undefined
attrConstruct _ = constructPadTemplateDirection
attrClear _ = undefined
#endif
-- VVV Prop "gtype"
-- Type: TBasicType TGType
-- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
-- Nullable: (Nothing,Nothing)
{- |
Get the value of the “@gtype@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' padTemplate #gtype
@
-}
getPadTemplateGtype :: (MonadIO m, IsPadTemplate o) => o -> m GType
getPadTemplateGtype obj = liftIO $ B.Properties.getObjectPropertyGType obj "gtype"
{- |
Construct a `GValueConstruct` with valid value for the “@gtype@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructPadTemplateGtype :: (IsPadTemplate o) => GType -> IO (GValueConstruct o)
constructPadTemplateGtype val = B.Properties.constructObjectPropertyGType "gtype" val
#if ENABLE_OVERLOADING
data PadTemplateGtypePropertyInfo
instance AttrInfo PadTemplateGtypePropertyInfo where
type AttrAllowedOps PadTemplateGtypePropertyInfo = '[ 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint PadTemplateGtypePropertyInfo = (~) GType
type AttrBaseTypeConstraint PadTemplateGtypePropertyInfo = IsPadTemplate
type AttrGetType PadTemplateGtypePropertyInfo = GType
type AttrLabel PadTemplateGtypePropertyInfo = "gtype"
type AttrOrigin PadTemplateGtypePropertyInfo = PadTemplate
attrGet _ = getPadTemplateGtype
attrSet _ = undefined
attrConstruct _ = constructPadTemplateGtype
attrClear _ = undefined
#endif
-- VVV Prop "name-template"
-- Type: TBasicType TUTF8
-- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
-- Nullable: (Nothing,Nothing)
{- |
Get the value of the “@name-template@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' padTemplate #nameTemplate
@
-}
getPadTemplateNameTemplate :: (MonadIO m, IsPadTemplate o) => o -> m (Maybe T.Text)
getPadTemplateNameTemplate obj = liftIO $ B.Properties.getObjectPropertyString obj "name-template"
{- |
Construct a `GValueConstruct` with valid value for the “@name-template@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructPadTemplateNameTemplate :: (IsPadTemplate o) => T.Text -> IO (GValueConstruct o)
constructPadTemplateNameTemplate val = B.Properties.constructObjectPropertyString "name-template" (Just val)
#if ENABLE_OVERLOADING
data PadTemplateNameTemplatePropertyInfo
instance AttrInfo PadTemplateNameTemplatePropertyInfo where
type AttrAllowedOps PadTemplateNameTemplatePropertyInfo = '[ 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint PadTemplateNameTemplatePropertyInfo = (~) T.Text
type AttrBaseTypeConstraint PadTemplateNameTemplatePropertyInfo = IsPadTemplate
type AttrGetType PadTemplateNameTemplatePropertyInfo = (Maybe T.Text)
type AttrLabel PadTemplateNameTemplatePropertyInfo = "name-template"
type AttrOrigin PadTemplateNameTemplatePropertyInfo = PadTemplate
attrGet _ = getPadTemplateNameTemplate
attrSet _ = undefined
attrConstruct _ = constructPadTemplateNameTemplate
attrClear _ = undefined
#endif
-- VVV Prop "presence"
-- Type: TInterface (Name {namespace = "Gst", name = "PadPresence"})
-- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly]
-- Nullable: (Nothing,Nothing)
{- |
Get the value of the “@presence@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' padTemplate #presence
@
-}
getPadTemplatePresence :: (MonadIO m, IsPadTemplate o) => o -> m Gst.Enums.PadPresence
getPadTemplatePresence obj = liftIO $ B.Properties.getObjectPropertyEnum obj "presence"
{- |
Construct a `GValueConstruct` with valid value for the “@presence@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructPadTemplatePresence :: (IsPadTemplate o) => Gst.Enums.PadPresence -> IO (GValueConstruct o)
constructPadTemplatePresence val = B.Properties.constructObjectPropertyEnum "presence" val
#if ENABLE_OVERLOADING
data PadTemplatePresencePropertyInfo
instance AttrInfo PadTemplatePresencePropertyInfo where
type AttrAllowedOps PadTemplatePresencePropertyInfo = '[ 'AttrConstruct, 'AttrGet]
type AttrSetTypeConstraint PadTemplatePresencePropertyInfo = (~) Gst.Enums.PadPresence
type AttrBaseTypeConstraint PadTemplatePresencePropertyInfo = IsPadTemplate
type AttrGetType PadTemplatePresencePropertyInfo = Gst.Enums.PadPresence
type AttrLabel PadTemplatePresencePropertyInfo = "presence"
type AttrOrigin PadTemplatePresencePropertyInfo = PadTemplate
attrGet _ = getPadTemplatePresence
attrSet _ = undefined
attrConstruct _ = constructPadTemplatePresence
attrClear _ = undefined
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList PadTemplate
type instance O.AttributeList PadTemplate = PadTemplateAttributeList
type PadTemplateAttributeList = ('[ '("caps", PadTemplateCapsPropertyInfo), '("direction", PadTemplateDirectionPropertyInfo), '("gtype", PadTemplateGtypePropertyInfo), '("name", Gst.Object.ObjectNamePropertyInfo), '("nameTemplate", PadTemplateNameTemplatePropertyInfo), '("parent", Gst.Object.ObjectParentPropertyInfo), '("presence", PadTemplatePresencePropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
padTemplateCaps :: AttrLabelProxy "caps"
padTemplateCaps = AttrLabelProxy
padTemplateDirection :: AttrLabelProxy "direction"
padTemplateDirection = AttrLabelProxy
padTemplateGtype :: AttrLabelProxy "gtype"
padTemplateGtype = AttrLabelProxy
padTemplateNameTemplate :: AttrLabelProxy "nameTemplate"
padTemplateNameTemplate = AttrLabelProxy
padTemplatePresence :: AttrLabelProxy "presence"
padTemplatePresence = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
data PadTemplatePadCreatedSignalInfo
instance SignalInfo PadTemplatePadCreatedSignalInfo where
type HaskellCallbackType PadTemplatePadCreatedSignalInfo = PadTemplatePadCreatedCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_PadTemplatePadCreatedCallback cb
cb'' <- mk_PadTemplatePadCreatedCallback cb'
connectSignalFunPtr obj "pad-created" cb'' connectMode
type instance O.SignalList PadTemplate = PadTemplateSignalList
type PadTemplateSignalList = ('[ '("deepNotify", Gst.Object.ObjectDeepNotifySignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("padCreated", PadTemplatePadCreatedSignalInfo)] :: [(Symbol, *)])
#endif
-- method PadTemplate::new
-- method type : Constructor
-- Args : [Arg {argCName = "name_template", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name template.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "direction", argType = TInterface (Name {namespace = "Gst", name = "PadDirection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPadDirection of the template.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "presence", argType = TInterface (Name {namespace = "Gst", name = "PadPresence"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPadPresence of the pad.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "caps", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstCaps set for the 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_pad_template_new" gst_pad_template_new ::
CString -> -- name_template : TBasicType TUTF8
CUInt -> -- direction : TInterface (Name {namespace = "Gst", name = "PadDirection"})
CUInt -> -- presence : TInterface (Name {namespace = "Gst", name = "PadPresence"})
Ptr Gst.Caps.Caps -> -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
IO (Ptr PadTemplate)
{- |
Creates a new pad template with a name according to the given template
and with the given arguments.
-}
padTemplateNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
{- ^ /@nameTemplate@/: the name template. -}
-> Gst.Enums.PadDirection
{- ^ /@direction@/: the 'GI.Gst.Enums.PadDirection' of the template. -}
-> Gst.Enums.PadPresence
{- ^ /@presence@/: the 'GI.Gst.Enums.PadPresence' of the pad. -}
-> Gst.Caps.Caps
{- ^ /@caps@/: a 'GI.Gst.Structs.Caps.Caps' set for the template. -}
-> m (Maybe PadTemplate)
{- ^ __Returns:__ a new 'GI.Gst.Objects.PadTemplate.PadTemplate'. -}
padTemplateNew nameTemplate direction presence caps = liftIO $ do
nameTemplate' <- textToCString nameTemplate
let direction' = (fromIntegral . fromEnum) direction
let presence' = (fromIntegral . fromEnum) presence
caps' <- unsafeManagedPtrGetPtr caps
result <- gst_pad_template_new nameTemplate' direction' presence' caps'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (newObject PadTemplate) result'
return result''
touchManagedPtr caps
freeMem nameTemplate'
return maybeResult
#if ENABLE_OVERLOADING
#endif
-- method PadTemplate::new_from_static_pad_template_with_gtype
-- method type : Constructor
-- 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},Arg {argCName = "pad_type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GType of the pad to create", 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_pad_template_new_from_static_pad_template_with_gtype" gst_pad_template_new_from_static_pad_template_with_gtype ::
Ptr Gst.StaticPadTemplate.StaticPadTemplate -> -- pad_template : TInterface (Name {namespace = "Gst", name = "StaticPadTemplate"})
CGType -> -- pad_type : TBasicType TGType
IO (Ptr PadTemplate)
{- |
Converts a 'GI.Gst.Structs.StaticPadTemplate.StaticPadTemplate' into a 'GI.Gst.Objects.PadTemplate.PadTemplate' with a type.
/Since: 1.14/
-}
padTemplateNewFromStaticPadTemplateWithGtype ::
(B.CallStack.HasCallStack, MonadIO m) =>
Gst.StaticPadTemplate.StaticPadTemplate
{- ^ /@padTemplate@/: the static pad template -}
-> GType
{- ^ /@padType@/: The 'GType' of the pad to create -}
-> m (Maybe PadTemplate)
{- ^ __Returns:__ a new 'GI.Gst.Objects.PadTemplate.PadTemplate'. -}
padTemplateNewFromStaticPadTemplateWithGtype padTemplate padType = liftIO $ do
padTemplate' <- unsafeManagedPtrGetPtr padTemplate
let padType' = gtypeToCGType padType
result <- gst_pad_template_new_from_static_pad_template_with_gtype padTemplate' padType'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (newObject PadTemplate) result'
return result''
touchManagedPtr padTemplate
return maybeResult
#if ENABLE_OVERLOADING
#endif
-- method PadTemplate::new_with_gtype
-- method type : Constructor
-- Args : [Arg {argCName = "name_template", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the name template.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "direction", argType = TInterface (Name {namespace = "Gst", name = "PadDirection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPadDirection of the template.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "presence", argType = TInterface (Name {namespace = "Gst", name = "PadPresence"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPadPresence of the pad.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "caps", argType = TInterface (Name {namespace = "Gst", name = "Caps"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstCaps set for the template.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "pad_type", argType = TBasicType TGType, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "The #GType of the pad to create", 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_pad_template_new_with_gtype" gst_pad_template_new_with_gtype ::
CString -> -- name_template : TBasicType TUTF8
CUInt -> -- direction : TInterface (Name {namespace = "Gst", name = "PadDirection"})
CUInt -> -- presence : TInterface (Name {namespace = "Gst", name = "PadPresence"})
Ptr Gst.Caps.Caps -> -- caps : TInterface (Name {namespace = "Gst", name = "Caps"})
CGType -> -- pad_type : TBasicType TGType
IO (Ptr PadTemplate)
{- |
Creates a new pad template with a name according to the given template
and with the given arguments.
/Since: 1.14/
-}
padTemplateNewWithGtype ::
(B.CallStack.HasCallStack, MonadIO m) =>
T.Text
{- ^ /@nameTemplate@/: the name template. -}
-> Gst.Enums.PadDirection
{- ^ /@direction@/: the 'GI.Gst.Enums.PadDirection' of the template. -}
-> Gst.Enums.PadPresence
{- ^ /@presence@/: the 'GI.Gst.Enums.PadPresence' of the pad. -}
-> Gst.Caps.Caps
{- ^ /@caps@/: a 'GI.Gst.Structs.Caps.Caps' set for the template. -}
-> GType
{- ^ /@padType@/: The 'GType' of the pad to create -}
-> m (Maybe PadTemplate)
{- ^ __Returns:__ a new 'GI.Gst.Objects.PadTemplate.PadTemplate'. -}
padTemplateNewWithGtype nameTemplate direction presence caps padType = liftIO $ do
nameTemplate' <- textToCString nameTemplate
let direction' = (fromIntegral . fromEnum) direction
let presence' = (fromIntegral . fromEnum) presence
caps' <- unsafeManagedPtrGetPtr caps
let padType' = gtypeToCGType padType
result <- gst_pad_template_new_with_gtype nameTemplate' direction' presence' caps' padType'
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (newObject PadTemplate) result'
return result''
touchManagedPtr caps
freeMem nameTemplate'
return maybeResult
#if ENABLE_OVERLOADING
#endif
-- method PadTemplate::get_caps
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "templ", argType = TInterface (Name {namespace = "Gst", name = "PadTemplate"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPadTemplate 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_pad_template_get_caps" gst_pad_template_get_caps ::
Ptr PadTemplate -> -- templ : TInterface (Name {namespace = "Gst", name = "PadTemplate"})
IO (Ptr Gst.Caps.Caps)
{- |
Gets the capabilities of the pad template.
-}
padTemplateGetCaps ::
(B.CallStack.HasCallStack, MonadIO m, IsPadTemplate a) =>
a
{- ^ /@templ@/: a 'GI.Gst.Objects.PadTemplate.PadTemplate' to get capabilities of. -}
-> m Gst.Caps.Caps
{- ^ __Returns:__ the 'GI.Gst.Structs.Caps.Caps' of the pad template.
Unref after usage. -}
padTemplateGetCaps templ = liftIO $ do
templ' <- unsafeManagedPtrCastPtr templ
result <- gst_pad_template_get_caps templ'
checkUnexpectedReturnNULL "padTemplateGetCaps" result
result' <- (wrapBoxed Gst.Caps.Caps) result
touchManagedPtr templ
return result'
#if ENABLE_OVERLOADING
data PadTemplateGetCapsMethodInfo
instance (signature ~ (m Gst.Caps.Caps), MonadIO m, IsPadTemplate a) => O.MethodInfo PadTemplateGetCapsMethodInfo a signature where
overloadedMethod _ = padTemplateGetCaps
#endif
-- method PadTemplate::pad_created
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "templ", argType = TInterface (Name {namespace = "Gst", name = "PadTemplate"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GstPadTemplate that has been created", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gst", name = "Pad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the #GstPad that created it", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False
foreign import ccall "gst_pad_template_pad_created" gst_pad_template_pad_created ::
Ptr PadTemplate -> -- templ : TInterface (Name {namespace = "Gst", name = "PadTemplate"})
Ptr Gst.Pad.Pad -> -- pad : TInterface (Name {namespace = "Gst", name = "Pad"})
IO ()
{- |
Emit the pad-created signal for this template when created by this pad.
-}
padTemplatePadCreated ::
(B.CallStack.HasCallStack, MonadIO m, IsPadTemplate a, Gst.Pad.IsPad b) =>
a
{- ^ /@templ@/: a 'GI.Gst.Objects.PadTemplate.PadTemplate' that has been created -}
-> b
{- ^ /@pad@/: the 'GI.Gst.Objects.Pad.Pad' that created it -}
-> m ()
padTemplatePadCreated templ pad = liftIO $ do
templ' <- unsafeManagedPtrCastPtr templ
pad' <- unsafeManagedPtrCastPtr pad
gst_pad_template_pad_created templ' pad'
touchManagedPtr templ
touchManagedPtr pad
return ()
#if ENABLE_OVERLOADING
data PadTemplatePadCreatedMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsPadTemplate a, Gst.Pad.IsPad b) => O.MethodInfo PadTemplatePadCreatedMethodInfo a signature where
overloadedMethod _ = padTemplatePadCreated
#endif