Copyright | Will Thompson Iñaki García Etxebarria and Jonas Platte |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria (inaki@blueleaf.cc) |
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); }
Synopsis
- newtype PadTemplate = PadTemplate (ManagedPtr PadTemplate)
- class (GObject o, IsDescendantOf PadTemplate o) => IsPadTemplate o
- toPadTemplate :: (MonadIO m, IsPadTemplate o) => o -> m PadTemplate
- noPadTemplate :: Maybe PadTemplate
- padTemplateGetCaps :: (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 ()
- constructPadTemplateCaps :: IsPadTemplate o => Caps -> IO (GValueConstruct o)
- getPadTemplateCaps :: (MonadIO m, IsPadTemplate o) => o -> m (Maybe Caps)
- constructPadTemplateDirection :: IsPadTemplate o => PadDirection -> IO (GValueConstruct o)
- getPadTemplateDirection :: (MonadIO m, IsPadTemplate o) => o -> m PadDirection
- constructPadTemplateGtype :: IsPadTemplate o => GType -> IO (GValueConstruct o)
- getPadTemplateGtype :: (MonadIO m, IsPadTemplate o) => o -> m GType
- constructPadTemplateNameTemplate :: IsPadTemplate o => Text -> IO (GValueConstruct o)
- getPadTemplateNameTemplate :: (MonadIO m, IsPadTemplate o) => o -> m (Maybe Text)
- constructPadTemplatePresence :: IsPadTemplate o => PadPresence -> IO (GValueConstruct o)
- getPadTemplatePresence :: (MonadIO m, IsPadTemplate o) => o -> m PadPresence
- type C_PadTemplatePadCreatedCallback = Ptr () -> Ptr Pad -> Ptr () -> IO ()
- type PadTemplatePadCreatedCallback = Pad -> IO ()
- afterPadTemplatePadCreated :: (IsPadTemplate a, MonadIO m) => a -> PadTemplatePadCreatedCallback -> m SignalHandlerId
- genClosure_PadTemplatePadCreated :: MonadIO m => PadTemplatePadCreatedCallback -> m (GClosure C_PadTemplatePadCreatedCallback)
- mk_PadTemplatePadCreatedCallback :: C_PadTemplatePadCreatedCallback -> IO (FunPtr C_PadTemplatePadCreatedCallback)
- noPadTemplatePadCreatedCallback :: Maybe PadTemplatePadCreatedCallback
- onPadTemplatePadCreated :: (IsPadTemplate a, MonadIO m) => a -> PadTemplatePadCreatedCallback -> m SignalHandlerId
- wrap_PadTemplatePadCreatedCallback :: PadTemplatePadCreatedCallback -> C_PadTemplatePadCreatedCallback
Exported types
newtype PadTemplate Source #
Memory-managed wrapper type.
PadTemplate (ManagedPtr PadTemplate) |
Instances
GObject PadTemplate Source # | |
Defined in GI.Gst.Objects.PadTemplate gobjectType :: IO GType | |
HasParentTypes PadTemplate Source # | |
Defined in GI.Gst.Objects.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
.
noPadTemplate :: Maybe PadTemplate Source #
A convenience alias for Nothing
:: Maybe
PadTemplate
.
Methods
getCaps
:: (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 (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.
Properties
caps
The capabilities of the pad described by the pad template.
constructPadTemplateCaps :: IsPadTemplate o => Caps -> IO (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 => PadDirection -> IO (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 => GType -> IO (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 => Text -> IO (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 => PadPresence -> IO (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 C_PadTemplatePadCreatedCallback = Ptr () -> Ptr Pad -> Ptr () -> IO () Source #
Type for the callback on the (unwrapped) C side.
type PadTemplatePadCreatedCallback Source #
This signal is fired when an element creates a pad from this template.
afterPadTemplatePadCreated :: (IsPadTemplate a, MonadIO m) => a -> PadTemplatePadCreatedCallback -> m SignalHandlerId Source #
Connect a signal handler for the “pad-created
” signal, to be run after the default handler.
When overloading is enabled, this is equivalent to
after
padTemplate #padCreated callback
genClosure_PadTemplatePadCreated :: MonadIO m => PadTemplatePadCreatedCallback -> m (GClosure C_PadTemplatePadCreatedCallback) Source #
Wrap the callback into a GClosure
.
mk_PadTemplatePadCreatedCallback :: C_PadTemplatePadCreatedCallback -> IO (FunPtr C_PadTemplatePadCreatedCallback) Source #
Generate a function pointer callable from C code, from a C_PadTemplatePadCreatedCallback
.
noPadTemplatePadCreatedCallback :: Maybe PadTemplatePadCreatedCallback Source #
A convenience synonym for
.Nothing
:: Maybe
PadTemplatePadCreatedCallback
onPadTemplatePadCreated :: (IsPadTemplate a, MonadIO m) => a -> PadTemplatePadCreatedCallback -> m SignalHandlerId Source #
Connect a signal handler for the “pad-created
” signal, to be run before the default handler.
When overloading is enabled, this is equivalent to
on
padTemplate #padCreated callback