diff options
author | wm4 <wm4@nowhere> | 2015-07-02 14:38:03 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2015-07-02 14:38:03 +0200 |
commit | a609877f00889a5cb5fe3e4e2877eec49cc90ab0 (patch) | |
tree | 5f5df4dfa14d685a6dd5471fb406826b5669d5ef /player/loadfile.c | |
parent | a9bbaa5eb29cae310ca8efd4f8d197de406683f7 (diff) | |
download | mpv-a609877f00889a5cb5fe3e4e2877eec49cc90ab0.tar.bz2 mpv-a609877f00889a5cb5fe3e4e2877eec49cc90ab0.tar.xz |
player: simplify reload logic
Instead of only reloading the demuxer, reopen the stream as well.
Diffstat (limited to 'player/loadfile.c')
-rw-r--r-- | player/loadfile.c | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/player/loadfile.c b/player/loadfile.c index f4ba0d4282..3b972f5ffc 100644 --- a/player/loadfile.c +++ b/player/loadfile.c @@ -1069,6 +1069,8 @@ static void play_current_file(struct MPContext *mpctx) MP_INFO(mpctx, "Playing: %s\n", mpctx->filename); +reopen_file: + assert(mpctx->stream == NULL); assert(mpctx->demuxer == NULL); assert(mpctx->d_audio == NULL); @@ -1105,8 +1107,6 @@ static void play_current_file(struct MPContext *mpctx) stream_set_capture_file(mpctx->stream, opts->stream_capture); -goto_reopen_demuxer: ; - mp_nav_reset(mpctx); open_demux_reentrant(mpctx); @@ -1242,16 +1242,6 @@ goto_reopen_demuxer: ; terminate_playback: - if (mpctx->stop_play == PT_RELOAD_DEMUXER) { - mpctx->stop_play = KEEP_PLAYING; - mpctx->playback_initialized = false; - uninit_audio_chain(mpctx); - uninit_video_chain(mpctx); - uninit_sub_all(mpctx); - uninit_demuxer(mpctx); - goto goto_reopen_demuxer; - } - process_unload_hooks(mpctx); mp_nav_destroy(mpctx); @@ -1279,13 +1269,18 @@ terminate_playback: if (!opts->gapless_audio && !mpctx->encode_lavc_ctx) uninit_audio_out(mpctx); + mpctx->playback_initialized = false; + + if (mpctx->stop_play == PT_RELOAD_FILE) { + mpctx->stop_play = KEEP_PLAYING; + goto reopen_file; + } + m_config_restore_backups(mpctx->mconfig); talloc_free(mpctx->filtered_tags); mpctx->filtered_tags = NULL; - mpctx->playback_initialized = false; - mp_notify(mpctx, MPV_EVENT_TRACKS_CHANGED, NULL); bool nothing_played = !mpctx->shown_aframes && !mpctx->shown_vframes && |