From: Ronald S. Bultje Date: Tue, 10 Sep 2002 09:31:40 +0000 (+0000) Subject: This updates all plugins to the new API for gst_pad_try_set_caps X-Git-Tag: CAPS~199 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0b497b1634b097988451b70aca5bf4190b81c01f;p=platform%2Fupstream%2Fgst-plugins-good.git 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 --- diff --git a/ext/dv/gstdvdec.c b/ext/dv/gstdvdec.c index 367cfe7..0ee8976 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 423e7f5..ac9eaa1 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 7970c5d..c53c55c 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 916fcbe..6ce634d 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 fc916a8..664df87 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 930461d..e21b01a 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 e8d8e01..8732137 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 3f34b1f..eb1bb09 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 a46f1b2..726224e 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 dd0b1b7..2879b86 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 d3a41fa..489a490 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 c0d4796..a8cba02 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 7f61f4d..0f3a40d 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 6413093..3fd90bb 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 c8cafa5..1328e94 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 506ec82..05d02b2 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 1ce5edd..9806f0e 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 853a56f..f7ebed1 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 2f95f05..3585a9c 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 5d9090f..2364878 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 debab4b..449e2fd 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 2e8710a..4e4dd49 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 cad9c34..a255e86 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 d1cc5af..0554042 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 76547ed..e4fdca0 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 bf66ec7..249609c 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 7dce792..6f10298 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; }