changeset 24762:1ed81edfac75

Disable channel scanner when no tuner is present. TV channel scanner is useless without tuner and causes mplayer crash due to uninitialized chanlist_s variable (e.g when dummy driver and tvscan are used together).
author voroshil
date Mon, 15 Oct 2007 17:46:17 +0000
parents 327b7e9f6a2c
children 5d7f6e5e0847
files help/help_mp-en.h stream/tv.c
diffstat 2 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/help/help_mp-en.h	Mon Oct 15 11:58:39 2007 +0000
+++ b/help/help_mp-en.h	Mon Oct 15 17:46:17 2007 +0000
@@ -2099,6 +2099,7 @@
 #define MSGTR_TV_Bt848UnableToStopCapture "tvi_bsdbt848: Unable to stop capture. Error: %s\n"
 #define MSGTR_TV_TTSupportedLanguages "Supported Teletext languages:\n"
 #define MSGTR_TV_TTSelectedLanguage "Selected default teletext language: %s\n"
+#define MSGTR_TV_ScannerNotAvailableWithoutTuner "Channel scanner is not available without tuner\n"
 
 //tvi_dshow.c
 #define MSGTR_TVI_DS_UnableConnectInputVideoDecoder  "Unable to connect given input to video decoder. Error:0x%x\n"
--- a/stream/tv.c	Mon Oct 15 11:58:39 2007 +0000
+++ b/stream/tv.c	Mon Oct 15 17:46:17 2007 +0000
@@ -88,6 +88,14 @@
     tv_scan_t* scan;
     int found=0, index=1;
 
+    //Channel scanner without tuner is useless and causes crash due to uninitialized chanlist_s
+    if (tvh->functions->control(tvh->priv, TVI_CONTROL_IS_TUNER, 0) != TVI_CONTROL_TRUE)
+    {
+        mp_msg(MSGT_TV, MSGL_WARN, MSGTR_TV_ScannerNotAvailableWithoutTuner);
+        tvh->tv_param->scan=0;
+        return;
+    }
+
     scan = tvh->scan;
     now=GetTimer();
     if (!scan) {