Mercurial > mplayer.hg
comparison libass/ass.c @ 20503:5cbf1c33a668
Revert r20517.
author | eugeni |
---|---|
date | Sun, 29 Oct 2006 17:29:55 +0000 |
parents | 30df9a64618a |
children | f672f6921ced |
comparison
equal
deleted
inserted
replaced
20502:81a92ae66d78 | 20503:5cbf1c33a668 |
---|---|
28 #include <sys/types.h> | 28 #include <sys/types.h> |
29 #include <sys/stat.h> | 29 #include <sys/stat.h> |
30 #include <unistd.h> | 30 #include <unistd.h> |
31 #include <inttypes.h> | 31 #include <inttypes.h> |
32 | 32 |
33 #ifdef HAVE_ENCA | |
34 #include "subreader.h" // for guess_buffer_cp | |
35 #endif | |
36 | |
33 #ifdef USE_ICONV | 37 #ifdef USE_ICONV |
34 #include <iconv.h> | 38 #include <iconv.h> |
35 #endif | 39 #endif |
36 | 40 |
37 #include "mp_msg.h" | 41 #include "mp_msg.h" |
38 #include "ass.h" | 42 #include "ass.h" |
39 #include "ass_utils.h" | 43 #include "ass_utils.h" |
40 #include "ass_library.h" | 44 #include "ass_library.h" |
45 #include "libvo/sub.h" // for utf8_get_char | |
41 | 46 |
42 typedef enum {PST_UNKNOWN = 0, PST_INFO, PST_STYLES, PST_EVENTS, PST_FONTS} parser_state_t; | 47 typedef enum {PST_UNKNOWN = 0, PST_INFO, PST_STYLES, PST_EVENTS, PST_FONTS} parser_state_t; |
43 | 48 |
44 struct parser_priv_s { | 49 struct parser_priv_s { |
45 parser_state_t state; | 50 parser_state_t state; |
803 char* cp_tmp = codepage; | 808 char* cp_tmp = codepage; |
804 #ifdef HAVE_ENCA | 809 #ifdef HAVE_ENCA |
805 char enca_lang[3], enca_fallback[100]; | 810 char enca_lang[3], enca_fallback[100]; |
806 if (sscanf(codepage, "enca:%2s:%99s", enca_lang, enca_fallback) == 2 | 811 if (sscanf(codepage, "enca:%2s:%99s", enca_lang, enca_fallback) == 2 |
807 || sscanf(codepage, "ENCA:%2s:%99s", enca_lang, enca_fallback) == 2) { | 812 || sscanf(codepage, "ENCA:%2s:%99s", enca_lang, enca_fallback) == 2) { |
808 cp_tmp = ass_guess_buffer_cp((unsigned char*)data, size, enca_lang, enca_fallback); | 813 cp_tmp = guess_buffer_cp((unsigned char*)data, size, enca_lang, enca_fallback); |
809 } | 814 } |
810 #endif | 815 #endif |
811 if ((icdsc = iconv_open (tocp, cp_tmp)) != (iconv_t)(-1)){ | 816 if ((icdsc = iconv_open (tocp, cp_tmp)) != (iconv_t)(-1)){ |
812 mp_msg(MSGT_SUBREADER,MSGL_V,"LIBSUB: opened iconv descriptor.\n"); | 817 mp_msg(MSGT_SUBREADER,MSGL_V,"LIBSUB: opened iconv descriptor.\n"); |
813 } else | 818 } else |
989 int sz = strlen(name); | 994 int sz = strlen(name); |
990 | 995 |
991 q = fname = malloc(sz + 1); | 996 q = fname = malloc(sz + 1); |
992 p = name; | 997 p = name; |
993 while (*p) { | 998 while (*p) { |
994 code = ass_utf8_get_char(&p); | 999 code = utf8_get_char(&p); |
995 if (code == 0) | 1000 if (code == 0) |
996 break; | 1001 break; |
997 if ( (code > 0x7F) || | 1002 if ( (code > 0x7F) || |
998 (code == '\\') || | 1003 (code == '\\') || |
999 (code == '/') || | 1004 (code == '/') || |