mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
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:
parent
af558bdc6f
commit
2c5496eb74
19 changed files with 43 additions and 49 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -282,7 +282,7 @@ gst_mixmatrix_set_all_caps (GstMixMatrix *mix)
|
|||
for (i=0;i<mix->sinkpadalloc;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;i<mix->srcpadalloc;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;i<mix->srcpadalloc;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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue