diff options
author | wm4 <wm4@nowhere> | 2020-02-27 02:23:58 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2020-02-27 02:23:58 +0100 |
commit | cf2b7a4997299ff9e0ff91d4273cd294686b001f (patch) | |
tree | 21c3f4a5c83407d5e1df92ba35d5847c6eba6097 /demux/demux.h | |
parent | b873f1f8e5a0d34defe4c7b975ec584377c731ac (diff) | |
download | mpv-cf2b7a4997299ff9e0ff91d4273cd294686b001f.tar.bz2 mpv-cf2b7a4997299ff9e0ff91d4273cd294686b001f.tar.xz |
sub, demux: improve behavior with negative subtitle delay/muxed subs
A negative subtitle delay means that subtitles from the future should be
shown earlier. With muxed subtitles, subtitle packets are demuxed along
with audio and video packets. But since they are demuxed "lazily",
nothing guarantees that subtitle packets from the future are available
in time.
Typically, the user-observed effect is that subtitles do not appear at
all (or too late) with large negative --sub-delay values, but that using
--cache might fix this.
Make this behave better. Automatically extend read-ahead to as much as
needed by the subtitles. It seems it's the easiest to pass the subtitle
render timestamp to the demuxer in order to guarantee that everything is
read. This timestamp based approach might be fragile, so disable it if
no negative sub-delay is used.
As far as the player frontend part is concerned, this makes use of the
code path for external subtitles, which are not lazily demuxed, and may
already trigger waiting.
Fixes: #7484
Diffstat (limited to 'demux/demux.h')
-rw-r--r-- | demux/demux.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/demux/demux.h b/demux/demux.h index c94f690da0..263b584ad3 100644 --- a/demux/demux.h +++ b/demux/demux.h @@ -251,6 +251,8 @@ bool demux_free_async_finish(struct demux_free_async_state *state); void demuxer_feed_caption(struct sh_stream *stream, demux_packet_t *dp); int demux_read_packet_async(struct sh_stream *sh, struct demux_packet **out_pkt); +int demux_read_packet_async_until(struct sh_stream *sh, double min_pts, + struct demux_packet **out_pkt); bool demux_stream_is_selected(struct sh_stream *stream); void demux_set_stream_wakeup_cb(struct sh_stream *sh, void (*cb)(void *ctx), void *ctx); |