Split out the padtemplate, autoplugfactoy and elementfactory into different pages to be able to show more examples an...

Original commit message from CVS:
Split out the padtemplate, autoplugfactoy and elementfactory into different
pages to be able to show more examples and the object hierarchy.
This commit is contained in:
Wim Taymans 2001-10-24 21:44:48 +00:00
parent 7e5cd5fc38
commit 0bb01afa84
11 changed files with 546 additions and 401 deletions

View file

@ -1,6 +1,8 @@
<!doctype book PUBLIC "-//Davenport//DTD DocBook V3.0//EN" [
<!entity Gst SYSTEM "sgml/gst.sgml">
<!entity GstAutoplug SYSTEM "sgml/gstautoplug.sgml">
<!entity GstAutoplugFactory SYSTEM "sgml/gstautoplugfactory.sgml">
<!entity GstInfo SYSTEM "sgml/gstinfo.sgml">
<!entity GstBin SYSTEM "sgml/gstbin.sgml">
<!entity GstData SYSTEM "sgml/gstdata.sgml">
@ -9,12 +11,13 @@
<!entity GstBufferPool SYSTEM "sgml/gstbufferpool.sgml">
<!entity GstCpu SYSTEM "sgml/gstcpu.sgml">
<!entity GstElement SYSTEM "sgml/gstelement.sgml">
<!entity GstElementFactory SYSTEM "sgml/gstelementfactory.sgml">
<!entity GstLog SYSTEM "sgml/gstlog.sgml">
<!entity GstObject SYSTEM "sgml/gstobject.sgml">
<!entity GstPad SYSTEM "sgml/gstpad.sgml">
<!entity GstPipeline SYSTEM "sgml/gstpipeline.sgml">
<!entity GstAutoplug SYSTEM "sgml/gstautoplug.sgml">
<!entity GstPadTemplate SYSTEM "sgml/gstpadtemplate.sgml">
<!entity GstParse SYSTEM "sgml/gstparse.sgml">
<!entity GstPipeline SYSTEM "sgml/gstpipeline.sgml">
<!entity GstPlugin SYSTEM "sgml/gstplugin.sgml">
<!entity GstPluginFeature SYSTEM "sgml/gstpluginfeature.sgml">
<!entity GstThread SYSTEM "sgml/gstthread.sgml">
@ -65,6 +68,7 @@ with some more specialized elements.</para>
&Gst;
&GstAutoplug;
&GstAutoplugFactory;
&GstBin;
&GstBuffer;
&GstBufferPool;
@ -73,10 +77,12 @@ with some more specialized elements.</para>
&GstCpu;
&GstData;
&GstElement;
&GstElementFactory;
&GstEvent;
&GstInfo;
&GstObject;
&GstPad;
&GstPadTemplate;
&GstParse;
&GstPipeline;
&GstPlugin;
@ -100,32 +106,8 @@ with some more specialized elements.</para>
<para>
libgstelements.la provide some basic elements like a disk source
and sink. The use of these elements is strictly though the gtk_object_get() and
gtk_object_set() functions and the GStreamer Core Library functions.
</para>
<para>
Use the gst_elementfactory_find() and gst_elementfactory_create() functions
to create these elements.
</para>
<para>
The following code example shows you how to create a GstDiskSrc element.
</para>
<para>
<programlisting role="C">
#include &lt;gst/gst.h&gt;
GstElement *src;
GstElementFactory *srcfactory;
gst_init(&amp;argc,&amp;argv);
srcfactory = gst_elementfactory_find("disksrc");
g_return_if_fail(srcfactory != NULL);
src = gst_elementfactory_create(srcfactory,"src");
g_return_if_fail(src != NULL);
...
</programlisting>
and sink. The use of these elements is strictly though the g_object_get() and
g_object_set() functions and the GStreamer Core Library functions.
</para>
&GstAggregator;

View file

@ -485,8 +485,6 @@ GST_ELEMENT_PADS
GST_ELEMENT_SCHED
GST_ELEMENT_MANAGER
GstElement
GstElementDetails
GstElementFactory
GstElementLoopFunction
gst_element_class_add_padtemplate
gst_element_destroy
@ -516,14 +514,6 @@ gst_element_error
gst_element_get_factory
gst_element_signal_eos
gst_element_restore_thyself
gst_elementfactory_new
gst_elementfactory_add_padtemplate
gst_elementfactory_find
gst_elementfactory_get_list
gst_elementfactory_can_src_caps
gst_elementfactory_can_sink_caps
gst_elementfactory_create
gst_elementfactory_make
<SUBSECTION Standard>
GstElementClass
GST_TYPE_ELEMENT
@ -534,12 +524,27 @@ GST_ELEMENT_CLASS_FAST
GST_IS_ELEMENT
GST_IS_ELEMENT_CLASS
gst_element_get_type
gst_elementfactory_get_type
GstElementFactoryClass
GST_TYPE_ELEMENTFACTORY
</SECTION>
<SECTION>
<FILE>gstelementfactory</FILE>
<TITLE>GstElementFactory</TITLE>
GstElementDetails
gst_elementfactory_new
gst_elementfactory_find
gst_elementfactory_get_list
gst_elementfactory_add_padtemplate
gst_elementfactory_can_src_caps
gst_elementfactory_can_sink_caps
gst_elementfactory_create
gst_elementfactory_make
<SUBSECTION Standard>
GstElementFactory
GST_ELEMENTFACTORY
GST_ELEMENTFACTORY_CLASS
GST_IS_ELEMENTFACTORY
GST_TYPE_ELEMENTFACTORY
gst_elementfactory_get_type
GST_ELEMENTFACTORY_CLASS
GST_IS_ELEMENTFACTORY_CLASS
</SECTION>
@ -549,16 +554,9 @@ GST_IS_ELEMENTFACTORY_CLASS
<TITLE>GstAutoplug</TITLE>
GstAutoplug
GstAutoplugFlags
GstAutoplugFactory
gst_autoplug_signal_new_object
gst_autoplug_to_caps
gst_autoplug_to_renderers
gst_autoplugfactory_new
gst_autoplugfactory_destroy
gst_autoplugfactory_find
gst_autoplugfactory_get_list
gst_autoplugfactory_create
gst_autoplugfactory_make
<SUBSECTION Standard>
GST_AUTOPLUG
GST_IS_AUTOPLUG
@ -566,6 +564,19 @@ GST_TYPE_AUTOPLUG
gst_autoplug_get_type
GST_AUTOPLUG_CLASS
GST_IS_AUTOPLUG_CLASS
</SECTION>
<SECTION>
<FILE>gstautoplugfactory</FILE>
<TITLE>GstAutoplugFactory</TITLE>
GstAutoplugFactory
gst_autoplugfactory_new
gst_autoplugfactory_destroy
gst_autoplugfactory_find
gst_autoplugfactory_get_list
gst_autoplugfactory_create
gst_autoplugfactory_make
<SUBSECTION Standard>
gst_autoplugfactory_get_type
GstAutoplugFactoryClass
GST_TYPE_AUTOPLUGFACTORY
@ -745,21 +756,6 @@ GST_GPAD_REALPAD
GstGhostPad
gst_ghost_pad_new
GstPadPresence
GstPadTemplate
GST_PADTEMPLATE_CAPS
GST_PADTEMPLATE_DIRECTION
GST_PADTEMPLATE_NAME_TEMPLATE
GST_PADTEMPLATE_PRESENCE
GST_PADTEMPLATE_NEW
GST_PADTEMPLATE_FACTORY
GST_PADTEMPLATE_GET
gst_padtemplate_new
gst_padtemplate_load_thyself
gst_padtemplate_save_thyself
gst_padtemplate_get_caps
gst_padtemplate_get_caps_by_name
<SUBSECTION Standard>
GstPadClass
GST_TYPE_PAD
@ -793,7 +789,27 @@ GST_IS_GHOST_PAD
GST_IS_GHOST_PAD_CLASS
GST_IS_GHOST_PAD_FAST
gst_ghost_pad_get_type
</SECTION>
<SECTION>
<FILE>gstpadtemplate</FILE>
<TITLE>GstPadTemplate</TITLE>
GstPadPresence
GstPadTemplate
GST_PADTEMPLATE_CAPS
GST_PADTEMPLATE_DIRECTION
GST_PADTEMPLATE_NAME_TEMPLATE
GST_PADTEMPLATE_PRESENCE
GST_PADTEMPLATE_NEW
GST_PADTEMPLATE_FACTORY
GST_PADTEMPLATE_GET
gst_padtemplate_new
gst_padtemplate_load_thyself
gst_padtemplate_save_thyself
gst_padtemplate_get_caps
gst_padtemplate_get_caps_by_name
<SUBSECTION Standard>
GstPadTemplateClass
GST_TYPE_PADTEMPLATE
GST_PADTEMPLATE
@ -938,6 +954,7 @@ GstTypeDefinition
GstTypeFindFunc
gst_typefactory_new
gst_typefactory_find
gst_typefactory_get_list
<SUBSECTION Standard>
GST_TYPEFACTORY
GST_IS_TYPEFACTORY

View file

@ -47,6 +47,7 @@ GtkObject
GstQueue
GstTypeFind
GstPad
GstPadTemplate
GstPluginFeature
GstAutoplugFactory
GstTypeFactory

View file

@ -13,14 +13,12 @@ non renderer ones do.
</para>
<para>
You first need to create a suitable autoplugger with gst_autoplugfactory_make().
You first need to create a suitable autoplugger with gst_autoplugfactory_make()
(see #GstAutoplugFactory).
The name of the autoplugger must be one of the registered autopluggers
(see #GstStaticAutoplug and #GstStaticAutoplugRender).
</para>
<para>
A list of all available autopluggers can be obtained with gst_autoplugfactory_get_list().
</para>
<para>
If the autoplugger supports the RENDERER API, use gst_autoplug_to_renderers() call to
create a bin that connectes the src caps to the specified rendrer elements. You can
then add the bin to a pipeline and run it.
@ -83,7 +81,7 @@ compatible with the provided sink caps.
<para>
Optionally you can get a notification when a new object is added to the created
pipeline with a gtk_signal_connect to the "new_object" signal.
pipeline with a g_signal_connect to the "new_object" signal.
</para>
<para>
@ -110,12 +108,6 @@ The type of the autoplugger.
@GST_AUTOPLUG_TO_RENDERER:
@GST_AUTOPLUG_FLAG_LAST:
<!-- ##### STRUCT GstAutoplugFactory ##### -->
<para>
</para>
<!-- ##### FUNCTION gst_autoplug_signal_new_object ##### -->
<para>
@ -149,57 +141,3 @@ The type of the autoplugger.
@Returns:
<!-- ##### FUNCTION gst_autoplugfactory_new ##### -->
<para>
</para>
@name:
@longdesc:
@type:
@Returns:
<!-- ##### FUNCTION gst_autoplugfactory_destroy ##### -->
<para>
</para>
@factory:
<!-- ##### FUNCTION gst_autoplugfactory_find ##### -->
<para>
</para>
@name:
@Returns:
<!-- ##### FUNCTION gst_autoplugfactory_get_list ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION gst_autoplugfactory_create ##### -->
<para>
</para>
@factory:
@Returns:
<!-- ##### FUNCTION gst_autoplugfactory_make ##### -->
<para>
</para>
@name:
@Returns:

View file

@ -0,0 +1,93 @@
<!-- ##### SECTION Title ##### -->
GstAutoplugFactory
<!-- ##### SECTION Short_Description ##### -->
Create autopluggers from a factory.
<!-- ##### SECTION Long_Description ##### -->
<para>
An autoplugfactory is used to create instances of an autoplugger. It
can be added to a #GstPlugin as it extends #GstPluginFeature.
</para>
<para>
Use gst_autoplugfactory_new() to create a new autoplugger which can be registered
to a plugin with gst_plugin_add_feature().
</para>
<para>
Use gst_autoplugfactory_find() to find the named autoplugfactory.
or use gst_autoplugfactory_get_list() to get a list of all available autopluggers.
</para>
<para>
Once an autoplugfactory has been obtained use gst_autoplugfactory_create() to
instantiate a real autopugger. Optionally gst_autoplugfactory_make() to create
and autoplugger from the named factory.
</para>
<para>
Use gst_autoplugfactory_destroy() to remove the factory from the global list.
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
#GstAutoplug, #GstPlugin, #GstPluginFeature.
</para>
<!-- ##### STRUCT GstAutoplugFactory ##### -->
<para>
</para>
<!-- ##### FUNCTION gst_autoplugfactory_new ##### -->
<para>
</para>
@name:
@longdesc:
@type:
@Returns:
<!-- ##### FUNCTION gst_autoplugfactory_destroy ##### -->
<para>
</para>
@factory:
<!-- ##### FUNCTION gst_autoplugfactory_find ##### -->
<para>
</para>
@name:
@Returns:
<!-- ##### FUNCTION gst_autoplugfactory_get_list ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION gst_autoplugfactory_create ##### -->
<para>
</para>
@factory:
@Returns:
<!-- ##### FUNCTION gst_autoplugfactory_make ##### -->
<para>
</para>
@name:
@Returns:

View file

@ -25,7 +25,7 @@ simpler to connect pads of two elements together.
<!-- ##### SECTION See_Also ##### -->
<para>
#GstElementFactory
</para>
<!-- ##### ENUM GstElementState ##### -->
@ -205,27 +205,6 @@ Get the manager of this element.
</para>
<!-- ##### STRUCT GstElementDetails ##### -->
<para>
This struct is used to define public information about the element. It
describes the element, mostly for the benefit of editors.
</para>
@longname:
@klass:
@description:
@version:
@author:
@copyright:
<!-- ##### STRUCT GstElementFactory ##### -->
<para>
This factory is used when registering the element, and contains the name
of the element, the GtkType value for it, as well as a pointer to the
GstElementDetails struct for the element.
</para>
<!-- ##### USER_FUNCTION GstElementLoopFunction ##### -->
<para>
This function type is used to specify a loop function for the element. It
@ -502,86 +481,6 @@ instead.
@Returns:
<!-- ##### FUNCTION gst_elementfactory_new ##### -->
<para>
</para>
@name:
@type:
@details:
@Returns:
<!-- ##### FUNCTION gst_elementfactory_add_padtemplate ##### -->
<para>
</para>
@elementfactory:
@templ:
<!-- # Unused Parameters # -->
@temp:
@pad:
<!-- ##### FUNCTION gst_elementfactory_find ##### -->
<para>
</para>
@name:
@Returns:
<!-- ##### FUNCTION gst_elementfactory_get_list ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION gst_elementfactory_can_src_caps ##### -->
<para>
</para>
@factory:
@caps:
@Returns:
<!-- ##### FUNCTION gst_elementfactory_can_sink_caps ##### -->
<para>
</para>
@factory:
@caps:
@Returns:
<!-- ##### FUNCTION gst_elementfactory_create ##### -->
<para>
</para>
@factory:
@name:
@Returns:
<!-- ##### FUNCTION gst_elementfactory_make ##### -->
<para>
</para>
@factoryname:
@name:
@Returns:
<!-- ##### SIGNAL GstElement::state-change ##### -->
<para>
Is trigered whenever the state of an element changes

View file

@ -0,0 +1,149 @@
<!-- ##### SECTION Title ##### -->
GstElementFactory
<!-- ##### SECTION Short_Description ##### -->
Create GstElements from a factory
<!-- ##### SECTION Long_Description ##### -->
<para>
GstElementFactory is used to create instances of elements. A GstElementfactory
can be added to a #GstPlugin as it is also a #GstPluginFeature.
</para>
<para>
Use gst_elementfactory_new() to create a new factory which can be added to a plugin
with gst_plugin_add_feature().
</para>
<para>
gst_elementfactory_get_list() is used to get a list of all available factories in
the plugin repository.
</para>
<para>
gst_elementfactory_add_padtemplate() is used to add a padtemplate to the factory.
This function will enable the application to query for elementfactories that handle
a specific media type.
</para>
<para>
Use the gst_elementfactory_find() and gst_elementfactory_create() functions
to create element instances or use gst_elementfactory_make() as a convenient
shortcut.
</para>
<para>
The following code example shows you how to create a GstDiskSrc element.
</para>
<para>
<programlisting role="C">
#include &lt;gst/gst.h&gt;
GstElement *src;
GstElementFactory *srcfactory;
gst_init(&amp;argc,&amp;argv);
srcfactory = gst_elementfactory_find("disksrc");
g_return_if_fail(srcfactory != NULL);
src = gst_elementfactory_create(srcfactory,"src");
g_return_if_fail(src != NULL);
...
</programlisting>
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
#GstElement, #GstPlugin, #GstPluginFeature, #GstPadTemplate.
</para>
<!-- ##### STRUCT GstElementDetails ##### -->
<para>
This struct is used to define public information about the element. It
describes the element, mostly for the benefit of editors.
</para>
@longname:
@klass:
@description:
@version:
@author:
@copyright:
<!-- ##### FUNCTION gst_elementfactory_new ##### -->
<para>
</para>
@name:
@type:
@details:
@Returns:
<!-- ##### FUNCTION gst_elementfactory_find ##### -->
<para>
</para>
@name:
@Returns:
<!-- ##### FUNCTION gst_elementfactory_get_list ##### -->
<para>
</para>
@Returns:
<!-- ##### FUNCTION gst_elementfactory_add_padtemplate ##### -->
<para>
</para>
@elementfactory:
@templ:
<!-- # Unused Parameters # -->
@temp:
@pad:
<!-- ##### FUNCTION gst_elementfactory_can_src_caps ##### -->
<para>
</para>
@factory:
@caps:
@Returns:
<!-- ##### FUNCTION gst_elementfactory_can_sink_caps ##### -->
<para>
</para>
@factory:
@caps:
@Returns:
<!-- ##### FUNCTION gst_elementfactory_create ##### -->
<para>
</para>
@factory:
@name:
@Returns:
<!-- ##### FUNCTION gst_elementfactory_make ##### -->
<para>
</para>
@factoryname:
@name:
@Returns:

View file

@ -11,38 +11,12 @@ connections. After two pad are retrieved from an element with gst_element_get_pa
can be connected with gst_pad_connect().
</para>
<para>
PedTemplates are use to describe the runtime behaviour of an element and what pads it
will have during its lifetime. Pads are typically created from a padtemplate with
GST_PADTEMPLATE_NEW() or with the factory macro GST_PADTEMPLATE_FACTORY().
Pads are typically created from a #GstPadTemplate with gst_pad_new_from_template().
</para>
<para>
Pad and PadTemplates have #GstCaps attached to it to describe the media type they
Pad have #GstCaps attached to it to describe the media type they
are capable of dealing with. gst_pad_get_caps() and gst_pad_set_caps() are used to
manipulate the caps of the pads. gst_padtemplate_get_caps() is used to get the
caps of a padtemplate. It's not possible to modify the caps of a padtemplate after
creation. The following code example shows the code to create a pad from a padtemplate.
<programlisting>
GST_PADTEMPLATE_FACTORY (my_factory,
"sink", /* the name of the pad */
GST_PAD_SINK, /* the direction of the pad */
GST_PAD_ALWAYS, /* when this pad will be present */
GST_CAPS_NEW ( /* the capabilities of the padtemplate */
"my_caps",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"channels", GST_PROPS_INT_RANGE (1, 6)
)
)
void
my_method (void)
{
GstPad *pad;
pad = gst_pad_new_from_template (GST_PADTEMPLATE_GET (my_factory), "sink");
...
}
</programlisting>
manipulate the caps of the pads.
Pads created from a padtemplate cannot set capabilities that are incompatible with
the padtemplates capabilities.
</para>
@ -51,7 +25,7 @@ Pads without padtemplates can be created with gst_pad_new() which takes a direct
a name as an argument.
</para>
<para>
gst_pad_get_parent() will retrieve the GstElement that owns the pad.
gst_pad_get_parent() will retrieve the #GstElement that owns the pad.
</para>
<para>
GstElements creating a pad will typicilally use the various gst_pad_set_*_function() calls
@ -61,7 +35,7 @@ to register callbacks for various events on the pads.
GstElements will use gst_pad_push() and gst_pad_pull() to push out or pull a buffer in. The
gst_pad_pullregion() function can be used to request for a buffer with a specific offset (in
time or in bytes). gst_pad_select() and gst_pad_selectv() are use by plugins to wait on a set
of pads for a new GstBuffer or GstEvent.
of pads for a new #GstBuffer or #GstEvent.
</para>
<para>
To send an event on a pad, use gst_pad_send_event().
@ -69,7 +43,7 @@ To send an event on a pad, use gst_pad_send_event().
<!-- ##### SECTION See_Also ##### -->
<para>
#GstCaps, #GstElement, #GstEvent
#GstPadTemplate, #GstElement, #GstEvent
</para>
<!-- ##### MACRO GST_PAD_NAME ##### -->
@ -911,139 +885,3 @@ Get the real pad of this ghost pad.
@Returns:
<!-- ##### ENUM GstPadPresence ##### -->
<para>
Indicates when this pad will become available.
</para>
@GST_PAD_ALWAYS: the pad is always available
@GST_PAD_SOMETIMES: the pad will become available depending on the media stream
@GST_PAD_REQUEST: th pad is only available on request with
gst_element_request_pad_by_name() or gst_element_request_compatible_pad().
<!-- ##### STRUCT GstPadTemplate ##### -->
<para>
</para>
@object:
@name_template:
@direction:
@presence:
@caps:
<!-- ##### MACRO GST_PADTEMPLATE_CAPS ##### -->
<para>
Get a handle to the padtemplate #GstCaps
</para>
@templ: the template to query
<!-- ##### MACRO GST_PADTEMPLATE_DIRECTION ##### -->
<para>
Get the direction of the padtemplate.
</para>
@templ: the template to query
<!-- ##### MACRO GST_PADTEMPLATE_NAME_TEMPLATE ##### -->
<para>
Get the nametemplate of the padtemplate.
</para>
@templ: the template to query
<!-- ##### MACRO GST_PADTEMPLATE_PRESENCE ##### -->
<para>
Get the presence of the padtemplate.
</para>
@templ: the template to query
<!-- ##### MACRO GST_PADTEMPLATE_NEW ##### -->
<para>
Create a new padtemplate.
</para>
@padname: the nametemplate for the pads that will be created with this template
@dir: the direction of the pads.
@pres: the presence of the pads.
@a...: the capabilities of this padtemplate usually created with GST_CAPS_NEW()
<!-- ##### MACRO GST_PADTEMPLATE_FACTORY ##### -->
<para>
Create a factory for a padtemplate. This can be used if you only want one instance
of the padtemplate. Use GST_PADTEMPLATE_GET() to get the unique padtemplate.
</para>
@name: th name of the factory
@padname: the nametemplate of the pads
@dir: the direction of the pads.
@pres: the presence of the pads.
@a...: the capabilities of this padtemplate, usually created with GST_CAPS_NEW()
<!-- ##### MACRO GST_PADTEMPLATE_GET ##### -->
<para>
Get the padtemplate of the factory created with GST_PADTEMPLATE_FACTORY()
</para>
@fact: the factory name to get the padtemplate from.
<!-- ##### FUNCTION gst_padtemplate_new ##### -->
<para>
</para>
@name_template:
@direction:
@presence:
@caps:
@Varargs:
@Returns:
<!-- ##### FUNCTION gst_padtemplate_load_thyself ##### -->
<para>
</para>
@parent:
@Returns:
<!-- ##### FUNCTION gst_padtemplate_save_thyself ##### -->
<para>
</para>
@templ:
@parent:
@Returns:
<!-- ##### FUNCTION gst_padtemplate_get_caps ##### -->
<para>
</para>
@templ:
@Returns:
<!-- ##### FUNCTION gst_padtemplate_get_caps_by_name ##### -->
<para>
</para>
@templ:
@name:
@Returns:

View file

@ -0,0 +1,212 @@
<!-- ##### SECTION Title ##### -->
GstPadTemplate
<!-- ##### SECTION Short_Description ##### -->
Describe the media type of a pad.
<!-- ##### SECTION Long_Description ##### -->
<para>
Padtemplates describe the possible media types a pad or an elementfactory can
handle.
</para>
<para>
Pad and PadTemplates have #GstCaps attached to it to describe the media type they
are capable of dealing with. gst_padtemplate_get_caps() is used to get the
caps of a padtemplate. It's not possible to modify the caps of a padtemplate after
creation.
</para>
<para>
Padtemplates can be created with gst_padtemplate_new() or with the convenient
GST_PADTEMPLATE_FACTORY() macro. A padtemplate can be used to create a pad or
to add to an elementfactory.
</para>
<para>
The following code example shows the code to create a pad from a padtemplate.
<programlisting>
GST_PADTEMPLATE_FACTORY (my_template_factory,
"sink", /* the name of the pad */
GST_PAD_SINK, /* the direction of the pad */
GST_PAD_ALWAYS, /* when this pad will be present */
GST_CAPS_NEW ( /* the capabilities of the padtemplate */
"my_caps",
"audio/raw",
"format", GST_PROPS_STRING ("int"),
"channels", GST_PROPS_INT_RANGE (1, 6)
)
)
void
my_method (void)
{
GstPad *pad;
pad = gst_pad_new_from_template (GST_PADTEMPLATE_GET (my_template_factory), "sink");
...
}
</programlisting>
</para>
<para>
The following example shows you how to add the padtemplate to an elementfactory:
<programlisting>
gboolean
my_factory_init (GstPlugin *plugin)
{
GstElementFactory *factory;
factory = gst_elementfactory_new ("my_factory", GST_TYPE_MYFACTORY, &amp;gst_myfactory_details);
g_return_val_if_fail (factory != NULL, FALSE);
gst_elementfactory_add_padtemplate (factory, GST_PADTEMPLATE_GET (my_template_factory));
gst_plugin_add_feature (plugin, GST_PLUGIN_FEATURE (factory));
return TRUE;
}
</programlisting>
</para>
<!-- ##### SECTION See_Also ##### -->
<para>
#GstPad, #GstElementFactory
</para>
<!-- ##### ENUM GstPadPresence ##### -->
<para>
Indicates when this pad will become available.
</para>
@GST_PAD_ALWAYS: the pad is always available
@GST_PAD_SOMETIMES: the pad will become available depending on the media stream
@GST_PAD_REQUEST: th pad is only available on request with
gst_element_request_pad_by_name() or gst_element_request_compatible_pad().
<!-- ##### STRUCT GstPadTemplate ##### -->
<para>
</para>
<!-- ##### MACRO GST_PADTEMPLATE_CAPS ##### -->
<para>
Get a handle to the padtemplate #GstCaps
</para>
@templ: the template to query
<!-- ##### MACRO GST_PADTEMPLATE_DIRECTION ##### -->
<para>
Get the direction of the padtemplate.
</para>
@templ: the template to query
<!-- ##### MACRO GST_PADTEMPLATE_NAME_TEMPLATE ##### -->
<para>
Get the nametemplate of the padtemplate.
</para>
@templ: the template to query
<!-- ##### MACRO GST_PADTEMPLATE_PRESENCE ##### -->
<para>
Get the presence of the padtemplate.
</para>
@templ: the template to query
<!-- ##### MACRO GST_PADTEMPLATE_NEW ##### -->
<para>
Create a new padtemplate.
</para>
@padname: the nametemplate for the pads that will be created with this template
@dir: the direction of the pads.
@pres: the presence of the pads.
@a...: the capabilities of this padtemplate usually created with GST_CAPS_NEW()
<!-- ##### MACRO GST_PADTEMPLATE_FACTORY ##### -->
<para>
Create a factory for a padtemplate. This can be used if you only want one instance
of the padtemplate. Use GST_PADTEMPLATE_GET() to get the unique padtemplate.
</para>
@name: th name of the factory
@padname: the nametemplate of the pads
@dir: the direction of the pads.
@pres: the presence of the pads.
@a...: the capabilities of this padtemplate, usually created with GST_CAPS_NEW()
<!-- ##### MACRO GST_PADTEMPLATE_GET ##### -->
<para>
Get the padtemplate of the factory created with GST_PADTEMPLATE_FACTORY()
</para>
@fact: the factory name to get the padtemplate from.
<!-- ##### FUNCTION gst_padtemplate_new ##### -->
<para>
</para>
@name_template:
@direction:
@presence:
@caps:
@Varargs:
@Returns:
<!-- ##### FUNCTION gst_padtemplate_load_thyself ##### -->
<para>
</para>
@parent:
@Returns:
<!-- ##### FUNCTION gst_padtemplate_save_thyself ##### -->
<para>
</para>
@templ:
@parent:
@Returns:
<!-- ##### FUNCTION gst_padtemplate_get_caps ##### -->
<para>
</para>
@templ:
@Returns:
<!-- ##### FUNCTION gst_padtemplate_get_caps_by_name ##### -->
<para>
</para>
@templ:
@name:
@Returns:
<!-- ##### SIGNAL GstPadTemplate::pad-created ##### -->
<para>
</para>
@gstpadtemplate: the object which received the signal.
@arg1:

View file

@ -2423,6 +2423,14 @@ Get the size of the file.
</para>
<!-- ##### STRUCT GstElementFactory ##### -->
<para>
This factory is used when registering the element, and contains the name
of the element, the GtkType value for it, as well as a pointer to the
GstElementDetails struct for the element.
</para>
<!-- ##### STRUCT GstEsdSink ##### -->
<para>

View file

@ -20,8 +20,8 @@ gst_plugin_add_feature() as shown in the example:
{
gchar *data = GST_BUFFER_DATA (buf);
if (strncmp (&data[0], "RIFF", 4)) return NULL;
if (strncmp (&data[8], "AVI ", 4)) return NULL;
if (strncmp (&amp;data[0], "RIFF", 4)) return NULL;
if (strncmp (&amp;data[8], "AVI ", 4)) return NULL;
return gst_caps_new ("avi_typefind","video/avi", NULL);
}
@ -97,3 +97,11 @@ performed by a plugin.
@Returns:
<!-- ##### FUNCTION gst_typefactory_get_list ##### -->
<para>
</para>
@Returns: