From 335080574f49557763f505c264d79ee86c236b37 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Thu, 12 Apr 2001 18:11:19 +0000 Subject: [PATCH] Lots of updates to the plugins for caps negotiation. Original commit message from CVS: Lots of updates to the plugins for caps negotiation. Added YUY2 output to the win32 dlls. Added a colorspace converter in gstplay --- components/bonobo-gstmediaplay/Makefile.am | 10 +- .../bonobo-gstmediaplay/bonobo-gstmediaplay.c | 5 + docs/gst/Makefile.am | 3 +- docs/gst/gstreamer-sections.txt | 4 + docs/gst/tmpl/gstpad.sgml | 33 ++- docs/gst/tmpl/gstreamer-unused.sgml | 230 +++++++++--------- examples/helloworld/helloworld.c | 7 +- gst/autoplug/gststaticautoplugrender.c | 4 +- gst/gstcaps.h | 1 + gst/gstinfo.h | 2 + gst/gstpad.c | 118 ++++++--- gst/gstpad.h | 66 ++--- gst/gstprops.c | 15 +- gst/gstqueue.c | 12 +- gstplay/gstplay.c | 39 ++- gstplay/gstplayprivate.h | 1 + libs/idct/gstidct.c | 16 +- plugins/elements/gstqueue.c | 12 +- test/mpeg2parse2.c | 8 +- tests/old/examples/helloworld/helloworld.c | 7 +- 20 files changed, 373 insertions(+), 220 deletions(-) diff --git a/components/bonobo-gstmediaplay/Makefile.am b/components/bonobo-gstmediaplay/Makefile.am index 86311bd24e..c026f43afb 100644 --- a/components/bonobo-gstmediaplay/Makefile.am +++ b/components/bonobo-gstmediaplay/Makefile.am @@ -7,6 +7,7 @@ INCLUDES = -I$(top_srcdir)/gst \ -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ -DDATADIR=\""$(datadir)"\" \ -I$(includedir) \ + $(shell gnome-config --cflags gnome gnomeui bonobo bonobox) \ $(BONOBOX_TEST_CFLAGS) -Wall -O2 bin_PROGRAMS = bonobo-gstmediaplay @@ -15,15 +16,16 @@ bonobo_gstmediaplay_SOURCES = \ bonobo-gstmediaplay.c bonobo_gstmediaplay_CFLAGS = -Wall -O2 \ - $(shell gnome-config --cflags gnomeui bonobo bonobox) $(shell libglade-config --cflags gnome) \ + $(shell gnome-config --cflags gnome gnomeui bonobo bonobox) $(shell libglade-config --cflags gnome) \ $(shell gstreamer-config --clfags ) bonobo_gstmediaplay_LDADD = \ - $(top_srcdir)/gstplay/libgstmediaplay.la + $(top_srcdir)/gstplay/libgstmediaplay.la \ + $(top_srcdir)/gst/libgst.la bonobo_gstmediaplay_LDFLAGS = \ - $(shell gnome-config --libs gnomeui bonobo bonobox) $(shell libglade-config --libs gnome) \ - $(shell gstreamer-config --libs ) + $(shell gnome-config --libs gnome gnomeui bonobo bonobox) $(shell libglade-config --libs gnome) \ + $(shell gstreamer-config --libs ) oafdir = $(datadir)/oaf OAF_FILES = gstmediaplay.oafinfo diff --git a/components/bonobo-gstmediaplay/bonobo-gstmediaplay.c b/components/bonobo-gstmediaplay/bonobo-gstmediaplay.c index ac6ee97d7e..4a6734eb3a 100644 --- a/components/bonobo-gstmediaplay/bonobo-gstmediaplay.c +++ b/components/bonobo-gstmediaplay/bonobo-gstmediaplay.c @@ -307,12 +307,16 @@ bonobo_gstmediaplay_factory (BonoboGenericFactory *this, void *data) control_data->play = gst_play_new (); + vbox = gtk_vbox_new (TRUE, 0); gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (control_data->play), TRUE, TRUE, 0); gtk_widget_show_all (vbox); + gst_play_set_uri (control_data->play, "/opt/data/armageddon1.mpg"); + gst_play_play (control_data->play); + /* * Create the BonoboControl object. */ @@ -403,6 +407,7 @@ init_server_factory (int argc, char **argv) int main (int argc, char **argv) { + //g_thread_init (NULL); /* * Setup the factory. */ diff --git a/docs/gst/Makefile.am b/docs/gst/Makefile.am index cbe86cc453..2f3f4b77bc 100644 --- a/docs/gst/Makefile.am +++ b/docs/gst/Makefile.am @@ -52,8 +52,7 @@ tmpl_sources = \ tmpl/gsttype.sgml \ tmpl/gstutils.sgml \ tmpl/gstxml.sgml \ - tmpl/spectrum.sgml \ - tmpl/videoraw.sgml + tmpl/spectrum.sgml gstreamer_docdir = $(HTML_DIR) gstreamer_doc_DATA = \ diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index 573e513ce0..ce1b13225e 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -366,6 +366,8 @@ GstPadGetFunction GstPadGetRegionFunction GstPadQoSFunction GstPadEOSFunction +GstPadNewCapsFunction + GstPadNegotiateReturn GstPadNegotiateFunction @@ -388,6 +390,7 @@ gst_pad_set_getregion_function gst_pad_set_negotiate_function gst_pad_set_qos_function gst_pad_set_eos_function +gst_pad_set_newcaps_function gst_pad_set_caps gst_pad_get_caps gst_pad_check_compatibility @@ -435,6 +438,7 @@ GST_RPAD_PULLREGIONFUNC GST_RPAD_QOSFUNC GST_RPAD_EOSFUNC GST_RPAD_NEGOTIATEFUNC +GST_RPAD_NEWCAPSFUNC GST_GPAD_REALPAD GstGhostPad diff --git a/docs/gst/tmpl/gstpad.sgml b/docs/gst/tmpl/gstpad.sgml index 150a8c893a..cccdb1ab38 100644 --- a/docs/gst/tmpl/gstpad.sgml +++ b/docs/gst/tmpl/gstpad.sgml @@ -155,6 +155,15 @@ The function that will be called in an EOS case. @Returns: TRUE if EOS was successful, FALSE otherwise + + + + + +@pad: +@caps: + + The possible results from padnegotiation. @@ -171,8 +180,10 @@ The function that will be called when negotiating. @pad: The pad that is being negotiated @caps: The current caps that are being negotiated -@count: A counter to keep track of the negotiation process +@data: @Returns: The result of the negotiation process + +@count: A counter to keep track of the negotiation process @@ -329,6 +340,15 @@ Destroy the pad. @eos: + + + + + +@pad: +@newcaps: + + @@ -556,9 +576,9 @@ Call the EOS function of the pad @srcpad: @destpad: @caps: -@counter: @Returns: +@counter: @count: @@ -636,6 +656,7 @@ Call the EOS function of the pad @pullfunc: @pullregionfunc: @negotiatefunc: +@newcapsfunc: @ghostpads: @@ -742,6 +763,14 @@ Get the EOS function of the real pad. @pad: + + + + + +@pad: + + Get the real pad of this ghost pad. diff --git a/docs/gst/tmpl/gstreamer-unused.sgml b/docs/gst/tmpl/gstreamer-unused.sgml index fcef71a0e8..80ebffdaab 100644 --- a/docs/gst/tmpl/gstreamer-unused.sgml +++ b/docs/gst/tmpl/gstreamer-unused.sgml @@ -67,14 +67,6 @@ Query the element for the current mime type - - - - - -@pad: -@parent: - @@ -83,6 +75,14 @@ Query the element for the current mime type @pad: @buf: + + + + + +@pad: +@parent: + @@ -91,6 +91,14 @@ Query the element for the current mime type @pad: @buf: + + + + + +@pad: +@buf: + @@ -98,14 +106,6 @@ Query the element for the current mime type @Returns: - - - - - -@pad: -@buf: - @@ -349,16 +349,16 @@ subclass use this to start their flag enumeration @audiosink: @channels: - -Generic connection between elements. - - + +Generic connection between elements. + + @@ -632,13 +632,13 @@ Specify the current offset in the file. @sheight: @bytes_per_line: - + - + @@ -672,24 +672,17 @@ Specify the current offset in the file. @name: @Returns: - - - - - - - + -@src: @@ -699,6 +692,13 @@ Specify the current offset in the file. @id: @sink: + + + + + +@src: + @@ -1096,13 +1096,6 @@ GstFilter @obj: - - - - - -@obj: - @@ -1110,6 +1103,13 @@ GstFilter @Returns: + + + + + +@obj: + @@ -1118,13 +1118,6 @@ GstFilter @pad: @Returns: - - - - - -@thread: - @@ -1135,6 +1128,13 @@ GstFilter @y1: @y2: + + + + + +@thread: + Flags for the GstSrc element @@ -1204,13 +1204,6 @@ GstColorSpace @obj: - - - - - -@Returns: - @@ -1218,6 +1211,13 @@ GstColorSpace @klass: + + + + + +@Returns: + @@ -1247,12 +1247,6 @@ GstColorSpace @pad: @Returns: - - - - - - @@ -1261,6 +1255,12 @@ GstColorSpace @name: @Returns: + + + + + + @@ -1397,16 +1397,16 @@ This macro sets the given flags. - -GstSink - - A flag indicating that MMX instructions are supported. + +GstSink + + @@ -1690,13 +1690,6 @@ or a video card. - - - - - -@obj: - @@ -1704,6 +1697,13 @@ or a video card. @Returns: + + + + + +@obj: + @@ -1724,12 +1724,6 @@ Query whether this object has multiple input pads. @obj: Element to query for multiple input pads. - - - - - - @@ -1738,6 +1732,12 @@ Query whether this object has multiple input pads. @format: @args...: + + + + + + @@ -2117,13 +2117,6 @@ The start point of a filter graph @audiosink: - - - - - -@obj: - This macro unsets the given state on the element. @@ -2132,6 +2125,13 @@ This macro unsets the given state on the element. @obj: Element to unset state of. @flag: State to unset, can be any number of bits in guint32. + + + + + +@obj: + @@ -2197,6 +2197,13 @@ The number of bytes per read. @obj: + + + + + +@Returns: + @@ -2207,13 +2214,6 @@ The number of bytes per read. @format: @args...: - - - - - -@Returns: - @@ -2318,17 +2318,6 @@ This macro sets the given state on the element. @obj: - -Information about video buffers. - - - - - - - -@Returns: - @@ -2338,6 +2327,17 @@ Information about video buffers. @offset: @size: + + + + + +@Returns: + + +Information about video buffers. + + @@ -2428,13 +2428,13 @@ A flag indicating that SSE instructions are supported. @obj: - + - + @@ -2577,6 +2577,13 @@ the offset. + + + + + +@obj: + @@ -2585,13 +2592,6 @@ the offset. @name: @Returns: - - - - - -@obj: - Get the current number of bytes read. @@ -2640,13 +2640,6 @@ plugin @klass: - - - - - -@klass: - @@ -2654,6 +2647,13 @@ plugin @obj: + + + + + +@klass: + Indicates this pad is active diff --git a/examples/helloworld/helloworld.c b/examples/helloworld/helloworld.c index 0ad2daa38d..e01e1371d5 100644 --- a/examples/helloworld/helloworld.c +++ b/examples/helloworld/helloworld.c @@ -13,7 +13,7 @@ void eos(GstElement *element) int main(int argc,char *argv[]) { - GstElement *bin, *disksrc, *parse, *decoder, *downmix, *mulaw, *osssink; + GstElement *bin, *disksrc, *parse, *decoder, *downmix, *mulaw, *mulawdec, *osssink; gst_init(&argc,&argv); @@ -36,6 +36,7 @@ int main(int argc,char *argv[]) decoder = gst_elementfactory_make("mpg123","decoder"); downmix = gst_elementfactory_make("stereo2mono","stereo2mono"); mulaw = gst_elementfactory_make("mulawencode","mulaw"); + mulawdec = gst_elementfactory_make("mulawdecode","mulawdec"); /* and an audio sink */ osssink = gst_elementfactory_make("osssink", "play_audio"); @@ -45,6 +46,7 @@ int main(int argc,char *argv[]) gst_bin_add(GST_BIN(bin), decoder); gst_bin_add(GST_BIN(bin), downmix); gst_bin_add(GST_BIN(bin), mulaw); + gst_bin_add(GST_BIN(bin), mulawdec); gst_bin_add(GST_BIN(bin), osssink); /* connect src to sink */ @@ -57,6 +59,8 @@ int main(int argc,char *argv[]) gst_pad_connect(gst_element_get_pad(downmix,"src"), gst_element_get_pad(mulaw,"sink")); gst_pad_connect(gst_element_get_pad(mulaw,"src"), + gst_element_get_pad(mulawdec,"sink")); + gst_pad_connect(gst_element_get_pad(mulawdec,"src"), gst_element_get_pad(osssink,"sink")); /* start playing */ @@ -76,6 +80,7 @@ int main(int argc,char *argv[]) gst_object_destroy(GST_OBJECT(decoder)); gst_object_destroy(GST_OBJECT(downmix)); gst_object_destroy(GST_OBJECT(mulaw)); + gst_object_destroy(GST_OBJECT(mulawdec)); gst_object_destroy(GST_OBJECT(disksrc)); gst_object_destroy(GST_OBJECT(bin)); diff --git a/gst/autoplug/gststaticautoplugrender.c b/gst/autoplug/gststaticautoplugrender.c index a9989ff03d..7f1413ff4d 100644 --- a/gst/autoplug/gststaticautoplugrender.c +++ b/gst/autoplug/gststaticautoplugrender.c @@ -261,10 +261,10 @@ gst_static_autoplug_to_render (GstAutoplug *autoplug, GstCaps *srccaps, GstEleme while (targetelement) { GList *elements; - GstPad *pad; + GstRealPad *pad; GstPadTemplate *templ; - pad = GST_PAD (gst_element_get_pad_list (targetelement)->data); + pad = GST_PAD_REALIZE (gst_element_get_pad_list (targetelement)->data); templ = GST_PAD_PADTEMPLATE (pad); caps.sink = GST_PADTEMPLATE_CAPS (templ); diff --git a/gst/gstcaps.h b/gst/gstcaps.h index 71b8213ad3..ff7ab84a67 100644 --- a/gst/gstcaps.h +++ b/gst/gstcaps.h @@ -94,6 +94,7 @@ GstProps* gst_caps_get_props (GstCaps *caps); #define gst_caps_get_int(caps, name) gst_props_get_int ((caps)->properties, name) #define gst_caps_get_fourcc_int(caps, name) gst_props_get_fourcc_int ((caps)->properties, name) #define gst_caps_get_boolean(caps, name) gst_props_get_boolean ((caps)->properties, name) +#define gst_caps_get_string(caps, name) gst_props_get_string ((caps)->properties, name) GstCaps* gst_caps_get_by_name (GstCaps *caps, const gchar *name); diff --git a/gst/gstinfo.h b/gst/gstinfo.h index 507b36b218..aae18933f3 100644 --- a/gst/gstinfo.h +++ b/gst/gstinfo.h @@ -271,10 +271,12 @@ enum { GST_CAT_PIPELINE, // Pipeline stuff GST_CAT_PLUGIN_LOADING, // Plugin loading GST_CAT_PLUGIN_ERRORS, // Errors during plugin loading + GST_CAT_PLUGIN_INFO, // Plugin state information GST_CAT_PROPERTIES, // Properties GST_CAT_THREAD, // Thread creation/management GST_CAT_TYPES, // Typing GST_CAT_XML, // XML load/save of everything + GST_CAT_NEGOTIATION, // Caps Negotiation stuff GST_CAT_MAX_CATEGORY, }; diff --git a/gst/gstpad.c b/gst/gstpad.c index 215f80f651..eca7d5fe2f 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -260,7 +260,6 @@ gst_pad_new_from_template (GstPadTemplate *templ, pad = gst_pad_new (name, templ->direction); GST_PAD_PADTEMPLATE(pad) = templ; - //GST_PAD_CAPS (pad) = GST_PADTEMPLATE_CAPS (templ); return pad; } @@ -430,6 +429,26 @@ gst_pad_set_negotiate_function (GstPad *pad, } +/** + * gst_pad_set_newcaps_function: + * @pad: the pad to set the newcaps function for + * @newcaps: the newcaps function + * + * Set the given newcaps function for the pad. + */ +void +gst_pad_set_newcaps_function (GstPad *pad, + GstPadNewCapsFunction newcaps) +{ + g_return_if_fail (pad != NULL); + g_return_if_fail (GST_IS_REAL_PAD (pad)); + + GST_RPAD_NEWCAPSFUNC (pad) = newcaps; + GST_DEBUG (0,"newcapsfunc for %s:%s(@%p) at %p is set to %p\n", + GST_DEBUG_PAD_NAME(pad),pad,&GST_RPAD_NEWCAPSFUNC(pad),newcaps); +} + + static void gst_pad_push_func(GstPad *pad, GstBuffer *buf) @@ -748,7 +767,8 @@ gst_pad_set_caps (GstPad *pad, if (GST_PAD_CAPS (pad)) gst_caps_unref (GST_PAD_CAPS (pad)); - gst_caps_ref (caps); + if (caps) + gst_caps_ref (caps); GST_PAD_CAPS(pad) = caps; return gst_pad_renegotiate (pad); @@ -941,18 +961,22 @@ cleanup: } static gboolean -gst_pad_renegotiate_func (GstPad *pad, GstPad *peerpad, GstCaps **newcaps, gint *counter) +gst_pad_renegotiate_func (GstPad *pad, gpointer *data1, GstPad *peerpad, gpointer *data2, GstCaps **newcaps) { GstRealPad *currentpad, *otherpad; + gpointer *currentdata, *otherdata; GstPadNegotiateReturn result; + gint counter = 0; g_return_val_if_fail (pad != NULL, FALSE); currentpad = GST_PAD_REALIZE (pad); otherpad = GST_REAL_PAD (peerpad); + currentdata = data1; + otherdata = data2; - GST_DEBUG (GST_CAT_ELEMENT_PADS, "negotiating pad %s:%s and %s:%s counter:%d\n", - GST_DEBUG_PAD_NAME(pad), GST_DEBUG_PAD_NAME(peerpad), *counter); + GST_DEBUG (GST_CAT_NEGOTIATION, "negotiating pad %s:%s and %s:%s data:%p\n", + GST_DEBUG_PAD_NAME(currentpad), GST_DEBUG_PAD_NAME(otherpad), currentdata); do { gboolean matchtempl; @@ -960,31 +984,47 @@ gst_pad_renegotiate_func (GstPad *pad, GstPad *peerpad, GstCaps **newcaps, gint if (!*newcaps) { if (otherpad->negotiatefunc) { GstRealPad *temp; + gpointer *tempdata; - otherpad->negotiatefunc (GST_PAD (otherpad), newcaps, *counter); + GST_DEBUG (GST_CAT_NEGOTIATION, "requesting other caps from pad %s:%s data:%p\n", + GST_DEBUG_PAD_NAME(otherpad), otherdata); + otherpad->negotiatefunc (GST_PAD (otherpad), newcaps, otherdata); temp = otherpad; otherpad = currentpad; currentpad = temp; + + tempdata = otherdata; + otherdata = currentdata; + currentdata = tempdata; } } + GST_DEBUG (GST_CAT_NEGOTIATION, "checking compatibility with pad %s:%s\n", + GST_DEBUG_PAD_NAME(otherpad)); matchtempl = gst_caps_check_compatibility (*newcaps, gst_pad_get_padtemplate_caps (GST_PAD (otherpad))); - GST_DEBUG (GST_CAT_ELEMENT_PADS, "caps compatibility check %s\n", (matchtempl?"ok":"fail")); + GST_DEBUG (GST_CAT_NEGOTIATION, "caps compatibility check %s\n", (matchtempl?"ok":"fail")); if (matchtempl) { + GST_DEBUG (GST_CAT_NEGOTIATION, "checking if other pad %s:%s can negotiate data:%p\n", + GST_DEBUG_PAD_NAME(otherpad), otherdata); if (otherpad->negotiatefunc) { GstRealPad *temp; + gpointer *tempdata; - GST_DEBUG (GST_CAT_ELEMENT_PADS, "switching pad for next phase\n"); + GST_DEBUG (GST_CAT_NEGOTIATION, "switching pad for next phase\n"); temp = currentpad; currentpad = otherpad; otherpad = temp; + + tempdata = otherdata; + otherdata = currentdata; + currentdata = tempdata; } else if (gst_caps_check_compatibility (*newcaps, GST_PAD_CAPS (otherpad))) { - GST_DEBUG (GST_CAT_ELEMENT_PADS, "negotiation succeeded\n"); + GST_DEBUG (GST_CAT_NEGOTIATION, "negotiation succeeded\n"); return TRUE; } else { @@ -997,36 +1037,39 @@ gst_pad_renegotiate_func (GstPad *pad, GstPad *peerpad, GstCaps **newcaps, gint if (*newcaps) gst_caps_ref(*newcaps); } - (*counter)++; + counter++; if (currentpad->negotiatefunc) { - GST_DEBUG (GST_CAT_ELEMENT_PADS, "calling negotiate function on pad %s:%s counter: %d\n", - GST_DEBUG_PAD_NAME (currentpad), *counter); - result = currentpad->negotiatefunc (GST_PAD (currentpad), newcaps, *counter); + GST_DEBUG (GST_CAT_NEGOTIATION, "calling negotiate function on pad %s:%s data: %p\n", + GST_DEBUG_PAD_NAME (currentpad), currentdata); + result = currentpad->negotiatefunc (GST_PAD (currentpad), newcaps, currentdata); switch (result) { case GST_PAD_NEGOTIATE_FAIL: - GST_DEBUG (GST_CAT_ELEMENT_PADS, "negotiation failed\n"); + GST_DEBUG (GST_CAT_NEGOTIATION, "negotiation failed\n"); return FALSE; case GST_PAD_NEGOTIATE_AGREE: - GST_DEBUG (GST_CAT_ELEMENT_PADS, "negotiation succeeded\n"); + GST_DEBUG (GST_CAT_NEGOTIATION, "negotiation succeeded\n"); return TRUE; case GST_PAD_NEGOTIATE_TRY: - GST_DEBUG (GST_CAT_ELEMENT_PADS, "try another option\n"); + GST_DEBUG (GST_CAT_NEGOTIATION, "try another option\n"); + break; + default: + GST_DEBUG (GST_CAT_NEGOTIATION, "invalid return\n"); break; } } else { - GST_DEBUG (GST_CAT_ELEMENT_PADS, "negotiation failed, no more options\n"); + GST_DEBUG (GST_CAT_NEGOTIATION, "negotiation failed, no more options\n"); return FALSE; } - } while (*counter < 100); + } while (counter < 100); g_warning ("negotiation between (%s:%s) and (%s:%s) failed: too many attempts (%d)\n", - GST_DEBUG_PAD_NAME(pad), GST_DEBUG_PAD_NAME(peerpad), *counter); + GST_DEBUG_PAD_NAME(pad), GST_DEBUG_PAD_NAME(peerpad), counter); - GST_DEBUG (GST_CAT_ELEMENT_PADS, "negotiation failed, too many attempts\n"); + GST_DEBUG (GST_CAT_NEGOTIATION, "negotiation failed, too many attempts\n"); return FALSE; } @@ -1045,7 +1088,7 @@ gst_pad_renegotiate (GstPad *pad) GstCaps *newcaps = NULL; GstRealPad *peerpad, *currentpad, *otherpad; gboolean result; - gint counter = 0; + gpointer data1 = NULL, data2 = NULL; g_return_val_if_fail (pad != NULL, FALSE); @@ -1054,26 +1097,31 @@ gst_pad_renegotiate (GstPad *pad) currentpad = GST_PAD_REALIZE (pad); if (!peerpad) { - GST_DEBUG (GST_CAT_ELEMENT_PADS, "no peer pad for pad %s:%s\n", + GST_DEBUG (GST_CAT_NEGOTIATION, "no peer pad for pad %s:%s\n", GST_DEBUG_PAD_NAME(currentpad)); return TRUE; } otherpad = GST_REAL_PAD (peerpad); - GST_INFO (GST_CAT_ELEMENT_PADS, "negotiating pad %s:%s and %s:%s", + GST_INFO (GST_CAT_NEGOTIATION, "negotiating pad %s:%s and %s:%s", GST_DEBUG_PAD_NAME(pad), GST_DEBUG_PAD_NAME(peerpad)); newcaps = GST_PAD_CAPS (pad); - result = gst_pad_renegotiate_func (GST_PAD (currentpad), GST_PAD (otherpad), &newcaps, &counter); + result = gst_pad_renegotiate_func (GST_PAD (currentpad), &data1, GST_PAD (otherpad), &data2, &newcaps); if (result) { - GST_DEBUG (GST_CAT_ELEMENT_PADS, "pads aggreed on caps :)\n"); + GST_DEBUG (GST_CAT_NEGOTIATION, "pads aggreed on caps :)\n"); /* here we have some sort of aggreement of the caps */ GST_PAD_CAPS (currentpad) = newcaps; + if (GST_RPAD_NEWCAPSFUNC (currentpad)) + GST_RPAD_NEWCAPSFUNC (currentpad) (GST_PAD (currentpad), newcaps); + GST_PAD_CAPS (otherpad) = newcaps; + if (GST_RPAD_NEWCAPSFUNC (otherpad)) + GST_RPAD_NEWCAPSFUNC (otherpad) (GST_PAD (otherpad), newcaps); } return result; @@ -1084,7 +1132,6 @@ gst_pad_renegotiate (GstPad *pad) * @srcpad: the pad that proxies * @destpad: the pad to proxy the negotiation to * @caps: the current caps - * @counter: a counter to keep track of the negotiation process * * Proxies the negotiation pad from srcpad to destpad. Further * negotiation is done on the peers of both pad instead. @@ -1092,33 +1139,40 @@ gst_pad_renegotiate (GstPad *pad) * Returns: the result of the negotiation preocess. */ GstPadNegotiateReturn -gst_pad_negotiate_proxy (GstPad *srcpad, GstPad *destpad, GstCaps **caps, gint counter) +gst_pad_negotiate_proxy (GstPad *srcpad, GstPad *destpad, GstCaps **caps) { GstRealPad *srcpeer; GstRealPad *destpeer; gboolean result; + gpointer data1 = NULL, data2 = NULL; g_return_val_if_fail (srcpad != NULL, GST_PAD_NEGOTIATE_FAIL); g_return_val_if_fail (destpad != NULL, GST_PAD_NEGOTIATE_FAIL); - GST_DEBUG (GST_CAT_ELEMENT_PADS, "negotiation proxied from pad (%s:%s) to pad (%s:%s)\n", + GST_DEBUG (GST_CAT_NEGOTIATION, "negotiation proxied from pad (%s:%s) to pad (%s:%s)\n", GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (destpad)); srcpeer = GST_RPAD_PEER (srcpad); destpeer = GST_RPAD_PEER (destpad); if (srcpeer && destpeer) { - counter--; - result = gst_pad_renegotiate_func (GST_PAD (srcpeer), GST_PAD (destpeer), caps, &counter); + result = gst_pad_renegotiate_func (GST_PAD (srcpeer), &data1, GST_PAD (destpeer), &data2, caps); if (result) { - GST_DEBUG (GST_CAT_ELEMENT_PADS, "pads aggreed on caps :)\n"); + GST_DEBUG (GST_CAT_NEGOTIATION, "pads (%s:%s) and (%s:%s) aggreed on caps :)\n", + GST_DEBUG_PAD_NAME (srcpad), GST_DEBUG_PAD_NAME (destpad)); /* here we have some sort of aggreement of the caps */ - GST_PAD_CAPS (srcpad) = *caps; + GST_PAD_CAPS (destpeer) = *caps; + if (GST_RPAD_NEWCAPSFUNC (destpeer)) + GST_RPAD_NEWCAPSFUNC (destpeer) (GST_PAD (destpeer), *caps); + GST_PAD_CAPS (destpad) = *caps; + if (GST_RPAD_NEWCAPSFUNC (destpad)) + GST_RPAD_NEWCAPSFUNC (destpad) (GST_PAD (destpad), *caps); } else { + GST_DEBUG (GST_CAT_NEGOTIATION, "pads did not aggree on caps :(\n"); return GST_PAD_NEGOTIATE_FAIL; } } diff --git a/gst/gstpad.h b/gst/gstpad.h index 880174c1d6..2b915ac8fa 100644 --- a/gst/gstpad.h +++ b/gst/gstpad.h @@ -89,16 +89,17 @@ typedef enum { /* this defines the functions used to chain buffers * pad is the sink pad (so the same chain function can be used for N pads) * buf is the buffer being passed */ -typedef void (*GstPadChainFunction) (GstPad *pad,GstBuffer *buf); -typedef GstBuffer *(*GstPadGetFunction) (GstPad *pad); -typedef GstBuffer *(*GstPadGetRegionFunction) (GstPad *pad, GstRegionType type, guint64 offset, guint64 len); -typedef void (*GstPadQoSFunction) (GstPad *pad, glong qos_message); +typedef void (*GstPadChainFunction) (GstPad *pad,GstBuffer *buf); +typedef GstBuffer* (*GstPadGetFunction) (GstPad *pad); +typedef GstBuffer* (*GstPadGetRegionFunction) (GstPad *pad, GstRegionType type, guint64 offset, guint64 len); +typedef void (*GstPadQoSFunction) (GstPad *pad, glong qos_message); -typedef void (*GstPadPushFunction) (GstPad *pad, GstBuffer *buf); -typedef GstBuffer *(*GstPadPullFunction) (GstPad *pad); -typedef GstBuffer *(*GstPadPullRegionFunction) (GstPad *pad, GstRegionType type, guint64 offset, guint64 len); -typedef gboolean (*GstPadEOSFunction) (GstPad *pad); -typedef GstPadNegotiateReturn (*GstPadNegotiateFunction) (GstPad *pad, GstCaps **caps, gint count); +typedef void (*GstPadPushFunction) (GstPad *pad, GstBuffer *buf); +typedef GstBuffer* (*GstPadPullFunction) (GstPad *pad); +typedef GstBuffer* (*GstPadPullRegionFunction) (GstPad *pad, GstRegionType type, guint64 offset, guint64 len); +typedef gboolean (*GstPadEOSFunction) (GstPad *pad); +typedef GstPadNegotiateReturn (*GstPadNegotiateFunction) (GstPad *pad, GstCaps **caps, gpointer *data); +typedef void (*GstPadNewCapsFunction) (GstPad *pad, GstCaps *caps); typedef enum { GST_PAD_UNKNOWN, @@ -114,11 +115,11 @@ typedef enum { } GstPadFlags; struct _GstPad { - GstObject object; + GstObject object; - gpointer element_private; + gpointer element_private; - GstPadTemplate *padtemplate; /* the template for this pad */ + GstPadTemplate *padtemplate; /* the template for this pad */ }; struct _GstPadClass { @@ -126,31 +127,32 @@ struct _GstPadClass { }; struct _GstRealPad { - GstPad pad; + GstPad pad; - GstCaps *caps; - GstPadDirection direction; + GstCaps *caps; + GstPadDirection direction; - cothread_state *threadstate; + cothread_state *threadstate; - GstRealPad *peer; + GstRealPad *peer; - GstBuffer *bufpen; - GstRegionType regiontype; - guint64 offset; - guint64 len; + GstBuffer *bufpen; + GstRegionType regiontype; + guint64 offset; + guint64 len; - GstPadChainFunction chainfunc; - GstPadGetFunction getfunc; - GstPadGetRegionFunction getregionfunc; - GstPadQoSFunction qosfunc; - GstPadEOSFunction eosfunc; + GstPadChainFunction chainfunc; + GstPadGetFunction getfunc; + GstPadGetRegionFunction getregionfunc; + GstPadQoSFunction qosfunc; + GstPadEOSFunction eosfunc; - GstPadPushFunction pushfunc; - GstPadPullFunction pullfunc; - GstPadPullRegionFunction pullregionfunc; + GstPadPushFunction pushfunc; + GstPadPullFunction pullfunc; + GstPadPullRegionFunction pullregionfunc; - GstPadNegotiateFunction negotiatefunc; + GstPadNegotiateFunction negotiatefunc; + GstPadNewCapsFunction newcapsfunc; GList *ghostpads; }; @@ -196,6 +198,7 @@ struct _GstGhostPadClass { #define GST_RPAD_QOSFUNC(pad) (((GstRealPad *)(pad))->qosfunc) #define GST_RPAD_EOSFUNC(pad) (((GstRealPad *)(pad))->eosfunc) #define GST_RPAD_NEGOTIATEFUNC(pad) (((GstRealPad *)(pad))->negotiatefunc) +#define GST_RPAD_NEWCAPSFUNC(pad) (((GstRealPad *)(pad))->newcapsfunc) #define GST_RPAD_REGIONTYPE(pad) (((GstRealPad *)(pad))->regiontype) #define GST_RPAD_OFFSET(pad) (((GstRealPad *)(pad))->offset) @@ -281,6 +284,7 @@ void gst_pad_set_getregion_function (GstPad *pad, GstPadGetRegionFunction getr void gst_pad_set_qos_function (GstPad *pad, GstPadQoSFunction qos); void gst_pad_set_eos_function (GstPad *pad, GstPadEOSFunction eos); void gst_pad_set_negotiate_function (GstPad *pad, GstPadNegotiateFunction nego); +void gst_pad_set_newcaps_function (GstPad *pad, GstPadNewCapsFunction newcaps); gboolean gst_pad_set_caps (GstPad *pad, GstCaps *caps); GstCaps* gst_pad_get_caps (GstPad *pad); @@ -309,7 +313,7 @@ gboolean gst_pad_connect (GstPad *srcpad, GstPad *sinkpad); void gst_pad_disconnect (GstPad *srcpad, GstPad *sinkpad); gboolean gst_pad_renegotiate (GstPad *pad); -GstPadNegotiateReturn gst_pad_negotiate_proxy (GstPad *srcpad, GstPad *destpad, GstCaps **caps, gint counter); +GstPadNegotiateReturn gst_pad_negotiate_proxy (GstPad *srcpad, GstPad *destpad, GstCaps **caps); #if 1 void gst_pad_push (GstPad *pad, GstBuffer *buf); diff --git a/gst/gstprops.c b/gst/gstprops.c index 001d199832..5ba3eeec43 100644 --- a/gst/gstprops.c +++ b/gst/gstprops.c @@ -68,7 +68,7 @@ gst_props_debug_entry (GstPropsEntry *entry) GST_DEBUG (0, "%d\n", entry->data.int_data); break; case GST_PROPS_FOURCC_ID_NUM: - GST_DEBUG (0, "%s\n", (gchar*)&entry->data.fourcc_data); + GST_DEBUG (0, "%4.4s\n", (gchar*)&entry->data.fourcc_data); break; case GST_PROPS_BOOL_ID_NUM: GST_DEBUG (0, "%d\n", entry->data.bool_data); @@ -563,6 +563,9 @@ gst_props_get_int (GstProps *props, const gchar *name) GList *lentry; GQuark quark; + g_return_val_if_fail (props != NULL, 0); + g_return_val_if_fail (name != NULL, 0); + quark = g_quark_from_string (name); lentry = g_list_find_custom (props->properties, GINT_TO_POINTER (quark), props_find_func); @@ -593,6 +596,9 @@ gst_props_get_fourcc_int (GstProps *props, const gchar *name) GList *lentry; GQuark quark; + g_return_val_if_fail (props != NULL, 0); + g_return_val_if_fail (name != NULL, 0); + quark = g_quark_from_string (name); lentry = g_list_find_custom (props->properties, GINT_TO_POINTER (quark), props_find_func); @@ -623,6 +629,9 @@ gst_props_get_boolean (GstProps *props, const gchar *name) GList *lentry; GQuark quark; + g_return_val_if_fail (props != NULL, FALSE); + g_return_val_if_fail (name != NULL, FALSE); + quark = g_quark_from_string (name); lentry = g_list_find_custom (props->properties, GINT_TO_POINTER (quark), props_find_func); @@ -653,6 +662,9 @@ gst_props_get_string (GstProps *props, const gchar *name) GList *lentry; GQuark quark; + g_return_val_if_fail (props != NULL, NULL); + g_return_val_if_fail (name != NULL, NULL); + quark = g_quark_from_string (name); lentry = g_list_find_custom (props->properties, GINT_TO_POINTER (quark), props_find_func); @@ -886,7 +898,6 @@ gst_props_check_compatibility (GstProps *fromprops, GstProps *toprops) g_quark_to_string (entry1->propid)); gst_props_debug_entry (entry1); gst_props_debug_entry (entry2); - GST_DEBUG (0, "\n"); } sourcelist = g_list_next (sourcelist); diff --git a/gst/gstqueue.c b/gst/gstqueue.c index 9b7a4c18fb..3de02890d8 100644 --- a/gst/gstqueue.c +++ b/gst/gstqueue.c @@ -66,8 +66,8 @@ static void gst_queue_set_arg (GtkObject *object, GtkArg *arg, guint id); static void gst_queue_get_arg (GtkObject *object, GtkArg *arg, guint id); static gboolean gst_queue_handle_eos (GstPad *pad); -static GstPadNegotiateReturn gst_queue_handle_negotiate_src (GstPad *pad, GstCaps **caps, gint count); -static GstPadNegotiateReturn gst_queue_handle_negotiate_sink (GstPad *pad, GstCaps **caps, gint count); +static GstPadNegotiateReturn gst_queue_handle_negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data); +static GstPadNegotiateReturn gst_queue_handle_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data); static void gst_queue_chain (GstPad *pad, GstBuffer *buf); static GstBuffer * gst_queue_get (GstPad *pad); @@ -153,20 +153,20 @@ gst_queue_init (GstQueue *queue) } static GstPadNegotiateReturn -gst_queue_handle_negotiate_src (GstPad *pad, GstCaps **caps, gint counter) +gst_queue_handle_negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data) { GstQueue *queue; queue = GST_QUEUE (GST_OBJECT_PARENT (pad)); - return gst_pad_negotiate_proxy (pad, queue->sinkpad, caps, counter); + return gst_pad_negotiate_proxy (pad, queue->sinkpad, caps); //return GST_PAD_NEGOTIATE_FAIL; } static GstPadNegotiateReturn -gst_queue_handle_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) +gst_queue_handle_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data) { GstQueue *queue; @@ -179,7 +179,7 @@ gst_queue_handle_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) } if (*caps) { */ - return gst_pad_negotiate_proxy (pad, queue->srcpad, caps, counter); + return gst_pad_negotiate_proxy (pad, queue->srcpad, caps); /* } diff --git a/gstplay/gstplay.c b/gstplay/gstplay.c index 037d10c706..09f12127e0 100644 --- a/gstplay/gstplay.c +++ b/gstplay/gstplay.c @@ -17,6 +17,7 @@ static void gst_play_get_arg (GtkObject *object,GtkArg *arg,guint id); static void gst_play_realize (GtkWidget *play); static void gst_play_frame_displayed (GstElement *element, GstPlay *play); +static void gst_play_have_size (GstElement *element, guint width, guint height, GstPlay *play); static void gst_play_audio_handoff (GstElement *element, GstPlay *play); /* signals and args */ @@ -116,6 +117,7 @@ static void gst_play_init (GstPlay *play) { GstPlayPrivate *priv = g_new0 (GstPlayPrivate, 1); + GstElement *colorspace; play->priv = priv; @@ -130,11 +132,24 @@ gst_play_init (GstPlay *play) gtk_signal_connect (GTK_OBJECT (priv->audio_element), "handoff", GTK_SIGNAL_FUNC (gst_play_audio_handoff), play); - priv->video_element = gst_elementfactory_make ("xvideosink", "show"); - g_return_if_fail (priv->video_element != NULL); + priv->video_element = gst_elementfactory_make ("bin", "video_bin"); + + priv->video_show = gst_elementfactory_make ("xvideosink", "show"); + g_return_if_fail (priv->video_show != NULL); //gtk_object_set (GTK_OBJECT (priv->video_element), "xv_enabled", FALSE, NULL); - gtk_signal_connect (GTK_OBJECT (priv->video_element), "frame_displayed", + gtk_signal_connect (GTK_OBJECT (priv->video_show), "frame_displayed", GTK_SIGNAL_FUNC (gst_play_frame_displayed), play); + gtk_signal_connect (GTK_OBJECT (priv->video_show), "have_size", + GTK_SIGNAL_FUNC (gst_play_have_size), play); + + colorspace = gst_elementfactory_make ("colorspace", "colorspace"); + gst_bin_add (GST_BIN (priv->video_element), colorspace); + gst_bin_add (GST_BIN (priv->video_element), priv->video_show); + + gst_element_connect (colorspace, "src", priv->video_show, "sink"); + gst_element_add_ghost_pad (priv->video_element, + gst_element_get_pad (colorspace, "sink"), + "sink"); play->state = GST_PLAY_STOPPED; play->flags = 0; @@ -158,10 +173,21 @@ static void gst_play_eos (GstElement *element, GstPlay *play) { - g_print("gstplay: eos reached\n"); + GST_DEBUG(0, "gstplay: eos reached\n"); gst_play_stop(play); } +static void +gst_play_have_size (GstElement *element, guint width, guint height, + GstPlay *play) +{ + GstPlayPrivate *priv; + + priv = (GstPlayPrivate *)play->priv; + + gtk_widget_set_usize (priv->video_widget, width, height); +} + static void gst_play_frame_displayed (GstElement *element, GstPlay *play) @@ -175,7 +201,7 @@ gst_play_frame_displayed (GstElement *element, if (!stolen) { gtk_widget_realize (priv->video_widget); gtk_socket_steal (GTK_SOCKET (priv->video_widget), - gst_util_get_int_arg (GTK_OBJECT(priv->video_element), "xid")); + gst_util_get_int_arg (GTK_OBJECT(priv->video_show), "xid")); gtk_widget_show (priv->video_widget); stolen = TRUE; } @@ -214,7 +240,7 @@ gst_play_object_introspect (GstObject *object, } else { *target = element; - g_print("gstplay: using element \"%s\" for %s property\n", + GST_DEBUG(0, "gstplay: using element \"%s\" for %s property\n", gst_element_get_name(element), property); } } @@ -396,7 +422,6 @@ gst_play_realize (GtkWidget *widget) GstPlayPrivate *priv; g_return_if_fail (GST_IS_PLAY (widget)); - g_print ("gst_play: realize\n"); play = GST_PLAY (widget); priv = (GstPlayPrivate *)play->priv; diff --git a/gstplay/gstplayprivate.h b/gstplay/gstplayprivate.h index 31e4e17f10..6c51479f03 100644 --- a/gstplay/gstplayprivate.h +++ b/gstplay/gstplayprivate.h @@ -14,6 +14,7 @@ struct _GstPlayPrivate { GstElement *thread; GstElement *bin; GstElement *video_element, *audio_element; + GstElement *video_show; GtkWidget *video_widget; GstElement *src; diff --git a/libs/idct/gstidct.c b/libs/idct/gstidct.c index 6eae831cef..39b3cfcf99 100644 --- a/libs/idct/gstidct.c +++ b/libs/idct/gstidct.c @@ -20,7 +20,7 @@ #include -#include +#include #include "gstidct.h" #include "dct.h" @@ -53,38 +53,38 @@ GstIDCT *gst_idct_new(GstIDCTMethod method) switch (method) { case GST_IDCT_FAST_INT: - g_print("GstIDCT: using fast_int_idct\n"); + GST_INFO (GST_CAT_PLUGIN_INFO, "GstIDCT: using fast_int_idct\n"); gst_idct_init_fast_int_idct(); new->convert = gst_idct_fast_int_idct; break; case GST_IDCT_INT: - g_print("GstIDCT: using int_idct\n"); + GST_INFO (GST_CAT_PLUGIN_INFO, "GstIDCT: using int_idct\n"); new->convert = gst_idct_int_idct; break; case GST_IDCT_FLOAT: - g_print("GstIDCT: using float_idct\n"); + GST_INFO (GST_CAT_PLUGIN_INFO, "GstIDCT: using float_idct\n"); gst_idct_init_float_idct(); new->convert = gst_idct_float_idct; break; #ifdef HAVE_LIBMMX case GST_IDCT_MMX: - g_print("GstIDCT: using MMX_idct\n"); + GST_INFO (GST_CAT_PLUGIN_INFO, "GstIDCT: using MMX_idct\n"); new->convert = gst_idct_mmx_idct; new->need_transpose = TRUE; break; case GST_IDCT_MMX32: - g_print("GstIDCT: using MMX32_idct\n"); + GST_INFO (GST_CAT_PLUGIN_INFO, "GstIDCT: using MMX32_idct\n"); new->convert = gst_idct_mmx32_idct; new->need_transpose = TRUE; break; case GST_IDCT_SSE: - g_print("GstIDCT: using SSE_idct\n"); + GST_INFO (GST_CAT_PLUGIN_INFO, "GstIDCT: using SSE_idct\n"); new->convert = gst_idct_sse_idct; new->need_transpose = TRUE; break; #endif /* HAVE_LIBMMX */ default: - g_print("GstIDCT: method not supported\n"); + GST_INFO (GST_CAT_PLUGIN_INFO, "GstIDCT: method not supported\n"); g_free(new); return NULL; } diff --git a/plugins/elements/gstqueue.c b/plugins/elements/gstqueue.c index 9b7a4c18fb..3de02890d8 100644 --- a/plugins/elements/gstqueue.c +++ b/plugins/elements/gstqueue.c @@ -66,8 +66,8 @@ static void gst_queue_set_arg (GtkObject *object, GtkArg *arg, guint id); static void gst_queue_get_arg (GtkObject *object, GtkArg *arg, guint id); static gboolean gst_queue_handle_eos (GstPad *pad); -static GstPadNegotiateReturn gst_queue_handle_negotiate_src (GstPad *pad, GstCaps **caps, gint count); -static GstPadNegotiateReturn gst_queue_handle_negotiate_sink (GstPad *pad, GstCaps **caps, gint count); +static GstPadNegotiateReturn gst_queue_handle_negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data); +static GstPadNegotiateReturn gst_queue_handle_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data); static void gst_queue_chain (GstPad *pad, GstBuffer *buf); static GstBuffer * gst_queue_get (GstPad *pad); @@ -153,20 +153,20 @@ gst_queue_init (GstQueue *queue) } static GstPadNegotiateReturn -gst_queue_handle_negotiate_src (GstPad *pad, GstCaps **caps, gint counter) +gst_queue_handle_negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data) { GstQueue *queue; queue = GST_QUEUE (GST_OBJECT_PARENT (pad)); - return gst_pad_negotiate_proxy (pad, queue->sinkpad, caps, counter); + return gst_pad_negotiate_proxy (pad, queue->sinkpad, caps); //return GST_PAD_NEGOTIATE_FAIL; } static GstPadNegotiateReturn -gst_queue_handle_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) +gst_queue_handle_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data) { GstQueue *queue; @@ -179,7 +179,7 @@ gst_queue_handle_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter) } if (*caps) { */ - return gst_pad_negotiate_proxy (pad, queue->srcpad, caps, counter); + return gst_pad_negotiate_proxy (pad, queue->srcpad, caps); /* } diff --git a/test/mpeg2parse2.c b/test/mpeg2parse2.c index 99120ee383..176eed35d2 100644 --- a/test/mpeg2parse2.c +++ b/test/mpeg2parse2.c @@ -29,7 +29,7 @@ void mpeg2parse_newpad(GstElement *parser,GstPad *pad, GstElement *pipeline) { int main(int argc,char *argv[]) { GstPipeline *pipeline; GstElement *src, *parse; - GstElement *decode, *show, *thread; + GstElement *decode, *show, *thread, *color; GtkWidget *gtk_socket; g_print("have %d args\n",argc); @@ -75,6 +75,9 @@ int main(int argc,char *argv[]) { decode = gst_elementfactory_make("mpeg2dec","decode_video"); g_return_val_if_fail(decode != NULL, -1); + color = gst_elementfactory_make("colorspace","color"); + g_return_val_if_fail(color != NULL, -1); + show = gst_elementfactory_make("xvideosink","show"); //gtk_object_set(GTK_OBJECT(show),"xv_enabled",FALSE,NULL); g_return_val_if_fail(show != NULL, -1); @@ -97,6 +100,7 @@ int main(int argc,char *argv[]) { //gst_bin_add(GST_BIN(thread),GST_ELEMENT(parse2)); gst_bin_add(GST_BIN(thread),GST_ELEMENT(decode)); + gst_bin_add(GST_BIN(thread),GST_ELEMENT(color)); gst_bin_add(GST_BIN(thread),GST_ELEMENT(show)); gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(thread)); @@ -113,6 +117,8 @@ int main(int argc,char *argv[]) { //gst_pad_connect(gst_element_get_pad(parse2,"src"), gst_element_get_pad(decode,"sink")); gst_pad_connect(gst_element_get_pad(decode,"src"), + gst_element_get_pad(color,"sink")); + gst_pad_connect(gst_element_get_pad(color,"src"), gst_element_get_pad(show,"sink")); gtk_widget_show_all(appwindow); diff --git a/tests/old/examples/helloworld/helloworld.c b/tests/old/examples/helloworld/helloworld.c index 0ad2daa38d..e01e1371d5 100644 --- a/tests/old/examples/helloworld/helloworld.c +++ b/tests/old/examples/helloworld/helloworld.c @@ -13,7 +13,7 @@ void eos(GstElement *element) int main(int argc,char *argv[]) { - GstElement *bin, *disksrc, *parse, *decoder, *downmix, *mulaw, *osssink; + GstElement *bin, *disksrc, *parse, *decoder, *downmix, *mulaw, *mulawdec, *osssink; gst_init(&argc,&argv); @@ -36,6 +36,7 @@ int main(int argc,char *argv[]) decoder = gst_elementfactory_make("mpg123","decoder"); downmix = gst_elementfactory_make("stereo2mono","stereo2mono"); mulaw = gst_elementfactory_make("mulawencode","mulaw"); + mulawdec = gst_elementfactory_make("mulawdecode","mulawdec"); /* and an audio sink */ osssink = gst_elementfactory_make("osssink", "play_audio"); @@ -45,6 +46,7 @@ int main(int argc,char *argv[]) gst_bin_add(GST_BIN(bin), decoder); gst_bin_add(GST_BIN(bin), downmix); gst_bin_add(GST_BIN(bin), mulaw); + gst_bin_add(GST_BIN(bin), mulawdec); gst_bin_add(GST_BIN(bin), osssink); /* connect src to sink */ @@ -57,6 +59,8 @@ int main(int argc,char *argv[]) gst_pad_connect(gst_element_get_pad(downmix,"src"), gst_element_get_pad(mulaw,"sink")); gst_pad_connect(gst_element_get_pad(mulaw,"src"), + gst_element_get_pad(mulawdec,"sink")); + gst_pad_connect(gst_element_get_pad(mulawdec,"src"), gst_element_get_pad(osssink,"sink")); /* start playing */ @@ -76,6 +80,7 @@ int main(int argc,char *argv[]) gst_object_destroy(GST_OBJECT(decoder)); gst_object_destroy(GST_OBJECT(downmix)); gst_object_destroy(GST_OBJECT(mulaw)); + gst_object_destroy(GST_OBJECT(mulawdec)); gst_object_destroy(GST_OBJECT(disksrc)); gst_object_destroy(GST_OBJECT(bin));