summaryrefslogtreecommitdiffstats
path: root/demux
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-06-23 22:16:47 +0200
committerwm4 <wm4@nowhere>2013-06-25 00:11:56 +0200
commit29cec6f98ba523025acdd1aea42795985e32306f (patch)
treef189ce66e8a8ea39547db1b59adea7a5a793bc04 /demux
parent9ee7364172fb4feae8cba07f9244a06286fd7399 (diff)
downloadmpv-29cec6f98ba523025acdd1aea42795985e32306f.tar.bz2
mpv-29cec6f98ba523025acdd1aea42795985e32306f.tar.xz
sub: prevent subtitle conversion if subs are known UTF-8
Currently this happens only in an obscure case (reading UTF-16 files with the old subreader).
Diffstat (limited to 'demux')
-rw-r--r--demux/demux_subreader.c1
-rw-r--r--demux/stheader.h1
2 files changed, 2 insertions, 0 deletions
diff --git a/demux/demux_subreader.c b/demux/demux_subreader.c
index c25616fbd7..ca03e73c33 100644
--- a/demux/demux_subreader.c
+++ b/demux/demux_subreader.c
@@ -1348,6 +1348,7 @@ static int d_check_file(struct demuxer *demuxer)
p->sh = new_sh_stream(demuxer, STREAM_SUB);
p->sh->codec = sd->codec;
p->sh->sub->frame_based = !sd->sub_uses_time;
+ p->sh->sub->is_utf8 = sr.args.utf16 != 0; // converted from utf-16 -> utf-8
add_sub_data(demuxer, sd);
subdata_free(sd);
diff --git a/demux/stheader.h b/demux/stheader.h
index 37bdbcc568..58caa27dcd 100644
--- a/demux/stheader.h
+++ b/demux/stheader.h
@@ -164,6 +164,7 @@ typedef struct sh_sub {
unsigned char *extradata; // extra header data passed from demuxer
int extradata_len;
int frame_based; // timestamps are frame-based
+ bool is_utf8; // if false, subtitle packet charset is unknown
struct ass_track *track; // loaded by libass
struct dec_sub *dec_sub; // decoder context
} sh_sub_t;