mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-18 13:25:56 +00:00
gst/id3demux/: We don't want the same string multiple times in a tag list for the same tag ever, for any tag, not jus...
Original commit message from CVS: * gst/id3demux/id3tags.c: * gst/id3demux/id3tags.h: * gst/id3demux/id3v2frames.c: (id3v2_tag_to_taglist): We don't want the same string multiple times in a tag list for the same tag ever, for any tag, not just for GST_TAG_GENRE, so make sure this doesn't happen and remove special-case code for GST_TAG_GENRE.
This commit is contained in:
parent
899fcb8914
commit
62d8456eb7
4 changed files with 25 additions and 13 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2007-11-14 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
|
* gst/id3demux/id3tags.c:
|
||||||
|
* gst/id3demux/id3tags.h:
|
||||||
|
* gst/id3demux/id3v2frames.c: (id3v2_tag_to_taglist):
|
||||||
|
We don't want the same string multiple times in a tag list for the
|
||||||
|
same tag ever, for any tag, not just for GST_TAG_GENRE, so make sure
|
||||||
|
this doesn't happen and remove special-case code for GST_TAG_GENRE.
|
||||||
|
|
||||||
2007-11-14 Tim-Philipp Müller <tim at centricular dot net>
|
2007-11-14 Tim-Philipp Müller <tim at centricular dot net>
|
||||||
|
|
||||||
* ext/taglib/gstid3v2mux.cc: (add_musicbrainz_tag), (add_funcs):
|
* ext/taglib/gstid3v2mux.cc: (add_musicbrainz_tag), (add_funcs):
|
||||||
|
|
|
@ -163,9 +163,6 @@ id3demux_read_id3v2_tag (GstBuffer * buffer, guint * id3v2_size,
|
||||||
|
|
||||||
*tags = work.tags;
|
*tags = work.tags;
|
||||||
|
|
||||||
if (work.prev_genre)
|
|
||||||
g_free (work.prev_genre);
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,9 +75,6 @@ typedef struct {
|
||||||
guint8 *parse_data;
|
guint8 *parse_data;
|
||||||
guint parse_size;
|
guint parse_size;
|
||||||
|
|
||||||
/* Previous genre string, for simple duplicate removal */
|
|
||||||
gchar *prev_genre;
|
|
||||||
|
|
||||||
/* To collect day/month from obsolete TDAT frame if it exists */
|
/* To collect day/month from obsolete TDAT frame if it exists */
|
||||||
guint pending_month;
|
guint pending_month;
|
||||||
guint pending_day;
|
guint pending_day;
|
||||||
|
|
|
@ -794,14 +794,23 @@ id3v2_tag_to_taglist (ID3TagsWorking * work, const gchar * tag_name,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case G_TYPE_STRING:{
|
case G_TYPE_STRING:{
|
||||||
if (!strcmp (tag_name, GST_TAG_GENRE)) {
|
const GValue *val;
|
||||||
if (work->prev_genre && !strcmp (tag_str, work->prev_genre))
|
guint i, num;
|
||||||
break; /* Same as the last genre */
|
|
||||||
g_free (work->prev_genre);
|
/* make sure we add each unique string only once per tag, we don't want
|
||||||
work->prev_genre = g_strdup (tag_str);
|
* to have the same genre in the genre list multiple times, for example,
|
||||||
|
* or the same DiscID in there twice just because it's contained in the
|
||||||
|
* tag multiple times under different TXXX user tags */
|
||||||
|
num = gst_tag_list_get_tag_size (tag_list, tag_name);
|
||||||
|
for (i = 0; i < num; ++i) {
|
||||||
|
val = gst_tag_list_get_value_index (tag_list, tag_name, i);
|
||||||
|
if (val != NULL && strcmp (g_value_get_string (val), tag_str) == 0)
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
if (i == num) {
|
||||||
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
|
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
|
||||||
tag_name, tag_str, NULL);
|
tag_name, tag_str, NULL);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue