diff src/wma/libffwma/asf.c @ 895:5d7e6f06c9b7 trunk

[svn] - now wma can handle wide characters in metadata. - wma no longer returns tuple with empty strings. (these should be NULL instead.)
author yaz
date Sat, 24 Mar 2007 09:29:41 -0700
parents aa044d71838f
children 55703f60fd54
line wrap: on
line diff
--- a/src/wma/libffwma/asf.c	Sat Mar 24 09:08:58 2007 -0700
+++ b/src/wma/libffwma/asf.c	Sat Mar 24 09:29:41 2007 -0700
@@ -306,17 +306,21 @@
 
 static void get_str16_nolen(ByteIOContext *pb, int len, char *buf, int buf_size)
 {
-    int c;
-    char *q;
+    gchar *ucs, *uptr;
+    gchar *tmp;
+    int tmplen = len;
+
+    ucs = g_malloc0(len);
+    uptr = ucs;
 
-    q = buf;
-    while (len > 0) {
-    	c = get_le16(pb);
-	if ((q - buf) < buf_size - 1)
-	*q++ = c;
-	len-=2;
-	}
-	   *q = '\0';
+    while(tmplen > 0) {
+        *uptr++ = (gchar)get_byte(pb);
+        tmplen--;
+    }
+
+    tmp = g_convert(ucs, len, "UTF-8", "UCS-2LE", NULL, NULL, NULL);
+    g_strlcpy(buf, tmp, buf_size);
+    g_free(tmp);
 }
 
 static int asf_probe(AVProbeData *pd)