diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-08-12 15:28:01 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2006-08-12 15:28:01 +0000 |
commit | 288c14e3aef1947b7fec48f0eb2654660be2959a (patch) | |
tree | ce1bfa2aa2480a8ad2c5a1ee1f1df36009956691 /libvo | |
parent | acd227a12525446900efe7980f8c248ece6edb41 (diff) | |
download | mpv-288c14e3aef1947b7fec48f0eb2654660be2959a.tar.bz2 mpv-288c14e3aef1947b7fec48f0eb2654660be2959a.tar.xz |
Reuse UTF-8 reading code in libavutil
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19372 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libvo')
-rw-r--r-- | libvo/sub.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/libvo/sub.c b/libvo/sub.c index cbf3e5bedd..6af8819060 100644 --- a/libvo/sub.c +++ b/libvo/sub.c @@ -14,6 +14,7 @@ #include "font_load.h" #include "sub.h" #include "spudec.h" +#include "libavutil/common.h" #define NEW_SPLITTING @@ -142,23 +143,8 @@ inline static void vo_draw_text_from_buffer(mp_osd_obj_t* obj,void (*draw_alpha) unsigned utf8_get_char(char **str) { uint8_t *strp = (uint8_t *)*str; - unsigned c = *strp++; - unsigned mask = 0x80; - int len = -1; - while (c & mask) { - mask >>= 1; - len++; - } - if (len <= 0 || len > 4) - goto no_utf8; - c &= mask - 1; - while ((*strp & 0xc0) == 0x80) { - if (len-- <= 0) - goto no_utf8; - c = (c << 6) | (*strp++ & 0x3f); - } - if (len) - goto no_utf8; + unsigned c; + GET_UTF8(c, *strp++, goto no_utf8;); *str = (char *)strp; return c; |