1 Author: Lyon Wang <b12696@freescale.com>
2 Date: Thu Oct 9 17:37:43 2014 +0800
4 [id3v2frames] Bug fix for id3demux issue
6 Fix the issue that id3 tags utf16 charaters cannot be extreacted in id3demux
7 when I tried to get the id3v2 tag such as TIT2, TALB etc. it will return extrac
10 Checked in id3v2frame.c, When parse the UTF-16 streams, it used g_convert() to
11 convert the buffer from UTF-16 to UTF-8, however it will return err that this
12 conversion is not supported which cause the extraction failed with these UTF-16
15 In the patch, use g_utf16_to_utf8() instead of g_convert, which can convert the
16 character format successfully.
18 https://bugzilla.gnome.org/show_bug.cgi?id=741144
20 Upstream-Status: Backport [1.5.1]
22 Signed-off-by: Lyon Wang <b12696@freescale.com>
24 diff --git a/gst-libs/gst/tag/id3v2frames.c b/gst-libs/gst/tag/id3v2frames.c
27 index 3785c2a..7b9d8ac
28 --- a/gst-libs/gst/tag/id3v2frames.c
29 +++ b/gst-libs/gst/tag/id3v2frames.c
30 @@ -1057,14 +1057,17 @@ parse_insert_string_field (guint8 encoding, gchar * data, gint data_size,
34 - field = g_convert (data, data_size, "UTF-8", in_encode, NULL, NULL, NULL);
36 - if (field == NULL || g_utf8_validate (field, -1, NULL) == FALSE) {
37 - /* As a fallback, try interpreting UTF-16 in the other endianness */
38 - if (in_encode == utf16beenc)
39 - field = g_convert (data, data_size, "UTF-8", utf16leenc,
41 + if (in_encode == utf16beenc) {
42 + gunichar2 *data_utf16;
44 + data_utf16 = (gunichar2 *) data;
45 + for (i=0; i<(data_size>>1); i++) {
46 + data_utf16[i] = GUINT16_TO_LE (data_utf16[i]);
49 + //field = g_convert (data, data_size, "UTF-8", in_encode, NULL, NULL, NULL);
50 + field = g_utf16_to_utf8((gunichar2 *)data, (glong)(data_size>>1), NULL, NULL, NULL);