From 680ddc0cea2d11d8ef5cd65c31e6dfdd18af98ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sat, 13 Aug 2005 10:33:22 +0000 Subject: [PATCH] Add GST_TAG_LANGUAGE_CODE as we have in 0.8, and don't spew out a warning if a tag that is already registered is re-r... Original commit message from CVS: * docs/gst/gstreamer-sections.txt: * gst/gsttag.c: (_gst_tag_initialize), (gst_tag_register): * gst/gsttag.h: Add GST_TAG_LANGUAGE_CODE as we have in 0.8, and don't spew out a warning if a tag that is already registered is re-registered, unless it is re-registered with a different type (#308438). --- ChangeLog | 10 ++++++++++ docs/gst/gstreamer-sections.txt | 1 + gst/gsttag.c | 9 ++++++++- gst/gsttag.h | 6 ++++++ gst/gsttaglist.c | 9 ++++++++- gst/gsttaglist.h | 6 ++++++ 6 files changed, 39 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4bcde0cf91..f1f1b51801 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2005-08-13 Tim-Philipp Müller + + * docs/gst/gstreamer-sections.txt: + * gst/gsttag.c: (_gst_tag_initialize), (gst_tag_register): + * gst/gsttag.h: + Add GST_TAG_LANGUAGE_CODE as we have in 0.8, and don't + spew out a warning if a tag that is already registered + is re-registered, unless it is re-registered with a + different type (#308438). + 2005-08-12 Tim-Philipp Müller * docs/pwg/appendix-porting.xml: diff --git a/docs/gst/gstreamer-sections.txt b/docs/gst/gstreamer-sections.txt index 252afc48f5..4d7a595218 100644 --- a/docs/gst/gstreamer-sections.txt +++ b/docs/gst/gstreamer-sections.txt @@ -1319,6 +1319,7 @@ GST_TAG_TRACK_GAIN GST_TAG_TRACK_PEAK GST_TAG_ALBUM_GAIN GST_TAG_ALBUM_PEAK +GST_TAG_LANGUAGE_CODE GST_TAG_LIST GST_IS_TAG_LIST diff --git a/gst/gsttag.c b/gst/gsttag.c index 0b7fb0923c..b0400980d3 100644 --- a/gst/gsttag.c +++ b/gst/gsttag.c @@ -188,6 +188,9 @@ _gst_tag_initialize (void) G_TYPE_DOUBLE, _("replaygain album gain"), _("album gain in db"), NULL); gst_tag_register (GST_TAG_ALBUM_PEAK, GST_TAG_FLAG_META, G_TYPE_DOUBLE, _("replaygain album peak"), _("peak of the album"), NULL); + gst_tag_register (GST_TAG_LANGUAGE_CODE, GST_TAG_FLAG_META, G_TYPE_STRING, + _("language code"), + _("language code for this stream, conforming to ISO-639-1"), NULL); } /** @@ -277,7 +280,11 @@ gst_tag_register (const gchar * name, GstTagFlag flag, GType type, key = g_quark_from_string (name); info = gst_tag_lookup (key); - g_return_if_fail (info == NULL); + + if (info) { + g_return_if_fail (info->type == type); + return; + } info = g_new (GstTagInfo, 1); info->flag = flag; diff --git a/gst/gsttag.h b/gst/gsttag.h index a58665e7bb..163b9e8969 100644 --- a/gst/gsttag.h +++ b/gst/gsttag.h @@ -424,6 +424,12 @@ gboolean gst_tag_list_get_pointer_index (const GstTagList * list, * peak of the album */ #define GST_TAG_ALBUM_PEAK "replaygain-album-peak" +/** + * GST_TAG_LANGUAGE_CODE: + * + * Language code (ISO-639-1) + */ +#define GST_TAG_LANGUAGE_CODE "language-code" G_END_DECLS diff --git a/gst/gsttaglist.c b/gst/gsttaglist.c index 0b7fb0923c..b0400980d3 100644 --- a/gst/gsttaglist.c +++ b/gst/gsttaglist.c @@ -188,6 +188,9 @@ _gst_tag_initialize (void) G_TYPE_DOUBLE, _("replaygain album gain"), _("album gain in db"), NULL); gst_tag_register (GST_TAG_ALBUM_PEAK, GST_TAG_FLAG_META, G_TYPE_DOUBLE, _("replaygain album peak"), _("peak of the album"), NULL); + gst_tag_register (GST_TAG_LANGUAGE_CODE, GST_TAG_FLAG_META, G_TYPE_STRING, + _("language code"), + _("language code for this stream, conforming to ISO-639-1"), NULL); } /** @@ -277,7 +280,11 @@ gst_tag_register (const gchar * name, GstTagFlag flag, GType type, key = g_quark_from_string (name); info = gst_tag_lookup (key); - g_return_if_fail (info == NULL); + + if (info) { + g_return_if_fail (info->type == type); + return; + } info = g_new (GstTagInfo, 1); info->flag = flag; diff --git a/gst/gsttaglist.h b/gst/gsttaglist.h index a58665e7bb..163b9e8969 100644 --- a/gst/gsttaglist.h +++ b/gst/gsttaglist.h @@ -424,6 +424,12 @@ gboolean gst_tag_list_get_pointer_index (const GstTagList * list, * peak of the album */ #define GST_TAG_ALBUM_PEAK "replaygain-album-peak" +/** + * GST_TAG_LANGUAGE_CODE: + * + * Language code (ISO-639-1) + */ +#define GST_TAG_LANGUAGE_CODE "language-code" G_END_DECLS