From 0b497b1634b097988451b70aca5bf4190b81c01f Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Tue, 10 Sep 2002 09:31:40 +0000 Subject: [PATCH] This updates all plugins to the new API for gst_pad_try_set_caps Original commit message from CVS: This updates all plugins to the new API for gst_pad_try_set_caps --- ext/dv/gstdvdec.c | 2 +- ext/esd/esdmon.c | 4 ++-- ext/ladspa/gstladspa.c | 2 +- gst/audiofx/audiowsincband.c | 11 ++++++----- gst/audiofx/audiowsinclimit.c | 11 ++++++----- gst/auparse/gstauparse.c | 2 +- gst/cutter/gstcutter.c | 7 +------ gst/effectv/gstaging.c | 6 +----- gst/effectv/gstdice.c | 6 +----- gst/effectv/gstedge.c | 6 +----- gst/effectv/gstquark.c | 6 +----- gst/effectv/gstrev.c | 6 +----- gst/effectv/gstshagadelic.c | 6 +----- gst/effectv/gstvertigo.c | 6 +----- gst/effectv/gstwarp.c | 6 +----- gst/goom/gstgoom.c | 2 +- gst/law/alaw-decode.c | 2 +- gst/law/alaw-encode.c | 2 +- gst/law/mulaw-decode.c | 9 ++------- gst/law/mulaw-encode.c | 2 +- gst/level/gstlevel.c | 7 ++----- gst/median/gstmedian.c | 5 +---- gst/monoscope/gstmonoscope.c | 2 +- gst/videocrop/gstvideocrop.c | 4 ++-- gst/wavparse/gstwavparse.c | 2 +- sys/oss/gstosssrc.c | 4 ++-- sys/v4l2/gstv4l2src.c | 2 +- 27 files changed, 42 insertions(+), 88 deletions(-) diff --git a/ext/dv/gstdvdec.c b/ext/dv/gstdvdec.c index 367cfe7254..0ee89761f5 100644 --- a/ext/dv/gstdvdec.c +++ b/ext/dv/gstdvdec.c @@ -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 */ diff --git a/ext/esd/esdmon.c b/ext/esd/esdmon.c index 423e7f5d4c..ac9eaa1a0b 100644 --- a/ext/esd/esdmon.c +++ b/ext/esd/esdmon.c @@ -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; diff --git a/ext/ladspa/gstladspa.c b/ext/ladspa/gstladspa.c index 7970c5d247..c53c55cc91 100644 --- a/ext/ladspa/gstladspa.c +++ b/ext/ladspa/gstladspa.c @@ -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;inumsrcpads;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; } } diff --git a/gst/audiofx/audiowsincband.c b/gst/audiofx/audiowsincband.c index 916fcbe9c7..6ce634d38a 100644 --- a/gst/audiofx/audiowsincband.c +++ b/gst/audiofx/audiowsincband.c @@ -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 diff --git a/gst/audiofx/audiowsinclimit.c b/gst/audiofx/audiowsinclimit.c index fc916a8254..664df8709d 100644 --- a/gst/audiofx/audiowsinclimit.c +++ b/gst/audiofx/audiowsinclimit.c @@ -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 diff --git a/gst/auparse/gstauparse.c b/gst/auparse/gstauparse.c index 930461d95d..e21b01a4c4 100644 --- a/gst/auparse/gstauparse.c +++ b/gst/auparse/gstauparse.c @@ -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; diff --git a/gst/cutter/gstcutter.c b/gst/cutter/gstcutter.c index e8d8e01588..87321373a9 100644 --- a/gst/cutter/gstcutter.c +++ b/gst/cutter/gstcutter.c @@ -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; } diff --git a/gst/effectv/gstaging.c b/gst/effectv/gstaging.c index 3f34b1facb..eb1bb094e5 100644 --- a/gst/effectv/gstaging.c +++ b/gst/effectv/gstaging.c @@ -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 diff --git a/gst/effectv/gstdice.c b/gst/effectv/gstdice.c index a46f1b2fea..726224ea82 100644 --- a/gst/effectv/gstdice.c +++ b/gst/effectv/gstdice.c @@ -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 diff --git a/gst/effectv/gstedge.c b/gst/effectv/gstedge.c index dd0b1b791d..2879b8684f 100644 --- a/gst/effectv/gstedge.c +++ b/gst/effectv/gstedge.c @@ -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 diff --git a/gst/effectv/gstquark.c b/gst/effectv/gstquark.c index d3a41fa29b..489a490110 100644 --- a/gst/effectv/gstquark.c +++ b/gst/effectv/gstquark.c @@ -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 diff --git a/gst/effectv/gstrev.c b/gst/effectv/gstrev.c index c0d47963cf..a8cba02fd7 100644 --- a/gst/effectv/gstrev.c +++ b/gst/effectv/gstrev.c @@ -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 diff --git a/gst/effectv/gstshagadelic.c b/gst/effectv/gstshagadelic.c index 7f61f4d316..0f3a40dcd7 100644 --- a/gst/effectv/gstshagadelic.c +++ b/gst/effectv/gstshagadelic.c @@ -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 diff --git a/gst/effectv/gstvertigo.c b/gst/effectv/gstvertigo.c index 641309332f..3fd90bb70f 100644 --- a/gst/effectv/gstvertigo.c +++ b/gst/effectv/gstvertigo.c @@ -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 diff --git a/gst/effectv/gstwarp.c b/gst/effectv/gstwarp.c index c8cafa585b..1328e94d2f 100644 --- a/gst/effectv/gstwarp.c +++ b/gst/effectv/gstwarp.c @@ -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 diff --git a/gst/goom/gstgoom.c b/gst/goom/gstgoom.c index 506ec82c10..05d02b2992 100644 --- a/gst/goom/gstgoom.c +++ b/gst/goom/gstgoom.c @@ -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; } diff --git a/gst/law/alaw-decode.c b/gst/law/alaw-decode.c index 1ce5edd4ff..9806f0ef1b 100644 --- a/gst/law/alaw-decode.c +++ b/gst/law/alaw-decode.c @@ -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; } diff --git a/gst/law/alaw-encode.c b/gst/law/alaw-encode.c index 853a56f8c5..f7ebed1863 100644 --- a/gst/law/alaw-encode.c +++ b/gst/law/alaw-encode.c @@ -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; } diff --git a/gst/law/mulaw-decode.c b/gst/law/mulaw-decode.c index 2f95f056db..3585a9cb62 100644 --- a/gst/law/mulaw-decode.c +++ b/gst/law/mulaw-decode.c @@ -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; } diff --git a/gst/law/mulaw-encode.c b/gst/law/mulaw-encode.c index 5d9090f581..23648780ed 100644 --- a/gst/law/mulaw-encode.c +++ b/gst/law/mulaw-encode.c @@ -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; } diff --git a/gst/level/gstlevel.c b/gst/level/gstlevel.c index debab4b725..449e2fdbc1 100644 --- a/gst/level/gstlevel.c +++ b/gst/level/gstlevel.c @@ -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; } diff --git a/gst/median/gstmedian.c b/gst/median/gstmedian.c index 2e8710a944..4e4dd496ee 100644 --- a/gst/median/gstmedian.c +++ b/gst/median/gstmedian.c @@ -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) diff --git a/gst/monoscope/gstmonoscope.c b/gst/monoscope/gstmonoscope.c index cad9c34f9c..a255e86173 100644 --- a/gst/monoscope/gstmonoscope.c +++ b/gst/monoscope/gstmonoscope.c @@ -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; } diff --git a/gst/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c index d1cc5af400..0554042e96 100644 --- a/gst/videocrop/gstvideocrop.c +++ b/gst/videocrop/gstvideocrop.c @@ -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; diff --git a/gst/wavparse/gstwavparse.c b/gst/wavparse/gstwavparse.c index 76547edadd..e4fdca05b9 100644 --- a/gst/wavparse/gstwavparse.c +++ b/gst/wavparse/gstwavparse.c @@ -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; } diff --git a/sys/oss/gstosssrc.c b/sys/oss/gstosssrc.c index bf66ec7ed5..249609cd9a 100644 --- a/sys/oss/gstosssrc.c +++ b/sys/oss/gstosssrc.c @@ -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; diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index 7dce792d5a..6f10298462 100644 --- a/sys/v4l2/gstv4l2src.c +++ b/sys/v4l2/gstv4l2src.c @@ -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; }