mirror of https://github.com/mpv-player/mpv
command: fix sub-seek while paused without a video
When using sub-seek without a video track while paused, adding the 0.01 SUB_SEEK_OFFSET to the new timestamp is not enough to show the new subtitle line. Add 0.1 instead to fix it. 0.01 is already enough for sub-step.
This commit is contained in:
parent
b564d5916e
commit
b35e34ae2f
|
@ -5445,6 +5445,14 @@ static void cmd_sub_step_seek(void *p)
|
||||||
track_ind == 0 ? "sub-delay" : "secondary-sub-delay",
|
track_ind == 0 ? "sub-delay" : "secondary-sub-delay",
|
||||||
cmd->on_osd);
|
cmd->on_osd);
|
||||||
} else {
|
} else {
|
||||||
|
// We can easily seek/step to the wrong subtitle line (because
|
||||||
|
// video frame PTS and sub PTS rarely match exactly).
|
||||||
|
// sub/sd_ass.c adds SUB_SEEK_OFFSET as a workaround, and we
|
||||||
|
// need an even bigger offset without a video.
|
||||||
|
if (!mpctx->current_track[0][STREAM_VIDEO] ||
|
||||||
|
mpctx->current_track[0][STREAM_VIDEO]->image) {
|
||||||
|
a[0] += SUB_SEEK_WITHOUT_VIDEO_OFFSET - SUB_SEEK_OFFSET;
|
||||||
|
}
|
||||||
mark_seek(mpctx);
|
mark_seek(mpctx);
|
||||||
queue_seek(mpctx, MPSEEK_ABSOLUTE, a[0], MPSEEK_EXACT,
|
queue_seek(mpctx, MPSEEK_ABSOLUTE, a[0], MPSEEK_EXACT,
|
||||||
MPSEEK_FLAG_DELAY);
|
MPSEEK_FLAG_DELAY);
|
||||||
|
|
1
sub/sd.h
1
sub/sd.h
|
@ -11,6 +11,7 @@
|
||||||
#define SUB_GAP_KEEP 0.4
|
#define SUB_GAP_KEEP 0.4
|
||||||
// slight offset when sub seeking or sub stepping
|
// slight offset when sub seeking or sub stepping
|
||||||
#define SUB_SEEK_OFFSET 0.01
|
#define SUB_SEEK_OFFSET 0.01
|
||||||
|
#define SUB_SEEK_WITHOUT_VIDEO_OFFSET 0.1
|
||||||
|
|
||||||
struct sd {
|
struct sd {
|
||||||
struct mpv_global *global;
|
struct mpv_global *global;
|
||||||
|
|
Loading…
Reference in New Issue