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
diff --git a/components/bonobo-gstmediaplay/Makefile.am b/components/bonobo-gstmediaplay/Makefile.am
index 86311bd..c026f43 100644
--- a/components/bonobo-gstmediaplay/Makefile.am
+++ b/components/bonobo-gstmediaplay/Makefile.am
@@ -7,6 +7,7 @@
 	-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.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 ac6ee97..4a6734e 100644
--- a/components/bonobo-gstmediaplay/bonobo-gstmediaplay.c
+++ b/components/bonobo-gstmediaplay/bonobo-gstmediaplay.c
@@ -307,12 +307,16 @@
 
   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 @@
 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 cbe86cc..2f3f4b7 100644
--- a/docs/gst/Makefile.am
+++ b/docs/gst/Makefile.am
@@ -52,8 +52,7 @@
 	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 573e513..ce1b132 100644
--- a/docs/gst/gstreamer-sections.txt
+++ b/docs/gst/gstreamer-sections.txt
@@ -366,6 +366,8 @@
 GstPadGetRegionFunction
 GstPadQoSFunction
 GstPadEOSFunction
+GstPadNewCapsFunction
+
 
 GstPadNegotiateReturn
 GstPadNegotiateFunction
@@ -388,6 +390,7 @@
 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_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 150a8c8..cccdb1a 100644
--- a/docs/gst/tmpl/gstpad.sgml
+++ b/docs/gst/tmpl/gstpad.sgml
@@ -155,6 +155,15 @@
 @Returns: TRUE if EOS was successful, FALSE otherwise
 
 
+<!-- ##### USER_FUNCTION GstPadNewCapsFunction ##### -->
+<para>
+
+</para>
+
+@pad: 
+@caps: 
+
+
 <!-- ##### ENUM GstPadNegotiateReturn ##### -->
 <para>
 The possible results from padnegotiation.
@@ -171,8 +180,10 @@
 
 @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
+<!-- # Unused Parameters # -->
+@count: A counter to keep track of the negotiation process
 
 
 <!-- ##### USER_FUNCTION GstPadPushFunction ##### -->
@@ -329,6 +340,15 @@
 @eos: 
 
 
+<!-- ##### FUNCTION gst_pad_set_newcaps_function ##### -->
+<para>
+
+</para>
+
+@pad: 
+@newcaps: 
+
+
 <!-- ##### FUNCTION gst_pad_set_caps ##### -->
 <para>
 
@@ -556,9 +576,9 @@
 @srcpad: 
 @destpad: 
 @caps: 
-@counter: 
 @Returns: 
 <!-- # Unused Parameters # -->
+@counter: 
 @count: 
 
 
@@ -636,6 +656,7 @@
 @pullfunc: 
 @pullregionfunc: 
 @negotiatefunc: 
+@newcapsfunc: 
 @ghostpads: 
 
 <!-- ##### MACRO GST_RPAD_DIRECTION ##### -->
@@ -742,6 +763,14 @@
 @pad: 
 
 
+<!-- ##### MACRO GST_RPAD_NEWCAPSFUNC ##### -->
+<para>
+
+</para>
+
+@pad: 
+
+
 <!-- ##### MACRO GST_GPAD_REALPAD ##### -->
 <para>
 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 fcef71a..80ebffd 100644
--- a/docs/gst/tmpl/gstreamer-unused.sgml
+++ b/docs/gst/tmpl/gstreamer-unused.sgml
@@ -67,14 +67,6 @@
 </para>
 
 
-<!-- ##### FUNCTION gst_pad_remove_ghost_parent ##### -->
-<para>
-
-</para>
-
-@pad: 
-@parent: 
-
 <!-- ##### FUNCTION gst_fdsink_chain ##### -->
 <para>
 
@@ -83,6 +75,14 @@
 @pad: 
 @buf: 
 
+<!-- ##### FUNCTION gst_pad_remove_ghost_parent ##### -->
+<para>
+
+</para>
+
+@pad: 
+@parent: 
+
 <!-- ##### FUNCTION gst_identity_chain ##### -->
 <para>
 
@@ -91,6 +91,14 @@
 @pad: 
 @buf: 
 
+<!-- ##### FUNCTION gst_audiosink_chain ##### -->
+<para>
+
+</para>
+
+@pad: 
+@buf: 
+
 <!-- ##### FUNCTION gst_connection_get_type ##### -->
 <para>
 
@@ -98,14 +106,6 @@
 
 @Returns: 
 
-<!-- ##### FUNCTION gst_audiosink_chain ##### -->
-<para>
-
-</para>
-
-@pad: 
-@buf: 
-
 <!-- ##### MACRO GST_PIPELINE_CLASS ##### -->
 <para>
 
@@ -349,16 +349,16 @@
 @audiosink: 
 @channels: 
 
-<!-- ##### SECTION ./tmpl/gstconnection.sgml:Short_Description ##### -->
-Generic connection between elements.
-
-
 <!-- ##### STRUCT GstSinkClass ##### -->
 <para>
 
 </para>
 
 
+<!-- ##### SECTION ./tmpl/gstconnection.sgml:Short_Description ##### -->
+Generic connection between elements.
+
+
 <!-- ##### STRUCT GstFilterClass ##### -->
 <para>
 
@@ -632,13 +632,13 @@
 @sheight: 
 @bytes_per_line: 
 
-<!-- ##### SECTION ./tmpl/GstElement.sgml:Long_Description ##### -->
+<!-- ##### ARG GstAudioSink:format ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### ARG GstAudioSink:format ##### -->
+<!-- ##### SECTION ./tmpl/GstElement.sgml:Long_Description ##### -->
 <para>
 
 </para>
@@ -672,24 +672,17 @@
 @name: 
 @Returns: 
 
-<!-- ##### STRUCT GstConnection ##### -->
-<para>
-
-</para>
-
-
 <!-- ##### STRUCT GstQueueClass ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### FUNCTION gst_fakesrc_push ##### -->
+<!-- ##### STRUCT GstConnection ##### -->
 <para>
 
 </para>
 
-@src: 
 
 <!-- ##### FUNCTION gst_type_add_sink ##### -->
 <para>
@@ -699,6 +692,13 @@
 @id: 
 @sink: 
 
+<!-- ##### FUNCTION gst_fakesrc_push ##### -->
+<para>
+
+</para>
+
+@src: 
+
 <!-- ##### MACRO GST_IS_IDENTITY_CLASS ##### -->
 <para>
 
@@ -1096,13 +1096,6 @@
 
 @obj: 
 
-<!-- ##### MACRO GST_IS_QUEUE_CLASS ##### -->
-<para>
-
-</para>
-
-@obj: 
-
 <!-- ##### FUNCTION gst_fdsrc_get_type ##### -->
 <para>
 
@@ -1110,6 +1103,13 @@
 
 @Returns: 
 
+<!-- ##### MACRO GST_IS_QUEUE_CLASS ##### -->
+<para>
+
+</para>
+
+@obj: 
+
 <!-- ##### FUNCTION gst_pad_get_type_id ##### -->
 <para>
 
@@ -1118,13 +1118,6 @@
 @pad: 
 @Returns: 
 
-<!-- ##### FUNCTION gst_thread_iterate ##### -->
-<para>
-
-</para>
-
-@thread: 
-
 <!-- ##### STRUCT OverlayClip ##### -->
 <para>
 
@@ -1135,6 +1128,13 @@
 @y1: 
 @y2: 
 
+<!-- ##### FUNCTION gst_thread_iterate ##### -->
+<para>
+
+</para>
+
+@thread: 
+
 <!-- ##### ENUM GstSrcFlags ##### -->
 <para>
 Flags for the GstSrc element
@@ -1204,13 +1204,6 @@
 
 @obj: 
 
-<!-- ##### FUNCTION gst_asyncdisksrc_get_type ##### -->
-<para>
-
-</para>
-
-@Returns: 
-
 <!-- ##### MACRO GST_AUDIOSINK_CLASS ##### -->
 <para>
 
@@ -1218,6 +1211,13 @@
 
 @klass: 
 
+<!-- ##### FUNCTION gst_asyncdisksrc_get_type ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
 <!-- ##### MACRO GST_SRC_CLASS ##### -->
 <para>
 
@@ -1247,12 +1247,6 @@
 @pad: 
 @Returns: 
 
-<!-- ##### MACRO GST_PROPS_FOURCC_ID ##### -->
-<para>
-
-</para>
-
-
 <!-- ##### FUNCTION gst_esdsink_new ##### -->
 <para>
 
@@ -1261,6 +1255,12 @@
 @name: 
 @Returns: 
 
+<!-- ##### MACRO GST_PROPS_FOURCC_ID ##### -->
+<para>
+
+</para>
+
+
 <!-- ##### FUNCTION gst_element_request_pad ##### -->
 <para>
 
@@ -1397,16 +1397,16 @@
 </para>
 
 
-<!-- ##### SECTION ./tmpl/gstsink.sgml:Title ##### -->
-GstSink
-
-
 <!-- ##### MACRO GST_CPU_FLAG_MMX ##### -->
 <para>
 A flag indicating that MMX instructions are supported.
 </para>
 
 
+<!-- ##### SECTION ./tmpl/gstsink.sgml:Title ##### -->
+GstSink
+
+
 <!-- ##### FUNCTION gst_object_get_type ##### -->
 <para>
 
@@ -1690,13 +1690,6 @@
 </para>
 
 
-<!-- ##### MACRO GST_IS_BIN_CLASS ##### -->
-<para>
-
-</para>
-
-@obj: 
-
 <!-- ##### FUNCTION gst_esdsink_get_type ##### -->
 <para>
 
@@ -1704,6 +1697,13 @@
 
 @Returns: 
 
+<!-- ##### MACRO GST_IS_BIN_CLASS ##### -->
+<para>
+
+</para>
+
+@obj: 
+
 <!-- ##### SECTION ./tmpl/GstElement.sgml:See_Also ##### -->
 <para>
 
@@ -1724,12 +1724,6 @@
 
 @obj: Element to query for multiple input pads.
 
-<!-- ##### SECTION ./tmpl/gstfilter.sgml:See_Also ##### -->
-<para>
-
-</para>
-
-
 <!-- ##### MACRO DEBUG_NOPREFIX ##### -->
 <para>
 
@@ -1738,6 +1732,12 @@
 @format: 
 @args...: 
 
+<!-- ##### SECTION ./tmpl/gstfilter.sgml:See_Also ##### -->
+<para>
+
+</para>
+
+
 <!-- ##### ARG GstAudioSink:frequency ##### -->
 <para>
 
@@ -2117,13 +2117,6 @@
 
 @audiosink: 
 
-<!-- ##### MACRO GST_IS_FAKESINK ##### -->
-<para>
-
-</para>
-
-@obj: 
-
 <!-- ##### MACRO GST_STATE_UNSET ##### -->
 <para>
 This macro unsets the given state on the element.
@@ -2132,6 +2125,13 @@
 @obj: Element to unset state of.
 @flag: State to unset, can be any number of bits in guint32.
 
+<!-- ##### MACRO GST_IS_FAKESINK ##### -->
+<para>
+
+</para>
+
+@obj: 
+
 <!-- ##### MACRO GST_QUEUE_CLASS ##### -->
 <para>
 
@@ -2197,6 +2197,13 @@
 
 @obj: 
 
+<!-- ##### FUNCTION gst_sinesrc_get_type ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
 <!-- ##### MACRO ERROR_OBJECT ##### -->
 <para>
 
@@ -2207,13 +2214,6 @@
 @format: 
 @args...: 
 
-<!-- ##### FUNCTION gst_sinesrc_get_type ##### -->
-<para>
-
-</para>
-
-@Returns: 
-
 <!-- ##### MACRO GST_IS_IDENTITY ##### -->
 <para>
 
@@ -2318,17 +2318,6 @@
 
 @obj: 
 
-<!-- ##### SECTION ./tmpl/videoraw.sgml:Short_Description ##### -->
-Information about video buffers.
-
-
-<!-- ##### FUNCTION gst_fdsink_get_type ##### -->
-<para>
-
-</para>
-
-@Returns: 
-
 <!-- ##### FUNCTION gst_src_push_region ##### -->
 <para>
 
@@ -2338,6 +2327,17 @@
 @offset: 
 @size: 
 
+<!-- ##### FUNCTION gst_fdsink_get_type ##### -->
+<para>
+
+</para>
+
+@Returns: 
+
+<!-- ##### SECTION ./tmpl/videoraw.sgml:Short_Description ##### -->
+Information about video buffers.
+
+
 <!-- ##### STRUCT GstPipelineClass ##### -->
 <para>
 
@@ -2428,13 +2428,13 @@
 
 @obj: 
 
-<!-- ##### ARG GstAsyncDiskSrc:size ##### -->
+<!-- ##### STRUCT GstDiskSrcClass ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### STRUCT GstDiskSrcClass ##### -->
+<!-- ##### ARG GstAsyncDiskSrc:size ##### -->
 <para>
 
 </para>
@@ -2577,6 +2577,13 @@
 </para>
 
 
+<!-- ##### MACRO GST_IS_ASYNCDISKSRC_CLASS ##### -->
+<para>
+
+</para>
+
+@obj: 
+
 <!-- ##### FUNCTION gst_sinesrc_new ##### -->
 <para>
 
@@ -2585,13 +2592,6 @@
 @name: 
 @Returns: 
 
-<!-- ##### MACRO GST_IS_ASYNCDISKSRC_CLASS ##### -->
-<para>
-
-</para>
-
-@obj: 
-
 <!-- ##### ARG GstAudioSrc:curoffset ##### -->
 <para>
 Get the current number of bytes read.
@@ -2640,13 +2640,6 @@
 
 @klass: 
 
-<!-- ##### MACRO GST_HTTPSRC_CLASS ##### -->
-<para>
-
-</para>
-
-@klass: 
-
 <!-- ##### MACRO GST_ASYNCDISKSRC ##### -->
 <para>
 
@@ -2654,6 +2647,13 @@
 
 @obj: 
 
+<!-- ##### MACRO GST_HTTPSRC_CLASS ##### -->
+<para>
+
+</para>
+
+@klass: 
+
 <!-- ##### ARG GstPad:active ##### -->
 <para>
 Indicates this pad is active
diff --git a/examples/helloworld/helloworld.c b/examples/helloworld/helloworld.c
index 0ad2daa..e01e137 100644
--- a/examples/helloworld/helloworld.c
+++ b/examples/helloworld/helloworld.c
@@ -13,7 +13,7 @@
 
 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 @@
   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 @@
   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 @@
   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 @@
   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 a9989ff..7f1413f 100644
--- a/gst/autoplug/gststaticautoplugrender.c
+++ b/gst/autoplug/gststaticautoplugrender.c
@@ -261,10 +261,10 @@
 
   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 71b8213..ff7ab84 100644
--- a/gst/gstcaps.h
+++ b/gst/gstcaps.h
@@ -94,6 +94,7 @@
 #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 507b36b..aae1893 100644
--- a/gst/gstinfo.h
+++ b/gst/gstinfo.h
@@ -271,10 +271,12 @@
   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 215f80f..eca7d5f 100644
--- a/gst/gstpad.c
+++ b/gst/gstpad.c
@@ -260,7 +260,6 @@
 
   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_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 @@
   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 @@
 }
 
 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 @@
     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 @@
       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 @@
   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 @@
   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 @@
  * @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 @@
  * 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 880174c..2b915ac 100644
--- a/gst/gstpad.h
+++ b/gst/gstpad.h
@@ -89,16 +89,17 @@
 /* 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 @@
 } 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 _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 @@
 #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_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 @@
 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 001d199..5ba3eee 100644
--- a/gst/gstprops.c
+++ b/gst/gstprops.c
@@ -68,7 +68,7 @@
       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 @@
   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 @@
   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 @@
   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 @@
   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 @@
 		   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 9b7a4c1..3de0289 100644
--- a/gst/gstqueue.c
+++ b/gst/gstqueue.c
@@ -66,8 +66,8 @@
 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 @@
 }
 
 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 @@
   }
   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 037d10c..09f1212 100644
--- a/gstplay/gstplay.c
+++ b/gstplay/gstplay.c
@@ -17,6 +17,7 @@
 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 @@
 gst_play_init (GstPlay *play)
 {
   GstPlayPrivate *priv = g_new0 (GstPlayPrivate, 1);
+  GstElement *colorspace;
 
   play->priv = priv;
 
@@ -130,11 +132,24 @@
   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,11 +173,22 @@
 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 @@
   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 @@
   }
   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 @@
   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 31e4e17..6c51479 100644
--- a/gstplay/gstplayprivate.h
+++ b/gstplay/gstplayprivate.h
@@ -14,6 +14,7 @@
   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 6eae831..39b3cfc 100644
--- a/libs/idct/gstidct.c
+++ b/libs/idct/gstidct.c
@@ -20,7 +20,7 @@
 
 #include <config.h>
 
-#include <gst/gstcpu.h>
+#include <gst/gst.h>
 #include "gstidct.h"
 #include "dct.h"
 
@@ -53,38 +53,38 @@
 
   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 9b7a4c1..3de0289 100644
--- a/plugins/elements/gstqueue.c
+++ b/plugins/elements/gstqueue.c
@@ -66,8 +66,8 @@
 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 @@
 }
 
 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 @@
   }
   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 99120ee..176eed3 100644
--- a/test/mpeg2parse2.c
+++ b/test/mpeg2parse2.c
@@ -29,7 +29,7 @@
 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 @@
   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 @@
 
   //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 @@
   //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 0ad2daa..e01e137 100644
--- a/tests/old/examples/helloworld/helloworld.c
+++ b/tests/old/examples/helloworld/helloworld.c
@@ -13,7 +13,7 @@
 
 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 @@
   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 @@
   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 @@
   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 @@
   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));