mirror of https://github.com/mpv-player/mpv
mplayer: make --frames=1 work for audio
This has the same (useless) definition as frame stepping in audio-only mode: one frame means one playloop iteration. (It's relatively useless, because one playloop iteration has a random duration. But it makes --frames=1 work, which is useful again.)
This commit is contained in:
parent
140636c407
commit
54e8e0a502
|
@ -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).
|
||||
|
|
|
@ -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;
|
||||
|
||||
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;
|
||||
}
|
||||
break;
|
||||
} // video
|
||||
|
||||
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);
|
||||
|
|
Loading…
Reference in New Issue