gst-libs/gst/tag/gstid3tag.c: Add mapping for audio cd discid tags, so we can extract them from tags as well (see #34...

Original commit message from CVS:
* gst-libs/gst/tag/gstid3tag.c: (user_tag_matches),
(gst_tag_from_id3_user_tag):
Add mapping for audio cd discid tags, so we can extract
them from tags as well (see #347848). Also compare identifiers
in ID3v2 TXXX frames in a case-insensitive way to increase
compatibility when reading tags (discid vs. DiscID vs. DiscId).
This commit is contained in:
Tim-Philipp Müller 2007-11-16 10:14:34 +00:00
parent e193646e8e
commit dffc29eb13
2 changed files with 22 additions and 2 deletions

View file

@ -1,3 +1,12 @@
2007-11-16 Tim-Philipp Müller <tim at centricular dot net>
* gst-libs/gst/tag/gstid3tag.c: (user_tag_matches),
(gst_tag_from_id3_user_tag):
Add mapping for audio cd discid tags, so we can extract
them from tags as well (see #347848). Also compare identifiers
in ID3v2 TXXX frames in a case-insensitive way to increase
compatibility when reading tags (discid vs. DiscID vs. DiscId).
2007-11-16 Jan Schmidt <jan.schmidt@sun.com> 2007-11-16 Jan Schmidt <jan.schmidt@sun.com>
* gst-plugins-base.doap: * gst-plugins-base.doap:

View file

@ -249,18 +249,28 @@ static const GstTagEntryMatch user_tag_matches[] = {
{GST_TAG_MUSICBRAINZ_ALBUMID, "TXXX|musicbrainz_albumid"}, {GST_TAG_MUSICBRAINZ_ALBUMID, "TXXX|musicbrainz_albumid"},
{GST_TAG_MUSICBRAINZ_ALBUMARTISTID, "TXXX|musicbrainz_albumartistid"}, {GST_TAG_MUSICBRAINZ_ALBUMARTISTID, "TXXX|musicbrainz_albumartistid"},
{GST_TAG_MUSICBRAINZ_TRMID, "TXXX|musicbrainz_trmid"}, {GST_TAG_MUSICBRAINZ_TRMID, "TXXX|musicbrainz_trmid"},
{GST_TAG_CDDA_MUSICBRAINZ_DISCID, "TXXX|musicbrainz_discid"},
/* musicbrainz identifiers according to spec no one pays /* musicbrainz identifiers according to spec no one pays
* attention to (http://musicbrainz.org/docs/specs/metadata_tags.html) */ * attention to (http://musicbrainz.org/docs/specs/metadata_tags.html) */
{GST_TAG_MUSICBRAINZ_ARTISTID, "TXXX|MusicBrainz Artist Id"}, {GST_TAG_MUSICBRAINZ_ARTISTID, "TXXX|MusicBrainz Artist Id"},
{GST_TAG_MUSICBRAINZ_ALBUMID, "TXXX|MusicBrainz Album Id"}, {GST_TAG_MUSICBRAINZ_ALBUMID, "TXXX|MusicBrainz Album Id"},
{GST_TAG_MUSICBRAINZ_ALBUMARTISTID, "TXXX|MusicBrainz Album Artist Id"}, {GST_TAG_MUSICBRAINZ_ALBUMARTISTID, "TXXX|MusicBrainz Album Artist Id"},
{GST_TAG_MUSICBRAINZ_TRMID, "TXXX|MusicBrainz TRM Id"}, {GST_TAG_MUSICBRAINZ_TRMID, "TXXX|MusicBrainz TRM Id"},
/* according to: http://wiki.musicbrainz.org/MusicBrainzTag (yes, no space
* before 'ID' and not 'Id' either this time, yay for consistency) */
{GST_TAG_CDDA_MUSICBRAINZ_DISCID, "TXXX|MusicBrainz DiscID"},
/* foobar2000 uses these identifiers to store gain/peak information in /* foobar2000 uses these identifiers to store gain/peak information in
* ID3v2 tags <= v2.3.0. In v2.4.0 there's the RVA2 frame for that */ * ID3v2 tags <= v2.3.0. In v2.4.0 there's the RVA2 frame for that */
{GST_TAG_TRACK_GAIN, "TXXX|replaygain_track_gain"}, {GST_TAG_TRACK_GAIN, "TXXX|replaygain_track_gain"},
{GST_TAG_TRACK_PEAK, "TXXX|replaygain_track_peak"}, {GST_TAG_TRACK_PEAK, "TXXX|replaygain_track_peak"},
{GST_TAG_ALBUM_GAIN, "TXXX|replaygain_album_gain"}, {GST_TAG_ALBUM_GAIN, "TXXX|replaygain_album_gain"},
{GST_TAG_ALBUM_PEAK, "TXXX|replaygain_album_peak"} {GST_TAG_ALBUM_PEAK, "TXXX|replaygain_album_peak"},
/* the following two are more or less made up, there seems to be little
* evidence that any popular application is actually putting this info
* into TXXX frames; the first one comes from a musicbrainz wiki 'proposed
* tags' page, the second one is analogue to the vorbis/ape/flac tag. */
{GST_TAG_CDDA_CDDB_DISCID, "TXXX|discid"},
{GST_TAG_CDDA_CDDB_DISCID, "TXXX|CDDB DiscID"}
}; };
/** /**
@ -283,7 +293,8 @@ gst_tag_from_id3_user_tag (const gchar * type, const gchar * id3_user_tag)
for (i = 0; i < G_N_ELEMENTS (user_tag_matches); ++i) { for (i = 0; i < G_N_ELEMENTS (user_tag_matches); ++i) {
if (strncmp (type, user_tag_matches[i].original_tag, 4) == 0 && if (strncmp (type, user_tag_matches[i].original_tag, 4) == 0 &&
strcmp (id3_user_tag, user_tag_matches[i].original_tag + 5) == 0) { g_ascii_strcasecmp (id3_user_tag,
user_tag_matches[i].original_tag + 5) == 0) {
GST_LOG ("Mapped ID3v2 user tag '%s' to GStreamer tag '%s'", GST_LOG ("Mapped ID3v2 user tag '%s' to GStreamer tag '%s'",
user_tag_matches[i].original_tag, user_tag_matches[i].gstreamer_tag); user_tag_matches[i].original_tag, user_tag_matches[i].gstreamer_tag);
return user_tag_matches[i].gstreamer_tag; return user_tag_matches[i].gstreamer_tag;