summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-09-01 21:02:43 +0200
committerwm4 <wm4@nowhere>2014-09-01 21:02:43 +0200
commite87617593ff12f61f45dc93e48880f95e2f7cd71 (patch)
tree465e52e59cf1a42218abadd19478c6d9d363fa5f
parent27a065182c8b80d39c1a4e908081b184421cec9d (diff)
downloadmpv-e87617593ff12f61f45dc93e48880f95e2f7cd71.tar.bz2
mpv-e87617593ff12f61f45dc93e48880f95e2f7cd71.tar.xz
player: reset playback-related fields right on start
-rw-r--r--player/loadfile.c40
1 files changed, 17 insertions, 23 deletions
diff --git a/player/loadfile.c b/player/loadfile.c
index f976832a01..a8b61b749f 100644
--- a/player/loadfile.c
+++ b/player/loadfile.c
@@ -1019,6 +1019,20 @@ static void play_current_file(struct MPContext *mpctx)
mpctx->filename = NULL;
mpctx->shown_aframes = 0;
mpctx->shown_vframes = 0;
+ mpctx->last_vo_pts = MP_NOPTS_VALUE;
+ mpctx->last_chapter_seek = -2;
+ mpctx->last_chapter_pts = MP_NOPTS_VALUE;
+ mpctx->last_chapter = -2;
+ mpctx->paused = false;
+ mpctx->paused_for_cache = false;
+ mpctx->playing_msg_shown = false;
+ mpctx->step_frames = 0;
+ mpctx->backstep_active = false;
+ mpctx->audio_delay = 0;
+ mpctx->max_frames = -1;
+ mpctx->seek = (struct seek_params){ 0 };
+
+ reset_playback_state(mpctx);
if (mpctx->playlist->current)
mpctx->filename = mpctx->playlist->current->filename;
@@ -1030,10 +1044,6 @@ static void play_current_file(struct MPContext *mpctx)
if (local_filename)
mpctx->filename = local_filename;
-#if HAVE_ENCODING
- encode_lavc_discontinuity(mpctx->encode_lavc_ctx);
-#endif
-
mpctx->add_osd_seek_info &= OSD_SEEK_INFO_EDITION;
if (opts->reset_options) {
@@ -1062,9 +1072,10 @@ static void play_current_file(struct MPContext *mpctx)
ass_set_style_overrides(mpctx->ass_library, opts->ass_force_style_list);
#endif
- MP_INFO(mpctx, "Playing: %s\n", mpctx->filename);
+ mpctx->audio_delay = opts->audio_delay;
+ mpctx->max_frames = opts->play_frames;
- //============ Open & Sync STREAM --- fork cache2 ====================
+ MP_INFO(mpctx, "Playing: %s\n", mpctx->filename);
assert(mpctx->stream == NULL);
assert(mpctx->demuxer == NULL);
@@ -1115,8 +1126,6 @@ goto_reopen_demuxer: ;
//============ Open DEMUXERS --- DETECT file type =======================
- mpctx->audio_delay = opts->audio_delay;
-
mpctx->demuxer = demux_open(mpctx->stream, opts->demuxer_name, NULL,
mpctx->global);
mpctx->master_demuxer = mpctx->demuxer;
@@ -1250,26 +1259,11 @@ goto_reopen_demuxer: ;
MP_VERBOSE(mpctx, "Starting playback...\n");
- mpctx->max_frames = opts->play_frames;
-
if (mpctx->max_frames == 0) {
mpctx->stop_play = PT_NEXT_ENTRY;
goto terminate_playback;
}
- reset_playback_state(mpctx);
-
- mpctx->last_vo_pts = MP_NOPTS_VALUE;
- mpctx->last_chapter_seek = -2;
- mpctx->last_chapter_pts = MP_NOPTS_VALUE;
- mpctx->last_chapter = -2;
- mpctx->paused = false;
- mpctx->paused_for_cache = false;
- mpctx->playing_msg_shown = false;
- mpctx->step_frames = 0;
- mpctx->backstep_active = false;
- mpctx->seek = (struct seek_params){ 0 };
-
// If there's a timeline force an absolute seek to initialize state
double startpos = rel_time_to_abs(mpctx, opts->play_start);
if (startpos == MP_NOPTS_VALUE && mpctx->resolve_result &&