changeset 4149:3118e8afb8a5 libavcodec

Fix ASF format parser's broken UTF-16 string handling 1. Add a PUT_UTF8 macro to common.h; code borrowed from libavcodec/flacenc.c. 2. Make use of the macro in flacenc.c Patch by Zuxy Meng % zuxy P meng A gmail P com % Original thread: Date: Nov 5, 2006 9:56 AM Subject: [Ffmpeg-devel] PUT_UTF8 & asf format enhancement
author gpoirier
date Mon, 06 Nov 2006 10:32:48 +0000
parents 228252c41929
children 2205aefb22b7
files flacenc.c
diffstat 1 files changed, 2 insertions(+), 14 deletions(-) [+]
line wrap: on
line diff
--- a/flacenc.c	Mon Nov 06 06:13:29 2006 +0000
+++ b/flacenc.c	Mon Nov 06 10:32:48 2006 +0000
@@ -1122,20 +1122,8 @@
 
 static void write_utf8(PutBitContext *pb, uint32_t val)
 {
-    int bytes, shift;
-
-    if(val < 0x80){
-        put_bits(pb, 8, val);
-        return;
-    }
-
-    bytes= (av_log2(val)+4) / 5;
-    shift = (bytes - 1) * 6;
-    put_bits(pb, 8, (256 - (256>>bytes)) | (val >> shift));
-    while(shift >= 6){
-        shift -= 6;
-        put_bits(pb, 8, 0x80 | ((val >> shift) & 0x3F));
-    }
+    uint8_t tmp;
+    PUT_UTF8(val, tmp, put_bits(pb, 8, tmp);)
 }
 
 static void output_frame_header(FlacEncodeContext *s)