From f186c1b29c20afc62aed64cfea3d8c3b121440a2 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 31 Jul 2006 08:48:36 +0000 Subject: 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 --- ChangeLog | 7 +++++++ gst/gdp/gstgdpdepay.c | 34 +++++++++++++++++++++++++++++++--- 2 files changed, 38 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index ad3a6d91..fa936e50 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2006-07-31 Wim Taymans + + * 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 + 2006-07-28 Tim-Philipp Müller * ext/xvid/gstxviddec.c: (gst_xviddec_init), (gst_xviddec_reset), diff --git a/gst/gdp/gstgdpdepay.c b/gst/gdp/gstgdpdepay.c index 69098995..4b0266fa 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); -- cgit v1.2.1