Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
Safe Haskell | None |
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 elementGetRequestPad
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); }
- newtype PadTemplate = PadTemplate (ManagedPtr PadTemplate)
- class GObject o => IsPadTemplate o
- toPadTemplate :: IsPadTemplate o => o -> IO PadTemplate
- noPadTemplate :: Maybe PadTemplate
- data PadTemplateGetCapsMethodInfo
- padTemplateGetCaps :: (HasCallStack, MonadIO m, IsPadTemplate a) => a -> m Caps
- padTemplateNew :: (HasCallStack, MonadIO m) => Text -> PadDirection -> PadPresence -> Caps -> m PadTemplate
- data PadTemplatePadCreatedMethodInfo
- padTemplatePadCreated :: (HasCallStack, MonadIO m, IsPadTemplate a, IsPad b) => a -> b -> m ()
- data PadTemplateCapsPropertyInfo
- constructPadTemplateCaps :: IsPadTemplate o => Caps -> IO (GValueConstruct o)
- getPadTemplateCaps :: (MonadIO m, IsPadTemplate o) => o -> m (Maybe Caps)
- padTemplateCaps :: AttrLabelProxy "caps"
- data PadTemplateDirectionPropertyInfo
- constructPadTemplateDirection :: IsPadTemplate o => PadDirection -> IO (GValueConstruct o)
- getPadTemplateDirection :: (MonadIO m, IsPadTemplate o) => o -> m PadDirection
- padTemplateDirection :: AttrLabelProxy "direction"
- data PadTemplateNameTemplatePropertyInfo
- constructPadTemplateNameTemplate :: IsPadTemplate o => Text -> IO (GValueConstruct o)
- getPadTemplateNameTemplate :: (MonadIO m, IsPadTemplate o) => o -> m (Maybe Text)
- padTemplateNameTemplate :: AttrLabelProxy "nameTemplate"
- data PadTemplatePresencePropertyInfo
- constructPadTemplatePresence :: IsPadTemplate o => PadPresence -> IO (GValueConstruct o)
- getPadTemplatePresence :: (MonadIO m, IsPadTemplate o) => o -> m PadPresence
- padTemplatePresence :: AttrLabelProxy "presence"
- type C_PadTemplatePadCreatedCallback = Ptr () -> Ptr Pad -> Ptr () -> IO ()
- type PadTemplatePadCreatedCallback = Pad -> IO ()
- data PadTemplatePadCreatedSignalInfo
- afterPadTemplatePadCreated :: (GObject a, MonadIO m) => a -> PadTemplatePadCreatedCallback -> m SignalHandlerId
- genClosure_PadTemplatePadCreated :: PadTemplatePadCreatedCallback -> IO Closure
- mk_PadTemplatePadCreatedCallback :: C_PadTemplatePadCreatedCallback -> IO (FunPtr C_PadTemplatePadCreatedCallback)
- noPadTemplatePadCreatedCallback :: Maybe PadTemplatePadCreatedCallback
- onPadTemplatePadCreated :: (GObject a, MonadIO m) => a -> PadTemplatePadCreatedCallback -> m SignalHandlerId
- wrap_PadTemplatePadCreatedCallback :: PadTemplatePadCreatedCallback -> Ptr () -> Ptr Pad -> Ptr () -> IO ()
Exported types
newtype PadTemplate Source #
GObject PadTemplate Source # | |
IsObject PadTemplate Source # | |
IsPadTemplate PadTemplate Source # | |
IsObject PadTemplate Source # | |
((~) * info (ResolvePadTemplateMethod t PadTemplate), MethodInfo * info PadTemplate p) => IsLabel t (PadTemplate -> p) Source # | |
((~) * info (ResolvePadTemplateMethod t PadTemplate), MethodInfo * info PadTemplate p) => IsLabelProxy t (PadTemplate -> p) Source # | |
HasAttributeList * PadTemplate Source # | |
type AttributeList PadTemplate Source # | |
type SignalList PadTemplate Source # | |
class GObject o => IsPadTemplate o Source #
toPadTemplate :: IsPadTemplate o => o -> IO PadTemplate Source #
Methods
getCaps
data PadTemplateGetCapsMethodInfo Source #
((~) * signature (m Caps), MonadIO m, IsPadTemplate a) => MethodInfo * PadTemplateGetCapsMethodInfo a signature Source # | |
:: (HasCallStack, MonadIO m, IsPadTemplate a) | |
=> a |
|
-> m Caps | Returns: the |
Gets the capabilities of the pad template.
new
:: (HasCallStack, MonadIO m) | |
=> Text |
|
-> PadDirection |
|
-> PadPresence |
|
-> Caps |
|
-> m PadTemplate | Returns: a new |
Creates a new pad template with a name according to the given template and with the given arguments.
padCreated
data PadTemplatePadCreatedMethodInfo Source #
((~) * signature (b -> m ()), MonadIO m, IsPadTemplate a, IsPad b) => MethodInfo * PadTemplatePadCreatedMethodInfo a signature Source # | |
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.
Properties
caps
data PadTemplateCapsPropertyInfo Source #
constructPadTemplateCaps :: IsPadTemplate o => Caps -> IO (GValueConstruct o) Source #
getPadTemplateCaps :: (MonadIO m, IsPadTemplate o) => o -> m (Maybe Caps) Source #
padTemplateCaps :: AttrLabelProxy "caps" Source #
direction
data PadTemplateDirectionPropertyInfo Source #
constructPadTemplateDirection :: IsPadTemplate o => PadDirection -> IO (GValueConstruct o) Source #
getPadTemplateDirection :: (MonadIO m, IsPadTemplate o) => o -> m PadDirection Source #
padTemplateDirection :: AttrLabelProxy "direction" Source #
nameTemplate
data PadTemplateNameTemplatePropertyInfo Source #
constructPadTemplateNameTemplate :: IsPadTemplate o => Text -> IO (GValueConstruct o) Source #
getPadTemplateNameTemplate :: (MonadIO m, IsPadTemplate o) => o -> m (Maybe Text) Source #
padTemplateNameTemplate :: AttrLabelProxy "nameTemplate" Source #
presence
data PadTemplatePresencePropertyInfo Source #
constructPadTemplatePresence :: IsPadTemplate o => PadPresence -> IO (GValueConstruct o) Source #
getPadTemplatePresence :: (MonadIO m, IsPadTemplate o) => o -> m PadPresence Source #
padTemplatePresence :: AttrLabelProxy "presence" Source #
Signals
padCreated
type PadTemplatePadCreatedCallback = Pad -> IO () Source #
afterPadTemplatePadCreated :: (GObject a, MonadIO m) => a -> PadTemplatePadCreatedCallback -> m SignalHandlerId Source #
mk_PadTemplatePadCreatedCallback :: C_PadTemplatePadCreatedCallback -> IO (FunPtr C_PadTemplatePadCreatedCallback) Source #
onPadTemplatePadCreated :: (GObject a, MonadIO m) => a -> PadTemplatePadCreatedCallback -> m SignalHandlerId Source #
wrap_PadTemplatePadCreatedCallback :: PadTemplatePadCreatedCallback -> Ptr () -> Ptr Pad -> Ptr () -> IO () Source #