ext/mad/gstid3tag.c: Fix handling of GST_TAG_DATE, which is now of type GST_TYPE_DATE.

Original commit message from CVS:
* ext/mad/gstid3tag.c: (gst_mad_id3_to_tag_list):
Fix handling of GST_TAG_DATE, which is now of type GST_TYPE_DATE.
This commit is contained in:
Tim-Philipp Müller 2005-10-13 19:14:25 +00:00
parent 7c27045a8a
commit cd53df63df
2 changed files with 30 additions and 5 deletions

View File

@ -1,3 +1,8 @@
2005-10-13 Tim-Philipp Müller <tim at centricular dot net>
* ext/mad/gstid3tag.c: (gst_mad_id3_to_tag_list):
Fix handling of GST_TAG_DATE, which is now of type GST_TYPE_DATE.
2005-10-13 Stefan Kost <ensonic@users.sf.net> 2005-10-13 Stefan Kost <ensonic@users.sf.net>
* examples/stats/mp2ogg.c: * examples/stats/mp2ogg.c:

View File

@ -528,6 +528,7 @@ gst_mad_id3_to_tag_list (const struct id3_tag * tag)
const id3_ucs4_t *ucs4; const id3_ucs4_t *ucs4;
id3_utf8_t *utf8; id3_utf8_t *utf8;
GstTagList *tag_list; GstTagList *tag_list;
GType tag_type;
guint i = 0; guint i = 0;
tag_list = gst_tag_list_new (); tag_list = gst_tag_list_new ();
@ -587,8 +588,10 @@ gst_mad_id3_to_tag_list (const struct id3_tag * tag)
continue; continue;
} }
tag_type = gst_tag_get_type (tag_name);
/* be sure to add non-string tags here */ /* be sure to add non-string tags here */
switch (gst_tag_get_type (tag_name)) { switch (tag_type) {
case G_TYPE_UINT: case G_TYPE_UINT:
{ {
guint tmp; guint tmp;
@ -651,11 +654,28 @@ gst_mad_id3_to_tag_list (const struct id3_tag * tag)
GST_TAG_DURATION, tmp * 1000 * 1000, NULL); GST_TAG_DURATION, tmp * 1000 * 1000, NULL);
break; break;
} }
default: case G_TYPE_STRING:{
g_assert (gst_tag_get_type (tag_name) == G_TYPE_STRING); gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, tag_name, utf8, tag_name, (const gchar *) utf8, NULL);
NULL);
break; break;
}
/* handles GST_TYPE_DATE and anything else */
default:{
GValue src = { 0, };
GValue dest = { 0, };
g_value_init (&src, G_TYPE_STRING);
g_value_set_string (&src, (const gchar *) utf8);
g_value_init (&dest, tag_type);
if (g_value_transform (&src, &dest)) {
gst_tag_list_add_values (tag_list, GST_TAG_MERGE_APPEND,
tag_name, &dest, NULL);
} else {
GST_WARNING ("Failed to transform tag from string to type '%s'",
g_type_name (tag_type));
}
break;
}
} }
free (utf8); free (utf8);
} }