Skip to content

Commit

Permalink
改变 pause 命令格式
Browse files Browse the repository at this point in the history
  • Loading branch information
niltsh committed Aug 11, 2012
1 parent 43a8cf0 commit 761dba8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 13 deletions.
8 changes: 5 additions & 3 deletions command.c
Original file line number Diff line number Diff line change
Expand Up @@ -2737,9 +2737,11 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd)

case MP_CMD_FRAME_STEP:
case MP_CMD_PAUSE:
cmd->pausing = 1;
brk_cmd = 1;
break;
if (cmd->args[0].v.i != -1) {
cmd->pausing = 1;
brk_cmd = 1;
}
break;

case MP_CMD_FILE_FILTER:
file_filter = cmd->args[0].v.i;
Expand Down
2 changes: 1 addition & 1 deletion input/input.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ static const mp_cmd_t mp_cmds[] = {
{ MP_CMD_SPEED_SET, "speed_set", 1, { {MP_CMD_ARG_FLOAT,{0}}, {-1,{0}} } },
{ MP_CMD_QUIT, "quit", 0, { {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
{ MP_CMD_STOP, "stop", 0, { {-1,{0}} } },
{ MP_CMD_PAUSE, "pause", 0, { {-1,{0}} } },
{ MP_CMD_PAUSE, "pause", 1, { {MP_CMD_ARG_INT,{0}}, {-1,{0}} } },
{ MP_CMD_FRAME_STEP, "frame_step", 0, { {-1,{0}} } },
{ MP_CMD_PLAY_TREE_STEP, "pt_step",1, { { MP_CMD_ARG_INT ,{0}}, { MP_CMD_ARG_INT ,{0}}, {-1,{0}} } },
{ MP_CMD_PLAY_TREE_UP_STEP, "pt_up_step",1, { { MP_CMD_ARG_INT,{0} }, { MP_CMD_ARG_INT ,{0}}, {-1,{0}} } },
Expand Down
25 changes: 16 additions & 9 deletions mplayer.c
Original file line number Diff line number Diff line change
Expand Up @@ -2546,12 +2546,23 @@ static void pause_loop(void)
if (mpctx->audio_out && mpctx->sh_audio)
mpctx->audio_out->pause(); // pause audio, keep data if possible

while ((cmd = mp_input_get_cmd(20, 1, 1)) == NULL || cmd->pausing == 4) {
while ((cmd = mp_input_get_cmd(20, 1, 1)) == NULL || (cmd->pausing == 4) || (cmd->id == MP_CMD_PAUSE)) {
if (cmd) {
cmd = mp_input_get_cmd(0, 1, 0);
run_command(mpctx, cmd);
mp_cmd_free(cmd);
continue;
if (cmd->id == MP_CMD_PAUSE) {
mp_msg(MSGT_IDENTIFY, MSGL_INFO, "pause args:%d\n", cmd->args[0].v.i);

mp_input_get_cmd(0, 1, 0);
mp_cmd_free(cmd);

if (cmd->args[0].v.i != 1) {
break;
}
} else {
cmd = mp_input_get_cmd(0, 1, 0);
run_command(mpctx, cmd);
mp_cmd_free(cmd);
}
continue;
}
if (mpctx->sh_video && mpctx->video_out && vo_config_count)
mpctx->video_out->check_events();
Expand Down Expand Up @@ -2586,10 +2597,6 @@ static void pause_loop(void)
handle_udp_master(mpctx->sh_video->pts);
usec_sleep(20000);
}
if (cmd && cmd->id == MP_CMD_PAUSE) {
cmd = mp_input_get_cmd(0, 1, 0);
mp_cmd_free(cmd);
}
mpctx->osd_function = OSD_PLAY;
if (mpctx->audio_out && mpctx->sh_audio) {
if (mpctx->eof) // do not play remaining audio if we e.g. switch to the next file
Expand Down

0 comments on commit 761dba8

Please sign in to comment.