diff options
author | wm4 <wm4@nowhere> | 2012-12-02 01:25:33 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2012-12-03 21:08:52 +0100 |
commit | 01584151c8d04c26a54bc1c75a3ea8a7828a7396 (patch) | |
tree | aaa81a858b300d721a1d19798d92d4cb3dbf0b7a /sub | |
parent | a4177fd5814300be95a050413f18bfc89f5c93df (diff) | |
download | mpv-01584151c8d04c26a54bc1c75a3ea8a7828a7396.tar.bz2 mpv-01584151c8d04c26a54bc1c75a3ea8a7828a7396.tar.xz |
sub: clear libavformat demuxed subtitles on seeking
libavformat demuxes ass subtitles in a broken way, that forces the
player to throw away all subtitle events received so far. See mplayer
svn commit 31293.
Diffstat (limited to 'sub')
-rw-r--r-- | sub/sd_ass.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/sub/sd_ass.c b/sub/sd_ass.c index 35557ce4f9..47bcbc92cf 100644 --- a/sub/sd_ass.c +++ b/sub/sd_ass.c @@ -38,6 +38,7 @@ struct sd_ass_priv { bool vsfilter_aspect; bool incomplete_event; struct sub_bitmap *parts; + bool flush_on_seek; }; static void free_last_event(ASS_Track *track) @@ -78,6 +79,8 @@ static void decode(struct sh_sub *sh, struct osd_state *osd, void *data, if (sh->type == 'a') { // ssa/ass subs if (bstr_startswith0((bstr){data, data_len}, "Dialogue: ")) { + // broken ffmpeg ASS packet format + ctx->flush_on_seek = true; ass_process_data(track, data, data_len); } else { ass_process_chunk(track, data, data_len, @@ -160,6 +163,9 @@ static void reset(struct sh_sub *sh, struct osd_state *osd) if (ctx->incomplete_event) free_last_event(ctx->ass_track); ctx->incomplete_event = false; + if (ctx->flush_on_seek) + ass_flush_events(ctx->ass_track); + ctx->flush_on_seek = false; } static void uninit(struct sh_sub *sh) |