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 (37)

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 ()

get_documentation_caps ()

pad_created (pad)

set_documentation_caps (caps)

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.request_pad_simple() 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 or None

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 or None

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.

get_documentation_caps()[source]
Returns:

The caps to document. For convenience, this will return Gst.PadTemplate.get_caps() when no documentation caps were set.

Return type:

Gst.Caps

See Gst.PadTemplate.set_documentation_caps().

New in version 1.18.

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.

set_documentation_caps(caps)[source]
Parameters:

caps (Gst.Caps) – the documented capabilities

Certain elements will dynamically construct the caps of their pad templates. In order not to let environment-specific information into the documentation, element authors should use this method to expose “stable” caps to the reader.

New in version 1.18.

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>

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.