From 2c5496eb74498afc6ff26e47773af43239a07abd Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Tue, 10 Sep 2002 09:31:40 +0000 Subject: 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/gsm/gstgsmdec.c | 2 +- ext/gsm/gstgsmenc.c | 2 +- ext/hermes/gstcolorspace.c | 4 ++-- ext/jack/gstjack.c | 2 +- ext/ladspa/gstladspa.c | 2 +- ext/lcs/gstcolorspace.c | 4 ++-- ext/tarkin/gsttarkindec.c | 4 ++-- gst/chart/gstchart.c | 4 ++-- gst/deinterlace/gstdeinterlace.c | 5 +---- gst/filter/gstbpwsinc.c | 11 ++++++----- gst/filter/gstiir.c | 9 +++++---- gst/filter/gstlpwsinc.c | 11 ++++++----- gst/mixmatrix/mixmatrix.c | 6 +++--- gst/passthrough/gstpassthrough.c | 5 ++--- gst/playondemand/gstplayondemand.c | 5 ++--- gst/speed/gstspeed.c | 4 ++-- gst/videocrop/gstvideocrop.c | 4 ++-- gst/virtualdub/gstxsharpen.c | 6 +----- sys/v4l2/gstv4l2src.c | 2 +- 19 files changed, 43 insertions(+), 49 deletions(-) diff --git a/ext/gsm/gstgsmdec.c b/ext/gsm/gstgsmdec.c index 35207618..aef69763 100644 --- a/ext/gsm/gstgsmdec.c +++ b/ext/gsm/gstgsmdec.c @@ -127,7 +127,7 @@ gst_gsmdec_sinkconnect (GstPad *pad, GstCaps *caps) "depth", GST_PROPS_INT (16), "rate", GST_PROPS_INT (rate), "channels", GST_PROPS_INT (1) - ))) + )) > 0) { return GST_PAD_CONNECT_OK; } diff --git a/ext/gsm/gstgsmenc.c b/ext/gsm/gstgsmenc.c index fb19b5ef..3ed506b8 100644 --- a/ext/gsm/gstgsmenc.c +++ b/ext/gsm/gstgsmenc.c @@ -128,7 +128,7 @@ gst_gsmenc_sinkconnect (GstPad *pad, GstCaps *caps) "gsm_gsm", "audio/x-gsm", "rate", GST_PROPS_INT (gsmenc->rate) - ))) + )) > 0) { return GST_PAD_CONNECT_OK; } diff --git a/ext/hermes/gstcolorspace.c b/ext/hermes/gstcolorspace.c index dcd05ca4..fe21fc56 100644 --- a/ext/hermes/gstcolorspace.c +++ b/ext/hermes/gstcolorspace.c @@ -344,7 +344,7 @@ gst_colorspace_srcconnect_func (GstPad *pad, GstCaps *caps, gboolean newcaps) peercaps = gst_caps_intersect (caps, ourcaps); if (peercaps) { /* see if the peer likes it too, it should as the caps say so.. */ - if (gst_pad_try_set_caps (space->srcpad, peercaps)) { + if (gst_pad_try_set_caps (space->srcpad, peercaps) > 0) { space->type = GST_COLORSPACE_NONE; space->disabled = FALSE; return GST_PAD_CONNECT_DONE; @@ -366,7 +366,7 @@ gst_colorspace_srcconnect_func (GstPad *pad, GstCaps *caps, gboolean newcaps) * is accepted by the peer */ while (peercaps) { if (colorspace_setup_converter (space, ourcaps, peercaps)) { - if (gst_pad_try_set_caps (space->srcpad, peercaps)) { + if (gst_pad_try_set_caps (space->srcpad, peercaps) > 0) { space->disabled = FALSE; return GST_PAD_CONNECT_DONE; } diff --git a/ext/jack/gstjack.c b/ext/jack/gstjack.c index 18d4ce43..179645f4 100644 --- a/ext/jack/gstjack.c +++ b/ext/jack/gstjack.c @@ -373,7 +373,7 @@ gst_jack_change_state (GstElement *element) caps = gst_pad_get_caps (pad->pad); gst_caps_set (caps, "rate", GST_PROPS_INT_TYPE, (gint) this->bin->rate, NULL); caps->fixed = TRUE; /* we know this to be true */ - if (!gst_pad_try_set_caps (pad->pad, caps)) + if (gst_pad_try_set_caps (pad->pad, caps) <= 0) return GST_STATE_FAILURE; l = g_list_next (l); } diff --git a/ext/ladspa/gstladspa.c b/ext/ladspa/gstladspa.c index 7970c5d2..c53c55cc 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/ext/lcs/gstcolorspace.c b/ext/lcs/gstcolorspace.c index 6dae2ab9..cee44d96 100644 --- a/ext/lcs/gstcolorspace.c +++ b/ext/lcs/gstcolorspace.c @@ -301,7 +301,7 @@ gst_colorspace_srcconnect_func (GstPad *pad, GstCaps *caps, gboolean newcaps) peercaps = gst_caps_intersect (caps, ourcaps); if (peercaps) { /* see if the peer likes it too, it should as the caps say so.. */ - if (gst_pad_try_set_caps (space->srcpad, peercaps)) { + if (gst_pad_try_set_caps (space->srcpad, peercaps) > 0) { space->type = GST_COLORSPACE_NONE; space->disabled = FALSE; return GST_PAD_CONNECT_DONE; @@ -323,7 +323,7 @@ gst_colorspace_srcconnect_func (GstPad *pad, GstCaps *caps, gboolean newcaps) * is accepted by the peer */ while (peercaps) { if (colorspace_setup_converter (space, ourcaps, peercaps)) { - if (gst_pad_try_set_caps (space->srcpad, peercaps)) { + if (gst_pad_try_set_caps (space->srcpad, peercaps) > 0) { space->disabled = FALSE; return GST_PAD_CONNECT_DONE; } diff --git a/ext/tarkin/gsttarkindec.c b/ext/tarkin/gsttarkindec.c index e0e538c5..28a7ee0a 100644 --- a/ext/tarkin/gsttarkindec.c +++ b/ext/tarkin/gsttarkindec.c @@ -206,7 +206,7 @@ gst_tarkindec_chain (GstPad *pad, GstBuffer *buf) layer = &tarkindec->tarkin_stream->layer->desc; if (!GST_PAD_CAPS (tarkindec->srcpad)) { - if (!gst_pad_try_set_caps (tarkindec->srcpad, + if (gst_pad_try_set_caps (tarkindec->srcpad, GST_CAPS_NEW ( "tarkin_raw", "video/raw", @@ -219,7 +219,7 @@ gst_tarkindec_chain (GstPad *pad, GstBuffer *buf) "blue_mask", GST_PROPS_INT (0xff), "width", GST_PROPS_INT (layer->width), "height", GST_PROPS_INT (layer->height) - ))) + )) <= 0) { gst_element_error (GST_ELEMENT (tarkindec), "could not output format"); gst_buffer_unref (buf); diff --git a/gst/chart/gstchart.c b/gst/chart/gstchart.c index e1c106ae..e24521a0 100644 --- a/gst/chart/gstchart.c +++ b/gst/chart/gstchart.c @@ -350,7 +350,7 @@ gst_chart_chain (GstPad *pad, GstBuffer *bufin) /* Check if we need to renegotiate size. */ if (chart->first_buffer) { GST_DEBUG (0, "making new pad"); - if (!gst_pad_try_set_caps (chart->srcpad, + if (gst_pad_try_set_caps (chart->srcpad, GST_CAPS_NEW ( "chartsrc", "video/raw", @@ -363,7 +363,7 @@ gst_chart_chain (GstPad *pad, GstBuffer *bufin) "blue_mask", GST_PROPS_INT (0x001f), "width", GST_PROPS_INT (chart->width), "height", GST_PROPS_INT (chart->height) - ))) + )) <= 0) { gst_element_error (GST_ELEMENT (chart), "could not set caps"); return; diff --git a/gst/deinterlace/gstdeinterlace.c b/gst/deinterlace/gstdeinterlace.c index 11543844..9c4d5c29 100644 --- a/gst/deinterlace/gstdeinterlace.c +++ b/gst/deinterlace/gstdeinterlace.c @@ -155,10 +155,7 @@ gst_deinterlace_sinkconnect (GstPad *pad, GstCaps *caps) filter->picsize = filter->width*filter->height; filter->src = g_malloc(filter->picsize); } - 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/filter/gstbpwsinc.c b/gst/filter/gstbpwsinc.c index 916fcbe9..6ce634d3 100644 --- a/gst/filter/gstbpwsinc.c +++ b/gst/filter/gstbpwsinc.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/filter/gstiir.c b/gst/filter/gstiir.c index c363802c..7b548f30 100644 --- a/gst/filter/gstiir.c +++ b/gst/filter/gstiir.c @@ -164,22 +164,23 @@ static GstPadConnectReturn gst_iir_sink_connect (GstPad * pad, GstCaps * caps) { GstIIR *filter; + GstPadConnectReturn set_retval; filter = GST_IIR (gst_pad_get_parent (pad)); 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 */ filter->state = (IIR_state *) g_malloc (sizeof (IIR_state)); IIR_init (filter->state, filter->stages, filter->gain, &(filter->A), &(filter->B)); - return GST_PAD_CONNECT_OK; } - return GST_PAD_CONNECT_REFUSED; + return set_retval; } static void diff --git a/gst/filter/gstlpwsinc.c b/gst/filter/gstlpwsinc.c index fc916a82..664df870 100644 --- a/gst/filter/gstlpwsinc.c +++ b/gst/filter/gstlpwsinc.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/mixmatrix/mixmatrix.c b/gst/mixmatrix/mixmatrix.c index a0dd9a0b..935b203b 100644 --- a/gst/mixmatrix/mixmatrix.c +++ b/gst/mixmatrix/mixmatrix.c @@ -282,7 +282,7 @@ gst_mixmatrix_set_all_caps (GstMixMatrix *mix) for (i=0;isinkpadalloc;i++) { if (mix->sinkpads[i]) { if (GST_PAD_CAPS(mix->sinkpads[i]) == NULL) - if (gst_pad_try_set_caps(mix->sinkpads[i],mix->caps) == FALSE) return FALSE; + if (gst_pad_try_set_caps(mix->sinkpads[i],mix->caps) <= 0) return FALSE; } } @@ -290,7 +290,7 @@ gst_mixmatrix_set_all_caps (GstMixMatrix *mix) for (i=0;isrcpadalloc;i++) { if (mix->srcpads[i]) { if (GST_PAD_CAPS(mix->srcpads[i]) == NULL) - if (gst_pad_try_set_caps(mix->srcpads[i],mix->caps) == FALSE) return FALSE; + if (gst_pad_try_set_caps(mix->srcpads[i],mix->caps) <= 0) return FALSE; } } @@ -311,7 +311,7 @@ gst_mixmatrix_connect (GstPad *pad, GstCaps *caps) for (i=0;isrcpadalloc;i++) { if (mix->srcpads[i]) { if (GST_PAD_CAPS(mix->srcpads[i]) == NULL) - if (gst_pad_try_set_caps(mix->srcpads[i], caps) == FALSE) + if (gst_pad_try_set_caps(mix->srcpads[i], caps) <= 0) return GST_PAD_CONNECT_REFUSED; } } diff --git a/gst/passthrough/gstpassthrough.c b/gst/passthrough/gstpassthrough.c index 870e6be9..841da95b 100644 --- a/gst/passthrough/gstpassthrough.c +++ b/gst/passthrough/gstpassthrough.c @@ -153,9 +153,8 @@ passthrough_connect_sink (GstPad *pad, GstCaps *caps) } } - if (GST_CAPS_IS_FIXED (caps) && ! gst_pad_try_set_caps (filter->srcpad, caps)) - return GST_PAD_CONNECT_REFUSED; - + if (GST_CAPS_IS_FIXED (caps)) + return gst_pad_try_set_caps (filter->srcpad, caps); return GST_PAD_CONNECT_DELAYED; } diff --git a/gst/playondemand/gstplayondemand.c b/gst/playondemand/gstplayondemand.c index 87a840de..4eeab9e1 100644 --- a/gst/playondemand/gstplayondemand.c +++ b/gst/playondemand/gstplayondemand.c @@ -162,9 +162,8 @@ play_on_demand_pad_connect (GstPad *pad, GstCaps *caps) } } - if (GST_CAPS_IS_FIXED (caps) && ! gst_pad_try_set_caps (filter->srcpad, caps)) - return GST_PAD_CONNECT_REFUSED; - + if (GST_CAPS_IS_FIXED (caps)) + return gst_pad_try_set_caps (filter->srcpad, caps); return GST_PAD_CONNECT_DELAYED; } diff --git a/gst/speed/gstspeed.c b/gst/speed/gstspeed.c index d943b608..2a30a7ad 100644 --- a/gst/speed/gstspeed.c +++ b/gst/speed/gstspeed.c @@ -121,10 +121,10 @@ speed_connect (GstPad *pad, GstCaps *caps) otherpad = (pad == filter->srcpad ? filter->sinkpad : filter->srcpad); if (GST_CAPS_IS_FIXED (caps)) { - if (!speed_parse_caps (filter, caps) || !gst_pad_try_set_caps (otherpad, caps)) + if (!speed_parse_caps (filter, 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/videocrop/gstvideocrop.c b/gst/videocrop/gstvideocrop.c index d1cc5af4..0554042e 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/virtualdub/gstxsharpen.c b/gst/virtualdub/gstxsharpen.c index 1d85b59f..f42ad7d0 100644 --- a/gst/virtualdub/gstxsharpen.c +++ b/gst/virtualdub/gstxsharpen.c @@ -147,11 +147,7 @@ gst_xsharpen_sinkconnect (GstPad * pad, GstCaps * caps) sharpen->dstpitch = sharpen->srcpitch = sharpen->width * sizeof (Pixel32); - if (gst_pad_try_set_caps (sharpen->srcpad, caps)) { - return GST_PAD_CONNECT_OK; - } - - return GST_PAD_CONNECT_REFUSED; + return gst_pad_try_set_caps (sharpen->srcpad, caps); } static void diff --git a/sys/v4l2/gstv4l2src.c b/sys/v4l2/gstv4l2src.c index 7dce792d..6f102984 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; } -- cgit v1.2.1