gi-gst-1.0.12: GStreamer bindings

CopyrightWill Thompson, Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
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

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 PadTemplate

Returns: a new PadTemplate.

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

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

data PadTemplateCapsPropertyInfo Source #

Instances

AttrInfo PadTemplateCapsPropertyInfo Source # 
type AttrOrigin PadTemplateCapsPropertyInfo Source # 
type AttrLabel PadTemplateCapsPropertyInfo Source # 
type AttrGetType PadTemplateCapsPropertyInfo Source # 
type AttrBaseTypeConstraint PadTemplateCapsPropertyInfo Source # 
type AttrSetTypeConstraint PadTemplateCapsPropertyInfo Source # 
type AttrAllowedOps PadTemplateCapsPropertyInfo Source # 

direction

data PadTemplateDirectionPropertyInfo Source #

Instances

AttrInfo PadTemplateDirectionPropertyInfo Source # 
type AttrOrigin PadTemplateDirectionPropertyInfo Source # 
type AttrLabel PadTemplateDirectionPropertyInfo Source # 
type AttrGetType PadTemplateDirectionPropertyInfo Source # 
type AttrBaseTypeConstraint PadTemplateDirectionPropertyInfo Source # 
type AttrSetTypeConstraint PadTemplateDirectionPropertyInfo Source # 
type AttrAllowedOps PadTemplateDirectionPropertyInfo Source # 

nameTemplate

data PadTemplateNameTemplatePropertyInfo Source #

Instances

AttrInfo PadTemplateNameTemplatePropertyInfo Source # 
type AttrOrigin PadTemplateNameTemplatePropertyInfo Source # 
type AttrLabel PadTemplateNameTemplatePropertyInfo Source # 
type AttrGetType PadTemplateNameTemplatePropertyInfo Source # 
type AttrBaseTypeConstraint PadTemplateNameTemplatePropertyInfo Source # 
type AttrSetTypeConstraint PadTemplateNameTemplatePropertyInfo Source # 
type AttrAllowedOps PadTemplateNameTemplatePropertyInfo Source # 

presence

data PadTemplatePresencePropertyInfo Source #

Instances

AttrInfo PadTemplatePresencePropertyInfo Source # 
type AttrOrigin PadTemplatePresencePropertyInfo Source # 
type AttrLabel PadTemplatePresencePropertyInfo Source # 
type AttrGetType PadTemplatePresencePropertyInfo Source # 
type AttrBaseTypeConstraint PadTemplatePresencePropertyInfo Source # 
type AttrSetTypeConstraint PadTemplatePresencePropertyInfo Source # 
type AttrAllowedOps PadTemplatePresencePropertyInfo Source # 

Signals

padCreated