changeset 29616:2609ee836bc1

Never switch to a program with no audio and no video.
author reimar
date Tue, 08 Sep 2009 09:06:43 +0000
parents 70404a7bebaf
children 3343d5151134
files command.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/command.c	Tue Sep 08 08:55:05 2009 +0000
+++ b/command.c	Tue Sep 08 09:06:43 2009 +0000
@@ -945,6 +945,10 @@
 	     &prog) == DEMUXER_CTRL_NOTIMPL)
 	    return M_PROPERTY_ERROR;
 
+	if (prog.aid < 0 && prog.vid < 0) {
+	    mp_msg(MSGT_CPLAYER, MSGL_ERR, "Selected program contains no audio or video streams!\n");
+	    return M_PROPERTY_ERROR;
+        }
 	mp_property_do("switch_audio", M_PROPERTY_SET, &prog.aid, mpctx);
 	mp_property_do("switch_video", M_PROPERTY_SET, &prog.vid, mpctx);
 	return M_PROPERTY_OK;