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

27 files changed:
ext/dv/gstdvdec.c
ext/esd/esdmon.c
ext/ladspa/gstladspa.c
gst/audiofx/audiowsincband.c
gst/audiofx/audiowsinclimit.c
gst/auparse/gstauparse.c
gst/cutter/gstcutter.c
gst/effectv/gstaging.c
gst/effectv/gstdice.c
gst/effectv/gstedge.c
gst/effectv/gstquark.c
gst/effectv/gstrev.c
gst/effectv/gstshagadelic.c
gst/effectv/gstvertigo.c
gst/effectv/gstwarp.c
gst/goom/gstgoom.c
gst/law/alaw-decode.c
gst/law/alaw-encode.c
gst/law/mulaw-decode.c
gst/law/mulaw-encode.c
gst/level/gstlevel.c
gst/median/gstmedian.c
gst/monoscope/gstmonoscope.c
gst/videocrop/gstvideocrop.c
gst/wavparse/gstwavparse.c
sys/oss/gstosssrc.c
sys/v4l2/gstv4l2src.c

index 367cfe7..0ee8976 100644 (file)
@@ -695,7 +695,7 @@ gst_dvdec_loop (GstElement *element)
       GstCaps *to_try = gst_caps_copy_1 (trylist);
 
       /* try each format */
-      if (gst_pad_try_set_caps (dvdec->videosrcpad, to_try)) {
+      if (gst_pad_try_set_caps (dvdec->videosrcpad, to_try) > 0) {
        guint32 fourcc;
 
        /* it worked, try to find what it was again */
index 423e7f5..ac9eaa1 100644 (file)
@@ -294,7 +294,7 @@ gst_esdmon_get (GstPad *pad)
   }
   if (!GST_PAD_CAPS (pad)) {
     /* set caps on src pad */
-    if (!gst_pad_try_set_caps (esdmon->srcpad,
+    if (gst_pad_try_set_caps (esdmon->srcpad,
                     GST_CAPS_NEW (
                       "oss_src",
                       "audio/raw",
@@ -306,7 +306,7 @@ gst_esdmon_get (GstPad *pad)
                           "depth",      GST_PROPS_INT (esdmon->depth),
                           "rate",       GST_PROPS_INT (esdmon->frequency),
                           "channels",   GST_PROPS_INT (esdmon->channels)
-                   )))
+                   )) <= 0)
     {
       gst_element_error (GST_ELEMENT (esdmon), "could not set caps");
       return NULL;
index 7970c5d..c53c55c 100644 (file)
@@ -507,7 +507,7 @@ gst_ladspa_connect (GstPad *pad, GstCaps *caps)
      not sure if this is correct. */
   if (GST_CAPS_IS_FIXED (caps)) {
     for (i=0;i<oclass->numsrcpads;i++) {
-      if (! gst_pad_try_set_caps (ladspa->srcpads[i], caps))
+      if (gst_pad_try_set_caps (ladspa->srcpads[i], caps) <= 0)
         return GST_PAD_CONNECT_REFUSED;
     }
   }
index 916fcbe..6ce634d 100644 (file)
@@ -179,6 +179,7 @@ gst_bpwsinc_sink_connect (GstPad * pad, GstCaps * caps)
   double sum = 0.0;
   int len = 0;
   double *kernel_lp, *kernel_hp;
+  GstPadConnectReturn set_retval;
   
   GstBPWSinc *filter = GST_BPWSINC (gst_pad_get_parent (pad));
 
@@ -187,8 +188,10 @@ gst_bpwsinc_sink_connect (GstPad * pad, GstCaps * caps)
 
   if (!GST_CAPS_IS_FIXED (caps))
     return GST_PAD_CONNECT_DELAYED;
-    
-  if (gst_pad_try_set_caps (filter->srcpad, caps)) 
+  set_retval = gst_pad_try_set_caps (filter->srcpad, caps);
+  
+  if (set_retval > 0)
   {
     len = filter->wing_size;
     /* fill the lp kernel */
@@ -259,11 +262,9 @@ gst_bpwsinc_sink_connect (GstPad * pad, GstCaps * caps)
     /* set up the residue memory space */
     filter->residue = (gfloat *) g_malloc (sizeof (gfloat) * (len * 2 + 1));
     for (i = 0; i <= len * 2; ++i) filter->residue[i] = 0.0;
-
-    return GST_PAD_CONNECT_OK;
   }
 
-  return GST_PAD_CONNECT_REFUSED;
+  return set_retval;
 }
 
 static void
index fc916a8..664df87 100644 (file)
@@ -171,14 +171,17 @@ gst_lpwsinc_sink_connect (GstPad * pad, GstCaps * caps)
   double sum = 0.0;
   int len = 0;
   GstLPWSinc *filter = GST_LPWSINC (gst_pad_get_parent (pad));
+  GstPadConnectReturn set_retval;
 
   g_assert (GST_IS_PAD (pad));
   g_assert (caps != NULL);
 
   if (!GST_CAPS_IS_FIXED (caps))
     return GST_PAD_CONNECT_DELAYED;
-    
-  if (gst_pad_try_set_caps (filter->srcpad, caps)) 
+
+  set_retval = gst_pad_try_set_caps(filter->srcpad, caps);
+  
+  if (set_retval > 0) 
   {
     /* connection works, so init the filter */
     /* FIXME: remember to free it */
@@ -208,11 +211,9 @@ gst_lpwsinc_sink_connect (GstPad * pad, GstCaps * caps)
     /* set up the residue memory space */
     filter->residue = (gfloat *) g_malloc (sizeof (gfloat) * (len * 2 + 1));
     for (i = 0; i <= len * 2; ++i) filter->residue[i] = 0.0;
-
-    return GST_PAD_CONNECT_OK;
   }
 
-  return GST_PAD_CONNECT_REFUSED;
+  return set_retval;
 }
 
 static void
index 930461d..e21b01a 100644 (file)
@@ -268,7 +268,7 @@ gst_auparse_chain (GstPad *pad, GstBuffer *buf)
                               "width",         GST_PROPS_INT (depth),
                               "signed",        GST_PROPS_BOOLEAN (sign));
 
-    if (!gst_pad_try_set_caps (auparse->srcpad, tempcaps)) {
+    if (gst_pad_try_set_caps (auparse->srcpad, tempcaps) <= 0) {
       gst_buffer_unref (buf);
       gst_element_error (GST_ELEMENT (auparse), "could not set audio caps");
       return;
index e8d8e01..8732137 100644 (file)
@@ -119,12 +119,7 @@ gst_cutter_connect (GstPad *pad, GstCaps *caps)
   otherpad = (pad == filter->srcpad ? filter->sinkpad : filter->srcpad);
 
   if (GST_CAPS_IS_FIXED (caps)) 
-  {
-    if (!gst_pad_try_set_caps (otherpad, caps))
-      return GST_PAD_CONNECT_REFUSED;
-
-    return GST_PAD_CONNECT_OK;
-  }
+    return gst_pad_try_set_caps (otherpad, caps);
   return GST_PAD_CONNECT_DELAYED;
 }
 
index 3f34b1f..eb1bb09 100644 (file)
@@ -164,11 +164,7 @@ gst_agingtv_sinkconnect (GstPad * pad, GstCaps * caps)
   filter->aging_mode = 0;
   aging_mode_switch (filter);
 
-  if (gst_pad_try_set_caps (filter->srcpad, caps)) {
-    return GST_PAD_CONNECT_OK;
-  }
-
-  return GST_PAD_CONNECT_REFUSED;
+  return gst_pad_try_set_caps (filter->srcpad, caps);
 }
 
 static void
index a46f1b2..726224e 100644 (file)
@@ -170,11 +170,7 @@ gst_dicetv_sinkconnect (GstPad * pad, GstCaps * caps)
   filter->dicemap = (gchar *) g_malloc (filter->height * filter->width * sizeof(char));
   gst_dicetv_create_map (filter);
 
-  if (gst_pad_try_set_caps (filter->srcpad, caps)) {
-    return GST_PAD_CONNECT_OK;
-  }
-
-  return GST_PAD_CONNECT_REFUSED;
+  return gst_pad_try_set_caps (filter->srcpad, caps);
 }
 
 static void
index dd0b1b7..2879b86 100644 (file)
@@ -148,11 +148,7 @@ gst_edgetv_sinkconnect (GstPad * pad, GstCaps * caps)
   filter->map = (guint32 *)g_malloc (filter->map_width * filter->map_height * sizeof(guint32) * 2);
   bzero(filter->map, filter->map_width * filter->map_height * sizeof(guint32) * 2);
 
-  if (gst_pad_try_set_caps (filter->srcpad, caps)) {
-    return GST_PAD_CONNECT_OK;
-  }
-
-  return GST_PAD_CONNECT_REFUSED;
+  return gst_pad_try_set_caps (filter->srcpad, caps);
 }
 
 static void
index d3a41fa..489a490 100644 (file)
@@ -175,11 +175,7 @@ gst_quarktv_sinkconnect (GstPad * pad, GstCaps * caps)
     filter->planetable[i] = NULL;
   }
 
-  if (gst_pad_try_set_caps (filter->srcpad, caps)) {
-    return GST_PAD_CONNECT_OK;
-  }
-
-  return GST_PAD_CONNECT_REFUSED;
+  return gst_pad_try_set_caps (filter->srcpad, caps);
 }
 
 static void
index c0d4796..a8cba02 100644 (file)
@@ -179,11 +179,7 @@ gst_revtv_sinkconnect (GstPad * pad, GstCaps * caps)
   gst_caps_get_int (caps, "width", &filter->width);
   gst_caps_get_int (caps, "height", &filter->height);
 
-  if (gst_pad_try_set_caps (filter->srcpad, caps)) {
-    return GST_PAD_CONNECT_OK;
-  }
-
-  return GST_PAD_CONNECT_REFUSED;
+  return gst_pad_try_set_caps (filter->srcpad, caps);
 }
 
 static void
index 7f61f4d..0f3a40d 100644 (file)
@@ -160,11 +160,7 @@ gst_shagadelictv_sinkconnect (GstPad * pad, GstCaps * caps)
 
   gst_shagadelic_initialize (filter);
 
-  if (gst_pad_try_set_caps (filter->srcpad, caps)) {
-    return GST_PAD_CONNECT_OK;
-  }
-
-  return GST_PAD_CONNECT_REFUSED;
+  return gst_pad_try_set_caps (filter->srcpad, caps);
 }
 
 static void
index 6413093..3fd90bb 100644 (file)
@@ -194,11 +194,7 @@ gst_vertigotv_sinkconnect (GstPad * pad, GstCaps * caps)
   filter->alt_buffer = filter->buffer + area;
   filter->phase = 0;
 
-  if (gst_pad_try_set_caps (filter->srcpad, caps)) {
-    return GST_PAD_CONNECT_OK;
-  }
-
-  return GST_PAD_CONNECT_REFUSED;
+  return gst_pad_try_set_caps (filter->srcpad, caps);
 }
 
 static void
index c8cafa5..1328e94 100644 (file)
@@ -158,11 +158,7 @@ gst_warptv_sinkconnect (GstPad * pad, GstCaps * caps)
 
   gst_warptv_initialize (filter);
 
-  if (gst_pad_try_set_caps (filter->srcpad, caps)) {
-    return GST_PAD_CONNECT_OK;
-  }
-
-  return GST_PAD_CONNECT_REFUSED;
+  return gst_pad_try_set_caps (filter->srcpad, caps);
 }
 
 static void
index 506ec82..05d02b2 100644 (file)
@@ -268,7 +268,7 @@ gst_goom_chain (GstPad *pad, GstBuffer *bufin)
                       "height",        GST_PROPS_INT (goom->height)
                   );
 
-    if (!gst_pad_try_set_caps (goom->srcpad, caps)) {
+    if (gst_pad_try_set_caps (goom->srcpad, caps) <= 0) {
       gst_element_error (GST_ELEMENT (goom), "could not set caps");
       return;
     }
index 1ce5edd..9806f0e 100644 (file)
@@ -65,7 +65,7 @@ alawdec_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter)
   gst_caps_set(tempcaps,"width",GST_PROPS_INT(16));
   gst_caps_set(tempcaps,"signed",GST_PROPS_BOOLEAN(TRUE));
 
-  if (gst_pad_try_set_caps (alawdec->srcpad, tempcaps))
+  if (gst_pad_try_set_caps (alawdec->srcpad, tempcaps) > 0)
   {
     return GST_PAD_NEGOTIATE_AGREE;
   }
index 853a56f..f7ebed1 100644 (file)
@@ -66,7 +66,7 @@ alawenc_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter)
   gst_caps_set(tempcaps,"width",GST_PROPS_INT(8));
   gst_caps_set(tempcaps,"signed",GST_PROPS_BOOLEAN(FALSE));
 
-  if (gst_pad_try_set_caps (alawenc->srcpad, tempcaps))
+  if (gst_pad_try_set_caps (alawenc->srcpad, tempcaps) > 0)
   {
     return GST_PAD_NEGOTIATE_AGREE;
   }
index 2f95f05..3585a9c 100644 (file)
@@ -64,13 +64,8 @@ mulawdec_connect_sink (GstPad *pad, GstCaps *caps)
   gst_caps_set(newcaps,"width",GST_PROPS_INT(16));
   gst_caps_set(newcaps,"signed",GST_PROPS_BOOLEAN(TRUE));
 
-  if (GST_CAPS_IS_FIXED (newcaps)) {
-    if (gst_pad_try_set_caps (mulawdec->srcpad, newcaps))
-      return GST_PAD_CONNECT_OK;
-    else
-      return GST_PAD_CONNECT_REFUSED;
-  }
-
+  if (GST_CAPS_IS_FIXED (newcaps))
+    return gst_pad_try_set_caps (mulawdec->srcpad, newcaps);
   return GST_PAD_CONNECT_DELAYED;
 }              
 
index 5d9090f..2364878 100644 (file)
@@ -65,7 +65,7 @@ mulawenc_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter)
   gst_caps_set(tempcaps,"width",GST_PROPS_INT(8));
   gst_caps_set(tempcaps,"signed",GST_PROPS_BOOLEAN(FALSE));
 
-  if (gst_pad_try_set_caps (mulawenc->srcpad, tempcaps))
+  if (gst_pad_try_set_caps (mulawenc->srcpad, tempcaps) > 0)
   {
     return GST_PAD_NEGOTIATE_AGREE;
   }
index debab4b..449e2fd 100644 (file)
@@ -132,11 +132,8 @@ gst_level_connect (GstPad *pad, GstCaps *caps)
          
   if (GST_CAPS_IS_FIXED (caps)) 
   {
-    if (/* !volume_parse_caps (filter, caps) || */
-       !gst_pad_try_set_caps (otherpad, caps))
-      return GST_PAD_CONNECT_REFUSED;
-                   
-    return GST_PAD_CONNECT_OK;
+    /*if ( !volume_parse_caps (filter, caps) || */
+    return gst_pad_try_set_caps (otherpad, caps);
   }
   return GST_PAD_CONNECT_DELAYED;
 }
index 2e8710a..4e4dd49 100644 (file)
@@ -138,10 +138,7 @@ gst_median_sinkconnect (GstPad *pad, GstCaps *caps)
   gst_caps_get_int (caps, "height", &filter->height);
 
   /* forward to the next plugin */
-  if (!gst_pad_try_set_caps(filter->srcpad, gst_caps_copy_1(caps)))
-    return GST_PAD_CONNECT_REFUSED;
-  
-  return GST_PAD_CONNECT_OK;
+  return gst_pad_try_set_caps(filter->srcpad, gst_caps_copy_1(caps));
 }
 
 void gst_median_init (GstMedian *median)
index cad9c34..a255e86 100644 (file)
@@ -273,7 +273,7 @@ gst_monoscope_chain (GstPad *pad, GstBuffer *bufin)
                       "height",        GST_PROPS_INT (monoscope->height)
                   );
 
-    if (!gst_pad_try_set_caps (monoscope->srcpad, caps)) {
+    if (gst_pad_try_set_caps (monoscope->srcpad, caps) <= 0) {
       gst_element_error (GST_ELEMENT (monoscope), "could not set caps");
       return;
     }
index d1cc5af..0554042 100644 (file)
@@ -341,14 +341,14 @@ gst_video_crop_chain (GstPad *pad, GstBuffer *buffer)
   }
 
   if (GST_PAD_CAPS (video_crop->srcpad) == NULL) {
-    if (!gst_pad_try_set_caps (video_crop->srcpad,
+    if (gst_pad_try_set_caps (video_crop->srcpad,
                               GST_CAPS_NEW (
                                       "video_crop_caps",
                                       "video/raw",
                                        "format",   GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")),
                                         "width",   GST_PROPS_INT (video_crop->crop_width),
                                         "height",  GST_PROPS_INT (video_crop->crop_height)
-                                      )))
+                                      )) <= 0)
     {
       gst_element_error (GST_ELEMENT (video_crop), "could not negotiate pads");
       return;
index 76547ed..e4fdca0 100644 (file)
@@ -275,7 +275,7 @@ gst_wavparse_chain (GstPad *pad, GstBuffer *buf)
                          "channels",   GST_PROPS_INT (format->wChannels)
                      );
 
-      if (!gst_pad_try_set_caps (wavparse->srcpad, caps)) {
+      if (gst_pad_try_set_caps (wavparse->srcpad, caps) <= 0) {
         gst_element_error (GST_ELEMENT (wavparse), "Could not set caps");
         return;
       }
index bf66ec7..249609c 100644 (file)
@@ -205,7 +205,7 @@ gst_osssrc_get (GstPad *pad)
   }
   if (!GST_PAD_CAPS (pad)) {
     /* set caps on src pad */
-    if (!gst_pad_try_set_caps (src->srcpad, 
+    if (gst_pad_try_set_caps (src->srcpad, 
                    GST_CAPS_NEW (
                      "oss_src",
                      "audio/raw",
@@ -217,7 +217,7 @@ gst_osssrc_get (GstPad *pad)
                          "depth",      GST_PROPS_INT (src->format),
                          "rate",       GST_PROPS_INT (src->frequency),
                          "channels",   GST_PROPS_INT (src->channels)
-                  ))) 
+                  )) <= 0
     {
       gst_element_error (GST_ELEMENT (src), "could not set caps");
       return NULL;
index 7dce792..6f10298 100644 (file)
@@ -547,7 +547,7 @@ gst_v4l2src_srcconnect (GstPad  *pad,
                                        GstCaps *onecaps;
                                        for (;lastcaps != NULL; lastcaps = lastcaps->next) {
                                                onecaps = gst_caps_copy_1(lastcaps);
-                                               if (gst_pad_try_set_caps(v4l2src->srcpad, onecaps))
+                                               if (gst_pad_try_set_caps(v4l2src->srcpad, onecaps) > 0)
                                                        if (gst_v4l2src_capture_init(v4l2src))
                                                                return GST_PAD_CONNECT_OK;
                                        }