This updates all plugins to the new API for gst_pad_try_set_caps
authorRonald S. Bultje <rbultje@ronald.bitfreak.net>
Tue, 10 Sep 2002 09:31:40 +0000 (09:31 +0000)
committerRonald S. Bultje <rbultje@ronald.bitfreak.net>
Tue, 10 Sep 2002 09:31:40 +0000 (09:31 +0000)
Original commit message from CVS:
This updates all plugins to the new API for gst_pad_try_set_caps

ext/alsa/gstalsa.c
gst/adder/gstadder.c
gst/audioscale/gstaudioscale.c
gst/videoscale/gstvideoscale.c
gst/volume/gstvolume.c
sys/v4l/gstv4lmjpegsrc.c
sys/v4l/gstv4lsrc.c

index 9d2e902..de6cd93 100644 (file)
@@ -907,7 +907,7 @@ gst_alsa_src_process (GstAlsa *this, snd_pcm_uframes_t frames)
         caps = gst_alsa_caps(this);
         l = this->pads;
         while (l) {
-            if (!gst_pad_try_set_caps (GST_ALSA_PAD(l)->pad, caps)) {
+            if (gst_pad_try_set_caps (GST_ALSA_PAD(l)->pad, caps) <= 0) {
                 g_print ("DANGER WILL ROBINSON!\n");
                 sleep(1);
                 return FALSE;
index 6aa6390..f6e8db1 100644 (file)
@@ -273,12 +273,12 @@ gst_adder_connect (GstPad *pad, GstCaps *caps)
     if (!gst_adder_parse_caps (adder, caps))
       return GST_PAD_CONNECT_REFUSED;
   
-    if (pad == adder->srcpad || gst_pad_try_set_caps (adder->srcpad, caps)) {
+    if (pad == adder->srcpad || gst_pad_try_set_caps (adder->srcpad, caps) > 0) {
       sinkpads = gst_element_get_pad_list ((GstElement*) adder);
       while (sinkpads) {
         p = (GstPad*) sinkpads->data;
         if (p != pad && p != adder->srcpad) {
-          if (!gst_pad_try_set_caps (p, caps)) {
+          if (gst_pad_try_set_caps (p, caps) <= 0) {
             GST_DEBUG (GST_CAT_PLUGIN_INFO, 
                       "caps mismatch; disconnecting and removing pad %s:%s "
                       "(peer %s:%s)",
index 4e0ce7c..ee7d2d4 100644 (file)
@@ -183,10 +183,7 @@ gst_audioscale_sinkconnect (GstPad * pad, GstCaps * caps)
   gst_caps_set (newcaps, "rate", GST_PROPS_INT_TYPE, audioscale->targetfrequency, NULL);
 
   if (GST_CAPS_IS_FIXED (caps))
-    if (gst_pad_try_set_caps (audioscale->srcpad, newcaps))
-      return GST_PAD_CONNECT_OK;
-    else
-      return GST_PAD_CONNECT_REFUSED;
+    return gst_pad_try_set_caps (audioscale->srcpad, newcaps);
   else
     return GST_PAD_CONNECT_DELAYED;
 }
index dfb73b7..e5bf912 100644 (file)
@@ -201,7 +201,7 @@ gst_videoscale_sinkconnect (GstPad *pad, GstCaps *caps)
                videoscale->targetheight);
 
   GST_DEBUG(0,"width %d",videoscale->targetwidth);
-  gst_pad_try_set_caps (videoscale->srcpad, 
+  return gst_pad_try_set_caps (videoscale->srcpad, 
                    GST_CAPS_NEW (
                      "videoscale_src",
                      "video/raw",
@@ -209,8 +209,6 @@ gst_videoscale_sinkconnect (GstPad *pad, GstCaps *caps)
                        "width",        GST_PROPS_INT (videoscale->targetwidth),
                        "height",       GST_PROPS_INT (videoscale->targetheight)
                    ));
-
-  return GST_PAD_CONNECT_OK;
 }
 
 static void
index 841f7dd..d89dd95 100644 (file)
@@ -144,13 +144,15 @@ volume_connect (GstPad *pad, GstCaps *caps)
   otherpad = (pad == filter->srcpad ? filter->sinkpad : filter->srcpad);
   
   if (GST_CAPS_IS_FIXED (caps)) {
-    if (!volume_parse_caps (filter, caps) || !gst_pad_try_set_caps (otherpad, caps))
+    GstPadConnectReturn set_retval;
+    if (!volume_parse_caps (filter, caps))
       return GST_PAD_CONNECT_REFUSED;
-    
-    if (gst_caps_get_int (caps, "rate", &rate)){
-      gst_dpman_set_rate(filter->dpman, rate);
-    }
-    return GST_PAD_CONNECT_OK;
+
+    if ((set_retval = gst_pad_try_set_caps(otherpad, caps)) > 0)
+      if (gst_caps_get_int (caps, "rate", &rate)){
+        gst_dpman_set_rate(filter->dpman, rate);
+      }
+    return set_retval;
   }
   
   return GST_PAD_CONNECT_DELAYED;
index 6322727..e608092 100644 (file)
@@ -258,7 +258,7 @@ gst_v4lmjpegsrc_srcconnect (GstPad  *pad,
                         "width",  GST_PROPS_INT(v4lmjpegsrc->end_width),
                         "height", GST_PROPS_INT(v4lmjpegsrc->end_height),
                         NULL       ) );
-  if (!gst_pad_try_set_caps(v4lmjpegsrc->srcpad, caps))
+  if (gst_pad_try_set_caps(v4lmjpegsrc->srcpad, caps) <= 0)
   {
     gst_element_error(GST_ELEMENT(v4lmjpegsrc),
       "Failed to set new caps");
index 2af0c74..1877850 100644 (file)
@@ -350,7 +350,7 @@ gst_v4lsrc_srcconnect (GstPad  *pad,
 
     gst_caps_debug (newcaps, "new caps to set on v4lsrc's src pad");
 
-    if (!gst_pad_try_set_caps(v4lsrc->srcpad, newcaps))
+    if (gst_pad_try_set_caps(v4lsrc->srcpad, newcaps) <= 0)
       continue;
 
     if (!gst_v4lsrc_capture_init(v4lsrc))