diff options
-rw-r--r-- | command.c | 11 | ||||
-rw-r--r-- | command.h | 2 | ||||
-rw-r--r-- | mplayer.c | 33 |
3 files changed, 18 insertions, 28 deletions
@@ -2367,12 +2367,11 @@ static const struct { }; #endif -int run_command(MPContext *mpctx, mp_cmd_t *cmd) +void run_command(MPContext *mpctx, mp_cmd_t *cmd) { struct MPOpts *opts = &mpctx->opts; sh_audio_t * const sh_audio = mpctx->sh_audio; sh_video_t * const sh_video = mpctx->sh_video; - int brk_cmd = 0; if (!set_property_command(mpctx, cmd)) switch (cmd->id) { case MP_CMD_SEEK:{ @@ -2397,7 +2396,6 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) mpctx->rel_seek_secs += v; mpctx->osd_function = (v > 0) ? OSD_FFW : OSD_REW; } - brk_cmd = 1; } break; @@ -2562,7 +2560,6 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) mpctx->stop_play = (n > 0) ? PT_NEXT_ENTRY : PT_PREV_ENTRY; if (mpctx->stop_play) mpctx->play_tree_step = n; - brk_cmd = 1; } } break; @@ -2579,7 +2576,6 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) play_tree_iter_free(i); } else mpctx->stop_play = (n > 0) ? PT_UP_NEXT : PT_UP_PREV; - brk_cmd = 1; } break; @@ -2593,7 +2589,6 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) else if (v < 0 && mpctx->playtree_iter->file > 1) mpctx->stop_play = PT_PREV_SRC; } - brk_cmd = 1; break; case MP_CMD_SUB_STEP: @@ -2676,7 +2671,6 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) pt_iter_goto_head(mpctx->playtree_iter); mpctx->stop_play = PT_NEXT_SRC; } - brk_cmd = 1; } break; @@ -2700,7 +2694,6 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) mpctx->stop_play = PT_NEXT_SRC; } } - brk_cmd = 1; } break; @@ -2710,7 +2703,6 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) (mpctx->playtree_iter, 0, 1) != PLAY_TREE_ITER_END) /* NOP */ ; mpctx->stop_play = PT_STOP; - brk_cmd = 1; break; #ifdef CONFIG_RADIO @@ -3242,5 +3234,4 @@ int run_command(MPContext *mpctx, mp_cmd_t *cmd) pause_player(mpctx); break; } - return brk_cmd; } @@ -4,7 +4,7 @@ struct MPContext; struct mp_cmd; -int run_command(struct MPContext *mpctx, struct mp_cmd *cmd); +void run_command(struct MPContext *mpctx, struct mp_cmd *cmd); char *property_expand_string(struct MPContext *mpctx, char *str); void property_print_help(void); @@ -2514,6 +2514,7 @@ static int seek(MPContext *mpctx, double amount, int style) mpctx->sh_video->last_pts = MP_NOPTS_VALUE; mpctx->num_buffered_frames = 0; mpctx->delay = 0; + mpctx->time_frame = 0; // Not all demuxers set d_video->pts during seek, so this value // (which is used by at least vobsub and edl code below) may // be completely wrong (probably 0). @@ -3743,7 +3744,7 @@ if(!mpctx->sh_audio && mpctx->d_audio->sh) { /*========================== PLAY AUDIO ============================*/ -if (mpctx->sh_audio) +if (mpctx->sh_audio && !mpctx->paused) if (!fill_audio_out_buffers(mpctx)) // at eof, all audio at least written to ao if (!mpctx->sh_video) @@ -3891,16 +3892,6 @@ if(auto_quality>0){ } #endif -//============================ Handle PAUSE =============================== - -// handle -sstep -if(step_sec>0) { - mpctx->osd_function=OSD_FFW; - mpctx->rel_seek_secs+=step_sec; -} - - edl_update(mpctx); - //================= Keyboard events, SEEKing ==================== current_module="key_events"; @@ -3908,20 +3899,28 @@ if(step_sec>0) { { while (1) { mp_cmd_t* cmd; - int brk_cmd = 0; - while( !brk_cmd && (cmd = mp_input_get_cmd(mpctx->input, 0,0,0)) != NULL) { - brk_cmd = run_command(mpctx, cmd); + while ((cmd = mp_input_get_cmd(mpctx->input, 0,0,0)) != NULL) { + run_command(mpctx, cmd); mp_cmd_free(cmd); - if (brk_cmd == 2) - goto goto_enable_cache; + if (mpctx->stop_play) + break; } - if (mpctx->paused && !mpctx->stop_play) + if (mpctx->paused && !(mpctx->stop_play || mpctx->rel_seek_secs + || mpctx->abs_seek_pos)) pause_loop(mpctx); else break; } } +// handle -sstep +if (step_sec > 0 && !mpctx->paused) { + mpctx->osd_function=OSD_FFW; + mpctx->rel_seek_secs+=step_sec; +} + + edl_update(mpctx); + /* Looping. */ if(mpctx->stop_play==AT_END_OF_FILE && opts->loop_times>=0) { mp_msg(MSGT_CPLAYER,MSGL_V,"loop_times = %d\n", opts->loop_times); |