summaryrefslogtreecommitdiffstats
path: root/player/misc.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-10-23 18:31:43 +0200
committerAlessandro Ghedini <alessandro@ghedini.me>2014-10-23 20:27:32 +0200
commit0a40fb00b4acd51adc831334c601a534927b51da (patch)
tree6c42bd7eb148e5fad5184e7b5abb528cf9f3e002 /player/misc.c
parent3c8aecb711bde4928e13a785527cea6c986a1b75 (diff)
downloadmpv-0a40fb00b4acd51adc831334c601a534927b51da.tar.bz2
mpv-0a40fb00b4acd51adc831334c601a534927b51da.tar.xz
player: fix exiting if both audio and video fail initializing
The player was supposed to exit playback if both video and audio failed to initialize (or if one of the streams was not selected when the other stream failed). This didn't work; for one this check was missing from one of the failure paths. And more importantly, both checked the current_track array incorrectly. Fix these issues, and move the failure handling code into a common function. CC: @mpv-player/stable Conflicts: player/audio.c player/video.c
Diffstat (limited to 'player/misc.c')
-rw-r--r--player/misc.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/player/misc.c b/player/misc.c
index d5e27f9584..394a4ca0d1 100644
--- a/player/misc.c
+++ b/player/misc.c
@@ -175,6 +175,24 @@ void update_window_title(struct MPContext *mpctx, bool force)
}
}
+void error_on_track(struct MPContext *mpctx, struct track *track)
+{
+ if (!track)
+ 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->current_track[0][STREAM_AUDIO] &&
+ !mpctx->current_track[0][STREAM_VIDEO])
+ mpctx->stop_play = PT_NEXT_ENTRY;
+ mpctx->error_playing = true;
+ mpctx->sleeptime = 0;
+ }
+}
+
void stream_dump(struct MPContext *mpctx)
{
struct MPOpts *opts = mpctx->opts;