From fa7c421588cb856481a948d2a95eef7c9e228b45 Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 15 Aug 2014 23:32:37 +0200 Subject: player: use virtual time for --audio-file with ordered chapters Apparently users prefer this behavior. It was used for subtitles too, so move the code to calculate the video offset into a separate function. Seeking also needs to be fixed. Fixes #1018. --- player/misc.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'player/misc.c') diff --git a/player/misc.c b/player/misc.c index a5f21ba3a5..bc3a1980c9 100644 --- a/player/misc.c +++ b/player/misc.c @@ -113,6 +113,16 @@ double get_start_time(struct MPContext *mpctx) return mpctx->demuxer ? mpctx->demuxer->start_time : 0; } +// Get the offset from the given track to the video. +double get_track_video_offset(struct MPContext *mpctx, struct track *track) +{ + if (track && track->under_timeline) + return mpctx->video_offset; + if (track && track->is_external) + return get_start_time(mpctx); + return 0; +} + float mp_get_cache_percent(struct MPContext *mpctx) { if (mpctx->demuxer) { -- cgit v1.2.3