diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2006-07-07 22:43:32 +0000 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2006-07-07 22:43:32 +0000 |
commit | 9d82b0dda1ae42e835ef4bc2c38ac1fd2753b781 (patch) | |
tree | 1ac202de9935a8d1197d56f2cf83433d511eb13e /libavcodec | |
parent | 5da714699d6e16f3a915fbe2cef9f5e9d8d77172 (diff) | |
download | ffmpeg-9d82b0dda1ae42e835ef4bc2c38ac1fd2753b781.tar.gz |
moving utf8 reading function to libavutil
Originally committed as revision 5664 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/flac.c | 47 |
1 files changed, 3 insertions, 44 deletions
diff --git a/libavcodec/flac.c b/libavcodec/flac.c index 4978d0e515..659112c77d 100644 --- a/libavcodec/flac.c +++ b/libavcodec/flac.c @@ -85,53 +85,12 @@ static int blocksize_table[] = { 256<<0, 256<<1, 256<<2, 256<<3, 256<<4, 256<<5, 256<<6, 256<<7 }; -static int64_t get_utf8(GetBitContext *gb) -{ - uint64_t val; - int ones=0, bytes; - - while(get_bits1(gb)) - ones++; - - if (ones==0) bytes=0; - else if(ones==1) return -1; - else bytes= ones - 1; - - val= get_bits(gb, 7-ones); - while(bytes--){ - const int tmp = get_bits(gb, 8); - - if((tmp>>6) != 2) - return -1; - val<<=6; - val|= tmp&0x3F; - } +static int64_t get_utf8(GetBitContext *gb){ + int64_t val; + GET_UTF8(val, get_bits(gb, 8), return -1;) return val; } -#if 0 -static int skip_utf8(GetBitContext *gb) -{ - int ones=0, bytes; - - while(get_bits1(gb)) - ones++; - - if (ones==0) bytes=0; - else if(ones==1) return -1; - else bytes= ones - 1; - - skip_bits(gb, 7-ones); - while(bytes--){ - const int tmp = get_bits(gb, 8); - - if((tmp>>6) != 2) - return -1; - } - return 0; -} -#endif - static void metadata_streaminfo(FLACContext *s); static void dump_headers(FLACContext *s); |