Commit 689ca135 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller

Extract vorbis comment LICENSE tags correctly.

Original commit message from CVS:
* gst-libs/gst/tag/gstvorbistag.c:
* tests/check/libs/tag.c:
Extract vorbis comment LICENSE tags correctly.
parent 054e43aa
2007-10-11 Tim-Philipp Müller <tim at centricular dot net>
* gst-libs/gst/tag/gstvorbistag.c:
* tests/check/libs/tag.c:
Extract vorbis comment LICENSE tags correctly.
2007-10-11 Tim-Philipp Müller <tim at centricular dot net>
Patch by: Jason Kivlighn <jkivlighn gmail com>
......@@ -57,6 +57,7 @@ static const GstTagEntryMatch tag_matches[] = {
{GST_TAG_COMPOSER, "COMPOSER"},
{GST_TAG_COPYRIGHT, "COPYRIGHT"},
{GST_TAG_LICENSE, "LICENSE"},
{GST_TAG_LICENSE_URI, "LICENSE"},
{GST_TAG_LOCATION, "LOCATION"},
{GST_TAG_ORGANIZATION, "ORGANIZATION"},
{GST_TAG_DESCRIPTION, "DESCRIPTION"},
......@@ -226,6 +227,12 @@ gst_vorbis_tag_add (GstTagList * list, const gchar * tag, const gchar * value)
} else if (strlen (value) != 2 && strlen (value) != 3) {
GST_WARNING ("doesn't contain an ISO-639 language code: %s", value);
}
} else if (strcmp (tag, "LICENSE") == 0) {
/* license tags in vorbis comments must contain an URI representing
* the license and nothing more, at least according to:
* http://wiki.xiph.org/index.php/LICENSE_and_COPYRIGHT_tags_on_Vorbis_Comments */
if (value && gst_uri_is_valid (value))
gst_tag = GST_TAG_LICENSE_URI;
}
if (!valid) {
......
......@@ -258,6 +258,8 @@ GST_START_TEST (test_vorbis_tags)
gst_vorbis_tag_add (list, "COPYRIGHT", "Copyfoo");
gst_vorbis_tag_add (list, "DESCRIPTION", "Descoo");
gst_vorbis_tag_add (list, "LICENSE", "Licoo");
gst_vorbis_tag_add (list, "LICENSE",
"http://creativecommons.org/licenses/by/3.0/");
gst_vorbis_tag_add (list, "LOCATION", "Bristol, UK");
gst_vorbis_tag_add (list, "ORGANIZATION", "Orgoo");
gst_vorbis_tag_add (list, "GENRE", "Goo");
......@@ -278,6 +280,8 @@ GST_START_TEST (test_vorbis_tags)
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_COPYRIGHT, "Copyfoo");
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_DESCRIPTION, "Descoo");
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_LICENSE, "Licoo");
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_LICENSE_URI,
"http://creativecommons.org/licenses/by/3.0/");
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_LOCATION, "Bristol, UK");
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_ORGANIZATION, "Orgoo");
ASSERT_TAG_LIST_HAS_STRING (list, GST_TAG_GENRE, "Goo");
......@@ -322,6 +326,7 @@ GST_START_TEST (test_vorbis_tags)
* (',' or '.') regardless of the current locale */
gst_vorbis_tag_add (list, "REPLAYGAIN_ALBUM_PEAK", "0,98107");
ASSERT_TAG_LIST_HAS_DOUBLE (list, GST_TAG_ALBUM_PEAK, 0.98107);
gst_vorbis_tag_add (list, "LICENSE", "http://foo.com/license-1.html");
/* make sure we can convert back and forth without loss */
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment