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 af558bdc6f
commit 2c5496eb74
19 changed files with 43 additions and 49 deletions

View File

@ -127,7 +127,7 @@ gst_gsmdec_sinkconnect (GstPad *pad, GstCaps *caps)
"depth", GST_PROPS_INT (16), "depth", GST_PROPS_INT (16),
"rate", GST_PROPS_INT (rate), "rate", GST_PROPS_INT (rate),
"channels", GST_PROPS_INT (1) "channels", GST_PROPS_INT (1)
))) )) > 0)
{ {
return GST_PAD_CONNECT_OK; return GST_PAD_CONNECT_OK;
} }

View File

@ -128,7 +128,7 @@ gst_gsmenc_sinkconnect (GstPad *pad, GstCaps *caps)
"gsm_gsm", "gsm_gsm",
"audio/x-gsm", "audio/x-gsm",
"rate", GST_PROPS_INT (gsmenc->rate) "rate", GST_PROPS_INT (gsmenc->rate)
))) )) > 0)
{ {
return GST_PAD_CONNECT_OK; return GST_PAD_CONNECT_OK;
} }

View File

@ -344,7 +344,7 @@ gst_colorspace_srcconnect_func (GstPad *pad, GstCaps *caps, gboolean newcaps)
peercaps = gst_caps_intersect (caps, ourcaps); peercaps = gst_caps_intersect (caps, ourcaps);
if (peercaps) { if (peercaps) {
/* see if the peer likes it too, it should as the caps say so.. */ /* 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->type = GST_COLORSPACE_NONE;
space->disabled = FALSE; space->disabled = FALSE;
return GST_PAD_CONNECT_DONE; return GST_PAD_CONNECT_DONE;
@ -366,7 +366,7 @@ gst_colorspace_srcconnect_func (GstPad *pad, GstCaps *caps, gboolean newcaps)
* is accepted by the peer */ * is accepted by the peer */
while (peercaps) { while (peercaps) {
if (colorspace_setup_converter (space, ourcaps, 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; space->disabled = FALSE;
return GST_PAD_CONNECT_DONE; return GST_PAD_CONNECT_DONE;
} }

View File

@ -373,7 +373,7 @@ gst_jack_change_state (GstElement *element)
caps = gst_pad_get_caps (pad->pad); caps = gst_pad_get_caps (pad->pad);
gst_caps_set (caps, "rate", GST_PROPS_INT_TYPE, (gint) this->bin->rate, NULL); gst_caps_set (caps, "rate", GST_PROPS_INT_TYPE, (gint) this->bin->rate, NULL);
caps->fixed = TRUE; /* we know this to be true */ 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; return GST_STATE_FAILURE;
l = g_list_next (l); l = g_list_next (l);
} }

View File

@ -507,7 +507,7 @@ gst_ladspa_connect (GstPad *pad, GstCaps *caps)
not sure if this is correct. */ not sure if this is correct. */
if (GST_CAPS_IS_FIXED (caps)) { if (GST_CAPS_IS_FIXED (caps)) {
for (i=0;i<oclass->numsrcpads;i++) { for (i=0;i<oclass->numsrcpads;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; return GST_PAD_CONNECT_REFUSED;
} }
} }

View File

@ -301,7 +301,7 @@ gst_colorspace_srcconnect_func (GstPad *pad, GstCaps *caps, gboolean newcaps)
peercaps = gst_caps_intersect (caps, ourcaps); peercaps = gst_caps_intersect (caps, ourcaps);
if (peercaps) { if (peercaps) {
/* see if the peer likes it too, it should as the caps say so.. */ /* 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->type = GST_COLORSPACE_NONE;
space->disabled = FALSE; space->disabled = FALSE;
return GST_PAD_CONNECT_DONE; return GST_PAD_CONNECT_DONE;
@ -323,7 +323,7 @@ gst_colorspace_srcconnect_func (GstPad *pad, GstCaps *caps, gboolean newcaps)
* is accepted by the peer */ * is accepted by the peer */
while (peercaps) { while (peercaps) {
if (colorspace_setup_converter (space, ourcaps, 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; space->disabled = FALSE;
return GST_PAD_CONNECT_DONE; return GST_PAD_CONNECT_DONE;
} }

View File

@ -206,7 +206,7 @@ gst_tarkindec_chain (GstPad *pad, GstBuffer *buf)
layer = &tarkindec->tarkin_stream->layer->desc; layer = &tarkindec->tarkin_stream->layer->desc;
if (!GST_PAD_CAPS (tarkindec->srcpad)) { 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 ( GST_CAPS_NEW (
"tarkin_raw", "tarkin_raw",
"video/raw", "video/raw",
@ -219,7 +219,7 @@ gst_tarkindec_chain (GstPad *pad, GstBuffer *buf)
"blue_mask", GST_PROPS_INT (0xff), "blue_mask", GST_PROPS_INT (0xff),
"width", GST_PROPS_INT (layer->width), "width", GST_PROPS_INT (layer->width),
"height", GST_PROPS_INT (layer->height) "height", GST_PROPS_INT (layer->height)
))) )) <= 0)
{ {
gst_element_error (GST_ELEMENT (tarkindec), "could not output format"); gst_element_error (GST_ELEMENT (tarkindec), "could not output format");
gst_buffer_unref (buf); gst_buffer_unref (buf);

View File

@ -350,7 +350,7 @@ gst_chart_chain (GstPad *pad, GstBuffer *bufin)
/* Check if we need to renegotiate size. */ /* Check if we need to renegotiate size. */
if (chart->first_buffer) { if (chart->first_buffer) {
GST_DEBUG (0, "making new pad"); 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 ( GST_CAPS_NEW (
"chartsrc", "chartsrc",
"video/raw", "video/raw",
@ -363,7 +363,7 @@ gst_chart_chain (GstPad *pad, GstBuffer *bufin)
"blue_mask", GST_PROPS_INT (0x001f), "blue_mask", GST_PROPS_INT (0x001f),
"width", GST_PROPS_INT (chart->width), "width", GST_PROPS_INT (chart->width),
"height", GST_PROPS_INT (chart->height) "height", GST_PROPS_INT (chart->height)
))) )) <= 0)
{ {
gst_element_error (GST_ELEMENT (chart), "could not set caps"); gst_element_error (GST_ELEMENT (chart), "could not set caps");
return; return;

View File

@ -155,10 +155,7 @@ gst_deinterlace_sinkconnect (GstPad *pad, GstCaps *caps)
filter->picsize = filter->width*filter->height; filter->picsize = filter->width*filter->height;
filter->src = g_malloc(filter->picsize); filter->src = g_malloc(filter->picsize);
} }
if (gst_pad_try_set_caps (filter->srcpad, caps)) { return gst_pad_try_set_caps (filter->srcpad, caps);
return GST_PAD_CONNECT_OK;
}
return GST_PAD_CONNECT_REFUSED;
} }
static void static void

View File

@ -179,6 +179,7 @@ gst_bpwsinc_sink_connect (GstPad * pad, GstCaps * caps)
double sum = 0.0; double sum = 0.0;
int len = 0; int len = 0;
double *kernel_lp, *kernel_hp; double *kernel_lp, *kernel_hp;
GstPadConnectReturn set_retval;
GstBPWSinc *filter = GST_BPWSINC (gst_pad_get_parent (pad)); GstBPWSinc *filter = GST_BPWSINC (gst_pad_get_parent (pad));
@ -188,7 +189,9 @@ gst_bpwsinc_sink_connect (GstPad * pad, GstCaps * caps)
if (!GST_CAPS_IS_FIXED (caps)) if (!GST_CAPS_IS_FIXED (caps))
return GST_PAD_CONNECT_DELAYED; 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; len = filter->wing_size;
/* fill the lp kernel */ /* fill the lp kernel */
@ -259,11 +262,9 @@ gst_bpwsinc_sink_connect (GstPad * pad, GstCaps * caps)
/* set up the residue memory space */ /* set up the residue memory space */
filter->residue = (gfloat *) g_malloc (sizeof (gfloat) * (len * 2 + 1)); filter->residue = (gfloat *) g_malloc (sizeof (gfloat) * (len * 2 + 1));
for (i = 0; i <= len * 2; ++i) filter->residue[i] = 0.0; 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 static void

View File

@ -164,22 +164,23 @@ static GstPadConnectReturn
gst_iir_sink_connect (GstPad * pad, GstCaps * caps) gst_iir_sink_connect (GstPad * pad, GstCaps * caps)
{ {
GstIIR *filter; GstIIR *filter;
GstPadConnectReturn set_retval;
filter = GST_IIR (gst_pad_get_parent (pad)); filter = GST_IIR (gst_pad_get_parent (pad));
if (!GST_CAPS_IS_FIXED (caps)) if (!GST_CAPS_IS_FIXED (caps))
return GST_PAD_CONNECT_DELAYED; 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 */ /* connection works, so init the filter */
/* FIXME: remember to free it */ /* FIXME: remember to free it */
filter->state = (IIR_state *) g_malloc (sizeof (IIR_state)); filter->state = (IIR_state *) g_malloc (sizeof (IIR_state));
IIR_init (filter->state, filter->stages, IIR_init (filter->state, filter->stages,
filter->gain, &(filter->A), &(filter->B)); filter->gain, &(filter->A), &(filter->B));
return GST_PAD_CONNECT_OK;
} }
return GST_PAD_CONNECT_REFUSED; return set_retval;
} }
static void static void

View File

@ -171,6 +171,7 @@ gst_lpwsinc_sink_connect (GstPad * pad, GstCaps * caps)
double sum = 0.0; double sum = 0.0;
int len = 0; int len = 0;
GstLPWSinc *filter = GST_LPWSINC (gst_pad_get_parent (pad)); GstLPWSinc *filter = GST_LPWSINC (gst_pad_get_parent (pad));
GstPadConnectReturn set_retval;
g_assert (GST_IS_PAD (pad)); g_assert (GST_IS_PAD (pad));
g_assert (caps != NULL); g_assert (caps != NULL);
@ -178,7 +179,9 @@ gst_lpwsinc_sink_connect (GstPad * pad, GstCaps * caps)
if (!GST_CAPS_IS_FIXED (caps)) if (!GST_CAPS_IS_FIXED (caps))
return GST_PAD_CONNECT_DELAYED; 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 */ /* connection works, so init the filter */
/* FIXME: remember to free it */ /* FIXME: remember to free it */
@ -208,11 +211,9 @@ gst_lpwsinc_sink_connect (GstPad * pad, GstCaps * caps)
/* set up the residue memory space */ /* set up the residue memory space */
filter->residue = (gfloat *) g_malloc (sizeof (gfloat) * (len * 2 + 1)); filter->residue = (gfloat *) g_malloc (sizeof (gfloat) * (len * 2 + 1));
for (i = 0; i <= len * 2; ++i) filter->residue[i] = 0.0; 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 static void

View File

@ -282,7 +282,7 @@ gst_mixmatrix_set_all_caps (GstMixMatrix *mix)
for (i=0;i<mix->sinkpadalloc;i++) { for (i=0;i<mix->sinkpadalloc;i++) {
if (mix->sinkpads[i]) { if (mix->sinkpads[i]) {
if (GST_PAD_CAPS(mix->sinkpads[i]) == NULL) 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;i<mix->srcpadalloc;i++) { for (i=0;i<mix->srcpadalloc;i++) {
if (mix->srcpads[i]) { if (mix->srcpads[i]) {
if (GST_PAD_CAPS(mix->srcpads[i]) == NULL) 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;i<mix->srcpadalloc;i++) { for (i=0;i<mix->srcpadalloc;i++) {
if (mix->srcpads[i]) { if (mix->srcpads[i]) {
if (GST_PAD_CAPS(mix->srcpads[i]) == NULL) 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; return GST_PAD_CONNECT_REFUSED;
} }
} }

View File

@ -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)) if (GST_CAPS_IS_FIXED (caps))
return GST_PAD_CONNECT_REFUSED; return gst_pad_try_set_caps (filter->srcpad, caps);
return GST_PAD_CONNECT_DELAYED; return GST_PAD_CONNECT_DELAYED;
} }

View File

@ -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)) if (GST_CAPS_IS_FIXED (caps))
return GST_PAD_CONNECT_REFUSED; return gst_pad_try_set_caps (filter->srcpad, caps);
return GST_PAD_CONNECT_DELAYED; return GST_PAD_CONNECT_DELAYED;
} }

View File

@ -121,10 +121,10 @@ speed_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 (!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_REFUSED;
return GST_PAD_CONNECT_OK; return gst_pad_try_set_caps(otherpad, caps);
} }
return GST_PAD_CONNECT_DELAYED; return GST_PAD_CONNECT_DELAYED;

View File

@ -341,14 +341,14 @@ gst_video_crop_chain (GstPad *pad, GstBuffer *buffer)
} }
if (GST_PAD_CAPS (video_crop->srcpad) == NULL) { 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 ( GST_CAPS_NEW (
"video_crop_caps", "video_crop_caps",
"video/raw", "video/raw",
"format", GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")), "format", GST_PROPS_FOURCC (GST_STR_FOURCC ("I420")),
"width", GST_PROPS_INT (video_crop->crop_width), "width", GST_PROPS_INT (video_crop->crop_width),
"height", GST_PROPS_INT (video_crop->crop_height) "height", GST_PROPS_INT (video_crop->crop_height)
))) )) <= 0)
{ {
gst_element_error (GST_ELEMENT (video_crop), "could not negotiate pads"); gst_element_error (GST_ELEMENT (video_crop), "could not negotiate pads");
return; return;

View File

@ -147,11 +147,7 @@ gst_xsharpen_sinkconnect (GstPad * pad, GstCaps * caps)
sharpen->dstpitch = sharpen->srcpitch = sharpen->width * sizeof (Pixel32); sharpen->dstpitch = sharpen->srcpitch = sharpen->width * sizeof (Pixel32);
if (gst_pad_try_set_caps (sharpen->srcpad, caps)) { return gst_pad_try_set_caps (sharpen->srcpad, caps);
return GST_PAD_CONNECT_OK;
}
return GST_PAD_CONNECT_REFUSED;
} }
static void static void

View File

@ -547,7 +547,7 @@ gst_v4l2src_srcconnect (GstPad *pad,
GstCaps *onecaps; GstCaps *onecaps;
for (;lastcaps != NULL; lastcaps = lastcaps->next) { for (;lastcaps != NULL; lastcaps = lastcaps->next) {
onecaps = gst_caps_copy_1(lastcaps); 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)) if (gst_v4l2src_capture_init(v4l2src))
return GST_PAD_CONNECT_OK; return GST_PAD_CONNECT_OK;
} }