asfdemux: extract WM/PartOfSet disc number and count metadata

Fixes #30

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-ugly/-/merge_requests/54>
This commit is contained in:
Tim-Philipp Müller 2020-06-02 00:41:23 +01:00
parent 4f4b67bea4
commit 112174bcea

View file

@ -3181,6 +3181,7 @@ gst_asf_demux_get_gst_tag_from_tag_name (const gchar * name_utf8)
"WM/Genre", GST_TAG_GENRE}, {
"WM/AlbumTitle", GST_TAG_ALBUM}, {
"WM/AlbumArtist", GST_TAG_ARTIST}, {
"WM/PartOfSet", GST_TAG_ALBUM_VOLUME_COUNT}, {
"WM/Picture", GST_TAG_IMAGE}, {
"WM/Track", GST_TAG_TRACK_NUMBER}, {
"WM/TrackNumber", GST_TAG_TRACK_NUMBER}, {
@ -3399,6 +3400,22 @@ gst_asf_demux_process_ext_content_desc (GstASFDemux * demux, guint8 * data,
g_free (value_utf8);
value_utf8 = g_strdup (genre_str);
}
} else if (!strcmp (gst_tag_name, GST_TAG_ALBUM_VOLUME_COUNT)) {
guint num = 0, count = 0;
if (sscanf (value_utf8, "%u/%u", &num, &count) == 2
&& num > 0 && num <= 99999 && count > 0 && count <= 99999) {
GST_DEBUG ("Disc %u of %u (%s)", num, count, value_utf8);
g_value_init (&tag_value, G_TYPE_UINT);
/* disc number */
g_value_set_uint (&tag_value, num);
gst_tag_list_add_values (taglist, GST_TAG_MERGE_APPEND,
GST_TAG_ALBUM_VOLUME_NUMBER, &tag_value, NULL);
/* disc count (will be added to the taglist below) */
g_value_set_uint (&tag_value, count);
} else {
GST_DEBUG ("Couldn't parse PartOfSet value %s", value_utf8);
}
} else {
GType tag_type;