diff options
author | wm4 <wm4@nowhere> | 2013-04-25 20:38:22 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2013-04-25 20:52:20 +0200 |
commit | 3765cfcf57e0232b5e96e77d9dd628755f1c0518 (patch) | |
tree | 8644ca978ddbc535dffc1202b03d5e3ac3fc8deb /core/command.c | |
parent | e1fccfdcd8a9efb2e3ce70cc4b7aba3e0eb91836 (diff) | |
download | mpv-3765cfcf57e0232b5e96e77d9dd628755f1c0518.tar.bz2 mpv-3765cfcf57e0232b5e96e77d9dd628755f1c0518.tar.xz |
core: simplify handling of --pause
Rename the struct MPOpts "start_pause" field to "pause". Store the user-
pause state in that field, so that both runtime pause toggling and the
--pause switch change the same variable. Simplify the initialization of
pause so that using --pause and changing the file while paused is
exactly the same case (changing the file while paused doesn't unpause,
this has been always this way).
Also make it a bit more consistent. Before, starting with --pause would
reset the pause state for every file, instead of following the usual
semantics for option switches (compare with behavior of --fs).
Diffstat (limited to 'core/command.c')
-rw-r--r-- | core/command.c | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/core/command.c b/core/command.c index 7497ea817f..05608c7df4 100644 --- a/core/command.c +++ b/core/command.c @@ -518,19 +518,15 @@ static int mp_property_pause(m_option_t *prop, int action, void *arg, { MPContext *mpctx = ctx; - switch (action) { - case M_PROPERTY_SET: + if (action == M_PROPERTY_SET) { if (*(int *)arg) { pause_player(mpctx); } else { unpause_player(mpctx); } return M_PROPERTY_OK; - case M_PROPERTY_GET: - *(int *)arg = mpctx->paused_user; - return M_PROPERTY_OK; } - return M_PROPERTY_NOT_IMPLEMENTED; + return mp_property_generic_option(prop, action, arg, ctx); } static int mp_property_cache(m_option_t *prop, int action, void *arg, @@ -1365,8 +1361,7 @@ static const m_option_t mp_properties[] = { CONF_RANGE, -2, 10, NULL }, { "metadata", mp_property_metadata, CONF_TYPE_STRING_LIST, 0, 0, 0, NULL }, - { "pause", mp_property_pause, CONF_TYPE_FLAG, - M_OPT_RANGE, 0, 1, NULL }, + M_OPTION_PROPERTY_CUSTOM("pause", mp_property_pause), { "cache", mp_property_cache, CONF_TYPE_INT }, M_OPTION_PROPERTY("pts-association-mode"), M_OPTION_PROPERTY("hr-seek"), @@ -2303,7 +2298,7 @@ void run_command(MPContext *mpctx, mp_cmd_t *cmd) pause_player(mpctx); break; case 3: // "pausing_toggle" - if (mpctx->paused_user) + if (opts->pause) unpause_player(mpctx); else pause_player(mpctx); |