gi-gst-1.0.18: GStreamer bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (inaki@blueleaf.cc)
Safe HaskellNone
LanguageHaskell2010

GI.Gst.Objects.PadTemplate

Contents

Description

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

Exported types

newtype PadTemplate Source #

Memory-managed wrapper type.

Instances
GObject PadTemplate Source # 
Instance details

Defined in GI.Gst.Objects.PadTemplate

Methods

gobjectType :: IO GType #

HasParentTypes PadTemplate Source # 
Instance details

Defined in GI.Gst.Objects.PadTemplate

type ParentTypes PadTemplate Source # 
Instance details

Defined in GI.Gst.Objects.PadTemplate

type ParentTypes PadTemplate = Object ': (Object ': ([] :: [Type]))

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 # 
Instance details

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

getCaps

padTemplateGetCaps Source #

Arguments

:: (HasCallStack, MonadIO m, IsPadTemplate a) 
=> a

templ: a PadTemplate to get capabilities of.

-> m Caps

Returns: the Caps of the pad template. Unref after usage.

Gets the capabilities of the pad template.

new

padTemplateNew Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

nameTemplate: the name template.

-> PadDirection

direction: the PadDirection of the template.

-> PadPresence

presence: the PadPresence of the pad.

-> Caps

caps: a Caps set for the template.

-> m (Maybe PadTemplate)

Returns: a new PadTemplate.

Creates a new pad template with a name according to the given template and with the given arguments.

newFromStaticPadTemplateWithGtype

padTemplateNewFromStaticPadTemplateWithGtype Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> StaticPadTemplate

padTemplate: the static pad template

-> GType

padType: The GType of the pad to create

-> m (Maybe PadTemplate)

Returns: a new PadTemplate.

Converts a StaticPadTemplate into a PadTemplate with a type.

Since: 1.14

newWithGtype

padTemplateNewWithGtype Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

nameTemplate: the name template.

-> PadDirection

direction: the PadDirection of the template.

-> PadPresence

presence: the PadPresence of the pad.

-> Caps

caps: a Caps set for the template.

-> GType

padType: The GType of the pad to create

-> m (Maybe PadTemplate)

Returns: a new PadTemplate.

Creates a new pad template with a name according to the given template and with the given arguments.

Since: 1.14

padCreated

padTemplatePadCreated Source #

Arguments

:: (HasCallStack, MonadIO m, IsPadTemplate a, IsPad b) 
=> a

templ: a PadTemplate that has been created

-> b

pad: the Pad that created it

-> 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 #

Arguments

 = Pad

pad: the pad that was created.

-> IO () 

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

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