Lots of updates to the plugins for caps negotiation.
authorWim Taymans <wim.taymans@gmail.com>
Thu, 12 Apr 2001 18:11:19 +0000 (18:11 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Thu, 12 Apr 2001 18:11:19 +0000 (18:11 +0000)
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

20 files changed:
components/bonobo-gstmediaplay/Makefile.am
components/bonobo-gstmediaplay/bonobo-gstmediaplay.c
docs/gst/Makefile.am
docs/gst/gstreamer-sections.txt
docs/gst/tmpl/gstpad.sgml
docs/gst/tmpl/gstreamer-unused.sgml
examples/helloworld/helloworld.c
gst/autoplug/gststaticautoplugrender.c
gst/gstcaps.h
gst/gstinfo.h
gst/gstpad.c
gst/gstpad.h
gst/gstprops.c
gst/gstqueue.c
gstplay/gstplay.c
gstplay/gstplayprivate.h
libs/idct/gstidct.c
plugins/elements/gstqueue.c
test/mpeg2parse2.c
tests/old/examples/helloworld/helloworld.c

index 86311bd..c026f43 100644 (file)
@@ -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
index ac6ee97..4a6734e 100644 (file)
@@ -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.
    */
index cbe86cc..2f3f4b7 100644 (file)
@@ -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 =           \
index 573e513..ce1b132 100644 (file)
@@ -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
index 150a8c8..cccdb1a 100644 (file)
@@ -155,6 +155,15 @@ The function that will be called in an EOS case.
 @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 @@ 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
+<!-- # Unused Parameters # -->
+@count: A counter to keep track of the negotiation process
 
 
 <!-- ##### USER_FUNCTION GstPadPushFunction ##### -->
@@ -329,6 +340,15 @@ Destroy the pad.
 @eos: 
 
 
+<!-- ##### FUNCTION gst_pad_set_newcaps_function ##### -->
+<para>
+
+</para>
+
+@pad: 
+@newcaps: 
+
+
 <!-- ##### FUNCTION gst_pad_set_caps ##### -->
 <para>
 
@@ -556,9 +576,9 @@ Call the EOS function of the pad
 @srcpad: 
 @destpad: 
 @caps: 
-@counter: 
 @Returns: 
 <!-- # Unused Parameters # -->
+@counter: 
 @count: 
 
 
@@ -636,6 +656,7 @@ Call the EOS function of the pad
 @pullfunc: 
 @pullregionfunc: 
 @negotiatefunc: 
+@newcapsfunc: 
 @ghostpads: 
 
 <!-- ##### MACRO GST_RPAD_DIRECTION ##### -->
@@ -742,6 +763,14 @@ Get the EOS function of the real pad.
 @pad: 
 
 
+<!-- ##### MACRO GST_RPAD_NEWCAPSFUNC ##### -->
+<para>
+
+</para>
+
+@pad: 
+
+
 <!-- ##### MACRO GST_GPAD_REALPAD ##### -->
 <para>
 Get the real pad of this ghost pad.
index fcef71a..80ebffd 100644 (file)
@@ -67,21 +67,21 @@ Query the element for the current mime type
 </para>
 
 
-<!-- ##### FUNCTION gst_pad_remove_ghost_parent ##### -->
+<!-- ##### FUNCTION gst_fdsink_chain ##### -->
 <para>
 
 </para>
 
 @pad: 
-@parent
+@buf
 
-<!-- ##### FUNCTION gst_fdsink_chain ##### -->
+<!-- ##### FUNCTION gst_pad_remove_ghost_parent ##### -->
 <para>
 
 </para>
 
 @pad: 
-@buf
+@parent
 
 <!-- ##### FUNCTION gst_identity_chain ##### -->
 <para>
@@ -91,20 +91,20 @@ Query the element for the current mime type
 @pad: 
 @buf: 
 
-<!-- ##### FUNCTION gst_connection_get_type ##### -->
+<!-- ##### FUNCTION gst_audiosink_chain ##### -->
 <para>
 
 </para>
 
-@Returns: 
+@pad: 
+@buf: 
 
-<!-- ##### FUNCTION gst_audiosink_chain ##### -->
+<!-- ##### FUNCTION gst_connection_get_type ##### -->
 <para>
 
 </para>
 
-@pad: 
-@buf: 
+@Returns: 
 
 <!-- ##### MACRO GST_PIPELINE_CLASS ##### -->
 <para>
@@ -349,16 +349,16 @@ subclass use this to start their flag enumeration
 @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 @@ Specify the current offset in the file.
 @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,32 +672,32 @@ Specify the current offset in the file.
 @name: 
 @Returns: 
 
-<!-- ##### STRUCT GstConnection ##### -->
+<!-- ##### STRUCT GstQueueClass ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### STRUCT GstQueueClass ##### -->
+<!-- ##### STRUCT GstConnection ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### FUNCTION gst_fakesrc_push ##### -->
+<!-- ##### FUNCTION gst_type_add_sink ##### -->
 <para>
 
 </para>
 
-@src: 
+@id: 
+@sink: 
 
-<!-- ##### FUNCTION gst_type_add_sink ##### -->
+<!-- ##### FUNCTION gst_fakesrc_push ##### -->
 <para>
 
 </para>
 
-@id: 
-@sink: 
+@src: 
 
 <!-- ##### MACRO GST_IS_IDENTITY_CLASS ##### -->
 <para>
@@ -1096,19 +1096,19 @@ GstFilter
 
 @obj: 
 
-<!-- ##### MACRO GST_IS_QUEUE_CLASS ##### -->
+<!-- ##### FUNCTION gst_fdsrc_get_type ##### -->
 <para>
 
 </para>
 
-@obj
+@Returns
 
-<!-- ##### FUNCTION gst_fdsrc_get_type ##### -->
+<!-- ##### MACRO GST_IS_QUEUE_CLASS ##### -->
 <para>
 
 </para>
 
-@Returns
+@obj
 
 <!-- ##### FUNCTION gst_pad_get_type_id ##### -->
 <para>
@@ -1118,13 +1118,6 @@ GstFilter
 @pad: 
 @Returns: 
 
-<!-- ##### FUNCTION gst_thread_iterate ##### -->
-<para>
-
-</para>
-
-@thread: 
-
 <!-- ##### STRUCT OverlayClip ##### -->
 <para>
 
@@ -1135,6 +1128,13 @@ GstFilter
 @y1: 
 @y2: 
 
+<!-- ##### FUNCTION gst_thread_iterate ##### -->
+<para>
+
+</para>
+
+@thread: 
+
 <!-- ##### ENUM GstSrcFlags ##### -->
 <para>
 Flags for the GstSrc element
@@ -1204,19 +1204,19 @@ GstColorSpace
 
 @obj: 
 
-<!-- ##### FUNCTION gst_asyncdisksrc_get_type ##### -->
+<!-- ##### MACRO GST_AUDIOSINK_CLASS ##### -->
 <para>
 
 </para>
 
-@Returns: 
+@klass: 
 
-<!-- ##### MACRO GST_AUDIOSINK_CLASS ##### -->
+<!-- ##### FUNCTION gst_asyncdisksrc_get_type ##### -->
 <para>
 
 </para>
 
-@klass: 
+@Returns: 
 
 <!-- ##### MACRO GST_SRC_CLASS ##### -->
 <para>
@@ -1247,19 +1247,19 @@ GstColorSpace
 @pad: 
 @Returns: 
 
-<!-- ##### MACRO GST_PROPS_FOURCC_ID ##### -->
+<!-- ##### FUNCTION gst_esdsink_new ##### -->
 <para>
 
 </para>
 
+@name: 
+@Returns: 
 
-<!-- ##### FUNCTION gst_esdsink_new ##### -->
+<!-- ##### MACRO GST_PROPS_FOURCC_ID ##### -->
 <para>
 
 </para>
 
-@name: 
-@Returns: 
 
 <!-- ##### FUNCTION gst_element_request_pad ##### -->
 <para>
@@ -1397,16 +1397,16 @@ This macro sets the given flags.
 </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,19 +1690,19 @@ or a video card.
 </para>
 
 
-<!-- ##### MACRO GST_IS_BIN_CLASS ##### -->
+<!-- ##### FUNCTION gst_esdsink_get_type ##### -->
 <para>
 
 </para>
 
-@obj
+@Returns
 
-<!-- ##### FUNCTION gst_esdsink_get_type ##### -->
+<!-- ##### MACRO GST_IS_BIN_CLASS ##### -->
 <para>
 
 </para>
 
-@Returns
+@obj
 
 <!-- ##### SECTION ./tmpl/GstElement.sgml:See_Also ##### -->
 <para>
@@ -1724,19 +1724,19 @@ Query whether this object has multiple input pads.
 
 @obj: Element to query for multiple input pads.
 
-<!-- ##### SECTION ./tmpl/gstfilter.sgml:See_Also ##### -->
+<!-- ##### MACRO DEBUG_NOPREFIX ##### -->
 <para>
 
 </para>
 
+@format: 
+@args...: 
 
-<!-- ##### MACRO DEBUG_NOPREFIX ##### -->
+<!-- ##### SECTION ./tmpl/gstfilter.sgml:See_Also ##### -->
 <para>
 
 </para>
 
-@format: 
-@args...: 
 
 <!-- ##### ARG GstAudioSink:frequency ##### -->
 <para>
@@ -2117,13 +2117,6 @@ The start point of a filter graph
 
 @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 @@ 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.
 
+<!-- ##### MACRO GST_IS_FAKESINK ##### -->
+<para>
+
+</para>
+
+@obj: 
+
 <!-- ##### MACRO GST_QUEUE_CLASS ##### -->
 <para>
 
@@ -2197,22 +2197,22 @@ The number of bytes per read.
 
 @obj: 
 
-<!-- ##### MACRO ERROR_OBJECT ##### -->
+<!-- ##### FUNCTION gst_sinesrc_get_type ##### -->
 <para>
 
 </para>
 
-@element: 
-@object: 
-@format: 
-@args...: 
+@Returns: 
 
-<!-- ##### FUNCTION gst_sinesrc_get_type ##### -->
+<!-- ##### MACRO ERROR_OBJECT ##### -->
 <para>
 
 </para>
 
-@Returns: 
+@element: 
+@object: 
+@format: 
+@args...: 
 
 <!-- ##### MACRO GST_IS_IDENTITY ##### -->
 <para>
@@ -2318,9 +2318,14 @@ This macro sets the given state on the element.
 
 @obj: 
 
-<!-- ##### SECTION ./tmpl/videoraw.sgml:Short_Description ##### -->
-Information about video buffers.
+<!-- ##### FUNCTION gst_src_push_region ##### -->
+<para>
+
+</para>
 
+@src: 
+@offset: 
+@size: 
 
 <!-- ##### FUNCTION gst_fdsink_get_type ##### -->
 <para>
@@ -2329,14 +2334,9 @@ Information about video buffers.
 
 @Returns: 
 
-<!-- ##### FUNCTION gst_src_push_region ##### -->
-<para>
-
-</para>
+<!-- ##### SECTION ./tmpl/videoraw.sgml:Short_Description ##### -->
+Information about video buffers.
 
-@src: 
-@offset: 
-@size: 
 
 <!-- ##### STRUCT GstPipelineClass ##### -->
 <para>
@@ -2428,13 +2428,13 @@ A flag indicating that SSE instructions are supported.
 
 @obj: 
 
-<!-- ##### ARG GstAsyncDiskSrc:size ##### -->
+<!-- ##### STRUCT GstDiskSrcClass ##### -->
 <para>
 
 </para>
 
 
-<!-- ##### STRUCT GstDiskSrcClass ##### -->
+<!-- ##### ARG GstAsyncDiskSrc:size ##### -->
 <para>
 
 </para>
@@ -2577,20 +2577,20 @@ the offset.
 </para>
 
 
-<!-- ##### FUNCTION gst_sinesrc_new ##### -->
+<!-- ##### MACRO GST_IS_ASYNCDISKSRC_CLASS ##### -->
 <para>
 
 </para>
 
-@name: 
-@Returns: 
+@obj: 
 
-<!-- ##### MACRO GST_IS_ASYNCDISKSRC_CLASS ##### -->
+<!-- ##### FUNCTION gst_sinesrc_new ##### -->
 <para>
 
 </para>
 
-@obj: 
+@name: 
+@Returns: 
 
 <!-- ##### ARG GstAudioSrc:curoffset ##### -->
 <para>
@@ -2640,19 +2640,19 @@ plugin
 
 @klass: 
 
-<!-- ##### MACRO GST_HTTPSRC_CLASS ##### -->
+<!-- ##### MACRO GST_ASYNCDISKSRC ##### -->
 <para>
 
 </para>
 
-@klass
+@obj
 
-<!-- ##### MACRO GST_ASYNCDISKSRC ##### -->
+<!-- ##### MACRO GST_HTTPSRC_CLASS ##### -->
 <para>
 
 </para>
 
-@obj
+@klass
 
 <!-- ##### ARG GstPad:active ##### -->
 <para>
index 0ad2daa..e01e137 100644 (file)
@@ -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));
 
index a9989ff..7f1413f 100644 (file)
@@ -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);
index 71b8213..ff7ab84 100644 (file)
@@ -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);
 
index 507b36b..aae1893 100644 (file)
@@ -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,
 };
index 215f80f..eca7d5f 100644 (file)
@@ -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;
     }
   }
index 880174c..2b915ac 100644 (file)
@@ -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 (*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           (*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, 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);
index 001d199..5ba3eee 100644 (file)
@@ -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);
index 9b7a4c1..3de0289 100644 (file)
@@ -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);
     /*
   }
 
index 037d10c..09f1212 100644 (file)
@@ -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,11 +173,22 @@ 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;
index 31e4e17..6c51479 100644 (file)
@@ -14,6 +14,7 @@ struct _GstPlayPrivate {
   GstElement *thread;
   GstElement *bin;
   GstElement *video_element, *audio_element;
+  GstElement *video_show;
   GtkWidget  *video_widget;
   GstElement *src;
 
index 6eae831..39b3cfc 100644 (file)
@@ -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 @@ 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;
   }
index 9b7a4c1..3de0289 100644 (file)
@@ -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);
     /*
   }
 
index 99120ee..176eed3 100644 (file)
@@ -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);
index 0ad2daa..e01e137 100644 (file)
@@ -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));