From 419624fb068ed4e7f449fa4fd0dda8edf161ac1c Mon Sep 17 00:00:00 2001 From: wm4 Date: Fri, 14 Apr 2017 18:22:45 +0200 Subject: player: unmess pause state handling Merge the pause_player() and unpause_player() functions. Make sure the pause events are emitted properly. We can now set the internal pause state based on a predicate, instead of e.g. handle_pause_on_low_cache() making a mess to trigger the internal pause state as wanted. Preparation for some more changes. --- player/command.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index 618e47dcf0..ab2d43984a 100644 --- a/player/command.c +++ b/player/command.c @@ -1493,11 +1493,7 @@ static int mp_property_pause(void *ctx, struct m_property *prop, MPContext *mpctx = ctx; if (mpctx->playback_initialized && action == M_PROPERTY_SET) { - if (*(int *)arg) { - pause_player(mpctx); - } else { - unpause_player(mpctx); - } + set_pause_state(mpctx, *(int *)arg); return M_PROPERTY_OK; } return mp_property_generic_option(mpctx, prop, action, arg); @@ -5018,10 +5014,10 @@ int run_command(struct MPContext *mpctx, struct mp_cmd *cmd, struct mpv_node *re if (cmd->is_up_down) { if (cmd->is_up) { if (mpctx->step_frames < 1) - pause_player(mpctx); + set_pause_state(mpctx, true); } else { if (cmd->repeated) { - unpause_player(mpctx); + set_pause_state(mpctx, false); } else { add_step_frame(mpctx, 1); } -- cgit v1.2.3