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 --- 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 +----- 11 files changed, 32 insertions(+), 38 deletions(-) (limited to 'gst') 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 -- cgit v1.2.1