diff options
author | xylosper <darklin20@gmail.com> | 2014-02-28 23:04:10 +0900 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-02-28 20:54:58 +0100 |
commit | 70b6c163ff5077910670475f7e25842db84308cd (patch) | |
tree | b84441e3e4ec2b0404d1cbd2d9311819dba7f659 /player | |
parent | dd13e29cc22f53f75d445d00861e65a5ba6a62d9 (diff) | |
download | mpv-70b6c163ff5077910670475f7e25842db84308cd.tar.bz2 mpv-70b6c163ff5077910670475f7e25842db84308cd.tar.xz |
client API: add two properties, 'time-start' and 'seekable'
Diffstat (limited to 'player')
-rw-r--r-- | player/command.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c index 4997056be4..7b2115b12e 100644 --- a/player/command.c +++ b/player/command.c @@ -383,6 +383,15 @@ static int mp_property_percent_pos(m_option_t *prop, int action, return M_PROPERTY_NOT_IMPLEMENTED; } +static int mp_property_time_start(m_option_t *prop, int action, void *arg, + MPContext *mpctx) +{ + double start = get_start_time(mpctx); + if (start < 0) + return M_PROPERTY_UNAVAILABLE; + return property_time(prop, action, arg, start); +} + /// Current position in seconds (RW) static int mp_property_time_pos(m_option_t *prop, int action, void *arg, MPContext *mpctx) @@ -908,6 +917,14 @@ static int mp_property_clock(m_option_t *prop, int action, void *arg, return M_PROPERTY_UNAVAILABLE; } +static int mp_property_seekable(m_option_t *prop, int action, void *arg, + MPContext *mpctx) +{ + if (!mpctx->demuxer) + return M_PROPERTY_UNAVAILABLE; + return m_property_int_ro(prop, action, arg, !!mpctx->demuxer->seekable); +} + /// Volume (RW) static int mp_property_volume(m_option_t *prop, int action, void *arg, MPContext *mpctx) @@ -2076,6 +2093,8 @@ static const m_option_t mp_properties[] = { { "avsync", mp_property_avsync, CONF_TYPE_DOUBLE }, { "percent-pos", mp_property_percent_pos, CONF_TYPE_DOUBLE, M_OPT_RANGE, 0, 100, NULL }, + { "time-start", mp_property_time_start, CONF_TYPE_TIME, + M_OPT_MIN, 0, 0, NULL }, { "time-pos", mp_property_time_pos, CONF_TYPE_TIME, M_OPT_MIN, 0, 0, NULL }, { "time-remaining", mp_property_remaining, CONF_TYPE_TIME }, @@ -2098,6 +2117,8 @@ static const m_option_t mp_properties[] = { M_OPTION_PROPERTY("hr-seek"), { "clock", mp_property_clock, CONF_TYPE_STRING, 0, 0, 0, NULL }, + { "seekable", mp_property_seekable, CONF_TYPE_FLAG, + M_OPT_RANGE, 0, 1, NULL }, M_PROPERTY("chapter-list", mp_property_list_chapters), M_PROPERTY("track-list", property_list_tracks), |