+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>
* examples/stats/mp2ogg.c:
const id3_ucs4_t *ucs4;
id3_utf8_t *utf8;
GstTagList *tag_list;
+ GType tag_type;
guint i = 0;
tag_list = gst_tag_list_new ();
continue;
}
+ tag_type = gst_tag_get_type (tag_name);
+
/* be sure to add non-string tags here */
- switch (gst_tag_get_type (tag_name)) {
+ switch (tag_type) {
case G_TYPE_UINT:
{
guint tmp;
GST_TAG_DURATION, tmp * 1000 * 1000, NULL);
break;
}
- default:
- g_assert (gst_tag_get_type (tag_name) == G_TYPE_STRING);
- gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND, tag_name, utf8,
- NULL);
+ case G_TYPE_STRING:{
+ gst_tag_list_add (tag_list, GST_TAG_MERGE_APPEND,
+ tag_name, (const gchar *) utf8, NULL);
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);
}