From: Tim-Philipp Müller Date: Wed, 29 Mar 2006 10:33:19 +0000 (+0000) Subject: plugins/elements/gsttypefindelement.*: When typefinding is done in push mode, we... X-Git-Tag: RELEASE-0_10_5~49 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=30ae52d1b98a9e9a2e6f5cc0a0129a2ec4c5e52a;p=platform%2Fupstream%2Fgstreamer.git plugins/elements/gsttypefindelement.*: When typefinding is done in push mode, we should cache events we receive durin... Original commit message from CVS: * plugins/elements/gsttypefindelement.c: (stop_typefinding), (gst_type_find_element_handle_event), (gst_type_find_element_send_cached_events), (gst_type_find_element_change_state): * plugins/elements/gsttypefindelement.h: When typefinding is done in push mode, we should cache events we receive during typefinding instead of just dropping them (e.g. newsegment, custom events from dvdreadsrc etc.) and then send them out once we've determined the type of the stream (and decodebin has had a chance to plug in a decoder/demuxer). --- diff --git a/ChangeLog b/ChangeLog index b63b39c000..30da970f3d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2006-03-29 Tim-Philipp Müller + + * plugins/elements/gsttypefindelement.c: (stop_typefinding), + (gst_type_find_element_handle_event), + (gst_type_find_element_send_cached_events), + (gst_type_find_element_change_state): + * plugins/elements/gsttypefindelement.h: + When typefinding is done in push mode, we should cache + events we receive during typefinding instead of just + dropping them (e.g. newsegment, custom events from + dvdreadsrc etc.) and then send them out once we've + determined the type of the stream (and decodebin + has had a chance to plug in a decoder/demuxer). + 2006-03-27 Wim Taymans * docs/design/part-qos.txt: diff --git a/plugins/elements/gsttypefindelement.c b/plugins/elements/gsttypefindelement.c index efeec4012c..600dea59d1 100644 --- a/plugins/elements/gsttypefindelement.c +++ b/plugins/elements/gsttypefindelement.c @@ -145,6 +145,8 @@ static gboolean gst_type_find_element_activate_src_pull (GstPad * pad, gboolean active); static GstFlowReturn gst_type_find_element_chain_do_typefinding (GstTypeFindElement * typefind); +static void +gst_type_find_element_send_cached_events (GstTypeFindElement * typefind); static guint gst_type_find_element_signals[LAST_SIGNAL] = { 0 }; @@ -440,6 +442,7 @@ stop_typefinding (GstTypeFindElement * typefind) GST_DEBUG_PAD_NAME (peer))); typefind->mode = MODE_ERROR; /* make the chain function error out */ } else { + gst_type_find_element_send_cached_events (typefind); gst_pad_push (typefind->src, typefind->store); } @@ -488,19 +491,16 @@ gst_type_find_element_handle_event (GstPad * pad, GstEvent * event) break; } default: - gst_event_unref (event); + GST_DEBUG_OBJECT (typefind, "Saving %s event to send later", + GST_EVENT_TYPE_NAME (event)); + typefind->cached_events = + g_list_append (typefind->cached_events, event); res = TRUE; break; } break; case MODE_NORMAL: - if (FALSE) { // GST_EVENT_TYPE (event) == GST_EVENT_DISCONTINUOUS) { - start_typefinding (typefind); - gst_event_unref (event); - res = TRUE; - } else { - res = gst_pad_event_default (pad, event); - } + res = gst_pad_event_default (pad, event); break; case MODE_ERROR: break; @@ -510,6 +510,22 @@ gst_type_find_element_handle_event (GstPad * pad, GstEvent * event) return res; } +static void +gst_type_find_element_send_cached_events (GstTypeFindElement * typefind) +{ + GList *l; + + for (l = typefind->cached_events; l != NULL; l = l->next) { + GstEvent *event = GST_EVENT (l->data); + + GST_DEBUG_OBJECT (typefind, "sending cached %s event", + GST_EVENT_TYPE_NAME (event)); + gst_pad_push_event (typefind->src, event); + } + g_list_free (typefind->cached_events); + typefind->cached_events = NULL; +} + static GstFlowReturn gst_type_find_element_chain (GstPad * pad, GstBuffer * buffer) { @@ -726,6 +742,10 @@ gst_type_find_element_change_state (GstElement * element, switch (transition) { case GST_STATE_CHANGE_PAUSED_TO_READY: gst_caps_replace (&typefind->caps, NULL); + g_list_foreach (typefind->cached_events, + (GFunc) gst_mini_object_unref, NULL); + g_list_free (typefind->cached_events); + typefind->cached_events = NULL; break; default: break; diff --git a/plugins/elements/gsttypefindelement.h b/plugins/elements/gsttypefindelement.h index f4dcec2e89..528be000c3 100644 --- a/plugins/elements/gsttypefindelement.h +++ b/plugins/elements/gsttypefindelement.h @@ -58,6 +58,8 @@ struct _GstTypeFindElement { guint mode; GstBuffer * store; + + GList * cached_events; }; struct _GstTypeFindElementClass {