summaryrefslogtreecommitdiffstats
path: root/command.c
diff options
context:
space:
mode:
authorUoti Urpala <uau@glyph.nonexistent.invalid>2010-12-14 22:31:39 +0200
committerUoti Urpala <uau@glyph.nonexistent.invalid>2010-12-14 22:33:12 +0200
commitff706ee86d4ca1e31de6c6c322a3bedb819ead05 (patch)
tree91d1906a2ad112e8864824661df8a1f9dbc0bd9b /command.c
parent4f610adfc29a2aa2f1159ded016ca4f8960c52e9 (diff)
downloadmpv-ff706ee86d4ca1e31de6c6c322a3bedb819ead05.tar.bz2
mpv-ff706ee86d4ca1e31de6c6c322a3bedb819ead05.tar.xz
core: avoid using sh_video->pts as "current pts"
Add a new field "video_pts" to mpctx. It records the time of the last frame flipped visible on VO. Change various code which used sh_video->pts to use either the new field or get_current_time(mpctx).
Diffstat (limited to 'command.c')
-rw-r--r--command.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/command.c b/command.c
index 4ffe29a351..489cd2d047 100644
--- a/command.c
+++ b/command.c
@@ -2689,14 +2689,12 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
abs = (cmd->nargs > 1) ? cmd->args[1].v.i : 0;
if (abs == 2) { /* Absolute seek to a specific timestamp in seconds */
mpctx->abs_seek_pos = SEEK_ABSOLUTE;
- if (sh_video)
- mpctx->osd_function =
- (v > sh_video->pts) ? OSD_FFW : OSD_REW;
+ mpctx->osd_function = v > get_current_time(mpctx) ?
+ OSD_FFW : OSD_REW;
mpctx->rel_seek_secs = v;
} else if (abs) { /* Absolute seek by percentage */
mpctx->abs_seek_pos = SEEK_ABSOLUTE | SEEK_FACTOR;
- if (sh_video)
- mpctx->osd_function = OSD_FFW; // Direction isn't set correctly
+ mpctx->osd_function = OSD_FFW; // Direction isn't set correctly
mpctx->rel_seek_secs = v / 100.0;
} else {
mpctx->rel_seek_secs += v;
@@ -2905,12 +2903,12 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd)
case MP_CMD_SUB_STEP:
if (sh_video) {
int movement = cmd->args[0].v.i;
- step_sub(subdata, sh_video->pts, movement);
+ step_sub(subdata, mpctx->video_pts, movement);
#ifdef CONFIG_ASS
if (ass_track)
sub_delay +=
ass_step_sub(ass_track,
- (sh_video->pts +
+ (mpctx->video_pts +
sub_delay) * 1000 + .5, movement) / 1000.;
#endif
set_osd_tmsg(OSD_MSG_SUB_DELAY, 1, osd_duration,