tag: Repair support for MusicBrainz IDs

Add missing release group ID and track ID
Mapping Followed:
https://picard.musicbrainz.org/docs/mappings/

https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/612
This commit is contained in:
Sumaid 2019-05-22 14:26:42 +05:30 committed by Sumaid Syed
parent 3a53ec066b
commit 8718458dc7
5 changed files with 33 additions and 3 deletions

View file

@ -146,16 +146,20 @@ gst_tag_from_id3_tag (const gchar * id3_tag)
static const GstTagEntryMatch user_tag_matches[] = {
/* musicbrainz identifiers being used in the real world (foobar2000) */
{GST_TAG_MUSICBRAINZ_RELEASETRACKID, "TXXX|musicbrainz_trackid"},
{GST_TAG_MUSICBRAINZ_ARTISTID, "TXXX|musicbrainz_artistid"},
{GST_TAG_MUSICBRAINZ_ALBUMID, "TXXX|musicbrainz_albumid"},
{GST_TAG_MUSICBRAINZ_ALBUMARTISTID, "TXXX|musicbrainz_albumartistid"},
{GST_TAG_MUSICBRAINZ_RELEASEGROUPID, "TXXX|musicbrainz_releasegroupid"},
{GST_TAG_MUSICBRAINZ_TRMID, "TXXX|musicbrainz_trmid"},
{GST_TAG_CDDA_MUSICBRAINZ_DISCID, "TXXX|musicbrainz_discid"},
/* musicbrainz identifiers according to spec no one pays
* attention to (http://musicbrainz.org/docs/specs/metadata_tags.html) */
{GST_TAG_MUSICBRAINZ_RELEASETRACKID, "TXXX|MusicBrainz Release Track Id"},
{GST_TAG_MUSICBRAINZ_ARTISTID, "TXXX|MusicBrainz Artist Id"},
{GST_TAG_MUSICBRAINZ_ALBUMID, "TXXX|MusicBrainz Album Id"},
{GST_TAG_MUSICBRAINZ_ALBUMARTISTID, "TXXX|MusicBrainz Album Artist Id"},
{GST_TAG_MUSICBRAINZ_RELEASEGROUPID, "TXXX|MusicBrainz Release Group 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) */

View file

@ -74,9 +74,11 @@ static const GstTagEntryMatch tag_matches[] = {
{GST_TAG_ALBUM_PEAK, "REPLAYGAIN_ALBUM_PEAK"},
{GST_TAG_REFERENCE_LEVEL, "REPLAYGAIN_REFERENCE_LOUDNESS"},
{GST_TAG_MUSICBRAINZ_TRACKID, "MUSICBRAINZ_TRACKID"},
{GST_TAG_MUSICBRAINZ_RELEASETRACKID, "MUSICBRAINZ_RELEASETRACKID"},
{GST_TAG_MUSICBRAINZ_ARTISTID, "MUSICBRAINZ_ARTISTID"},
{GST_TAG_MUSICBRAINZ_ALBUMID, "MUSICBRAINZ_ALBUMID"},
{GST_TAG_MUSICBRAINZ_ALBUMARTISTID, "MUSICBRAINZ_ALBUMARTISTID"},
{GST_TAG_MUSICBRAINZ_RELEASEGROUPID, "MUSICBRAINZ_RELEASEGROUPID"},
{GST_TAG_MUSICBRAINZ_TRMID, "MUSICBRAINZ_TRMID"},
{GST_TAG_ARTIST_SORTNAME, "ARTISTSORT"},
{GST_TAG_ARTIST_SORTNAME, "ARTISTSORTORDER"},

View file

@ -57,6 +57,18 @@ G_BEGIN_DECLS
* MusicBrainz album artist ID
*/
#define GST_TAG_MUSICBRAINZ_ALBUMARTISTID "musicbrainz-albumartistid"
/**
* GST_TAG_MUSICBRAINZ_RELEASEGROUPID:
*
* MusicBrainz Release Group ID
*/
#define GST_TAG_MUSICBRAINZ_RELEASEGROUPID "musicbrainz-releasegroupid"
/**
* GST_TAG_MUSICBRAINZ_RELEASETRACKID:
*
* MusicBrainz Release Track ID
*/
#define GST_TAG_MUSICBRAINZ_RELEASETRACKID "musicbrainz-releasetrackid"
/**
* GST_TAG_MUSICBRAINZ_TRMID:
*
@ -431,12 +443,12 @@ GST_TAG_API
const gchar * gst_tag_to_vorbis_tag (const gchar * gst_tag);
GST_TAG_API
void gst_vorbis_tag_add (GstTagList * list,
const gchar * tag,
void gst_vorbis_tag_add (GstTagList * list,
const gchar * tag,
const gchar * value);
GST_TAG_API
GList * gst_tag_to_vorbis_comments (const GstTagList * list,
GList * gst_tag_to_vorbis_comments (const GstTagList * list,
const gchar * tag);
/* functions to convert GstBuffers with vorbiscomment contents to GstTagLists and back */

View file

@ -82,6 +82,12 @@ gst_tag_register_tags_internal (gpointer unused)
gst_tag_register_static (GST_TAG_MUSICBRAINZ_ALBUMARTISTID, GST_TAG_FLAG_META,
G_TYPE_STRING,
_("album artist ID"), _("MusicBrainz album artist ID"), NULL);
gst_tag_register_static (GST_TAG_MUSICBRAINZ_RELEASEGROUPID,
GST_TAG_FLAG_META, G_TYPE_STRING, _("release group ID"),
_("MusicBrainz release group ID"), NULL);
gst_tag_register_static (GST_TAG_MUSICBRAINZ_RELEASETRACKID,
GST_TAG_FLAG_META, G_TYPE_STRING, _("release track ID"),
_("MusicBrainz release track ID"), NULL);
gst_tag_register_static (GST_TAG_MUSICBRAINZ_TRMID, GST_TAG_FLAG_META,
G_TYPE_STRING, _("track TRM ID"), _("MusicBrainz TRM ID"), NULL);

View file

@ -192,6 +192,8 @@ GST_START_TEST (test_musicbrainz_tag_registration)
gst_vorbis_tag_add (list, "MUSICBRAINZ_ARTISTID", "234567");
gst_vorbis_tag_add (list, "MUSICBRAINZ_ALBUMID", "345678");
gst_vorbis_tag_add (list, "MUSICBRAINZ_ALBUMARTISTID", "4567890");
gst_vorbis_tag_add (list, "MUSICBRAINZ_RELEASETRACKID", "4567891");
gst_vorbis_tag_add (list, "MUSICBRAINZ_RELEASEGROUPID", "4567892");
gst_vorbis_tag_add (list, "MUSICBRAINZ_TRMID", "5678901");
/* MUSICBRAINZ_SORTNAME = GST_TAG_ARTIST_SORTNAME now */
gst_vorbis_tag_add (list, "MUSICBRAINZ_SORTNAME", "Five, 678901");
@ -201,6 +203,10 @@ GST_START_TEST (test_musicbrainz_tag_registration)
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_MUSICBRAINZ_ALBUMID, "345678");
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_MUSICBRAINZ_ALBUMARTISTID,
"4567890");
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_MUSICBRAINZ_RELEASETRACKID,
"4567891");
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_MUSICBRAINZ_RELEASEGROUPID,
"4567892");
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_MUSICBRAINZ_TRMID, "5678901");
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_ARTIST_SORTNAME, "Five, 678901");