tag: Add tags for acoustid id & acoustid fingerprint

Mapping followed: https://picard.musicbrainz.org/docs/mappings/

https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/issues/612
This commit is contained in:
Sumaid Syed 2019-07-05 20:14:34 +05:30
parent 8718458dc7
commit 18351dcd24
5 changed files with 45 additions and 3 deletions

View file

@ -161,6 +161,10 @@ static const GstTagEntryMatch user_tag_matches[] = {
{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"},
/* acoustid identifiers according to the official musicbrainz mapping
* https://picard.musicbrainz.org/docs/mappings/ */
{GST_TAG_ACOUSTID_ID, "TXXX|Acoustid Id"},
{GST_TAG_ACOUSTID_FINGERPRINT, "TXXX|Acoustid Fingerprint"},
/* 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"},

View file

@ -73,6 +73,8 @@ static const GstTagEntryMatch tag_matches[] = {
{GST_TAG_ALBUM_GAIN, "REPLAYGAIN_ALBUM_GAIN"},
{GST_TAG_ALBUM_PEAK, "REPLAYGAIN_ALBUM_PEAK"},
{GST_TAG_REFERENCE_LEVEL, "REPLAYGAIN_REFERENCE_LOUDNESS"},
{GST_TAG_ACOUSTID_ID, "ACOUSTID_ID"},
{GST_TAG_ACOUSTID_FINGERPRINT, "ACOUSTID_FINGERPRINT"},
{GST_TAG_MUSICBRAINZ_TRACKID, "MUSICBRAINZ_TRACKID"},
{GST_TAG_MUSICBRAINZ_RELEASETRACKID, "MUSICBRAINZ_RELEASETRACKID"},
{GST_TAG_MUSICBRAINZ_ARTISTID, "MUSICBRAINZ_ARTISTID"},

View file

@ -61,12 +61,16 @@ G_BEGIN_DECLS
* GST_TAG_MUSICBRAINZ_RELEASEGROUPID:
*
* MusicBrainz Release Group ID
*
* Since: 1.18
*/
#define GST_TAG_MUSICBRAINZ_RELEASEGROUPID "musicbrainz-releasegroupid"
/**
* GST_TAG_MUSICBRAINZ_RELEASETRACKID:
*
* MusicBrainz Release Track ID
*
* Since: 1.18
*/
#define GST_TAG_MUSICBRAINZ_RELEASETRACKID "musicbrainz-releasetrackid"
/**
@ -76,6 +80,29 @@ G_BEGIN_DECLS
*/
#define GST_TAG_MUSICBRAINZ_TRMID "musicbrainz-trmid"
/**
* GST_TAG_ACOUSTID_ID:
*
* AcoustID Identifier
*
* Since: 1.18
*/
#define GST_TAG_ACOUSTID_ID "acoustid-id"
/**
* GST_TAG_ACOUSTID_FINGERPRINT:
*
* AcoustID Fingerprint (Chromaprint)
*
* Since: 1.18
*/
/*
* FIXME 2.0: Using "chromaprint-fingerprint" for backwards compatibility with the
* old custom tag from the chromaprint plugin but should change this to
* "acoustid-fingerprint" in 2.0 for consistency.
*/
#define GST_TAG_ACOUSTID_FINGERPRINT "chromaprint-fingerprint"
/**
* GST_TAG_CMML_STREAM:
*
@ -443,12 +470,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

@ -90,6 +90,11 @@ gst_tag_register_tags_internal (gpointer unused)
_("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);
gst_tag_register_static (GST_TAG_ACOUSTID_ID, GST_TAG_FLAG_META,
G_TYPE_STRING, _("AcoustID ID"), _("AcoustID ID"), NULL);
gst_tag_register_static (GST_TAG_ACOUSTID_FINGERPRINT,
GST_TAG_FLAG_META, G_TYPE_STRING, _("AcoustID fingerprint (chromaprint)"),
_("AcoustID fingerprint (chromaprint)"), NULL);
/* CDDA tags */
gst_tag_register_static (GST_TAG_CDDA_CDDB_DISCID, GST_TAG_FLAG_META,

View file

@ -253,6 +253,8 @@ GST_START_TEST (test_vorbis_tags)
gst_vorbis_tag_add (list, "CONTACT", "Coo");
gst_vorbis_tag_add (list, "COMMENT", "Stroodle is good");
gst_vorbis_tag_add (list, "COMMENT", "Peroxysulfid stroodles the brain");
gst_vorbis_tag_add (list, "ACOUSTID_ID", "5678913");
gst_vorbis_tag_add (list, "ACOUSTID_FINGERPRINT", "5678912");
gst_vorbis_tag_add (list, "TRACKNUMBER", "5");
gst_vorbis_tag_add (list, "TRACKTOTAL", "77");
@ -275,6 +277,8 @@ GST_START_TEST (test_vorbis_tags)
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_CONTACT, "Coo");
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_COMMENT,
"Peroxysulfid stroodles the brain");
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_ACOUSTID_ID, "5678913");
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_ACOUSTID_FINGERPRINT, "5678912");
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_COMMENT, "Stroodle is good");
ASSERT_TAG_LIST_HAS_UINT (list, GST_TAG_TRACK_NUMBER, 5);
ASSERT_TAG_LIST_HAS_UINT (list, GST_TAG_TRACK_COUNT, 77);