diff options
-rw-r--r-- | DOCS/man/en/options.rst | 5 | ||||
-rw-r--r-- | core/mplayer.c | 25 |
2 files changed, 19 insertions, 11 deletions
diff --git a/DOCS/man/en/options.rst b/DOCS/man/en/options.rst index 873366da22..6651e97a67 100644 --- a/DOCS/man/en/options.rst +++ b/DOCS/man/en/options.rst @@ -651,7 +651,10 @@ *NOTE*: Practical use of this feature is questionable. Disabled by default. --frames=<number> - Play/convert only first <number> frames, then quit. + Play/convert only first <number> video frames, then quit. For audio only, + run <number> iteration of the playback loop, which is most likely not what + you want. (This behavior also applies to the corner case when there are + less video frames than <number>, and audio is longer than the video.) --fullscreen, --fs Fullscreen playback (centers movie, and paints black bands around it). diff --git a/core/mplayer.c b/core/mplayer.c index eeb875173b..ed8505251a 100644 --- a/core/mplayer.c +++ b/core/mplayer.c @@ -3158,7 +3158,7 @@ static void run_playloop(struct MPContext *mpctx) bool end_is_chapter = false; double sleeptime = get_wakeup_period(mpctx); bool was_restart = mpctx->restart_playback; - bool new_video_frame_shown = false; + bool new_frame_shown = false; #ifdef CONFIG_ENCODING if (encode_lavc_didfail(mpctx->encode_lavc_ctx)) { @@ -3342,20 +3342,25 @@ static void run_playloop(struct MPContext *mpctx) update_avsync(mpctx); print_status(mpctx); screenshot_flip(mpctx); - new_video_frame_shown = true; + new_frame_shown = true; - if (mpctx->max_frames >= 0) { - mpctx->max_frames--; - if (mpctx->max_frames <= 0) - mpctx->stop_play = PT_NEXT_ENTRY; - } break; } // video + // If no more video is available, one frame means one playloop iteration. + // Otherwise, one frame means one video frame. + if (!video_left) + new_frame_shown = true; + + if (mpctx->max_frames >= 0) { + if (new_frame_shown) + mpctx->max_frames--; + if (mpctx->max_frames <= 0) + mpctx->stop_play = PT_NEXT_ENTRY; + } + if (mpctx->step_frames > 0 && !mpctx->paused) { - // If no more video is available, one frame means one playloop iteration. - // Otherwise, one frame means one video frame. - if (!video_left || new_video_frame_shown) + if (new_frame_shown) mpctx->step_frames--; if (mpctx->step_frames == 0) pause_player(mpctx); |