diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index 7b75da64fa..552f400ebe 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -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
diff --git a/docs/gst/tmpl/gstbuffer.sgml b/docs/gst/tmpl/gstbuffer.sgml index 5b670acb07..9e6f6a2913 100644 --- a/docs/gst/tmpl/gstbuffer.sgml +++ b/docs/gst/tmpl/gstbuffer.sgml @@ -134,39 +134,6 @@ This macro releases a lock on the object. -FIXME this is strange. - - - - - -GST_BUFFER_READONLY -the buffer is read only - - - -GST_BUFFER_EOS -this buffer is the last one in the stream - - - -GST_BUFFER_ORIGINAL -this buffer not a copy - - - -GST_BUFFER_DONTFREE -do not try to free the data when this buffer is unref-ed - - - -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_READONLY: the buffer is read only @@ -175,7 +142,7 @@ used when data in a stream has been skipped @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 diff --git a/docs/gst/tmpl/gstdisksrc.sgml b/docs/gst/tmpl/gstdisksrc.sgml index 67c4fd6366..a7d80b5896 100644 --- a/docs/gst/tmpl/gstdisksrc.sgml +++ b/docs/gst/tmpl/gstdisksrc.sgml @@ -2,12 +2,11 @@ GstDiskSrc -Synchronous read from a file (disksrc) +Asynchronous read from a file (disksrc) -Synchonously read buffers from a file. If you need asynchronous reading -with seeking capabilities use a GstAsynDiskSrc instead. +Asynchonously read buffers from a file. @@ -45,11 +44,11 @@ Specify how many bytes to read at a time. -Get the current offset in the file. +Get/set the current offset in the file. - +Get the size of the file. diff --git a/docs/gst/tmpl/gstobject.sgml b/docs/gst/tmpl/gstobject.sgml index 21cb532ae3..1abc9546de 100644 --- a/docs/gst/tmpl/gstobject.sgml +++ b/docs/gst/tmpl/gstobject.sgml @@ -101,26 +101,26 @@ This macro releases a lock on the object. - +Acquire a reference to the mutex of this object. -@obj: +@obj: Object to get the mutex of. - +Get the parent of this object -@obj: +@obj: Object to get the parent of. - +Get the name of this object -@obj: +@obj: Object to get the name of. diff --git a/docs/gst/tmpl/gstpad.sgml b/docs/gst/tmpl/gstpad.sgml index c4dd1f6c6b..db45773d2d 100644 --- a/docs/gst/tmpl/gstpad.sgml +++ b/docs/gst/tmpl/gstpad.sgml @@ -124,15 +124,15 @@ The function that will be called when pulling a buffer. 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. @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 - -@size: the size of the region to get @@ -172,18 +172,28 @@ The function that will be called when pulling buffers. @Returns: a GstBuffer + + +the region types for #gst_pad_pullregion. + + +@GST_REGION_NONE: no type specified +@GST_REGION_OFFSET_LEN: an offet/length pair +@GST_REGION_TIME_LEN: a time start/length pair + 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. -@pad: the pad to pull -@type: -@offset: the offset of the region to pull -@len: -@Returns: a GstBuffer - -@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 + @@ -440,6 +450,8 @@ Destroy the pad. @pad: +@buf: + @buffer: @@ -466,16 +478,6 @@ Destroy the pad. @size: - - - - - -@nextpad: -@Varargs: -@Returns: - - @@ -514,6 +516,30 @@ Call the EOS function of the pad @elements: + + + + + +@pad: + + + + + + + +@pad: + + + + + + + +@pad: + + diff --git a/docs/gst/tmpl/gstreamer-unused.sgml b/docs/gst/tmpl/gstreamer-unused.sgml index 61b61d7e16..9f76b0b77e 100644 --- a/docs/gst/tmpl/gstreamer-unused.sgml +++ b/docs/gst/tmpl/gstreamer-unused.sgml @@ -65,14 +65,6 @@ Query the element for the current mime type - - - - - -@pad: -@buf: - @@ -81,6 +73,14 @@ Query the element for the current mime type @pad: @parent: + + + + + +@pad: +@buf: + This macro usets the given flags. @@ -780,6 +780,10 @@ Query whether this object has multiple input pads. + +Asynchronous disk reader. (asyncdisksrc) + + @@ -895,6 +899,15 @@ Specify the current offset in the file. @klass: + + + + + +@nextpad: +@Varargs: +@Returns: + @@ -1370,6 +1383,10 @@ The start point of a filter graph @klass: + +GstAsyncDiskSrc + + @@ -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 + + + + + + @@ -2191,6 +2214,13 @@ The end point of a filter graph @format: @args...: + + +Reads data from a file. You can seek to a specific location by setting +the offset. + + + diff --git a/docs/manual/Makefile.am b/docs/manual/Makefile.am index 5220840351..9d9a225d29 100644 --- a/docs/manual/Makefile.am +++ b/docs/manual/Makefile.am @@ -20,6 +20,7 @@ sgml_files = gstreamer-manual.sgml \ motivation.sgml \ plugins.sgml \ programs.sgml \ + debugging.sgml \ queues.sgml \ states.sgml \ threads.sgml \ diff --git a/docs/manual/debugging.sgml b/docs/manual/debugging.sgml new file mode 100644 index 0000000000..da1003be20 --- /dev/null +++ b/docs/manual/debugging.sgml @@ -0,0 +1,78 @@ + + Debugging + + GStreamer has an extensive set of debugging tools for + plugin developers. + + + + Command line options + + Applications using the GStreamer libraries accept the following set + of command line argruments to enable the debugging system. + + + + + + + + Sets the mask for the debugging output. + + + + + + Sets the mask for the info output. + + + + + Print the a short desciption of the + options and an overview of the current debugging/info masks + set. + + + + + + + The follwing table gives an overview of the mask values and + their meaning. (enabled) means that the corresponding flag + has been set. + + +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 + + + + Adding a custom debug handler + + + + + diff --git a/docs/manual/gstreamer-manual.sgml b/docs/manual/gstreamer-manual.sgml index 1892c5e5cd..69871cfaa4 100644 --- a/docs/manual/gstreamer-manual.sgml +++ b/docs/manual/gstreamer-manual.sgml @@ -23,6 +23,7 @@ + @@ -183,9 +184,12 @@ GStreamer comes prepackaged with a few programs. + and some usefull debugging options. + &DEBUGGING; + &PROGRAMS; &COMPONENTS; diff --git a/docs/manual/pads.sgml b/docs/manual/pads.sgml index 52f0ccb66b..1efd56dd0b 100644 --- a/docs/manual/pads.sgml +++ b/docs/manual/pads.sgml @@ -57,7 +57,7 @@ GstObject. - + Dynamic pads Some elements might not have their pads when they are created. This can, for @@ -119,6 +119,58 @@ main(int argc, char *argv[]) + + Request pads + + 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. + + + 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. + + + 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. + + + ... + 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)); + ... + + + 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. + + + 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. + + + ... + 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)); + ... + + Capabilities of a GstPad diff --git a/docs/manual/quotes.sgml b/docs/manual/quotes.sgml index b1c475fb4b..11cfc1f572 100644 --- a/docs/manual/quotes.sgml +++ b/docs/manual/quotes.sgml @@ -15,8 +15,8 @@ 16 Feb 2001 - wtay: - I shipped a few commerical products to >40000 people now but + wtay: + I shipped a few commerical products to >40000 people now but GStreamer is way more exciting... @@ -26,7 +26,7 @@ * - tool-mantool-man is a gstreamer groupie diff --git a/docs/manual/xml.sgml b/docs/manual/xml.sgml index ba86abbc86..18413f187b 100644 --- a/docs/manual/xml.sgml +++ b/docs/manual/xml.sgml @@ -120,7 +120,9 @@ main (int argc, char *argv[]) Loading a GstElement from an XML file - 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. @@ -128,37 +130,26 @@ main (int argc, char *argv[]) #include <stdlib.h> #include <gst/gst.h> -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 (&argc, &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. + + 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. + + + + Adding custom XML tags into the core XML data + + + 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. + + + 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. + + + To insert a hook into the element saving procedure you can connect + a signal to the GstElement using the following piece of code: + + +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")); + ... + + + When the thread is saved, the object_save method will be caled. Our example + will insert a comment tag: + + +static void +object_saved (GstObject *object, xmlNodePtr parent, gpointer data) +{ + xmlNodePtr child; + + child = xmlNewChild(parent, ns, "comment", NULL); + xmlNewChild(child, ns, "text", (gchar *)data); +} + + + 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: + + + ... + <gst:element> + <gst:name>thread</gst:name> + <gst:type>thread</gst:type> + <gst:version>0.1.0</gst:version> + ... + </gst:children> + <test:comment> + <test:text>decoder thread</test:text> + </test:comment> + </gst:element> + ... + + + 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. + + + + We can extend our previous example with the following piece of + code. + + + + 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); + + + + Whenever a new object has been loaded, the xml_loaded function will be + called. this function looks like: + + +static void +xml_loaded (GstXML *xml, GstObject *object, xmlNodePtr self, gpointer data) +{ + xmlNodePtr children = self->xmlChildrenNode; + + while (children) { + if (!strcmp (children->name, "comment")) { + xmlNodePtr nodes = children->xmlChildrenNode; + + while (nodes) { + if (!strcmp (nodes->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->next; + } + } + children = children->next; + } +} + + + 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. + diff --git a/examples/plugins/example.c b/examples/plugins/example.c index 9b0d6192e6..00cf8c19d7 100644 --- a/examples/plugins/example.c +++ b/examples/plugins/example.c @@ -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); diff --git a/examples/plugins/example.h b/examples/plugins/example.h index 368c7470f9..840b8a3d18 100644 --- a/examples/plugins/example.h +++ b/examples/plugins/example.h @@ -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. diff --git a/gst/gst.c b/gst/gst.c index a8aa7958fd..247f9ea0f5 100644 --- a/gst/gst.c +++ b/gst/gst.c @@ -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; ipushfunc) { - 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 diff --git a/gst/gstpad.h b/gst/gstpad.h index 8e8c0d2df9..8e1ed43cff 100644 --- a/gst/gstpad.h +++ b/gst/gstpad.h @@ -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); diff --git a/tests/old/examples/plugins/example.c b/tests/old/examples/plugins/example.c index 9b0d6192e6..00cf8c19d7 100644 --- a/tests/old/examples/plugins/example.c +++ b/tests/old/examples/plugins/example.c @@ -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); diff --git a/tests/old/examples/plugins/example.h b/tests/old/examples/plugins/example.h index 368c7470f9..840b8a3d18 100644 --- a/tests/old/examples/plugins/example.h +++ b/tests/old/examples/plugins/example.h @@ -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.