Mercurial > libavformat.hg
changeset 3459:a79f6237c3d2 libavformat
move utf8 code before udta func, will be used by 3gp tags
author | bcoudurier |
---|---|
date | Wed, 11 Jun 2008 09:35:02 +0000 |
parents | 1ccb0b1813c9 |
children | bd563026a5af |
files | movenc.c |
diffstat | 1 files changed, 27 insertions(+), 27 deletions(-) [+] |
line wrap: on
line diff
--- a/movenc.c Wed Jun 11 09:33:35 2008 +0000 +++ b/movenc.c Wed Jun 11 09:35:02 2008 +0000 @@ -1189,6 +1189,33 @@ return size; } +static int utf8len(const uint8_t *b) +{ + int len=0; + int val; + while(*b){ + GET_UTF8(val, *b++, return -1;) + len++; + } + return len; +} + +static int ascii_to_wc(ByteIOContext *pb, const uint8_t *b) +{ + int val; + while(*b){ + GET_UTF8(val, *b++, return -1;) + put_be16(pb, val); + } + put_be16(pb, 0x00); + return 0; +} + +static uint16_t language_code(const char *str) +{ + return (((str[0]-0x60) & 0x1F) << 10) + (((str[1]-0x60) & 0x1F) << 5) + ((str[2]-0x60) & 0x1F); +} + static int mov_write_udta_tag(ByteIOContext *pb, MOVContext *mov, AVFormatContext *s) { @@ -1227,33 +1254,6 @@ return 0; } -static int utf8len(const uint8_t *b) -{ - int len=0; - int val; - while(*b){ - GET_UTF8(val, *b++, return -1;) - len++; - } - return len; -} - -static int ascii_to_wc(ByteIOContext *pb, const uint8_t *b) -{ - int val; - while(*b){ - GET_UTF8(val, *b++, return -1;) - put_be16(pb, val); - } - put_be16(pb, 0x00); - return 0; -} - -static uint16_t language_code(const char *str) -{ - return (((str[0]-0x60) & 0x1F) << 10) + (((str[1]-0x60) & 0x1F) << 5) + ((str[2]-0x60) & 0x1F); -} - static void mov_write_psp_udta_tag(ByteIOContext *pb, const char *str, const char *lang, int type) {