summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorTsukasa OMOTO <henry0312@gmail.com>2014-06-30 02:44:32 +0900
committerwm4 <wm4@nowhere>2014-06-29 20:39:49 +0200
commit1aef780b6cd7743df7e21cfb7dc45ad5f99e0825 (patch)
treec47f0ffdee6c8fc0857155946dc8b25082f5c125 /player
parenta73415584c9dbf920ec14d26d0b0629cae81b3d5 (diff)
downloadmpv-1aef780b6cd7743df7e21cfb7dc45ad5f99e0825.tar.bz2
mpv-1aef780b6cd7743df7e21cfb7dc45ad5f99e0825.tar.xz
options: support setting start time relative to start PTS
Signed-off-by: wm4 <wm4@nowhere>
Diffstat (limited to 'player')
-rw-r--r--player/misc.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/player/misc.c b/player/misc.c
index 6eae646242..6aa58863e8 100644
--- a/player/misc.c
+++ b/player/misc.c
@@ -53,12 +53,17 @@ double get_relative_time(struct MPContext *mpctx)
double rel_time_to_abs(struct MPContext *mpctx, struct m_rel_time t)
{
double length = get_time_length(mpctx);
+ double start = get_start_time(mpctx);
switch (t.type) {
case REL_TIME_ABSOLUTE:
return t.pos;
- case REL_TIME_NEGATIVE:
- if (length != 0)
- return MPMAX(length - t.pos, 0.0);
+ case REL_TIME_RELATIVE:
+ if (t.pos >= 0) {
+ return start + t.pos;
+ } else {
+ if (length != 0)
+ return MPMAX(start + length + t.pos, 0.0);
+ }
break;
case REL_TIME_PERCENT:
if (length != 0)