mirror of
https://github.com/mpv-player/mpv
synced 2025-03-24 20:31:37 +00:00
demux: set SEEK_HR for backstep seeks, move a hr-seek detail to playloop
Just rearranging shit. Setting SEEK_HR for backstep seeks actually doesn't have much meaning, but disables the weird audio snapping for "keyframe" seeks, and I don't know it's late.
This commit is contained in:
parent
ef6adce04d
commit
c66aa2b1a9
@ -1258,11 +1258,7 @@ static void perform_backward_seek(struct demux_internal *in)
|
|||||||
target -= in->opts->back_seek_size;
|
target -= in->opts->back_seek_size;
|
||||||
|
|
||||||
MP_VERBOSE(in, "triggering backward seek to get more packets\n");
|
MP_VERBOSE(in, "triggering backward seek to get more packets\n");
|
||||||
|
queue_seek(in, target, SEEK_SATAN | SEEK_HR, false);
|
||||||
// Note: we don't want it to use SEEK_FORWARD, while the player frontend
|
|
||||||
// wants it. As a fragile hack, SEEK_HR controls this.
|
|
||||||
queue_seek(in, target, SEEK_SATAN, false);
|
|
||||||
|
|
||||||
in->reading = true;
|
in->reading = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3225,11 +3221,6 @@ static bool queue_seek(struct demux_internal *in, double seek_pts, int flags,
|
|||||||
bool set_backwards = flags & SEEK_SATAN;
|
bool set_backwards = flags & SEEK_SATAN;
|
||||||
flags &= ~(unsigned)SEEK_SATAN;
|
flags &= ~(unsigned)SEEK_SATAN;
|
||||||
|
|
||||||
// For HR seeks in backward playback mode, the correct seek rounding
|
|
||||||
// direction is forward instead of backward.
|
|
||||||
if (set_backwards && (flags & SEEK_HR))
|
|
||||||
flags |= SEEK_FORWARD;
|
|
||||||
|
|
||||||
struct demux_cached_range *cache_target =
|
struct demux_cached_range *cache_target =
|
||||||
find_cache_seek_target(in, seek_pts, flags);
|
find_cache_seek_target(in, seek_pts, flags);
|
||||||
|
|
||||||
|
@ -305,6 +305,10 @@ static void mp_seek(MPContext *mpctx, struct seek_params seek)
|
|||||||
demux_flags |= SEEK_FACTOR;
|
demux_flags |= SEEK_FACTOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int play_dir = opts->play_dir;
|
||||||
|
if (play_dir < 0)
|
||||||
|
demux_flags |= SEEK_SATAN;
|
||||||
|
|
||||||
if (hr_seek) {
|
if (hr_seek) {
|
||||||
double hr_seek_offset = opts->hr_seek_demuxer_offset;
|
double hr_seek_offset = opts->hr_seek_demuxer_offset;
|
||||||
// Always try to compensate for possibly bad demuxers in "special"
|
// Always try to compensate for possibly bad demuxers in "special"
|
||||||
@ -321,15 +325,15 @@ static void mp_seek(MPContext *mpctx, struct seek_params seek)
|
|||||||
}
|
}
|
||||||
demux_pts -= hr_seek_offset;
|
demux_pts -= hr_seek_offset;
|
||||||
demux_flags = (demux_flags | SEEK_HR) & ~SEEK_FORWARD;
|
demux_flags = (demux_flags | SEEK_HR) & ~SEEK_FORWARD;
|
||||||
|
// For HR seeks in backward playback mode, the correct seek rounding
|
||||||
|
// direction is forward instead of backward.
|
||||||
|
if (play_dir < 0)
|
||||||
|
demux_flags |= SEEK_FORWARD;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!mpctx->demuxer->seekable)
|
if (!mpctx->demuxer->seekable)
|
||||||
demux_flags |= SEEK_CACHED;
|
demux_flags |= SEEK_CACHED;
|
||||||
|
|
||||||
int play_dir = opts->play_dir;
|
|
||||||
if (play_dir < 0)
|
|
||||||
demux_flags |= SEEK_SATAN;
|
|
||||||
|
|
||||||
if (!demux_seek(mpctx->demuxer, demux_pts, demux_flags)) {
|
if (!demux_seek(mpctx->demuxer, demux_pts, demux_flags)) {
|
||||||
if (!mpctx->demuxer->seekable) {
|
if (!mpctx->demuxer->seekable) {
|
||||||
MP_ERR(mpctx, "Cannot seek in this stream.\n");
|
MP_ERR(mpctx, "Cannot seek in this stream.\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user