Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
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 Caps
attached to it to describe the media type
they are capable of dealing with. 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 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 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 elementRequestPadSimple
call to instantiate a pad from this template.
Padtemplates can be created with padTemplateNew
or with
gst_static_pad_template_get (), which creates a PadTemplate
from a
StaticPadTemplate
that can be filled with the
convenient GST_STATIC_PAD_TEMPLATE()
macro.
A padtemplate can be used to create a pad (see 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); }
Synopsis
- newtype PadTemplate = PadTemplate (ManagedPtr PadTemplate)
- class (GObject o, IsDescendantOf PadTemplate o) => IsPadTemplate o
- toPadTemplate :: (MonadIO m, IsPadTemplate o) => o -> m PadTemplate
- padTemplateGetCaps :: (HasCallStack, MonadIO m, IsPadTemplate a) => a -> m Caps
- padTemplateGetDocumentationCaps :: (HasCallStack, MonadIO m, IsPadTemplate a) => a -> m Caps
- padTemplateNew :: (HasCallStack, MonadIO m) => Text -> PadDirection -> PadPresence -> Caps -> m (Maybe PadTemplate)
- padTemplateNewFromStaticPadTemplateWithGtype :: (HasCallStack, MonadIO m) => StaticPadTemplate -> GType -> m (Maybe PadTemplate)
- padTemplateNewWithGtype :: (HasCallStack, MonadIO m) => Text -> PadDirection -> PadPresence -> Caps -> GType -> m (Maybe PadTemplate)
- padTemplatePadCreated :: (HasCallStack, MonadIO m, IsPadTemplate a, IsPad b) => a -> b -> m ()
- padTemplateSetDocumentationCaps :: (HasCallStack, MonadIO m, IsPadTemplate a) => a -> Caps -> m ()
- constructPadTemplateCaps :: (IsPadTemplate o, MonadIO m) => Caps -> m (GValueConstruct o)
- getPadTemplateCaps :: (MonadIO m, IsPadTemplate o) => o -> m (Maybe Caps)
- constructPadTemplateDirection :: (IsPadTemplate o, MonadIO m) => PadDirection -> m (GValueConstruct o)
- getPadTemplateDirection :: (MonadIO m, IsPadTemplate o) => o -> m PadDirection
- constructPadTemplateGtype :: (IsPadTemplate o, MonadIO m) => GType -> m (GValueConstruct o)
- getPadTemplateGtype :: (MonadIO m, IsPadTemplate o) => o -> m GType
- constructPadTemplateNameTemplate :: (IsPadTemplate o, MonadIO m) => Text -> m (GValueConstruct o)
- getPadTemplateNameTemplate :: (MonadIO m, IsPadTemplate o) => o -> m (Maybe Text)
- constructPadTemplatePresence :: (IsPadTemplate o, MonadIO m) => PadPresence -> m (GValueConstruct o)
- getPadTemplatePresence :: (MonadIO m, IsPadTemplate o) => o -> m PadPresence
- type PadTemplatePadCreatedCallback = Pad -> IO ()
- afterPadTemplatePadCreated :: (IsPadTemplate a, MonadIO m) => a -> ((?self :: a) => PadTemplatePadCreatedCallback) -> m SignalHandlerId
- onPadTemplatePadCreated :: (IsPadTemplate a, MonadIO m) => a -> ((?self :: a) => PadTemplatePadCreatedCallback) -> m SignalHandlerId
Exported types
newtype PadTemplate Source #
Memory-managed wrapper type.
PadTemplate (ManagedPtr PadTemplate) |
Instances
Eq PadTemplate Source # | |
Defined in GI.Gst.Objects.PadTemplate (==) :: PadTemplate -> PadTemplate -> Bool # (/=) :: PadTemplate -> PadTemplate -> Bool # | |
GObject PadTemplate Source # | |
Defined in GI.Gst.Objects.PadTemplate | |
ManagedPtrNewtype PadTemplate Source # | |
Defined in GI.Gst.Objects.PadTemplate toManagedPtr :: PadTemplate -> ManagedPtr PadTemplate | |
TypedObject PadTemplate Source # | |
Defined in GI.Gst.Objects.PadTemplate | |
HasParentTypes PadTemplate Source # | |
Defined in GI.Gst.Objects.PadTemplate | |
IsGValue (Maybe PadTemplate) Source # | Convert |
Defined in GI.Gst.Objects.PadTemplate gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe PadTemplate -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe PadTemplate) | |
type ParentTypes PadTemplate Source # | |
Defined in GI.Gst.Objects.PadTemplate |
class (GObject o, IsDescendantOf PadTemplate o) => IsPadTemplate o Source #
Type class for types which can be safely cast to PadTemplate
, for instance with toPadTemplate
.
Instances
(GObject o, IsDescendantOf PadTemplate o) => IsPadTemplate o Source # | |
Defined in GI.Gst.Objects.PadTemplate |
toPadTemplate :: (MonadIO m, IsPadTemplate o) => o -> m PadTemplate Source #
Cast to PadTemplate
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
addControlBinding, bindProperty, bindPropertyFull, defaultError, forceFloating, freezeNotify, getv, hasActiveControlBindings, hasAncestor, hasAsAncestor, hasAsParent, isFloating, notify, notifyByPspec, padCreated, ref, refSink, removeControlBinding, runDispose, stealData, stealQdata, suggestNextSync, syncValues, thawNotify, unparent, unref, watchClosure.
Getters
getCaps, getControlBinding, getControlRate, getData, getDocumentationCaps, getGValueArray, getName, getParent, getPathString, getProperty, getQdata, getValue.
Setters
setControlBindingDisabled, setControlBindingsDisabled, setControlRate, setData, setDataFull, setDocumentationCaps, setName, setParent, setProperty.
getCaps
:: (HasCallStack, MonadIO m, IsPadTemplate a) | |
=> a |
|
-> m Caps | Returns: the |
Gets the capabilities of the pad template.
getDocumentationCaps
padTemplateGetDocumentationCaps Source #
:: (HasCallStack, MonadIO m, IsPadTemplate a) | |
=> a |
|
-> m Caps | Returns: The caps to document. For convenience, this will return
|
See padTemplateSetDocumentationCaps
.
Since: 1.18
new
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> PadDirection |
|
-> PadPresence |
|
-> Caps |
|
-> m (Maybe PadTemplate) | Returns: a new |
Creates a new pad template with a name according to the given template and with the given arguments.
newFromStaticPadTemplateWithGtype
padTemplateNewFromStaticPadTemplateWithGtype Source #
:: (HasCallStack, MonadIO m) | |
=> StaticPadTemplate |
|
-> GType |
|
-> m (Maybe PadTemplate) | Returns: a new |
Converts a StaticPadTemplate
into a PadTemplate
with a type.
Since: 1.14
newWithGtype
padTemplateNewWithGtype Source #
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> PadDirection |
|
-> PadPresence |
|
-> Caps |
|
-> GType |
|
-> m (Maybe PadTemplate) | Returns: a new |
Creates a new pad template with a name according to the given template and with the given arguments.
Since: 1.14
padCreated
padTemplatePadCreated Source #
:: (HasCallStack, MonadIO m, IsPadTemplate a, IsPad b) | |
=> a |
|
-> b |
|
-> m () |
Emit the pad-created signal for this template when created by this pad.
setDocumentationCaps
padTemplateSetDocumentationCaps Source #
:: (HasCallStack, MonadIO m, IsPadTemplate a) | |
=> a |
|
-> Caps |
|
-> m () |
Certain elements will dynamically construct the caps of their pad templates. In order not to let environment-specific information into the documentation, element authors should use this method to expose "stable" caps to the reader.
Since: 1.18
Properties
caps
The capabilities of the pad described by the pad template.
constructPadTemplateCaps :: (IsPadTemplate o, MonadIO m) => Caps -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “caps
” property. This is rarely needed directly, but it is used by new
.
getPadTemplateCaps :: (MonadIO m, IsPadTemplate o) => o -> m (Maybe Caps) Source #
Get the value of the “caps
” property.
When overloading is enabled, this is equivalent to
get
padTemplate #caps
direction
The direction of the pad described by the pad template.
constructPadTemplateDirection :: (IsPadTemplate o, MonadIO m) => PadDirection -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “direction
” property. This is rarely needed directly, but it is used by new
.
getPadTemplateDirection :: (MonadIO m, IsPadTemplate o) => o -> m PadDirection Source #
Get the value of the “direction
” property.
When overloading is enabled, this is equivalent to
get
padTemplate #direction
gtype
The type of the pad described by the pad template.
Since: 1.14
constructPadTemplateGtype :: (IsPadTemplate o, MonadIO m) => GType -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “gtype
” property. This is rarely needed directly, but it is used by new
.
getPadTemplateGtype :: (MonadIO m, IsPadTemplate o) => o -> m GType Source #
Get the value of the “gtype
” property.
When overloading is enabled, this is equivalent to
get
padTemplate #gtype
nameTemplate
The name template of the pad template.
constructPadTemplateNameTemplate :: (IsPadTemplate o, MonadIO m) => Text -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “name-template
” property. This is rarely needed directly, but it is used by new
.
getPadTemplateNameTemplate :: (MonadIO m, IsPadTemplate o) => o -> m (Maybe Text) Source #
Get the value of the “name-template
” property.
When overloading is enabled, this is equivalent to
get
padTemplate #nameTemplate
presence
When the pad described by the pad template will become available.
constructPadTemplatePresence :: (IsPadTemplate o, MonadIO m) => PadPresence -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “presence
” property. This is rarely needed directly, but it is used by new
.
getPadTemplatePresence :: (MonadIO m, IsPadTemplate o) => o -> m PadPresence Source #
Get the value of the “presence
” property.
When overloading is enabled, this is equivalent to
get
padTemplate #presence
Signals
padCreated
type PadTemplatePadCreatedCallback Source #
This signal is fired when an element creates a pad from this template.
afterPadTemplatePadCreated :: (IsPadTemplate a, MonadIO m) => a -> ((?self :: a) => PadTemplatePadCreatedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the padCreated signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
padTemplate #padCreated callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onPadTemplatePadCreated :: (IsPadTemplate a, MonadIO m) => a -> ((?self :: a) => PadTemplatePadCreatedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the padCreated signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
padTemplate #padCreated callback