diff options
author | wm4 <wm4@nowhere> | 2014-12-10 14:42:57 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2014-12-10 14:42:57 +0100 |
commit | c6dc0c6d99593a809803b1bf4bcc183b084f9b79 (patch) | |
tree | 1a5bac3b687a73e479a4b17bbdcd73de848db59d /player | |
parent | 10a2f69347b3e2889435eeae7e427ab029555e31 (diff) | |
download | mpv-c6dc0c6d99593a809803b1bf4bcc183b084f9b79.tar.bz2 mpv-c6dc0c6d99593a809803b1bf4bcc183b084f9b79.tar.xz |
command: add "idle" property
Yes, it's redundant with events.
Diffstat (limited to 'player')
-rw-r--r-- | player/command.c | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/player/command.c b/player/command.c index 851437ca0a..0e7c505104 100644 --- a/player/command.c +++ b/player/command.c @@ -72,6 +72,8 @@ #include "core.h" struct command_ctx { + bool is_idle; + double last_seek_time; double last_seek_pts; @@ -1160,6 +1162,14 @@ static int mp_property_core_idle(void *ctx, struct m_property *prop, return m_property_flag_ro(action, arg, idle); } +static int mp_property_idle(void *ctx, struct m_property *prop, + int action, void *arg) +{ + MPContext *mpctx = ctx; + struct command_ctx *cmd = mpctx->command_ctx; + return m_property_flag_ro(action, arg, cmd->is_idle); +} + static int mp_property_eof_reached(void *ctx, struct m_property *prop, int action, void *arg) { @@ -3195,6 +3205,7 @@ static const struct m_property mp_properties[] = { {"hr-seek", mp_property_generic_option}, {"clock", mp_property_clock}, {"seekable", mp_property_seekable}, + {"idle", mp_property_idle}, {"chapter-list", mp_property_list_chapters}, {"track-list", property_list_tracks}, @@ -4633,9 +4644,12 @@ static void command_event(struct MPContext *mpctx, int event, void *arg) } ctx->prev_pts = now; } - if (event == MPV_EVENT_SEEK) { + if (event == MPV_EVENT_SEEK) ctx->prev_pts = MP_NOPTS_VALUE; - } + if (event == MPV_EVENT_IDLE) + ctx->is_idle = true; + if (event == MPV_EVENT_START_FILE) + ctx->is_idle = false; } void mp_notify(struct MPContext *mpctx, int event, void *arg) |