diff options
author | Dudemanguy <random342@airmail.cc> | 2023-09-27 21:52:44 -0500 |
---|---|---|
committer | Dudemanguy <random342@airmail.cc> | 2023-09-27 22:38:13 -0500 |
commit | f40bbfec4fcd2d9a787a4d98ec7698a646e5607e (patch) | |
tree | 5fcf3c8c80548e578d6cc6f730c5cc5f33ea6e85 /demux/demux.h | |
parent | 09b04fbf0940151f5856aa4396f9b467622371a3 (diff) | |
download | mpv-f40bbfec4fcd2d9a787a4d98ec7698a646e5607e.tar.bz2 mpv-f40bbfec4fcd2d9a787a4d98ec7698a646e5607e.tar.xz |
demux: improve stream selection state
This replaces the previous commit and makes more sense. The internal
demux marked tracks as eager depending on their type and for subtitles
it would always lazily read them unless there happened to be no
available av stream. However, we want the sub stream to be eager if the
player is paused. The existing subtitle is still preserved on the
screen, but if the user changes tracks that's when the problem occurs.
So to handle this case, propagate the mpctx->paused down to the stream
selection logic. This modifies both demuxer_refresh_track and
demuxer_select_track to take that boolean value. A few other parts of
the player use this, but we can just assume false there (no change in
behavior from before) since they should never be related to subtitles.
The core player code is aware of its own state naturally, and can always
pass the appropriate value so go ahead and do so. When we change the
pause state, a refresh seek is done on all existing subtitle tracks to
make sure their eager state is the appropriate value (i.e. so it's not
still set to eager after a pause and a track switch). Slightly invasive
change, but it works with the existing logic instead of going around it
so ultimately it should be a better approach. We can additionally remove
the old force boolean from sub_read_packets since it is no longer
needed.
Diffstat (limited to 'demux/demux.h')
-rw-r--r-- | demux/demux.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/demux/demux.h b/demux/demux.h index 08904f26cc..4582c544e7 100644 --- a/demux/demux.h +++ b/demux/demux.h @@ -319,9 +319,9 @@ void demux_get_reader_state(struct demuxer *demuxer, struct demux_reader_state * void demux_block_reading(struct demuxer *demuxer, bool block); void demuxer_select_track(struct demuxer *demuxer, struct sh_stream *stream, - double ref_pts, bool selected); + double ref_pts, bool selected, bool paused); void demuxer_refresh_track(struct demuxer *demuxer, struct sh_stream *stream, - double ref_pts); + double ref_pts, bool paused); int demuxer_help(struct mp_log *log, const m_option_t *opt, struct bstr name); |