summaryrefslogtreecommitdiffstats
path: root/player/misc.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-08-15 23:32:37 +0200
committerwm4 <wm4@nowhere>2014-08-15 23:32:37 +0200
commitfa7c421588cb856481a948d2a95eef7c9e228b45 (patch)
tree34ca0ab3d1cac35135b07cb67d4646221d140158 /player/misc.c
parent318e8da25071a76a3d88944304ae91f6d25d7f43 (diff)
downloadmpv-fa7c421588cb856481a948d2a95eef7c9e228b45.tar.bz2
mpv-fa7c421588cb856481a948d2a95eef7c9e228b45.tar.xz
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.
Diffstat (limited to 'player/misc.c')
-rw-r--r--player/misc.c10
1 files changed, 10 insertions, 0 deletions
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) {