From e5c094754157102a964364041d6fb0caf2188809 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sat, 29 Jun 2013 01:34:11 +0200 Subject: dec_sub: introduce sub_control(), use it for sub_step This means the direct libass usage can be removed from command.c, and no weird hacks for retrieving the ASS_Track are needed. Also fix a bug when using this feature with ordered chapters. --- core/command.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'core/command.c') diff --git a/core/command.c b/core/command.c index f273bda2b2..453ddbe974 100644 --- a/core/command.c +++ b/core/command.c @@ -55,7 +55,6 @@ #include "video/decode/dec_video.h" #include "audio/decode/dec_audio.h" #include "core/path.h" -#include "sub/ass_mp.h" #include "stream/tv.h" #include "stream/stream_radio.h" #include "stream/pvr.h" @@ -2087,18 +2086,18 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) } case MP_CMD_SUB_STEP: -#ifdef CONFIG_ASS if (mpctx->osd->dec_sub) { - int movement = cmd->args[0].v.i; - struct ass_track *ass_track = sub_get_ass_track(mpctx->osd->dec_sub); - if (ass_track) { + double a[2]; + a[0] = mpctx->video_pts - mpctx->osd->video_offset + opts->sub_delay; + a[1] = cmd->args[0].v.i; + if (sub_control(mpctx->osd->dec_sub, SD_CTRL_SUB_STEP, a) > 0) { + opts->sub_delay += a[0]; + + osd_changed_all(mpctx->osd); set_osd_tmsg(mpctx, OSD_MSG_SUB_DELAY, osdl, osd_duration, "Sub delay: %d ms", ROUND(opts->sub_delay * 1000)); - double cur = (mpctx->video_pts + opts->sub_delay) * 1000 + .5; - opts->sub_delay += ass_step_sub(ass_track, cur, movement) / 1000.; } } -#endif break; case MP_CMD_OSD: { -- cgit v1.2.3