From 95281dfe33e807ebfda8eb92951a60e2b1232199 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/alsa/gstalsa.c | 2 +- gst/adder/gstadder.c | 4 ++-- gst/audioscale/gstaudioscale.c | 5 +---- gst/videoscale/gstvideoscale.c | 4 +--- gst/volume/gstvolume.c | 14 ++++++++------ sys/v4l/gstv4lmjpegsrc.c | 2 +- sys/v4l/gstv4lsrc.c | 2 +- 7 files changed, 15 insertions(+), 18 deletions(-) diff --git a/ext/alsa/gstalsa.c b/ext/alsa/gstalsa.c index 9d2e902882..de6cd931f3 100644 --- a/ext/alsa/gstalsa.c +++ b/ext/alsa/gstalsa.c @@ -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; diff --git a/gst/adder/gstadder.c b/gst/adder/gstadder.c index 6aa63902be..f6e8db1e7f 100644 --- a/gst/adder/gstadder.c +++ b/gst/adder/gstadder.c @@ -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)", diff --git a/gst/audioscale/gstaudioscale.c b/gst/audioscale/gstaudioscale.c index 4e0ce7c642..ee7d2d4f3d 100644 --- a/gst/audioscale/gstaudioscale.c +++ b/gst/audioscale/gstaudioscale.c @@ -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; } diff --git a/gst/videoscale/gstvideoscale.c b/gst/videoscale/gstvideoscale.c index dfb73b77d5..e5bf9124a4 100644 --- a/gst/videoscale/gstvideoscale.c +++ b/gst/videoscale/gstvideoscale.c @@ -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 diff --git a/gst/volume/gstvolume.c b/gst/volume/gstvolume.c index 841f7dd234..d89dd95403 100644 --- a/gst/volume/gstvolume.c +++ b/gst/volume/gstvolume.c @@ -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; diff --git a/sys/v4l/gstv4lmjpegsrc.c b/sys/v4l/gstv4lmjpegsrc.c index 6322727291..e608092fa8 100644 --- a/sys/v4l/gstv4lmjpegsrc.c +++ b/sys/v4l/gstv4lmjpegsrc.c @@ -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"); diff --git a/sys/v4l/gstv4lsrc.c b/sys/v4l/gstv4lsrc.c index 2af0c74f5b..18778506bd 100644 --- a/sys/v4l/gstv4lsrc.c +++ b/sys/v4l/gstv4lsrc.c @@ -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))