summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-03-25 22:57:24 +0100
committerwm4 <wm4@nowhere>2013-03-26 01:29:53 +0100
commit54e8e0a50207283d1cbe595e69e5cd10c346ed40 (patch)
treeb3241d1d61876556d9410a723b75743c212f9c9e /core
parent140636c407fe8d999fd86ab22c15df3e9d82f0e8 (diff)
downloadmpv-54e8e0a50207283d1cbe595e69e5cd10c346ed40.tar.bz2
mpv-54e8e0a50207283d1cbe595e69e5cd10c346ed40.tar.xz
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.)
Diffstat (limited to 'core')
-rw-r--r--core/mplayer.c25
1 files changed, 15 insertions, 10 deletions
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);