Gst.PadTemplate

g GObject.InitiallyUnowned GObject.InitiallyUnowned Gst.Object Gst.Object GObject.InitiallyUnowned->Gst.Object GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gst.PadTemplate Gst.PadTemplate Gst.Object->Gst.PadTemplate

Subclasses:None

Methods

Inherited:Gst.Object (27), GObject.Object (38)
Structs:GObject.ObjectClass (5)
class new (name_template, direction, presence, caps)
class new_from_static_pad_template_with_gtype (pad_template, pad_type)
class new_with_gtype (name_template, direction, presence, caps, pad_type)
  get_caps ()
  pad_created (pad)

Virtual Methods

Inherited:Gst.Object (1), GObject.Object (7)
  do_pad_created (pad)

Properties

Inherited:Gst.Object (2)
Name Type Flags Short Description
caps Gst.Caps r/w/co The capabilities of the pad described by the pad template
direction Gst.PadDirection r/w/co The direction of the pad described by the pad template
gtype GObject.GType r/w/co The GObject.GType of the pad described by the pad template
name-template str r/w/co The name template of the pad template
presence Gst.PadPresence r/w/co When the pad described by the pad template will become available

Signals

Inherited:Gst.Object (1), GObject.Object (1)
Name Short Description
pad-created This signal is fired when an element creates a pad from this template.

Fields

Inherited:Gst.Object (1), GObject.Object (1)
Name Type Access Description
caps Gst.Caps r  
direction Gst.PadDirection r  
name_template str r  
object Gst.Object r  
presence Gst.PadPresence r  

Class Details

class Gst.PadTemplate(**kwargs)
Bases:Gst.Object
Abstract:No
Structure:Gst.PadTemplateClass

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 Gst.Caps attached to it to describe the media type they are capable of dealing with. Gst.PadTemplate.get_caps() 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 Gst.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 Gst.PadTemplate with GST_PAD_TEMPLATE_DIRECTION().

The GST_PAD_TEMPLATE_NAME_TEMPLATE () is important for Gst.PadPresence.REQUEST pads because it has to be used as the name in the Gst.Element.get_request_pad() call to instantiate a pad from this template.

Padtemplates can be created with Gst.PadTemplate.new() or with Gst.StaticPadTemplate.get (), which creates a Gst.PadTemplate from a Gst.StaticPadTemplate that can be filled with the convenient GST_STATIC_PAD_TEMPLATE() macro.

A padtemplate can be used to create a pad (see Gst.Pad.new_from_template() or Gst.Pad.new_from_static_template ()) or to add to an element class (see Gst.ElementClass.add_static_pad_template ()).

The following code example shows the code to create a pad from a padtemplate.

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:

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);
}
classmethod new(name_template, direction, presence, caps)[source]
Parameters:
Returns:

a new Gst.PadTemplate.

Return type:

Gst.PadTemplate or None

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

classmethod new_from_static_pad_template_with_gtype(pad_template, pad_type)[source]
Parameters:
Returns:

a new Gst.PadTemplate.

Return type:

Gst.PadTemplate

Converts a Gst.StaticPadTemplate into a Gst.PadTemplate with a type.

New in version 1.14.

classmethod new_with_gtype(name_template, direction, presence, caps, pad_type)[source]
Parameters:
Returns:

a new Gst.PadTemplate.

Return type:

Gst.PadTemplate

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

New in version 1.14.

get_caps()[source]
Returns:the Gst.Caps of the pad template. Unref after usage.
Return type:Gst.Caps

Gets the capabilities of the pad template.

pad_created(pad)[source]
Parameters:pad (Gst.Pad) – the Gst.Pad that created it

Emit the pad-created signal for this template when created by this pad.

do_pad_created(pad) virtual
Parameters:pad (Gst.Pad) – the Gst.Pad that created it

Emit the pad-created signal for this template when created by this pad.

Signal Details

Gst.PadTemplate.signals.pad_created(pad_template, pad)
Signal Name:

pad-created

Flags:

RUN_LAST

Parameters:
  • pad_template (Gst.PadTemplate) – The object which received the signal
  • pad (Gst.Pad) – the pad that was created.

This signal is fired when an element creates a pad from this template.

Property Details

Gst.PadTemplate.props.caps
Name:caps
Type:Gst.Caps
Default Value:None
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

The capabilities of the pad described by the pad template.

Gst.PadTemplate.props.direction
Name:direction
Type:Gst.PadDirection
Default Value:Gst.PadDirection.UNKNOWN
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

The direction of the pad described by the pad template.

Gst.PadTemplate.props.gtype
Name:gtype
Type:GObject.GType
Default Value:<GType void (4)>
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

The type of the pad described by the pad template.

New in version 1.14.

Gst.PadTemplate.props.name_template
Name:name-template
Type:str
Default Value:None
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

The name template of the pad template.

Gst.PadTemplate.props.presence
Name:presence
Type:Gst.PadPresence
Default Value:Gst.PadPresence.ALWAYS
Flags:READABLE, WRITABLE, CONSTRUCT_ONLY

When the pad described by the pad template will become available.