get up-to-date with the gst_caps_debug api improved capsnego in mad improved capsnego...
authorAndy Wingo <wingo@pobox.com>
Sun, 3 Mar 2002 00:53:25 +0000 (00:53 +0000)
committerAndy Wingo <wingo@pobox.com>
Sun, 3 Mar 2002 00:53:25 +0000 (00:53 +0000)
Original commit message from CVS:
* get up-to-date with the gst_caps_debug api
* improved capsnego in mad
* improved capsnego in adder
* improved capsnego in intfloat plugins
* unbroke capsnego in stereomono plugins
* fix cothread stack allocation within the main thread in new cothreads

common
gst/adder/gstadder.c
sys/v4l/gstv4lsrc.c
tools/gst-launch-ext

diff --git a/common b/common
index 7b9a180..2adced5 160000 (submodule)
--- a/common
+++ b/common
@@ -1 +1 @@
-Subproject commit 7b9a18016ec2fe74c23382856a0f480da259f971
+Subproject commit 2adced54d821c7870fd4d9e5e19482418a64c931
index 617b2e0..119c71f 100644 (file)
@@ -153,11 +153,13 @@ gst_adder_parse_caps (GstAdder *adder, GstCaps *caps)
       adder->law        = gst_caps_get_int (caps, "law");
       adder->endianness = gst_caps_get_int (caps, "endianness");
       adder->is_signed  = gst_caps_get_int (caps, "signed");
+      adder->channels   = gst_caps_get_int (caps, "channels");
     } else if (strcmp (format, "float") == 0) {
       adder->format     = GST_ADDER_FORMAT_FLOAT;
       adder->layout     = gst_caps_get_string (caps, "layout");
       adder->intercept  = gst_caps_get_float  (caps, "intercept");
       adder->slope      = gst_caps_get_float  (caps, "slope");
+      adder->channels   = gst_caps_get_int (caps, "channels");
     }
   } else {
     /* otherwise, a previously-connected pad has set all the values. we should
@@ -165,11 +167,13 @@ gst_adder_parse_caps (GstAdder *adder, GstCaps *caps)
     if (strcmp (format, "int") == 0) {
       if ((adder->format != GST_ADDER_FORMAT_INT) ||
           (adder->width  != gst_caps_get_int (caps, "width")) ||
+          (adder->channels != gst_caps_get_int (caps, "channels")) ||
           (adder->is_signed != gst_caps_get_int (caps, "signed"))) {
         return FALSE;
       }
     } else if (strcmp (format, "float") == 0) {
-      if (adder->format != GST_ADDER_FORMAT_FLOAT) {
+      if ((adder->format != GST_ADDER_FORMAT_FLOAT) ||
+          (adder->channels != gst_caps_get_int (caps, "channels"))) {
         return FALSE;
       }
     } else {
@@ -184,7 +188,8 @@ static GstPadConnectReturn
 gst_adder_connect (GstPad *pad, GstCaps *caps)
 {
   GstAdder *adder;
-  GList *sinkpads;
+  GList *sinkpads, *remove = NULL;
+  GSList *channels;
   GstPad *p;
   
   g_return_val_if_fail (caps != NULL, GST_PAD_CONNECT_REFUSED);
@@ -205,11 +210,26 @@ gst_adder_connect (GstPad *pad, GstCaps *caps)
             GST_DEBUG (0, "caps mismatch; disconnecting and removing pad %s:%s (peer %s:%s)\n",
                        GST_DEBUG_PAD_NAME (p), GST_DEBUG_PAD_NAME (GST_PAD_PEER (p)));
             gst_pad_disconnect (GST_PAD (GST_PAD_PEER (p)), p);
-            gst_element_remove_pad (GST_ELEMENT (adder), p);
+            remove = g_list_prepend (remove, p);
           }
         }
         sinkpads = g_list_next (sinkpads);
       }
+      while (remove) {
+        gst_element_remove_pad (GST_ELEMENT (adder), GST_PAD_CAST (remove->data));
+      restart:
+        channels = adder->input_channels;
+        while (channels) {
+          GstAdderInputChannel *channel = (GstAdderInputChannel*) channels->data;
+          if (channel->sinkpad == GST_PAD_CAST (remove->data)) {
+            gst_bytestream_destroy (channel->bytestream);
+            adder->input_channels = g_slist_remove_link (adder->input_channels, channels);
+            goto restart;
+          }
+          channels = g_slist_next (channels);
+        }
+        remove = g_list_next (remove);
+      }
       return GST_PAD_CONNECT_OK;
     } else {
       return GST_PAD_CONNECT_REFUSED;
index 3a07c13..f711f42 100644 (file)
@@ -320,7 +320,7 @@ gst_v4lsrc_srcconnect (GstPad  *pad,
                                  "height", GST_PROPS_INT(v4lsrc->height),
                                  NULL      ) );
 
-    gst_caps_debug (newcaps);
+    gst_caps_debug (newcaps, "new caps to set on v4lsrc's src pad");
 
     if (!gst_pad_try_set_caps(v4lsrc->srcpad, newcaps))
       continue;
index 8f41244..a12b13c 100755 (executable)
@@ -87,7 +87,6 @@ read_config ();
   "vob", "mpegdemux video_00! { queue ! mpeg2dec ! $cfg{VIDEOSINK} } mpegdemux0.audio_00! { queue ! a52dec ! $cfg{AUDIOSINK} }",
   "wav", "wavparse ! $cfg{AUDIOSINK}",
   "fli", "flxdec ! colorspace ! $cfg{VIDEOSINK}"
-
 );
 
 if ($cfg{VISUALIZER}) {