summaryrefslogtreecommitdiffstats
path: root/sub
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2012-11-22 00:08:58 +0200
committerwm4 <wm4@nowhere>2012-12-03 21:08:52 +0100
commit72205635abe7f240118658d934b5db871a184201 (patch)
tree795038dcb1595a7e77103c97608c8b51b8be9894 /sub
parent3486f59fe28efa81ce6951208b94cec91ad6cdb8 (diff)
downloadmpv-72205635abe7f240118658d934b5db871a184201.tar.bz2
mpv-72205635abe7f240118658d934b5db871a184201.tar.xz
subs: remove --utf8, simplify code
Remove the options --utf8 and --unicode which had no effect any more (what they once did should be doable with --subcp). The only use of corresponding variables left in code was subreader.c code using sub_utf8 as a flag indicating whether iconv conversion was active. Change the code to test the existence of iconv context instead. Conflicts: DOCS/man/en/options.rst core/cfg-mplayer.h sub/sub.c sub/sub.h sub/subreader.c Merged from mplayer2 commit ea7311. Note: --unicode was already removed
Diffstat (limited to 'sub')
-rw-r--r--sub/sub.c1
-rw-r--r--sub/sub.h2
-rw-r--r--sub/subreader.c24
3 files changed, 5 insertions, 22 deletions
diff --git a/sub/sub.c b/sub/sub.c
index 0dae442aee..56d85141a7 100644
--- a/sub/sub.c
+++ b/sub/sub.c
@@ -58,7 +58,6 @@ char * const sub_osd_names[]={
};
char * const sub_osd_names_short[] ={ "", "|>", "||", "[]", "<<" , ">>", "", "", "", "", "", "", "" };
-int sub_utf8=0;
int sub_pos=100;
int sub_visibility=1;
diff --git a/sub/sub.h b/sub/sub.h
index 4fe052d8b2..0de36fedb5 100644
--- a/sub/sub.h
+++ b/sub/sub.h
@@ -195,8 +195,6 @@ extern const struct m_sub_options osd_style_conf;
extern char * const sub_osd_names[];
extern char * const sub_osd_names_short[];
-extern int sub_utf8;
-
extern char *sub_cp;
extern int sub_pos;
diff --git a/sub/subreader.c b/sub/subreader.c
index 826bc3577b..c7b69d711c 100644
--- a/sub/subreader.c
+++ b/sub/subreader.c
@@ -1166,9 +1166,6 @@ static int sub_autodetect (stream_t* st, int *uses_time, int utf16) {
return SUB_INVALID; // too many bad lines
}
-extern int sub_utf8;
-int sub_utf8_prev=0;
-
extern float sub_delay;
extern float sub_fps;
@@ -1196,7 +1193,6 @@ void subcp_open (stream_t *st)
#endif
if ((icdsc = iconv_open (tocp, cp_tmp)) != (iconv_t)(-1)){
mp_msg(MSGT_SUBREADER,MSGL_V,"SUB: opened iconv descriptor.\n");
- sub_utf8 = 2;
} else
mp_msg(MSGT_SUBREADER,MSGL_ERR,"SUB: error opening iconv descriptor.\n");
}
@@ -1223,10 +1219,8 @@ subtitle* subcp_recode (subtitle *sub)
ileft = strlen(ip);
oleft = 4 * ileft;
- if (!(ot = malloc(oleft + 1))){
- mp_msg(MSGT_SUBREADER,MSGL_WARN,"SUB: error allocating mem.\n");
- continue;
- }
+ if (!(ot = malloc(oleft + 1)))
+ abort();
op = ot;
if (iconv(icdsc, &ip, &ileft,
&op, &oleft) == (size_t)(-1)) {
@@ -1424,7 +1418,6 @@ sub_data* sub_read_file(char *filename, float fps, struct MPOpts *opts)
mp_msg(MSGT_SUBREADER, MSGL_V, "SUB: Detected subtitle file format: %s\n", srp->name);
#ifdef CONFIG_ICONV
- sub_utf8_prev=sub_utf8;
{
int l,k;
k = -1;
@@ -1432,7 +1425,6 @@ sub_data* sub_read_file(char *filename, float fps, struct MPOpts *opts)
char *exts[] = {".utf", ".utf8", ".utf-8" };
for (k=3;--k>=0;)
if (l >= strlen(exts[k]) && !strcasecmp(filename+(l - strlen(exts[k])), exts[k])){
- sub_utf8 = 1;
break;
}
}
@@ -1442,14 +1434,8 @@ sub_data* sub_read_file(char *filename, float fps, struct MPOpts *opts)
sub_num=0;n_max=32;
first=malloc(n_max*sizeof(subtitle));
- if(!first){
-#ifdef CONFIG_ICONV
- subcp_close();
- sub_utf8=sub_utf8_prev;
-#endif
- free_stream(fd);
- return NULL;
- }
+ if (!first)
+ abort();
#ifdef CONFIG_SORTSUB
alloced_sub =
@@ -1470,7 +1456,7 @@ sub_data* sub_read_file(char *filename, float fps, struct MPOpts *opts)
sub=srp->read(fd, sub, &(struct readline_args){utf16, opts});
if(!sub) break; // EOF
#ifdef CONFIG_ICONV
- if ((sub!=ERR) && sub_utf8 == 2) sub=subcp_recode(sub);
+ if (sub!=ERR) sub=subcp_recode(sub);
#endif
if ( sub == ERR )
{