summaryrefslogtreecommitdiffstats
path: root/core/mplayer.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-04-04 01:16:55 +0200
committerwm4 <wm4@nowhere>2013-04-04 01:16:55 +0200
commitf3c26b6ab40ab91853bed51045ffeab96e2fde01 (patch)
tree70c0d9e49e51740815a988c164cbae973d8b6871 /core/mplayer.c
parent840890abdd3f094c1004b5b6db1c5d321d9c9344 (diff)
downloadmpv-f3c26b6ab40ab91853bed51045ffeab96e2fde01.tar.bz2
mpv-f3c26b6ab40ab91853bed51045ffeab96e2fde01.tar.xz
mplayer: fix framestepping on ordered chapter segment boundaries
Trying to step over a segment boundary didn't work, and the video was stuck at the end of the current chapter. At this point, both video and audio of the segment has ended, and the segment switching code is going to call seek() to go to the next segment (the part of the code in run_playloop that uses end_is_chapter). However, this seek() is not called if playback is paused, and the framestepping code always paused before this code is run. Move the framestepping code below the chapter switching code. The added restart_playback condition makes sure the code is called only after at least one video frame has been shown. Also don't reset the framestep counter after seek. It's not needed, and removing it prevents full unpausing when stepping over a segment boundary. This also terminates playback when frame stepping at the end of the file. The --keep-open option can be used to get the old behavior.
Diffstat (limited to 'core/mplayer.c')
-rw-r--r--core/mplayer.c62
1 files changed, 34 insertions, 28 deletions
diff --git a/core/mplayer.c b/core/mplayer.c
index 42967dc1e5..e4b811869d 100644
--- a/core/mplayer.c
+++ b/core/mplayer.c
@@ -2692,7 +2692,6 @@ static void seek_reset(struct MPContext *mpctx, bool reset_ao, bool reset_ac)
mpctx->hrseek_active = false;
mpctx->hrseek_framedrop = false;
mpctx->total_avsync_change = 0;
- mpctx->step_frames = 0;
mpctx->drop_frame_cnt = 0;
mpctx->dropped_frames = 0;
@@ -3368,25 +3367,6 @@ static void run_playloop(struct MPContext *mpctx)
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 (new_frame_shown)
- mpctx->step_frames--;
- if (mpctx->step_frames == 0)
- pause_player(mpctx);
- }
-
if (mpctx->sh_audio && (mpctx->restart_playback ? !video_left :
mpctx->ao->untimed && (mpctx->delay <= 0 ||
!video_left))) {
@@ -3418,13 +3398,6 @@ static void run_playloop(struct MPContext *mpctx)
update_subtitles(mpctx, a_pos);
}
- if (opts->playing_msg && !mpctx->playing_msg_shown && new_frame_shown) {
- mpctx->playing_msg_shown = true;
- char *msg = mp_property_expand_string(mpctx, opts->playing_msg);
- mp_msg(MSGT_CPLAYER, MSGL_INFO, "%s\n", msg);
- talloc_free(msg);
- }
-
/* It's possible for the user to simultaneously switch both audio
* and video streams to "disabled" at runtime. Handle this by waiting
* rather than immediately stopping playback due to EOF.
@@ -3451,7 +3424,40 @@ static void run_playloop(struct MPContext *mpctx)
}, true);
} else
mpctx->stop_play = AT_END_OF_FILE;
- } else if (!mpctx->stop_play) {
+ sleeptime = 0;
+ }
+
+ if (!mpctx->stop_play && !mpctx->restart_playback) {
+
+ // 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 (opts->playing_msg && !mpctx->playing_msg_shown && new_frame_shown) {
+ mpctx->playing_msg_shown = true;
+ char *msg = mp_property_expand_string(mpctx, opts->playing_msg);
+ mp_msg(MSGT_CPLAYER, MSGL_INFO, "%s\n", msg);
+ talloc_free(msg);
+ }
+
+ 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 (new_frame_shown)
+ mpctx->step_frames--;
+ if (mpctx->step_frames == 0)
+ pause_player(mpctx);
+ }
+
+ }
+
+ if (!mpctx->stop_play) {
double audio_sleep = 9;
if (mpctx->sh_audio && !mpctx->paused) {
if (mpctx->ao->untimed) {