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
This commit is contained in:
Ronald S. Bultje 2002-09-10 09:31:40 +00:00
parent 2ddfd11493
commit 95281dfe33
7 changed files with 15 additions and 18 deletions

View file

@ -907,7 +907,7 @@ gst_alsa_src_process (GstAlsa *this, snd_pcm_uframes_t frames)
caps = gst_alsa_caps(this); caps = gst_alsa_caps(this);
l = this->pads; l = this->pads;
while (l) { 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"); g_print ("DANGER WILL ROBINSON!\n");
sleep(1); sleep(1);
return FALSE; return FALSE;

View file

@ -273,12 +273,12 @@ gst_adder_connect (GstPad *pad, GstCaps *caps)
if (!gst_adder_parse_caps (adder, caps)) if (!gst_adder_parse_caps (adder, caps))
return GST_PAD_CONNECT_REFUSED; 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); sinkpads = gst_element_get_pad_list ((GstElement*) adder);
while (sinkpads) { while (sinkpads) {
p = (GstPad*) sinkpads->data; p = (GstPad*) sinkpads->data;
if (p != pad && p != adder->srcpad) { 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, GST_DEBUG (GST_CAT_PLUGIN_INFO,
"caps mismatch; disconnecting and removing pad %s:%s " "caps mismatch; disconnecting and removing pad %s:%s "
"(peer %s:%s)", "(peer %s:%s)",

View file

@ -183,10 +183,7 @@ gst_audioscale_sinkconnect (GstPad * pad, GstCaps * caps)
gst_caps_set (newcaps, "rate", GST_PROPS_INT_TYPE, audioscale->targetfrequency, NULL); gst_caps_set (newcaps, "rate", GST_PROPS_INT_TYPE, audioscale->targetfrequency, NULL);
if (GST_CAPS_IS_FIXED (caps)) if (GST_CAPS_IS_FIXED (caps))
if (gst_pad_try_set_caps (audioscale->srcpad, newcaps)) return gst_pad_try_set_caps (audioscale->srcpad, newcaps);
return GST_PAD_CONNECT_OK;
else
return GST_PAD_CONNECT_REFUSED;
else else
return GST_PAD_CONNECT_DELAYED; return GST_PAD_CONNECT_DELAYED;
} }

View file

@ -201,7 +201,7 @@ gst_videoscale_sinkconnect (GstPad *pad, GstCaps *caps)
videoscale->targetheight); videoscale->targetheight);
GST_DEBUG(0,"width %d",videoscale->targetwidth); 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 ( GST_CAPS_NEW (
"videoscale_src", "videoscale_src",
"video/raw", "video/raw",
@ -209,8 +209,6 @@ gst_videoscale_sinkconnect (GstPad *pad, GstCaps *caps)
"width", GST_PROPS_INT (videoscale->targetwidth), "width", GST_PROPS_INT (videoscale->targetwidth),
"height", GST_PROPS_INT (videoscale->targetheight) "height", GST_PROPS_INT (videoscale->targetheight)
)); ));
return GST_PAD_CONNECT_OK;
} }
static void static void

View file

@ -144,13 +144,15 @@ volume_connect (GstPad *pad, GstCaps *caps)
otherpad = (pad == filter->srcpad ? filter->sinkpad : filter->srcpad); otherpad = (pad == filter->srcpad ? filter->sinkpad : filter->srcpad);
if (GST_CAPS_IS_FIXED (caps)) { 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; return GST_PAD_CONNECT_REFUSED;
if (gst_caps_get_int (caps, "rate", &rate)){ if ((set_retval = gst_pad_try_set_caps(otherpad, caps)) > 0)
gst_dpman_set_rate(filter->dpman, rate); if (gst_caps_get_int (caps, "rate", &rate)){
} gst_dpman_set_rate(filter->dpman, rate);
return GST_PAD_CONNECT_OK; }
return set_retval;
} }
return GST_PAD_CONNECT_DELAYED; return GST_PAD_CONNECT_DELAYED;

View file

@ -258,7 +258,7 @@ gst_v4lmjpegsrc_srcconnect (GstPad *pad,
"width", GST_PROPS_INT(v4lmjpegsrc->end_width), "width", GST_PROPS_INT(v4lmjpegsrc->end_width),
"height", GST_PROPS_INT(v4lmjpegsrc->end_height), "height", GST_PROPS_INT(v4lmjpegsrc->end_height),
NULL ) ); 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), gst_element_error(GST_ELEMENT(v4lmjpegsrc),
"Failed to set new caps"); "Failed to set new caps");

View file

@ -350,7 +350,7 @@ gst_v4lsrc_srcconnect (GstPad *pad,
gst_caps_debug (newcaps, "new caps to set on v4lsrc's src 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; continue;
if (!gst_v4lsrc_capture_init(v4lsrc)) if (!gst_v4lsrc_capture_init(v4lsrc))