More doc updates

Original commit message from CVS:
More doc updates
Manual additions: xml/load save of custom XML, debugging, request pads
added a signal to the example plugin
fixed a bug in mp3parse (ifdef 1)
This commit is contained in:
Wim Taymans 2001-02-22 23:18:51 +00:00
parent 94472df1c2
commit 1340064d57
19 changed files with 476 additions and 139 deletions

View file

@ -343,6 +343,7 @@ GstPadEOSFunction
GstPadPushFunction
GstPadPullFunction
GstRegionType
GstPadPullRegionFunction
GstPadDirection
@ -374,14 +375,16 @@ gst_pad_connect
gst_pad_disconnect
gst_pad_push
gst_pad_pull
gst_pad_pull_region
gst_pad_pullregion
gst_pad_select
gst_pad_set_eos
gst_pad_handle_qos
gst_pad_eos
gst_pad_load_and_connect
GST_RPAD_LEN
GST_RPAD_OFFSET
GST_RPAD_REGIONTYPE
GstRealPad
GST_RPAD_DIRECTION
GST_RPAD_CAPS
@ -734,7 +737,6 @@ GST_DISKSRC
GST_DISKSRC_CLASS
GST_IS_DISKSRC
GST_IS_DISKSRC_CLASS
gst_disksrc_details
</SECTION>
<SECTION>

View file

@ -134,39 +134,6 @@ This macro releases a lock on the object.
<!-- ##### ENUM GstBufferFlags ##### -->
<para>
FIXME this is strange.
<informaltable pgwide=1 frame="none" role="enum">
<tgroup cols="2"><colspec colwidth="2*"><colspec colwidth="8*">
<tbody>
<row>
<entry>GST_BUFFER_READONLY</entry>
<entry>the buffer is read only</entry>
</row>
<row>
<entry>GST_BUFFER_EOS</entry>
<entry>this buffer is the last one in the stream</entry>
</row>
<row>
<entry>GST_BUFFER_ORIGINAL</entry>
<entry>this buffer not a copy</entry>
</row>
<row>
<entry>GST_BUFFER_DONTFREE</entry>
<entry>do not try to free the data when this buffer is unref-ed</entry>
</row>
<row>
<entry>GST_BUFFER_FLUSH</entry>
<entry>this buffer is not related to previous buffers. This flag is mainly
used when data in a stream has been skipped</entry>
</row>
</tbody></tgroup></informaltable>
</para>
@GST_BUFFER_READONLY: the buffer is read only
@ -175,7 +142,7 @@ used when data in a stream has been skipped</entry>
@GST_BUFFER_FLUSH: this buffer is not related to previous buffers. This flag is mainly
used when data in a stream has been skipped
@GST_BUFFER_EOS: this buffer is the last one in the stream
@GST_BUFFER_DISCONTINUOUS:
@GST_BUFFER_DISCONTINUOUS: The buffer has a discontinuity
<!-- ##### STRUCT GstBuffer ##### -->
<para>

View file

@ -2,12 +2,11 @@
GstDiskSrc
<!-- ##### SECTION Short_Description ##### -->
Synchronous read from a file (disksrc)
Asynchronous read from a file (disksrc)
<!-- ##### SECTION Long_Description ##### -->
<para>
Synchonously read buffers from a file. If you need asynchronous reading
with seeking capabilities use a <classname>GstAsynDiskSrc</classname> instead.
Asynchonously read buffers from a file.
</para>
@ -45,11 +44,11 @@ Specify how many bytes to read at a time.
<!-- ##### ARG GstDiskSrc:offset ##### -->
<para>
Get the current offset in the file.
Get/set the current offset in the file.
</para>
<!-- ##### ARG GstDiskSrc:size ##### -->
<para>
Get the size of the file.
</para>

View file

@ -101,26 +101,26 @@ This macro releases a lock on the object.
<!-- ##### MACRO GST_GET_LOCK ##### -->
<para>
Acquire a reference to the mutex of this object.
</para>
@obj:
@obj: Object to get the mutex of.
<!-- ##### MACRO GST_OBJECT_PARENT ##### -->
<para>
Get the parent of this object
</para>
@obj:
@obj: Object to get the parent of.
<!-- ##### MACRO GST_OBJECT_NAME ##### -->
<para>
Get the name of this object
</para>
@obj:
@obj: Object to get the name of.
<!-- ##### FUNCTION gst_object_new ##### -->

View file

@ -124,15 +124,15 @@ The function that will be called when pulling a buffer.
<!-- ##### USER_FUNCTION GstPadGetRegionFunction ##### -->
<para>
The function that will be called when pulling a region buffer.
You can specify which buffer to get using an offset/length pair or
a start/stop timecode pair.
</para>
@pad: the pad to get a buffer from
@type:
@type: the type of region to get (time or offset based)
@offset: the offset of the region to get
@len:
@len: the length of the region to get
@Returns: a #GstBuffer
<!-- # Unused Parameters # -->
@size: the size of the region to get
<!-- ##### USER_FUNCTION GstPadQoSFunction ##### -->
@ -172,18 +172,28 @@ The function that will be called when pulling buffers.
@Returns: a GstBuffer
<!-- ##### ENUM GstRegionType ##### -->
<para>
the region types for #gst_pad_pullregion.
</para>
@GST_REGION_NONE: no type specified
@GST_REGION_OFFSET_LEN: an offet/length pair
@GST_REGION_TIME_LEN: a time start/length pair
<!-- ##### USER_FUNCTION GstPadPullRegionFunction ##### -->
<para>
The function that will be called when pulling a region buffer.
You can specify which buffer to get using an offset/length pair or
a start/stop timecode pair.
</para>
@pad: the pad to pull
@type:
@offset: the offset of the region to pull
@len:
@Returns: a GstBuffer
<!-- # Unused Parameters # -->
@size: the size of the region to pull
@pad: the pad to get a buffer from
@type: the type of region to get (time or offset based)
@offset: the offset of the region to get
@len: the length of the region to get
@Returns: a #GstBuffer
</para>
<!-- ##### ENUM GstPadDirection ##### -->
@ -440,6 +450,8 @@ Destroy the pad.
</para>
@pad:
@buf:
<!-- # Unused Parameters # -->
@buffer:
@ -466,16 +478,6 @@ Destroy the pad.
@size:
<!-- ##### FUNCTION gst_pad_select ##### -->
<para>
</para>
@nextpad:
@Varargs:
@Returns:
<!-- ##### FUNCTION gst_pad_set_eos ##### -->
<para>
@ -514,6 +516,30 @@ Call the EOS function of the pad
@elements:
<!-- ##### MACRO GST_RPAD_LEN ##### -->
<para>
</para>
@pad:
<!-- ##### MACRO GST_RPAD_OFFSET ##### -->
<para>
</para>
@pad:
<!-- ##### MACRO GST_RPAD_REGIONTYPE ##### -->
<para>
</para>
@pad:
<!-- ##### STRUCT GstRealPad ##### -->
<para>

View file

@ -65,14 +65,6 @@ Query the element for the current mime type
</para>
<!-- ##### FUNCTION gst_fdsink_chain ##### -->
<para>
</para>
@pad:
@buf:
<!-- ##### FUNCTION gst_pad_remove_ghost_parent ##### -->
<para>
@ -81,6 +73,14 @@ Query the element for the current mime type
@pad:
@parent:
<!-- ##### FUNCTION gst_fdsink_chain ##### -->
<para>
</para>
@pad:
@buf:
<!-- ##### MACRO GST_SRC_UNSET_FLAGS ##### -->
<para>
This macro usets the given flags.
@ -780,6 +780,10 @@ Query whether this object has multiple input pads.
</para>
<!-- ##### SECTION ./tmpl/gstasyncdisksrc.sgml:Short_Description ##### -->
Asynchronous disk reader. (asyncdisksrc)
<!-- ##### FUNCTION gst_src_signal_eos ##### -->
<para>
@ -895,6 +899,15 @@ Specify the current offset in the file.
@klass:
<!-- ##### FUNCTION gst_pad_select ##### -->
<para>
</para>
@nextpad:
@Varargs:
@Returns:
<!-- ##### FUNCTION gst_identity_get_type ##### -->
<para>
@ -1370,6 +1383,10 @@ The start point of a filter graph
@klass:
<!-- ##### SECTION ./tmpl/gstasyncdisksrc.sgml:Title ##### -->
GstAsyncDiskSrc
<!-- ##### MACRO GST_TYPE_ASYNCDISKSRC ##### -->
<para>
@ -2000,6 +2017,12 @@ Flags for the GstSrc element
@GST_SRC_ASYNC: Indicates that this src is asynchronous
@GST_SRC_FLAG_LAST: subclasses can use this to number their flags
<!-- ##### SECTION ./tmpl/gstasyncdisksrc.sgml:See_Also ##### -->
<para>
</para>
<!-- ##### MACRO GST_HTTPSRC ##### -->
<para>
@ -2191,6 +2214,13 @@ The end point of a filter graph
@format:
@args...:
<!-- ##### SECTION ./tmpl/gstasyncdisksrc.sgml:Long_Description ##### -->
<para>
Reads data from a file. You can seek to a specific location by setting
the offset.
</para>
<!-- ##### MACRO GST_IS_ASYNCDISKSRC_CLASS ##### -->
<para>

View file

@ -20,6 +20,7 @@ sgml_files = gstreamer-manual.sgml \
motivation.sgml \
plugins.sgml \
programs.sgml \
debugging.sgml \
queues.sgml \
states.sgml \
threads.sgml \

View file

@ -0,0 +1,78 @@
<chapter id="cha-debugging">
<title>Debugging</title>
<para>
GStreamer has an extensive set of debugging tools for
plugin developers.
</para>
<sect1>
<title>Command line options</title>
<para>
Applications using the GStreamer libraries accept the following set
of command line argruments to enable the debugging system.
</para>
<para>
<itemizedlist>
<listitem>
<para>
<option>--gst-debug-mask=<replaceable>mask</replaceable></option>
Sets the mask for the debugging output.
</para>
</listitem>
<listitem>
<para>
<option>--gst-info-mask=<replaceable>mask</replaceable></option>
Sets the mask for the info output.
</para>
</listitem>
<listitem>
<para>
<option>--help</option> Print the a short desciption of the
options and an overview of the current debugging/info masks
set.
</para>
</listitem>
</itemizedlist>
</para>
<para>
<para>
The follwing table gives an overview of the mask values and
their meaning. (enabled) means that the corresponding flag
has been set.
</para>
<programlisting>
Mask (to be OR'ed) info/debug FLAGS
--------------------------------------------------------
0x00000001 (enabled)/ GST_INIT
0x00000002 / COTHREADS
0x00000004 / COTHREAD_SWITCH
0x00000008 / AUTOPLUG
0x00000010 / AUTOPLUG_ATTEMPT
0x00000020 / PARENTAGE
0x00000040 / STATES
0x00000080 / PLANING
0x00000100 / SCHEDULING
0x00000200 / OPERATION
0x00000400 / BUFFER
0x00000800 / CAPS
0x00001000 / CLOCK
0x00002000 / ELEMENT_PADS
0x00004000 / ELEMENTFACTORY
0x00008000 / PADS
0x00010000 / PIPELINE
0x00020000 / PLUGIN_LOADING
0x00040000 / PLUGIN_ERRORS
0x00080000 / PROPERTIES
0x00100000 / THREAD
0x00200000 / TYPES
0x00400000 / XML
</programlisting>
</sect1>
<sect1>
<title>Adding a custom debug handler</title>
<para>
</para>
</sect1>
</chapter>

View file

@ -23,6 +23,7 @@
<!ENTITY XML SYSTEM "xml.sgml">
<!ENTITY PLUGINS SYSTEM "plugins.sgml">
<!ENTITY DEBUGGING SYSTEM "debugging.sgml">
<!ENTITY PROGRAMS SYSTEM "programs.sgml">
<!ENTITY COMPONENTS SYSTEM "components.sgml">
<!ENTITY QUOTES SYSTEM "quotes.sgml">
@ -183,9 +184,12 @@
<partintro>
<para>
<application>GStreamer</application> comes prepackaged with a few programs.
and some usefull debugging options.
</para>
</partintro>
&DEBUGGING;
&PROGRAMS;
&COMPONENTS;

View file

@ -57,7 +57,7 @@
GstObject.
</para>
</sect2>
<sect2 id="sec-pads-synamic">
<sect2 id="sec-pads-dynamic">
<title>Dynamic pads</title>
<para>
Some elements might not have their pads when they are created. This can, for
@ -119,6 +119,58 @@ main(int argc, char *argv[])
</para>
</note>
</sect2>
<sect2 id="sec-pads-request">
<title>Request pads</title>
<para>
An element can also have request pads. These pads are not created automatically
but are only created on demand. This is very usefull for muxers, aggregators
and tee elements.
</para>
<para>
The tee element, for example, has one input pad and a request padtemplate for the
output pads. Whenever an element wants to get an output pad from the tee element, it
has to request the pad.
</para>
<para>
The following piece of code can be used to get a pad from the tee element. After
the pad has been requested, it can be used to connect another element to it.
</para>
<programlisting>
...
GstPad *pad;
...
element = gst_elementfactory_make ("tee", "element");
pad = gst_element_request_pad_by_name (element, "src%d");
g_print ("new pad %s\n", gst_pad_get_name (pad));
...
</programlisting>
<para>
The gst_element_request_pad_by_name method can be used to get a pad
from the element based on the name_template of the padtemplate.
</para>
<para>
It is also possible to request a pad that is compatible with another
padtemplate. This is very usefull if you want to connect an element to
a muxer element and you need to request a pad that is compatible. The
gst_element_request_compatible_pad is used to request a compatible pad, as
is shown in the next example.
</para>
<programlisting>
...
GstPadTemplate *templ;
GstPad *pad;
...
element = gst_elementfactory_make ("tee", "element");
mp3parse = gst_elementfactory_make ("mp3parse", "mp3parse");
templ = gst_element_get_padtemplate_by_name (mp3parse, "sink");
pad = gst_element_request_compatible_pad (element, templ);
g_print ("new pad %s\n", gst_pad_get_name (pad));
...
</programlisting>
</sect2>
</sect1>
<sect1 id="sec-pads-description">
<title>Capabilities of a GstPad</title>

View file

@ -15,8 +15,8 @@
<term>16 Feb 2001</term>
<listitem>
<para>
<emphasis>wtay:
I shipped a few commerical products to >40000 people now but
<emphasis>wtay:</emphasis>
I shipped a few commerical products to &gt;40000 people now but
GStreamer is way more exciting...
</para>
</listitem>
@ -26,7 +26,7 @@
<listitem>
<para>
*
<emphasis>tool-man</emphasis
<emphasis>tool-man</emphasis>
is a gstreamer groupie
</para>
</listitem>

View file

@ -120,7 +120,9 @@ main (int argc, char *argv[])
<sect1 id="sec-xml-load">
<title>Loading a GstElement from an XML file</title>
<para>
A saved XML file can be loade with the gst_xml_new (filename, rootelement).
Before an XML file can be loaded, you must create a GstXML object.
A saved XML file can then be loaded with the
gst_xml_parse_file (xml, filename, rootelement) method.
The root element can optionally left NULL. The following code example loads
the previously created XML file and runs it.
</para>
@ -128,37 +130,26 @@ main (int argc, char *argv[])
#include &lt;stdlib.h&gt;
#include &lt;gst/gst.h&gt;
gboolean playing;
/* eos will be called when the src element has an end of stream */
void
eos (GstElement *element, gpointer data)
{
g_print ("have eos, quitting\n");
playing = FALSE;
}
int
main(int argc, char *argv[])
{
GstXML *xml;
GstElement *bin;
GstElement *disk;
gboolean ret;
gst_init (&amp;argc, &amp;argv);
xml = gst_xml_new ("xmlTest.gst", NULL);
xml = gst_xml_new ();
ret = gst_xml_parse_file(xml, "xmlTest.gst", NULL);
g_assert (ret == TRUE);
bin = gst_xml_get_element (xml, "bin");
g_assert (bin != NULL);
gst_element_set_state (bin, GST_STATE_PLAYING);
playing = TRUE;
while (playing) {
gst_bin_iterate (GST_BIN (bin));
}
while (gst_bin_iterate(GST_BIN(bin)));
gst_element_set_state (bin, GST_STATE_NULL);
@ -173,6 +164,127 @@ main(int argc, char *argv[])
gst_xml_get_topelements (xml) can be used to get a list of all toplevel elements
in the XML file.
</para>
<para>
In addition to loading a file, you can also load a from a xmlDocPtr and
an in memory buffer using gst_xml_parse_doc and gst_xml_parse_memory
respectivily. both of these methods return a gboolean indicating success
or failure of the requested action.
</para>
</sect1>
<sect1 id="sec-xml-custom">
<title>Adding custom XML tags into the core XML data</title>
<para>
It is possible to add custom XML tags to the core XML created with
gst_xml_write. This feature can be used by an application to add more
information to the save plugins. the editor will for example insert
the position of the elements on the screen using the custom XML tags.
</para>
<para>
It is strongly suggested to save and load the custom XML tags using
a namespace. This will solve the problem of having your XML tags
interfere with the core XML tags.
</para>
<para>
To insert a hook into the element saving procedure you can connect
a signal to the GstElement using the following piece of code:
</para>
<programlisting>
xmlNsPtr ns;
...
ns = xmlNewNs (NULL, "http://gstreamer.net/gst-test/1.0/", "test");
...
thread = gst_elementfactory_make("thread", "thread");
gtk_signal_connect (GTK_OBJECT (thread), "object_saved", object_saved, g_strdup ("decoder thread"));
...
</programlisting>
<para>
When the thread is saved, the object_save method will be caled. Our example
will insert a comment tag:
</para>
<programlisting>
static void
object_saved (GstObject *object, xmlNodePtr parent, gpointer data)
{
xmlNodePtr child;
child = xmlNewChild(parent, ns, "comment", NULL);
xmlNewChild(child, ns, "text", (gchar *)data);
}
</programlisting>
<para>
Adding the custom tag code to the above example you will get an XML file
with the custom tags in it. Here's an excerpt:
</para>
<programlisting>
...
&lt;gst:element&gt;
&lt;gst:name&gt;thread&lt;/gst:name&gt;
&lt;gst:type&gt;thread&lt;/gst:type&gt;
&lt;gst:version&gt;0.1.0&lt;/gst:version&gt;
...
&lt;/gst:children&gt;
&lt;test:comment&gt;
&lt;test:text&gt;decoder thread&lt;/test:text&gt;
&lt;/test:comment&gt;
&lt;/gst:element&gt;
...
</programlisting>
<para>
To retrieve the custom XML again, you need to attach a signal to
the GstXML object used to load the XML data. You can then parse your
custom XML from the XML tree whenever an object is loaded.
</para>
<para>
We can extend our previous example with the following piece of
code.
</para>
<programlisting>
xml = gst_xml_new ();
gtk_signal_connect (GTK_OBJECT (xml), "object_loaded", xml_loaded, xml);
ret = gst_xml_parse_file(xml, "xmlTest.gst", NULL);
g_assert (ret == TRUE);
</programlisting>
<para>
Whenever a new object has been loaded, the xml_loaded function will be
called. this function looks like:
</para>
<programlisting>
static void
xml_loaded (GstXML *xml, GstObject *object, xmlNodePtr self, gpointer data)
{
xmlNodePtr children = self-&gt;xmlChildrenNode;
while (children) {
if (!strcmp (children-&gt;name, "comment")) {
xmlNodePtr nodes = children-&gt;xmlChildrenNode;
while (nodes) {
if (!strcmp (nodes-&gt;name, "text")) {
gchar *name = g_strdup (xmlNodeGetContent (nodes));
g_print ("object %s loaded with comment '%s'\n",
gst_object_get_name (object), name);
}
nodes = nodes-&gt;next;
}
}
children = children-&gt;next;
}
}
</programlisting>
<para>
As you can see, you'll get a handle to the GstXML object, the
newly loaded GstObject and the xmlNodePtr that was used to create
this object. In the above example we look for our special tag inside
the XML tree that was used to load the object and we print our
comment to the console.
</para>
</sect1>
</chapter>

View file

@ -65,11 +65,11 @@ static GstPadFactory sink_factory = {
"example_sink", /* The name of the caps */
"unknown/unknown", /* The overall MIME/type */
"foo", GST_PROPS_INT (1), /* An integer property */
"bar", GST_PROPS_BOOLEAN (TRUE) /* A boolean */
"bar", GST_PROPS_BOOLEAN (TRUE), /* A boolean */
"baz", GST_PROPS_LIST ( /* A list of values for */
GST_PROPS_INT (1),
GST_PROPS_INT (3),
),
GST_PROPS_INT (3)
)
),
NULL /* All factories must be NULL-terminated */
};
@ -165,6 +165,18 @@ gst_example_class_init (GstExampleClass *klass)
gtk_object_add_arg_type("GstExample::active", GTK_TYPE_INT,
GTK_ARG_READWRITE, ARG_ACTIVE);
/* Here we add a signal to the object. This is avery useless signal
* called asdf. The signal will also pass a pointer to the listeners
* which happens to be the example element itself */
gst_example_signals[ASDF] =
gtk_signal_new("asdf", GTK_RUN_LAST, gtkobject_class->type,
GTK_SIGNAL_OFFSET (GstExampleClass, asdf),
gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
GST_TYPE_EXAMPLE);
gtk_object_class_add_signals (gtkobject_class, gst_example_signals,
LAST_SIGNAL);
/* The last thing is to provide the functions that implement get and set
* of arguments.
*/
@ -221,7 +233,6 @@ gst_example_chain (GstPad *pad, GstBuffer *buf)
g_return_if_fail(pad != NULL);
g_return_if_fail(GST_IS_PAD(pad));
g_return_if_fail(buf != NULL);
g_return_if_fail(GST_IS_BUFFER(buf));
/* We need to get a pointer to the element this pad belogs to. */
example = GST_EXAMPLE(gst_pad_get_parent (pad));
@ -254,6 +265,10 @@ gst_example_chain (GstPad *pad, GstBuffer *buf)
*/
gst_pad_push(example->srcpad,outbuf);
/* For fun we'll emit our useless signal here */
gtk_signal_emit (GTK_OBJECT (example), gst_example_signals[ASDF],
example);
/* If we're not doing something, just send the original incoming buffer. */
} else {
gst_pad_push(example->srcpad,buf);

View file

@ -54,6 +54,9 @@ typedef struct _GstExampleClass GstExampleClass;
struct _GstExampleClass {
GstElementClass parent_class;
/* signals */
void (*asdf) (GstElement *element, GstExample *example);
};
/* Five standard preprocessing macros are used in the Gtk+ object system.

View file

@ -156,11 +156,13 @@ gst_init_check (int *argc,
g_print (" --gst-info-mask=FLAGS Gst info flags to set (current %08x)\n", gst_info_get_categories());
g_print (" --gst-debug-mask=FLAGS Gst debugging flags to set\n");
g_print ("\nGStreamer info/debug FLAGS (to be OR'ed)\n");
g_print ("\n Mask (to be OR'ed) info/debug FLAGS \n");
g_print ("--------------------------------------------------------\n");
for (i = 0; i<GST_CAT_MAX_CATEGORY; i++) {
g_print (" 0x%08x %s %s\n", 1<<i,
g_print (" 0x%08x %s%s %s\n", 1<<i,
(gst_info_get_categories() & (1<<i)?"(enabled)":" "),
(gst_debug_get_categories() & (1<<i)?"/(enabled)":"/ "),
gst_get_category_name (i));
}

View file

@ -909,22 +909,49 @@ gst_pad_ghost_save_thyself (GstPad *pad,
}
#ifndef gst_pad_push
void gst_pad_push(GstPad *pad,GstBuffer *buf) {
GstRealPad *peer = GST_RPAD_PEER(pad);
GST_DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad));
/**
* gst_pad_push:
* @pad: the pad to push
* @buf: the buffer to push
*
* Push a buffer to the peer of the pad.
*/
void
gst_pad_push (GstPad *pad, GstBuffer *buf)
{
GstRealPad *peer = GST_RPAD_PEER (pad);
g_return_if_fail (peer != NULL);
GST_DEBUG_ENTER ("(%s:%s)", GST_DEBUG_PAD_NAME (pad));
if (peer->pushfunc) {
GST_DEBUG (0,"calling pushfunc &%s of peer pad %s:%s\n",
GST_DEBUG_FUNCPTR_NAME(peer->pushfunc),GST_DEBUG_PAD_NAME(((GstPad*)peer)));
(peer->pushfunc)(((GstPad*)peer),buf);
GST_DEBUG (0, "calling pushfunc &%s of peer pad %s:%s\n",
GST_DEBUG_FUNCPTR_NAME (peer->pushfunc), GST_DEBUG_PAD_NAME (((GstPad*)peer)));
(peer->pushfunc) (((GstPad*)peer), buf);
} else
GST_DEBUG (0,"no pushfunc\n");
GST_DEBUG (0, "no pushfunc\n");
}
#endif
#ifndef gst_pad_pull
GstBuffer *gst_pad_pull(GstPad *pad) {
/**
* gst_pad_pull:
* @pad: the pad to pull
*
* Pull a buffer from the peer pad.
*
* Returns: a new buffer from the peer pad.
*/
GstBuffer*
gst_pad_pull (GstPad *pad)
{
GstRealPad *peer = GST_RPAD_PEER(pad);
g_return_if_fail (peer != NULL);
GST_DEBUG_ENTER("(%s:%s)",GST_DEBUG_PAD_NAME(pad));
if (peer->pullfunc) {
GST_DEBUG (0,"calling pullfunc &%s (@%p) of peer pad %s:%s\n",
GST_DEBUG_FUNCPTR_NAME(peer->pullfunc),&peer->pullfunc,GST_DEBUG_PAD_NAME(((GstPad*)peer)));
@ -937,9 +964,29 @@ GstBuffer *gst_pad_pull(GstPad *pad) {
#endif
#ifndef gst_pad_pullregion
GstBuffer *gst_pad_pullregion(GstPad *pad,GstRegionType type,guint64 offset,guint64 len) {
/**
* gst_pad_pullregion:
* @pad: the pad to pull the region from
* @type: the regiontype
* @offset: the offset/start of the buffer to pull
* @len: the length of the buffer to pull
*
* Pull a buffer region from the peer pad. The region to pull can be
* specified with a offset/lenght pair or with a start/legnth time
* indicator as specified by the type parameter.
*
* Returns: a new buffer from the peer pad with data in the specified
* region.
*/
GstBuffer*
gst_pad_pullregion (GstPad *pad, GstRegionType type, guint64 offset, guint64 len)
{
GstRealPad *peer = GST_RPAD_PEER(pad);
g_return_if_fail (peer != NULL);
GST_DEBUG_ENTER("(%s:%s,%d,%lld,%lld)",GST_DEBUG_PAD_NAME(pad),type,offset,len);
if (peer->pullregionfunc) {
GST_DEBUG (0,"calling pullregionfunc &%s of peer pad %s:%s\n",
GST_DEBUG_FUNCPTR_NAME(peer->pullregionfunc),GST_DEBUG_PAD_NAME(((GstPad*)peer)));
@ -1193,23 +1240,6 @@ gst_pad_set_eos(GstPad *pad)
return TRUE;
}
/*
GstPad *
gst_pad_select(GstPad *nextpad, ...) {
va_list args;
GstPad *pad;
GSList *pads = NULL;
// construct the list of pads
va_start (args, nextpad);
while ((pad = va_arg (args, GstPad*)))
pads = g_slist_prepend (pads, pad);
va_end (args);
// now switch to the nextpad
*/
/**
* gst_pad_set_element_private:
* @pad: the pad to set the private data to

View file

@ -289,7 +289,7 @@ void gst_pad_connect (GstPad *srcpad, GstPad *sinkpad);
void gst_pad_disconnect (GstPad *srcpad, GstPad *sinkpad);
#if 1
void gst_pad_push (GstPad *pad, GstBuffer *buffer);
void gst_pad_push (GstPad *pad, GstBuffer *buf);
#else
#define gst_pad_push(pad,buf) G_STMT_START{ \
if ((pad)->peer->pushfunc) ((pad)->peer->pushfunc)((pad)->peer,(buf)); \
@ -305,8 +305,6 @@ GstBuffer* gst_pad_pullregion (GstPad *pad, GstRegionType type, guint64 offset
(((pad)->peer->pullregionfunc) ? ((pad)->peer->pullregionfunc)((pad)->peer,(type),(offset),(len)) : NULL)
#endif
GstPad * gst_pad_select (GstPad *nextpad, ...);
#define gst_pad_eos(pad) (GST_RPAD_EOSFUNC(GST_RPAD_PEER(pad))(GST_PAD(GST_RPAD_PEER(pad))))
gboolean gst_pad_set_eos (GstPad *pad);

View file

@ -65,11 +65,11 @@ static GstPadFactory sink_factory = {
"example_sink", /* The name of the caps */
"unknown/unknown", /* The overall MIME/type */
"foo", GST_PROPS_INT (1), /* An integer property */
"bar", GST_PROPS_BOOLEAN (TRUE) /* A boolean */
"bar", GST_PROPS_BOOLEAN (TRUE), /* A boolean */
"baz", GST_PROPS_LIST ( /* A list of values for */
GST_PROPS_INT (1),
GST_PROPS_INT (3),
),
GST_PROPS_INT (3)
)
),
NULL /* All factories must be NULL-terminated */
};
@ -165,6 +165,18 @@ gst_example_class_init (GstExampleClass *klass)
gtk_object_add_arg_type("GstExample::active", GTK_TYPE_INT,
GTK_ARG_READWRITE, ARG_ACTIVE);
/* Here we add a signal to the object. This is avery useless signal
* called asdf. The signal will also pass a pointer to the listeners
* which happens to be the example element itself */
gst_example_signals[ASDF] =
gtk_signal_new("asdf", GTK_RUN_LAST, gtkobject_class->type,
GTK_SIGNAL_OFFSET (GstExampleClass, asdf),
gtk_marshal_NONE__POINTER, GTK_TYPE_NONE, 1,
GST_TYPE_EXAMPLE);
gtk_object_class_add_signals (gtkobject_class, gst_example_signals,
LAST_SIGNAL);
/* The last thing is to provide the functions that implement get and set
* of arguments.
*/
@ -221,7 +233,6 @@ gst_example_chain (GstPad *pad, GstBuffer *buf)
g_return_if_fail(pad != NULL);
g_return_if_fail(GST_IS_PAD(pad));
g_return_if_fail(buf != NULL);
g_return_if_fail(GST_IS_BUFFER(buf));
/* We need to get a pointer to the element this pad belogs to. */
example = GST_EXAMPLE(gst_pad_get_parent (pad));
@ -254,6 +265,10 @@ gst_example_chain (GstPad *pad, GstBuffer *buf)
*/
gst_pad_push(example->srcpad,outbuf);
/* For fun we'll emit our useless signal here */
gtk_signal_emit (GTK_OBJECT (example), gst_example_signals[ASDF],
example);
/* If we're not doing something, just send the original incoming buffer. */
} else {
gst_pad_push(example->srcpad,buf);

View file

@ -54,6 +54,9 @@ typedef struct _GstExampleClass GstExampleClass;
struct _GstExampleClass {
GstElementClass parent_class;
/* signals */
void (*asdf) (GstElement *element, GstExample *example);
};
/* Five standard preprocessing macros are used in the Gtk+ object system.