[Mplayer-cvslog] CVS: main/libmpdemux dvbin.c,1.6,1.7

Nico Sabbi CVS syncmail at mplayerhq.hu
Sat Apr 3 12:30:49 CEST 2004


CVS change done by Nico Sabbi CVS

Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var2/tmp/cvs-serv9710

Modified Files:
	dvbin.c 
Log Message:
disallow non-sense type parameter; added support for absolute file path; prefer channels.conf.{sat,ter,cbl} over channels.conf if the file is available

Index: dvbin.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/dvbin.c,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- dvbin.c	19 Mar 2004 20:22:10 -0000	1.6
+++ dvbin.c	3 Apr 2004 10:30:46 -0000	1.7
@@ -64,7 +64,7 @@
 }
 stream_defaults =
 {
-	"", 1, "", 0, 0, "channels.conf"
+	"", 1, "", 0, 0, NULL
 };
 
 #define ST_OFF(f) M_ST_OFF(struct stream_priv_s, f)
@@ -95,7 +95,7 @@
 m_option_t dvbin_opts_conf[] = {
 	{"prog", &stream_defaults.prog, CONF_TYPE_STRING, 0, 0 ,0, NULL},
 	{"card", &stream_defaults.card, CONF_TYPE_INT, M_OPT_RANGE, 1, 4, NULL},
-	{"type", &stream_defaults.type, CONF_TYPE_STRING, 0, 0 ,0, NULL},
+	{"type", "DVB card type is autodetected and can't be overridden\n", CONF_TYPE_PRINT, CONF_NOCFG, 0 ,0, NULL},
 	{"vid",  &stream_defaults.vid,  CONF_TYPE_INT, 0, 0 ,0, NULL},
 	{"aid",  &stream_defaults.aid,  CONF_TYPE_INT, 0, 0 ,0, NULL},
 	{"file", &stream_defaults.file, CONF_TYPE_STRING, 0, 0 ,0, NULL},
@@ -664,27 +664,7 @@
  		return STREAM_ERROR;
  	}
 	
-	if(!strncmp(p->type, "CBL", 3))
-	{
-		tuner_type = TUNER_CBL;
-	}
-	else if(!strncmp(p->type, "TER", 3))
-	{
-		tuner_type = TUNER_TER;
-	}
-	else if(!strncmp(p->type, "SAT", 3))
-	{
-		tuner_type = TUNER_SAT;
-	}
-	else
-	{
-		int t = dvb_get_tuner_type(priv);
-
-		if((t==TUNER_SAT) || (t==TUNER_TER) || (t==TUNER_CBL))
-		{
-			tuner_type = t;
-		}
-	}
+	tuner_type = dvb_get_tuner_type(priv);
 
 	if(tuner_type == 0)
 	{
@@ -695,12 +675,38 @@
 
 	priv->tuner_type = tuner_type;
 
-	mp_msg(MSGT_DEMUX, MSGL_V, "OPEN_DVB: prog=%s, card=%d, type=%d, vid=%d, aid=%d, file=%s\n",
-		p->prog, priv->card+1, priv->tuner_type, p->vid, p->aid, p->file);
+	mp_msg(MSGT_DEMUX, MSGL_V, "OPEN_DVB: prog=%s, card=%d, type=%d, vid=%d, aid=%d\n",
+		p->prog, priv->card+1, priv->tuner_type, p->vid, p->aid);
 
 	if(dvb_list_ptr == NULL)
 	{
-		filename = get_path(p->file);
+		if(p->file != NULL)
+		{
+			if(p->file[0] == '/')
+				filename = p->file;
+			else
+				filename = get_path(p->file);
+		}
+		else
+		{
+			switch(priv->tuner_type)
+			{
+				case TUNER_TER:
+					filename = get_path("channels.conf.ter");
+					break;
+				case TUNER_CBL:
+					filename = get_path("channels.conf.cbl");
+					break;
+				case TUNER_SAT:
+					filename = get_path("channels.conf.sat");
+					break;
+			}
+		}
+		
+		if((filename == NULL) || (access(filename, F_OK | R_OK) != 0))
+			filename = get_path("channels.conf");
+
+		
 		if(filename)
 		{
 			if((dvb_list_ptr = dvb_get_channels(filename, tuner_type)) == NULL)




More information about the MPlayer-cvslog mailing list