summaryrefslogtreecommitdiffstats
path: root/gst/speed
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2002-02-17 17:34:23 +0000
committerAndy Wingo <wingo@pobox.com>2002-02-17 17:34:23 +0000
commit26834ee0e6972cd70e4a89134740ecdd29d9882e (patch)
treee669c229f44fc2d4b7b9cdc80c01b416f48a9d93 /gst/speed
parent9a40de21d537dbadd158161ae7add3fb572644fa (diff)
downloadgst-plugins-bad-26834ee0e6972cd70e4a89134740ecdd29d9882e.tar.gz
gst-plugins-bad-26834ee0e6972cd70e4a89134740ecdd29d9882e.tar.bz2
gst-plugins-bad-26834ee0e6972cd70e4a89134740ecdd29d9882e.zip
capsnego fixes in adder, speed, and identity
Original commit message from CVS: capsnego fixes in adder, speed, and identity
Diffstat (limited to 'gst/speed')
-rw-r--r--gst/speed/gstspeed.c54
1 files changed, 23 insertions, 31 deletions
diff --git a/gst/speed/gstspeed.c b/gst/speed/gstspeed.c
index 8cf90191..bbbe7fd8 100644
--- a/gst/speed/gstspeed.c
+++ b/gst/speed/gstspeed.c
@@ -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_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 GstElementClass *parent_class = NULL;
//static guint gst_filter_signals[LAST_SIGNAL] = { 0 };
-/*
-static GstPadNegotiateReturn
-speed_negotiate_src (GstPad *pad, GstCaps **caps, gpointer *data)
+static GstPadConnectReturn
+speed_connect_sink (GstPad *pad, GstCaps *caps)
{
- GstSpeed* filter = GST_SPEED (gst_pad_get_parent (pad));
-
- if (*caps==NULL)
- return GST_PAD_NEGOTIATE_FAIL;
+ GstSpeed *filter;
- if (speed_parse_caps(filter, *caps))
- return GST_PAD_NEGOTIATE_FAIL;
+ filter = GST_SPEED (gst_pad_get_parent (pad));
+ 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 (GST_CAPS_IS_FIXED (caps)) {
+ if (!speed_parse_caps (filter, caps) || !gst_pad_try_set_caps (filter->srcpad, caps))
+ return GST_PAD_CONNECT_REFUSED;
+
+ return GST_PAD_CONNECT_OK;
+ }
- return gst_pad_negotiate_proxy(pad,filter->sinkpad,caps);
+ return GST_PAD_CONNECT_DELAYED;
}
-static GstPadNegotiateReturn
-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
+static gboolean
speed_parse_caps (GstSpeed *filter, GstCaps *caps)
{
const gchar *format;
@@ -177,9 +166,9 @@ speed_parse_caps (GstSpeed *filter, GstCaps *caps)
filter->layout, filter->intercept, filter->slope);
}
} else {
- return -1;
+ return FALSE;
}
- return 0;
+ return TRUE;
}
@@ -230,10 +219,9 @@ static void
speed_init (GstSpeed *filter)
{
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);
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->srcpad);
@@ -277,6 +265,10 @@ speed_loop (GstElement *element)
#define _FORMAT gint8
#include "filter.func"
#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 */
}
}