Class PadTemplate
- All Implemented Interfaces:
Proxy
Pad and PadTemplates have GstCaps attached to it to describe the media type
they are capable of dealing with. gst_pad_template_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 GstPadPresence 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 GstPadTemplate 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 gst_element_request_pad_simple() call to instantiate a pad from this template.
Padtemplates can be created with gst_pad_template_new() or with
gst_static_pad_template_get (), which creates a GstPadTemplate from a
GstStaticPadTemplate 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_element_class_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);
}
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classPadTemplate.Builder<B extends PadTemplate.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static interfaceFunctional interface declaration of thePadCreatedCallbackcallback.static classNested classes/interfaces inherited from class org.freedesktop.gstreamer.gst.GstObject
GstObject.DeepNotifyCallback, GstObject.Object$Impl, GstObject.ObjectClassNested classes/interfaces inherited from class org.gnome.gobject.InitiallyUnowned
InitiallyUnowned.InitiallyUnownedClassNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new PadTemplate.PadTemplate(MemorySegment address) Create a PadTemplate proxy instance for the provided memory address.PadTemplate(String nameTemplate, PadDirection direction, PadPresence presence, Caps caps) Creates a new pad template with a name according to the given template and with the given arguments. -
Method Summary
Modifier and TypeMethodDescriptionprotected PadTemplateasParent()Returns this instance as if it were its parent type.static PadTemplate.Builder<? extends PadTemplate.Builder> builder()APadTemplate.Builderobject constructs aPadTemplatewith the specified properties.voidemitPadCreated(@Nullable Pad pad) Emits the "pad-created" signal.static PadTemplatefromStaticPadTemplateWithGtype(StaticPadTemplate padTemplate, Type padType) Converts aGstStaticPadTemplateinto aGstPadTemplatewith a type.getCaps()Gets the capabilities of the pad template.See gst_pad_template_set_documentation_caps().static MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the PadTemplate classThis signal is fired when an element creates a pad from this template.voidpadCreated(Pad pad) Emit the pad-created signal for this template when created by this pad.voidsetDocumentationCaps(Caps caps) Certain elements will dynamically construct the caps of their pad templates.static PadTemplatewithGtype(String nameTemplate, PadDirection direction, PadPresence presence, Caps caps, Type padType) Creates a new pad template with a name according to the given template and with the given arguments.Methods inherited from class org.freedesktop.gstreamer.gst.GstObject
addControlBinding, checkUniqueness, deepNotify, defaultDeepNotify, defaultError, emitDeepNotify, getControlBinding, getControlRate, getGValueArray, getName, getParent, getPathString, getValue, getValueArray, hasActiveControlBindings, hasAncestor, hasAsAncestor, hasAsParent, onDeepNotify, ref, refSink, removeControlBinding, replace, setControlBindingDisabled, setControlBindingsDisabled, setControlRate, setName, setParent, suggestNextSync, syncValues, unparent, unrefMethods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
PadTemplate
Create a PadTemplate proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
PadTemplate
Creates a new pad template with a name according to the given template and with the given arguments.- Parameters:
nameTemplate- the name template.direction- theGstPadDirectionof the template.presence- theGstPadPresenceof the pad.caps- aGstCapsset for the template.
-
PadTemplate
public PadTemplate()Creates a new PadTemplate.
-
-
Method Details
-
getType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type. -
fromStaticPadTemplateWithGtype
public static PadTemplate fromStaticPadTemplateWithGtype(StaticPadTemplate padTemplate, Type padType) Converts aGstStaticPadTemplateinto aGstPadTemplatewith a type.- Parameters:
padTemplate- the static pad templatepadType- TheGTypeof the pad to create- Returns:
- a new
GstPadTemplate. - Since:
- 1.14
-
withGtype
public static PadTemplate withGtype(String nameTemplate, PadDirection direction, PadPresence presence, Caps caps, Type padType) Creates a new pad template with a name according to the given template and with the given arguments.- Parameters:
nameTemplate- the name template.direction- theGstPadDirectionof the template.presence- theGstPadPresenceof the pad.caps- aGstCapsset for the template.padType- TheGTypeof the pad to create- Returns:
- a new
GstPadTemplate. - Since:
- 1.14
-
getCaps
Gets the capabilities of the pad template.- Returns:
- the
GstCapsof the pad template. Unref after usage.
-
getDocumentationCaps
See gst_pad_template_set_documentation_caps().- Returns:
- The caps to document. For convenience, this will return gst_pad_template_get_caps() when no documentation caps were set.
- Since:
- 1.18
-
padCreated
Emit the pad-created signal for this template when created by this pad.- Parameters:
pad- theGstPadthat created it
-
setDocumentationCaps
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.- Parameters:
caps- the documented capabilities- Since:
- 1.18
-
onPadCreated
public SignalConnection<PadTemplate.PadCreatedCallback> onPadCreated(PadTemplate.PadCreatedCallback handler) This signal is fired when an element creates a pad from this template.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitPadCreated
Emits the "pad-created" signal. SeeonPadCreated(org.freedesktop.gstreamer.gst.PadTemplate.PadCreatedCallback). -
builder
APadTemplate.Builderobject constructs aPadTemplatewith the specified properties. Use the variousset...()methods to set properties, and finish construction withPadTemplate.Builder.build().- Returns:
- the builder object
-