summaryrefslogtreecommitdiff
path: root/gst/gdp/gstgdpdepay.c
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2006-07-31 08:48:36 +0000
committerWim Taymans <wim.taymans@gmail.com>2006-07-31 08:48:36 +0000
commitf186c1b29c20afc62aed64cfea3d8c3b121440a2 (patch)
treeb4b18f0fbdb668046603c103074bed97cf321a7f /gst/gdp/gstgdpdepay.c
parent5e12c7fcabcf36ad8a6e8175cd960d8a2d29d32d (diff)
downloadgstreamer-plugins-bad-f186c1b29c20afc62aed64cfea3d8c3b121440a2.tar.gz
gst/gdp/gstgdpdepay.c: Consume all events except EOS because we generate events from the gdp payload instead. Fixes #...
Original commit message from CVS: * gst/gdp/gstgdpdepay.c: (gst_gdp_depay_init), (gst_gdp_depay_sink_event), (gst_gdp_depay_chain): Consume all events except EOS because we generate events from the gdp payload instead. Fixes #349204
Diffstat (limited to 'gst/gdp/gstgdpdepay.c')
-rw-r--r--gst/gdp/gstgdpdepay.c34
1 files changed, 31 insertions, 3 deletions
diff --git a/gst/gdp/gstgdpdepay.c b/gst/gdp/gstgdpdepay.c
index 690989953..4b0266fab 100644
--- a/gst/gdp/gstgdpdepay.c
+++ b/gst/gdp/gstgdpdepay.c
@@ -81,7 +81,9 @@ GST_DEBUG_CATEGORY_STATIC (gst_gdp_depay_debug);
GST_BOILERPLATE_FULL (GstGDPDepay, gst_gdp_depay, GstElement,
GST_TYPE_ELEMENT, _do_init);
+static gboolean gst_gdp_depay_sink_event (GstPad * pad, GstEvent * event);
static GstFlowReturn gst_gdp_depay_chain (GstPad * pad, GstBuffer * buffer);
+
static GstStateChangeReturn gst_gdp_depay_change_state (GstElement *
element, GstStateChange transition);
@@ -121,14 +123,15 @@ gst_gdp_depay_init (GstGDPDepay * gdpdepay, GstGDPDepayClass * g_class)
gst_pad_new_from_static_template (&gdp_depay_sink_template, "sink");
gst_pad_set_chain_function (gdpdepay->sinkpad,
GST_DEBUG_FUNCPTR (gst_gdp_depay_chain));
+ gst_pad_set_event_function (gdpdepay->sinkpad,
+ GST_DEBUG_FUNCPTR (gst_gdp_depay_sink_event));
gst_element_add_pad (GST_ELEMENT (gdpdepay), gdpdepay->sinkpad);
gdpdepay->srcpad =
gst_pad_new_from_static_template (&gdp_depay_src_template, "src");
- gst_element_add_pad (GST_ELEMENT (gdpdepay), gdpdepay->srcpad);
-
/* our caps will always be decided by the incoming GDP caps buffers */
gst_pad_use_fixed_caps (gdpdepay->srcpad);
+ gst_element_add_pad (GST_ELEMENT (gdpdepay), gdpdepay->srcpad);
gdpdepay->adapter = gst_adapter_new ();
}
@@ -149,6 +152,32 @@ gst_gdp_depay_finalize (GObject * gobject)
GST_CALL_PARENT (G_OBJECT_CLASS, finalize, (gobject));
}
+/* we ignore most events because the only events we want to output are those
+ * found in the gdp data stream.
+ * An exception is the EOS event, if we get that on the sinkpad, we certainly
+ * are not going to produce more data.
+ */
+static gboolean
+gst_gdp_depay_sink_event (GstPad * pad, GstEvent * event)
+{
+ GstGDPDepay *this;
+ gboolean res = TRUE;
+
+ this = GST_GDP_DEPAY (gst_pad_get_parent (pad));
+
+ switch (GST_EVENT_TYPE (event)) {
+ case GST_EVENT_EOS:
+ res = gst_pad_push_event (this->srcpad, event);
+ break;
+ default:
+ gst_event_unref (event);
+ break;
+ }
+ gst_object_unref (this);
+
+ return res;
+}
+
static GstFlowReturn
gst_gdp_depay_chain (GstPad * pad, GstBuffer * buffer)
{
@@ -286,7 +315,6 @@ gst_gdp_depay_chain (GstPad * pad, GstBuffer * buffer)
ret = GST_FLOW_ERROR;
goto done;
}
- /* FIXME: set me as source ? */
GST_DEBUG_OBJECT (this, "sending deserialized event %p of type %s",
event, gst_event_type_get_name (event->type));
gst_pad_push_event (this->srcpad, event);