X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gst%2Ficydemux%2Fgsticydemux.c;h=b7070a3df0bdeb4e0de35eb129750f7f7f908033;hb=4c2f5333bbd1766bfb1a3ce30a5ca34195e323d7;hp=a2f4ef2c95b38cf9c422068b8163e6da5b58897a;hpb=a060a657861a8a1a8386be89d729df1286de3c00;p=platform%2Fupstream%2Fgst-plugins-good.git diff --git a/gst/icydemux/gsticydemux.c b/gst/icydemux/gsticydemux.c index a2f4ef2..b7070a3 100644 --- a/gst/icydemux/gsticydemux.c +++ b/gst/icydemux/gsticydemux.c @@ -82,7 +82,7 @@ static GstStateChangeReturn gst_icydemux_change_state (GstElement * element, GstStateChange transition); static gboolean gst_icydemux_sink_setcaps (GstPad * pad, GstCaps * caps); -static void gst_icydemux_send_tag_event (GstICYDemux * icydemux, +static gboolean gst_icydemux_send_tag_event (GstICYDemux * icydemux, GstTagList * taglist); static GstElementClass *parent_class = NULL; @@ -301,6 +301,22 @@ gst_icydemux_unicodify (const gchar * str) return gst_tag_freeform_string_to_utf8 (str, -1, env_vars); } +static gboolean +gst_icydemux_tag_found (GstICYDemux * icydemux, GstTagList * tags) +{ + /* send the tag event if we have finished typefinding and have a src pad */ + if (icydemux->srcpad) + return gst_icydemux_send_tag_event (icydemux, tags); + + /* if we haven't a source pad yet, cache the tags */ + if (!icydemux->cached_tags) + icydemux->cached_tags = gst_tag_list_new (); + + gst_tag_list_insert (icydemux->cached_tags, tags, GST_TAG_MERGE_REPLACE_ALL); + + return TRUE; +} + static void gst_icydemux_parse_and_send_tags (GstICYDemux * icydemux) { @@ -351,18 +367,8 @@ gst_icydemux_parse_and_send_tags (GstICYDemux * icydemux) g_free (buffer); gst_adapter_clear (icydemux->meta_adapter); - if (found_tag) { - if (icydemux->srcpad) { - gst_icydemux_send_tag_event (icydemux, tags); - } else { - if (!icydemux->cached_tags) { - icydemux->cached_tags = gst_tag_list_new (); - } - - gst_tag_list_insert (icydemux->cached_tags, tags, - GST_TAG_MERGE_REPLACE_ALL); - } - } + if (found_tag) + gst_icydemux_tag_found (icydemux, tags); } static gboolean @@ -370,6 +376,14 @@ gst_icydemux_handle_event (GstPad * pad, GstEvent * event) { GstICYDemux *icydemux = GST_ICYDEMUX (GST_PAD_PARENT (pad)); + if (GST_EVENT_TYPE (event) == GST_EVENT_TAG) { + GstTagList *tags; + + gst_event_parse_tag (event, &tags); + gst_event_unref (event); + return gst_icydemux_tag_found (icydemux, tags); + } + if (icydemux->typefinding) { switch (GST_EVENT_TYPE (event)) { case GST_EVENT_FLUSH_STOP: @@ -603,7 +617,7 @@ gst_icydemux_change_state (GstElement * element, GstStateChange transition) return ret; } -static void +static gboolean gst_icydemux_send_tag_event (GstICYDemux * icydemux, GstTagList * tags) { GstEvent *event; @@ -615,7 +629,7 @@ gst_icydemux_send_tag_event (GstICYDemux * icydemux, GstTagList * tags) GST_EVENT_TIMESTAMP (event) = 0; GST_DEBUG_OBJECT (icydemux, "Sending tag event on src pad"); - gst_pad_push_event (icydemux->srcpad, event); + return gst_pad_push_event (icydemux->srcpad, event); }