summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--player/command.c8
-rw-r--r--player/core.h2
-rw-r--r--player/discnav.c2
-rw-r--r--player/loadfile.c23
4 files changed, 15 insertions, 20 deletions
diff --git a/player/command.c b/player/command.c
index c4fe75dd25..ac403fb50d 100644
--- a/player/command.c
+++ b/player/command.c
@@ -678,7 +678,7 @@ static int mp_property_disc_title(void *ctx, struct m_property *prop,
title = *(int*)arg;
if (demux_stream_control(d, STREAM_CTRL_SET_CURRENT_TITLE, &title) < 0)
return M_PROPERTY_NOT_IMPLEMENTED;
- mpctx->stop_play = PT_RELOAD_DEMUXER;
+ mpctx->stop_play = PT_RELOAD_FILE;
return M_PROPERTY_OK;
}
return M_PROPERTY_NOT_IMPLEMENTED;
@@ -837,7 +837,7 @@ static int mp_property_edition(void *ctx, struct m_property *prop,
edition = *(int *)arg;
if (edition != demuxer->edition) {
opts->edition_id = edition;
- mpctx->stop_play = PT_RELOAD_DEMUXER;
+ mpctx->stop_play = PT_RELOAD_FILE;
}
return M_PROPERTY_OK;
}
@@ -2847,7 +2847,7 @@ static int mp_property_dvb_channel(void *ctx, struct m_property *prop,
mpctx->last_dvb_step = 1;
r = prop_stream_ctrl(mpctx, STREAM_CTRL_DVB_SET_CHANNEL, arg);
if (r == M_PROPERTY_OK)
- mpctx->stop_play = PT_RELOAD_DEMUXER;
+ mpctx->stop_play = PT_RELOAD_FILE;
return r;
case M_PROPERTY_SWITCH: {
struct m_property_switch_arg *sa = arg;
@@ -2855,7 +2855,7 @@ static int mp_property_dvb_channel(void *ctx, struct m_property *prop,
mpctx->last_dvb_step = dir;
r = prop_stream_ctrl(mpctx, STREAM_CTRL_DVB_STEP_CHANNEL, &dir);
if (r == M_PROPERTY_OK)
- mpctx->stop_play = PT_RELOAD_DEMUXER;
+ mpctx->stop_play = PT_RELOAD_FILE;
return r;
}
case M_PROPERTY_GET_TYPE:
diff --git a/player/core.h b/player/core.h
index 06d3a29734..907c997b96 100644
--- a/player/core.h
+++ b/player/core.h
@@ -37,7 +37,7 @@ enum stop_play_reason {
PT_NEXT_ENTRY, // prepare to play next entry in playlist
PT_CURRENT_ENTRY, // prepare to play mpctx->playlist->current
PT_STOP, // stop playback, clear playlist
- PT_RELOAD_DEMUXER, // restart playback, but keep stream open
+ PT_RELOAD_FILE, // restart playback
PT_QUIT, // stop playback, quit player
PT_ERROR, // play next playlist entry (due to an error)
};
diff --git a/player/discnav.c b/player/discnav.c
index 91657f7f73..0b4537e5e1 100644
--- a/player/discnav.c
+++ b/player/discnav.c
@@ -234,7 +234,7 @@ void mp_handle_nav(struct MPContext *mpctx)
break;
}
case MP_NAV_EVENT_RESET_ALL: {
- mpctx->stop_play = PT_RELOAD_DEMUXER;
+ mpctx->stop_play = PT_RELOAD_FILE; // would wipe DVD state -> broken
MP_VERBOSE(nav, "reload\n");
// return immediately.
// other events should be handled after reloaded.
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 &&