capsnego fixes in adder, speed, and identity

Original commit message from CVS:
capsnego fixes in adder, speed, and identity
This commit is contained in:
Andy Wingo 2002-02-17 17:34:23 +00:00
parent 9a40de21d5
commit 26834ee0e6

View file

@ -102,44 +102,33 @@ static void speed_init (GstSpeed *filter);
static void speed_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec); static void speed_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
static void speed_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec); static void speed_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
static gint speed_parse_caps (GstSpeed *filter, GstCaps *caps); static gboolean speed_parse_caps (GstSpeed *filter, GstCaps *caps);
static void speed_loop (GstElement *element); static void speed_loop (GstElement *element);
static GstElementClass *parent_class = NULL; static GstElementClass *parent_class = NULL;
//static guint gst_filter_signals[LAST_SIGNAL] = { 0 }; //static guint gst_filter_signals[LAST_SIGNAL] = { 0 };
/* static GstPadConnectReturn
static GstPadNegotiateReturn speed_connect_sink (GstPad *pad, GstCaps *caps)
speed_negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data)
{ {
GstSpeed* filter = GST_SPEED (gst_pad_get_parent (pad)); GstSpeed *filter;
if (*caps==NULL) filter = GST_SPEED (gst_pad_get_parent (pad));
return GST_PAD_NEGOTIATE_FAIL; g_return_val_if_fail (filter != NULL, GST_PAD_CONNECT_REFUSED);
g_return_val_if_fail (GST_IS_SPEED (filter), GST_PAD_CONNECT_REFUSED);
if (speed_parse_caps(filter, *caps)) if (GST_CAPS_IS_FIXED (caps)) {
return GST_PAD_NEGOTIATE_FAIL; if (!speed_parse_caps (filter, caps) || !gst_pad_try_set_caps (filter->srcpad, caps))
return GST_PAD_CONNECT_REFUSED;
return gst_pad_negotiate_proxy(pad,filter->sinkpad,caps); return GST_PAD_CONNECT_OK;
}
return GST_PAD_CONNECT_DELAYED;
} }
static GstPadNegotiateReturn static gboolean
speed_negotiate_sink (GstPad *pad, GstCaps **caps, gpointer *data)
{
GstSpeed* filter = GST_SPEED (gst_pad_get_parent (pad));
if (*caps==NULL)
return GST_PAD_NEGOTIATE_FAIL;
if (speed_parse_caps(filter, *caps))
return GST_PAD_NEGOTIATE_FAIL;
return gst_pad_negotiate_proxy(pad,filter->srcpad,caps);
}
*/
static gint
speed_parse_caps (GstSpeed *filter, GstCaps *caps) speed_parse_caps (GstSpeed *filter, GstCaps *caps)
{ {
const gchar *format; const gchar *format;
@ -177,9 +166,9 @@ speed_parse_caps (GstSpeed *filter, GstCaps *caps)
filter->layout, filter->intercept, filter->slope); filter->layout, filter->intercept, filter->slope);
} }
} else { } else {
return -1; return FALSE;
} }
return 0; return TRUE;
} }
@ -230,10 +219,9 @@ static void
speed_init (GstSpeed *filter) speed_init (GstSpeed *filter)
{ {
filter->sinkpad = gst_pad_new_from_template(speed_sink_factory (),"sink"); filter->sinkpad = gst_pad_new_from_template(speed_sink_factory (),"sink");
//gst_pad_set_negotiate_function(filter->sinkpad,speed_negotiate_sink); gst_pad_set_connect_function(filter->sinkpad,speed_connect_sink);
gst_pad_set_bufferpool_function (filter->sinkpad, speed_sink_get_bufferpool); gst_pad_set_bufferpool_function (filter->sinkpad, speed_sink_get_bufferpool);
filter->srcpad = gst_pad_new_from_template(speed_src_factory (),"src"); filter->srcpad = gst_pad_new_from_template(speed_src_factory (),"src");
//gst_pad_set_negotiate_function(filter->srcpad,speed_negotiate_src);
gst_element_add_pad(GST_ELEMENT(filter),filter->sinkpad); gst_element_add_pad(GST_ELEMENT(filter),filter->sinkpad);
gst_element_add_pad(GST_ELEMENT(filter),filter->srcpad); gst_element_add_pad(GST_ELEMENT(filter),filter->srcpad);
@ -277,6 +265,10 @@ speed_loop (GstElement *element)
#define _FORMAT gint8 #define _FORMAT gint8
#include "filter.func" #include "filter.func"
#undef _FORMAT #undef _FORMAT
} else {
gst_element_error (element, "capsnego was never performed, bailing...");
gst_element_yield (element); /* this is necessary for some reason with loop
elements */
} }
} }