From 0c3cca89fc0b62a50d74a7140e1afb690c4bfb72 Mon Sep 17 00:00:00 2001 From: "Ronald S. Bultje" Date: Sat, 4 Dec 2004 12:05:34 +0000 Subject: gst/apetag/apedemux.c: Forward tags, too. Original commit message from CVS: * gst/apetag/apedemux.c: (gst_ape_demux_parse_tags), (gst_ape_demux_stream_init): Forward tags, too. --- gst/apetag/apedemux.c | 31 +++++++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) (limited to 'gst/apetag') diff --git a/gst/apetag/apedemux.c b/gst/apetag/apedemux.c index 0722595c..0c232261 100644 --- a/gst/apetag/apedemux.c +++ b/gst/apetag/apedemux.c @@ -421,7 +421,7 @@ gst_ape_demux_typefind (GstApeDemux * ape, * Parse tags from a buffer. */ -static void +static GstTagList * gst_ape_demux_parse_tags (GstApeDemux * ape, guint8 * data, gint size) { GstTagList *taglist = gst_tag_list_new (); @@ -501,10 +501,13 @@ gst_ape_demux_parse_tags (GstApeDemux * ape, guint8 * data, gint size) /* let people know */ if (have_tag) { gst_element_found_tags (GST_ELEMENT (ape), taglist); - /*gst_pad_push (ape->srcpad, GST_DATA (gst_event_new_tag (taglist))); */ + /* we'll push it over the srcpad later */ } else { gst_tag_list_free (taglist); + taglist = NULL; } + + return taglist; } /* @@ -518,6 +521,7 @@ gst_ape_demux_stream_init (GstApeDemux * ape) gboolean seekable = TRUE, res = TRUE; guint8 *data; guint32 size = 0; + GstTagList *taglist1 = NULL, *taglist2 = NULL, *taglist = NULL; GST_LOG ("Initializing stream, stripping tags"); @@ -568,7 +572,7 @@ gst_ape_demux_stream_init (GstApeDemux * ape) goto the_city; } } - gst_ape_demux_parse_tags (ape, data, size); + taglist1 = gst_ape_demux_parse_tags (ape, data, size); ape->start_off = size; } @@ -633,7 +637,7 @@ gst_ape_demux_stream_init (GstApeDemux * ape) data += 32; size -= 32; } - gst_ape_demux_parse_tags (ape, data, size); + taglist2 = gst_ape_demux_parse_tags (ape, data, size); ape->end_off = size; } @@ -671,6 +675,25 @@ gst_ape_demux_stream_init (GstApeDemux * ape) the_city: /* become rich & famous */ gst_bytestream_destroy (bs); + if (taglist1 || taglist2) { + if (res) { + /* merge */ + if (taglist1 && taglist2) { + taglist = gst_tag_list_merge (taglist1, taglist2, + GST_TAG_MERGE_REPLACE); + gst_tag_list_free (taglist1); + gst_tag_list_free (taglist2); + } else { + taglist = taglist1 ? taglist1 : taglist2; + } + gst_pad_push (ape->srcpad, GST_DATA (gst_event_new_tag (taglist))); + } else { + if (taglist1) + gst_tag_list_free (taglist1); + if (taglist2) + gst_tag_list_free (taglist2); + } + } return res; } -- cgit v1.2.1