mirror of
https://github.com/mpv-player/mpv
synced 2024-12-22 14:52:43 +00:00
player: simplify error_on_track()
track can't be NLUL at this point, so the if is redundant. Remove it and unindent the block. Also, make the function check whether the track is selected at all, which makes it safer and idempotent.
This commit is contained in:
parent
1aa2ae5404
commit
242dbc6c2c
@ -163,24 +163,22 @@ void update_window_title(struct MPContext *mpctx, bool force)
|
||||
|
||||
void error_on_track(struct MPContext *mpctx, struct track *track)
|
||||
{
|
||||
if (!track)
|
||||
if (!track || !track->selected)
|
||||
return;
|
||||
mp_deselect_track(mpctx, track);
|
||||
if (track) {
|
||||
if (track->type == STREAM_AUDIO)
|
||||
MP_INFO(mpctx, "Audio: no audio\n");
|
||||
if (track->type == STREAM_VIDEO)
|
||||
MP_INFO(mpctx, "Video: no video\n");
|
||||
if (mpctx->opts->stop_playback_on_init_failure ||
|
||||
!(mpctx->vo_chain || mpctx->ao_chain))
|
||||
{
|
||||
if (!mpctx->stop_play)
|
||||
mpctx->stop_play = PT_ERROR;
|
||||
if (mpctx->error_playing >= 0)
|
||||
mpctx->error_playing = MPV_ERROR_NOTHING_TO_PLAY;
|
||||
}
|
||||
mpctx->sleeptime = 0;
|
||||
if (track->type == STREAM_AUDIO)
|
||||
MP_INFO(mpctx, "Audio: no audio\n");
|
||||
if (track->type == STREAM_VIDEO)
|
||||
MP_INFO(mpctx, "Video: no video\n");
|
||||
if (mpctx->opts->stop_playback_on_init_failure ||
|
||||
!(mpctx->vo_chain || mpctx->ao_chain))
|
||||
{
|
||||
if (!mpctx->stop_play)
|
||||
mpctx->stop_play = PT_ERROR;
|
||||
if (mpctx->error_playing >= 0)
|
||||
mpctx->error_playing = MPV_ERROR_NOTHING_TO_PLAY;
|
||||
}
|
||||
mpctx->sleeptime = 0;
|
||||
}
|
||||
|
||||
int stream_dump(struct MPContext *mpctx, const char *source_filename)
|
||||
|
Loading…
Reference in New Issue
Block a user