diff options
author | Zuxy Meng <zuxy.meng@gmail.com> | 2006-11-06 10:32:48 +0000 |
---|---|---|
committer | Guillaume Poirier <gpoirier@mplayerhq.hu> | 2006-11-06 10:32:48 +0000 |
commit | 360932f76d30862ed6b7d325d0f31756f5b5da7c (patch) | |
tree | 1e416cddb9c708720944aa6184646e086ccc1e19 /libavcodec/flacenc.c | |
parent | f4e31985da4ba620bb32347c0ef30de71727116c (diff) | |
download | ffmpeg-360932f76d30862ed6b7d325d0f31756f5b5da7c.tar.gz |
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
Originally committed as revision 6911 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec/flacenc.c')
-rw-r--r-- | libavcodec/flacenc.c | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/libavcodec/flacenc.c b/libavcodec/flacenc.c index 73f0bb416f..b7b7d0d8e6 100644 --- a/libavcodec/flacenc.c +++ b/libavcodec/flacenc.c @@ -1122,20 +1122,8 @@ static void put_sbits(PutBitContext *pb, int bits, int32_t val) 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) |