mirror of
https://github.com/mpv-player/mpv
synced 2025-02-19 06:17:00 +00:00
player: refactor: reduce some dependencies on current_track
Don't mind me.
This commit is contained in:
parent
5c8378b71a
commit
a080432992
@ -1831,11 +1831,7 @@ static struct track* track_next(struct MPContext *mpctx, int order,
|
||||
struct track *cur = mpctx->tracks[n];
|
||||
// One track can be selected only one time - pretend already selected
|
||||
// tracks don't exist.
|
||||
for (int r = 0; r < NUM_PTRACKS; r++) {
|
||||
if (r != order && mpctx->current_track[r][type] == cur)
|
||||
cur = NULL;
|
||||
}
|
||||
if (!cur)
|
||||
if (cur->selected)
|
||||
continue;
|
||||
if (cur->type == type) {
|
||||
if (cur == track) {
|
||||
@ -2518,9 +2514,9 @@ static int mp_property_vd_imgparams(void *ctx, struct m_property *prop,
|
||||
{
|
||||
MPContext *mpctx = ctx;
|
||||
struct vo_chain *vo_c = mpctx->vo_chain;
|
||||
struct track *track = mpctx->current_track[0][STREAM_VIDEO];
|
||||
if (!vo_c || !track)
|
||||
if (!vo_c)
|
||||
return M_PROPERTY_UNAVAILABLE;
|
||||
struct track *track = mpctx->current_track[0][STREAM_VIDEO];
|
||||
struct mp_codec_params *c =
|
||||
track && track->stream ? track->stream->codec : NULL;
|
||||
if (vo_c->vf->input_params.imgfmt) {
|
||||
|
@ -1158,13 +1158,6 @@ reopen_file:
|
||||
|
||||
enable_demux_thread(mpctx);
|
||||
|
||||
if (mpctx->current_track[0][STREAM_VIDEO] &&
|
||||
mpctx->current_track[0][STREAM_VIDEO]->attached_picture)
|
||||
{
|
||||
MP_INFO(mpctx,
|
||||
"Displaying attached picture. Use --no-audio-display to prevent this.\n");
|
||||
}
|
||||
|
||||
#if HAVE_ENCODING
|
||||
if (mpctx->encode_lavc_ctx && mpctx->current_track[0][STREAM_VIDEO])
|
||||
encode_lavc_expect_stream(mpctx->encode_lavc_ctx, AVMEDIA_TYPE_VIDEO);
|
||||
@ -1176,20 +1169,23 @@ reopen_file:
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!mpctx->current_track[0][STREAM_VIDEO] &&
|
||||
!mpctx->current_track[0][STREAM_AUDIO])
|
||||
{
|
||||
MP_FATAL(mpctx, "No video or audio streams selected.\n");
|
||||
mpctx->error_playing = MPV_ERROR_NOTHING_TO_PLAY;
|
||||
goto terminate_playback;
|
||||
}
|
||||
|
||||
update_playback_speed(mpctx);
|
||||
|
||||
reinit_video_chain(mpctx);
|
||||
reinit_audio_chain(mpctx);
|
||||
reinit_sub_all(mpctx);
|
||||
|
||||
if (!mpctx->vo_chain && !mpctx->ao_chain) {
|
||||
MP_FATAL(mpctx, "No video or audio streams selected.\n");
|
||||
mpctx->error_playing = MPV_ERROR_NOTHING_TO_PLAY;
|
||||
goto terminate_playback;
|
||||
}
|
||||
|
||||
if (mpctx->vo_chain && mpctx->vo_chain->is_coverart) {
|
||||
MP_INFO(mpctx,
|
||||
"Displaying attached picture. Use --no-audio-display to prevent this.\n");
|
||||
}
|
||||
|
||||
MP_VERBOSE(mpctx, "Starting playback...\n");
|
||||
|
||||
mpctx->playback_initialized = true;
|
||||
|
@ -172,8 +172,7 @@ void error_on_track(struct MPContext *mpctx, struct track *track)
|
||||
if (track->type == STREAM_VIDEO)
|
||||
MP_INFO(mpctx, "Video: no video\n");
|
||||
if (mpctx->opts->stop_playback_on_init_failure ||
|
||||
(!mpctx->current_track[0][STREAM_AUDIO] &&
|
||||
!mpctx->current_track[0][STREAM_VIDEO]))
|
||||
!(mpctx->vo_chain || mpctx->ao_chain))
|
||||
{
|
||||
if (!mpctx->stop_play)
|
||||
mpctx->stop_play = PT_ERROR;
|
||||
|
Loading…
Reference in New Issue
Block a user