diff options
author | wm4 <wm4@nowhere> | 2013-06-24 23:52:53 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-06-25 00:11:57 +0200 |
commit | 125c20bd081a7d99681f3ac25174c1360b885436 (patch) | |
tree | f5bb546c0965b6dc9291c35423e79f25d9748d9f /sub/dec_sub.c | |
parent | f48829b546095bd33e243332c965ab58d6481160 (diff) | |
download | mpv-125c20bd081a7d99681f3ac25174c1360b885436.tar.bz2 mpv-125c20bd081a7d99681f3ac25174c1360b885436.tar.xz |
dec_sub: add hack to display last MicroDVD subtitle event
The old subreader.c infrastructure handled this in a similar way.
Diffstat (limited to 'sub/dec_sub.c')
-rw-r--r-- | sub/dec_sub.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/sub/dec_sub.c b/sub/dec_sub.c index 56ed2a3d6f..968ca3e39f 100644 --- a/sub/dec_sub.c +++ b/sub/dec_sub.c @@ -411,6 +411,17 @@ bool sub_read_all_packets(struct dec_sub *sub, struct sh_sub *sh) if (!opts->suboverlap_enabled) fix_overlaps_and_gaps(subs); + if (sh->gsh->codec && strcmp(sh->gsh->codec, "microdvd") == 0) { + // The last subtitle event in MicroDVD subs can have duration unset, + // which means show the subtitle until end of video. + // See FFmpeg FATE MicroDVD_capability_tester.sub + if (subs->num_packets) { + struct demux_packet *last = subs->packets[subs->num_packets - 1]; + if (last->duration <= 0) + last->duration = 10; // arbitrary + } + } + add_sub_list(sub, preprocess, subs); talloc_free(subs); |