From db4e736086f5d1a3807ec73534db1eccf1b8c014 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Wed, 31 Oct 2007 14:33:03 +0000 Subject: [PATCH] gst/asfdemux/gstasfdemux.c: Convert tags that come as string into the type required by Original commit message from CVS: * gst/asfdemux/gstasfdemux.c: (gst_asf_demux_process_ext_content_desc): Convert tags that come as string into the type required by GstTagList. --- ChangeLog | 6 ++++++ gst/asfdemux/gstasfdemux.c | 21 ++++++++++++++++++--- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index 9f6dd142d5..d1b98aa4a6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-10-31 Tim-Philipp Müller + + * gst/asfdemux/gstasfdemux.c: (gst_asf_demux_process_ext_content_desc): + Convert tags that come as string into the type required by + GstTagList. + 2007-10-30 Wim Taymans * gst/mpegaudioparse/gstmpegaudioparse.c: diff --git a/gst/asfdemux/gstasfdemux.c b/gst/asfdemux/gstasfdemux.c index 3a5440fb4a..50b46c423e 100644 --- a/gst/asfdemux/gstasfdemux.c +++ b/gst/asfdemux/gstasfdemux.c @@ -2070,9 +2070,24 @@ gst_asf_demux_process_ext_content_desc (GstASFDemux * demux, guint8 * data, g_date_free (date); } } else { - g_value_init (&tag_value, G_TYPE_STRING); - g_value_set_string (&tag_value, value_utf8); - /* FIXME: convert to target value type if required */ + GType tag_type; + + /* convert tag from string to other type if required */ + tag_type = gst_tag_get_type (gst_tag_name); + g_value_init (&tag_value, tag_type); + if (!gst_value_deserialize (&tag_value, value_utf8)) { + GValue from_val = { 0, }; + + g_value_init (&from_val, G_TYPE_STRING); + g_value_set_string (&from_val, value_utf8); + if (!g_value_transform (&from_val, &tag_value)) { + GST_WARNING_OBJECT (demux, + "Could not transform string tag to " "%s tag type %s", + gst_tag_name, g_type_name (tag_type)); + g_value_unset (&tag_value); + } + g_value_unset (&from_val); + } } } else if (value_utf8 == NULL) { GST_WARNING ("Failed to convert string value to UTF8, skipping");