mirror of
https://github.com/mpv-player/mpv
synced 2025-03-11 08:37:59 +00:00
player: simplify edition switching
The player fully restarts playback when the edition or disk title is changed. Before this, the player tried to reinitialized playback partially. For example, it did not print a new "Playing: <file>" message, and did not send playback end to libmpv users (scripts or applications). This playback restart code was a bit messy and could have unforeseen interactions with various state. There have been bugs before. Since it's a mostly cosmetic thing for an obscure feature, just change it to a full restart. This works well, though since it may have consequences for scripts or client API users, mention it in interface-changes.rst.
This commit is contained in:
parent
36099d27f8
commit
9428294634
@ -103,6 +103,8 @@ Interface changes
|
||||
of 3D content doesn't justify such an option anyway.
|
||||
- change cycle-values command to use the current value, instead of an
|
||||
internal counter that remembered the current position.
|
||||
- edition and disc title switching will now fully reload playback (may have
|
||||
consequences for scripts, client API, or when using file-local options)
|
||||
--- mpv 0.28.0 ---
|
||||
- rename --hwdec=mediacodec option to mediacodec-copy, to reflect
|
||||
conventions followed by other hardware video decoding APIs
|
||||
|
@ -926,7 +926,7 @@ static int mp_property_disc_title(void *ctx, struct m_property *prop,
|
||||
if (demux_stream_control(d, STREAM_CTRL_SET_CURRENT_TITLE, &title) < 0)
|
||||
return M_PROPERTY_NOT_IMPLEMENTED;
|
||||
if (!mpctx->stop_play)
|
||||
mpctx->stop_play = PT_RELOAD_FILE;
|
||||
mpctx->stop_play = PT_CURRENT_ENTRY;
|
||||
return M_PROPERTY_OK;
|
||||
}
|
||||
return M_PROPERTY_NOT_IMPLEMENTED;
|
||||
@ -1143,7 +1143,7 @@ static int mp_property_edition(void *ctx, struct m_property *prop,
|
||||
if (edition != demuxer->edition) {
|
||||
mpctx->opts->edition_id = edition;
|
||||
if (!mpctx->stop_play)
|
||||
mpctx->stop_play = PT_RELOAD_FILE;
|
||||
mpctx->stop_play = PT_CURRENT_ENTRY;
|
||||
mp_wakeup_core(mpctx);
|
||||
break; // make it accessible to the demuxer via option change notify
|
||||
}
|
||||
|
@ -43,7 +43,6 @@ 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_FILE, // restart playback
|
||||
PT_QUIT, // stop playback, quit player
|
||||
PT_ERROR, // play next playlist entry (due to an error)
|
||||
};
|
||||
|
@ -1203,10 +1203,6 @@ static void play_current_file(struct MPContext *mpctx)
|
||||
|
||||
MP_INFO(mpctx, "Playing: %s\n", mpctx->filename);
|
||||
|
||||
reopen_file:
|
||||
|
||||
reset_playback_state(mpctx);
|
||||
|
||||
assert(mpctx->demuxer == NULL);
|
||||
|
||||
process_hooks(mpctx, "on_load");
|
||||
@ -1398,12 +1394,6 @@ terminate_playback:
|
||||
|
||||
mpctx->playback_initialized = false;
|
||||
|
||||
if (mpctx->stop_play == PT_RELOAD_FILE) {
|
||||
mpctx->stop_play = KEEP_PLAYING;
|
||||
mp_cancel_reset(mpctx->playback_abort);
|
||||
goto reopen_file;
|
||||
}
|
||||
|
||||
m_config_restore_backups(mpctx->mconfig);
|
||||
|
||||
TA_FREEP(&mpctx->filter_root);
|
||||
|
Loading…
Reference in New Issue
Block a user