summaryrefslogtreecommitdiffstats
path: root/player/misc.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-02-05 21:15:47 +0100
committerwm4 <wm4@nowhere>2016-02-05 23:17:27 +0100
commit242dbc6c2c985bfd4dd8df699c6df6c33f8889d1 (patch)
treeed8a16fcdab6c2b5ffd57405f493a55ee561b0f6 /player/misc.c
parent1aa2ae5404d134815eddcb3f146a9c1f8bbfc2e9 (diff)
downloadmpv-242dbc6c2c985bfd4dd8df699c6df6c33f8889d1.tar.bz2
mpv-242dbc6c2c985bfd4dd8df699c6df6c33f8889d1.tar.xz
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.
Diffstat (limited to 'player/misc.c')
-rw-r--r--player/misc.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/player/misc.c b/player/misc.c
index 1343c60eaf..d68ad1db3e 100644
--- a/player/misc.c
+++ b/player/misc.c
@@ -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)