summaryrefslogtreecommitdiffstats
path: root/options
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 /options
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 'options')
-rw-r--r--options/m_option.c7
-rw-r--r--options/m_option.h2
2 files changed, 6 insertions, 3 deletions
diff --git a/options/m_option.c b/options/m_option.c
index 04b4783dc1..3baaaa6762 100644
--- a/options/m_option.c
+++ b/options/m_option.c
@@ -2181,10 +2181,13 @@ static int parse_rel_time(struct mp_log *log, const m_option_t *opt,
}
}
- bool sign = bstr_eatstart0(&param, "-");
double time;
if (parse_timestring(param, &time, 0)) {
- t.type = sign ? REL_TIME_NEGATIVE : REL_TIME_ABSOLUTE;
+ if (bstr_startswith0(param, "+") || bstr_startswith0(param, "-")) {
+ t.type = REL_TIME_RELATIVE;
+ } else {
+ t.type = REL_TIME_ABSOLUTE;
+ }
t.pos = time;
goto out;
}
diff --git a/options/m_option.h b/options/m_option.h
index 02fcb9bfca..13afea22df 100644
--- a/options/m_option.h
+++ b/options/m_option.h
@@ -70,7 +70,7 @@ typedef void (*m_opt_print_fn)(struct mp_log *log);
enum m_rel_time_type {
REL_TIME_NONE,
REL_TIME_ABSOLUTE,
- REL_TIME_NEGATIVE,
+ REL_TIME_RELATIVE,
REL_TIME_PERCENT,
REL_TIME_CHAPTER,
};