Commit 0b497b16 authored by Ronald S. Bultje's avatar Ronald S. Bultje

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
parent dc3b48f7
......@@ -695,7 +695,7 @@ gst_dvdec_loop (GstElement *element)
GstCaps *to_try = gst_caps_copy_1 (trylist);
/* try each format */
if (gst_pad_try_set_caps (dvdec->videosrcpad, to_try)) {
if (gst_pad_try_set_caps (dvdec->videosrcpad, to_try) > 0) {
guint32 fourcc;
/* it worked, try to find what it was again */
......
......@@ -294,7 +294,7 @@ gst_esdmon_get (GstPad *pad)
}
if (!GST_PAD_CAPS (pad)) {
/* set caps on src pad */
if (!gst_pad_try_set_caps (esdmon->srcpad,
if (gst_pad_try_set_caps (esdmon->srcpad,
GST_CAPS_NEW (
"oss_src",
"audio/raw",
......@@ -306,7 +306,7 @@ gst_esdmon_get (GstPad *pad)
"depth", GST_PROPS_INT (esdmon->depth),
"rate", GST_PROPS_INT (esdmon->frequency),
"channels", GST_PROPS_INT (esdmon->channels)
)))
)) <= 0)
{
gst_element_error (GST_ELEMENT (esdmon), "could not set caps");
return NULL;
......
......@@ -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;
}
}
......
......@@ -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
......
......@@ -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
......
......@@ -268,7 +268,7 @@ gst_auparse_chain (GstPad *pad, GstBuffer *buf)
"width", GST_PROPS_INT (depth),
"signed", GST_PROPS_BOOLEAN (sign));
if (!gst_pad_try_set_caps (auparse->srcpad, tempcaps)) {
if (gst_pad_try_set_caps (auparse->srcpad, tempcaps) <= 0) {
gst_buffer_unref (buf);
gst_element_error (GST_ELEMENT (auparse), "could not set audio caps");
return;
......
......@@ -119,12 +119,7 @@ gst_cutter_connect (GstPad *pad, GstCaps *caps)
otherpad = (pad == filter->srcpad ? filter->sinkpad : filter->srcpad);
if (GST_CAPS_IS_FIXED (caps))
{
if (!gst_pad_try_set_caps (otherpad, caps))
return GST_PAD_CONNECT_REFUSED;
return GST_PAD_CONNECT_OK;
}
return gst_pad_try_set_caps (otherpad, caps);
return GST_PAD_CONNECT_DELAYED;
}
......
......@@ -164,11 +164,7 @@ gst_agingtv_sinkconnect (GstPad * pad, GstCaps * caps)
filter->aging_mode = 0;
aging_mode_switch (filter);
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
......
......@@ -170,11 +170,7 @@ gst_dicetv_sinkconnect (GstPad * pad, GstCaps * caps)
filter->dicemap = (gchar *) g_malloc (filter->height * filter->width * sizeof(char));
gst_dicetv_create_map (filter);
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
......
......@@ -148,11 +148,7 @@ gst_edgetv_sinkconnect (GstPad * pad, GstCaps * caps)
filter->map = (guint32 *)g_malloc (filter->map_width * filter->map_height * sizeof(guint32) * 2);
bzero(filter->map, filter->map_width * filter->map_height * sizeof(guint32) * 2);
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
......
......@@ -175,11 +175,7 @@ gst_quarktv_sinkconnect (GstPad * pad, GstCaps * caps)
filter->planetable[i] = NULL;
}
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,11 +179,7 @@ gst_revtv_sinkconnect (GstPad * pad, GstCaps * caps)
gst_caps_get_int (caps, "width", &filter->width);
gst_caps_get_int (caps, "height", &filter->height);
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
......
......@@ -160,11 +160,7 @@ gst_shagadelictv_sinkconnect (GstPad * pad, GstCaps * caps)
gst_shagadelic_initialize (filter);
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
......
......@@ -194,11 +194,7 @@ gst_vertigotv_sinkconnect (GstPad * pad, GstCaps * caps)
filter->alt_buffer = filter->buffer + area;
filter->phase = 0;
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
......
......@@ -158,11 +158,7 @@ gst_warptv_sinkconnect (GstPad * pad, GstCaps * caps)
gst_warptv_initialize (filter);
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
......
......@@ -268,7 +268,7 @@ gst_goom_chain (GstPad *pad, GstBuffer *bufin)
"height", GST_PROPS_INT (goom->height)
);
if (!gst_pad_try_set_caps (goom->srcpad, caps)) {
if (gst_pad_try_set_caps (goom->srcpad, caps) <= 0) {
gst_element_error (GST_ELEMENT (goom), "could not set caps");
return;
}
......
......@@ -65,7 +65,7 @@ alawdec_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter)
gst_caps_set(tempcaps,"width",GST_PROPS_INT(16));
gst_caps_set(tempcaps,"signed",GST_PROPS_BOOLEAN(TRUE));
if (gst_pad_try_set_caps (alawdec->srcpad, tempcaps))
if (gst_pad_try_set_caps (alawdec->srcpad, tempcaps) > 0)
{
return GST_PAD_NEGOTIATE_AGREE;
}
......
......@@ -66,7 +66,7 @@ alawenc_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter)
gst_caps_set(tempcaps,"width",GST_PROPS_INT(8));
gst_caps_set(tempcaps,"signed",GST_PROPS_BOOLEAN(FALSE));
if (gst_pad_try_set_caps (alawenc->srcpad, tempcaps))
if (gst_pad_try_set_caps (alawenc->srcpad, tempcaps) > 0)
{
return GST_PAD_NEGOTIATE_AGREE;
}
......
......@@ -64,13 +64,8 @@ mulawdec_connect_sink (GstPad *pad, GstCaps *caps)
gst_caps_set(newcaps,"width",GST_PROPS_INT(16));
gst_caps_set(newcaps,"signed",GST_PROPS_BOOLEAN(TRUE));
if (GST_CAPS_IS_FIXED (newcaps)) {
if (gst_pad_try_set_caps (mulawdec->srcpad, newcaps))
return GST_PAD_CONNECT_OK;
else
return GST_PAD_CONNECT_REFUSED;
}
if (GST_CAPS_IS_FIXED (newcaps))
return gst_pad_try_set_caps (mulawdec->srcpad, newcaps);
return GST_PAD_CONNECT_DELAYED;
}
......
......@@ -65,7 +65,7 @@ mulawenc_negotiate_sink (GstPad *pad, GstCaps **caps, gint counter)
gst_caps_set(tempcaps,"width",GST_PROPS_INT(8));
gst_caps_set(tempcaps,"signed",GST_PROPS_BOOLEAN(FALSE));
if (gst_pad_try_set_caps (mulawenc->srcpad, tempcaps))
if (gst_pad_try_set_caps (mulawenc->srcpad, tempcaps) > 0)
{
return GST_PAD_NEGOTIATE_AGREE;
}
......
......@@ -132,11 +132,8 @@ gst_level_connect (GstPad *pad, GstCaps *caps)
if (GST_CAPS_IS_FIXED (caps))
{
if (/* !volume_parse_caps (filter, caps) || */
!gst_pad_try_set_caps (otherpad, caps))
return GST_PAD_CONNECT_REFUSED;
return GST_PAD_CONNECT_OK;
/*if ( !volume_parse_caps (filter, caps) || */
return gst_pad_try_set_caps (otherpad, caps);
}
return GST_PAD_CONNECT_DELAYED;
}
......
......@@ -138,10 +138,7 @@ gst_median_sinkconnect (GstPad *pad, GstCaps *caps)
gst_caps_get_int (caps, "height", &filter->height);
/* forward to the next plugin */
if (!gst_pad_try_set_caps(filter->srcpad, gst_caps_copy_1(caps)))
return GST_PAD_CONNECT_REFUSED;
return GST_PAD_CONNECT_OK;
return gst_pad_try_set_caps(filter->srcpad, gst_caps_copy_1(caps));
}
void gst_median_init (GstMedian *median)
......
......@@ -273,7 +273,7 @@ gst_monoscope_chain (GstPad *pad, GstBuffer *bufin)
"height", GST_PROPS_INT (monoscope->height)
);
if (!gst_pad_try_set_caps (monoscope->srcpad, caps)) {
if (gst_pad_try_set_caps (monoscope->srcpad, caps) <= 0) {
gst_element_error (GST_ELEMENT (monoscope), "could not set caps");
return;
}
......
......@@ -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;
......
......@@ -275,7 +275,7 @@ gst_wavparse_chain (GstPad *pad, GstBuffer *buf)
"channels", GST_PROPS_INT (format->wChannels)
);
if (!gst_pad_try_set_caps (wavparse->srcpad, caps)) {
if (gst_pad_try_set_caps (wavparse->srcpad, caps) <= 0) {
gst_element_error (GST_ELEMENT (wavparse), "Could not set caps");
return;
}
......
......@@ -205,7 +205,7 @@ gst_osssrc_get (GstPad *pad)
}
if (!GST_PAD_CAPS (pad)) {
/* set caps on src pad */
if (!gst_pad_try_set_caps (src->srcpad,
if (gst_pad_try_set_caps (src->srcpad,
GST_CAPS_NEW (
"oss_src",
"audio/raw",
......@@ -217,7 +217,7 @@ gst_osssrc_get (GstPad *pad)
"depth", GST_PROPS_INT (src->format),
"rate", GST_PROPS_INT (src->frequency),
"channels", GST_PROPS_INT (src->channels)
)))
)) <= 0)
{
gst_element_error (GST_ELEMENT (src), "could not set caps");
return NULL;
......
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment