0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 12:02:23 +02:00

command: use playback time as reference for sub_seek

update_subtitle() already uees playback_pts to make subtitles work
better in no-audio mode. Using get_current_time() usually gets
playback_pts, but also has the advantage that it will use the seek
target time during seeks. This will result in multiple sub_seek commands
doing the right thing (at least as long as they're far enough apart so
that seeking is actually initiated when the second command is run).
This commit is contained in:
wm4 2014-11-05 18:47:12 +01:00
parent a821e72b81
commit ea613c2592

View File

@ -4018,9 +4018,10 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd)
return -1;
struct osd_sub_state state;
get_osd_sub_state(mpctx, 0, &state);
if (state.dec_sub && mpctx->video_pts != MP_NOPTS_VALUE) {
double refpts = get_current_time(mpctx);
if (state.dec_sub && refpts != MP_NOPTS_VALUE) {
double a[2];
a[0] = mpctx->video_pts - state.video_offset - opts->sub_delay;
a[0] = refpts - state.video_offset - opts->sub_delay;
a[1] = cmd->args[0].v.i;
if (sub_control(state.dec_sub, SD_CTRL_SUB_STEP, a) > 0) {
if (cmd->id == MP_CMD_SUB_STEP) {