[Mplayer-cvslog] CVS: main/libmpdemux dvb_tune.c,1.3,1.4 dvbin.c,1.3,1.4

Attila Kinali CVS attila at mplayerhq.hu
Sat Nov 1 16:17:07 CET 2003


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv11948/libmpdemux

Modified Files:
	dvb_tune.c dvbin.c 
Log Message:
Patch by Nico <nsabbi at libero.it>

this patch fixes a recently discovered bug for which DVB-C users 
couldn't tune
(wrong parsing of the config file and incorrect parameter passing to 
tune_it())
and includes the still unapplied patch posted in date 6/9/2003:

-  it works correctly with and without caches; in the former case it 
doesn't take anymore a lot of time to empty the cache before changing channel;
the uninit_cache() function is called in mplayer.c just after 
the new tuning operation
- initialized a variable identifying the tuner type, and exit if it 
isn't supported


- doesn't crash anymore when
1) the channels file doesn't exists
2) the tuner is used by another application
3) in the menu, when trying to select a channel before the first
4) some mp_msg() called in case of error



Index: dvb_tune.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/dvb_tune.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- dvb_tune.c	14 Aug 2003 01:05:49 -0000	1.3
+++ dvb_tune.c	1 Nov 2003 15:17:01 -0000	1.4
@@ -65,7 +65,7 @@
   fe_fd = open(dvb_frontenddev[priv->card], O_RDWR);
   if(fe_fd < 0)
   {
-  	mp_msg(MSGT_DEMUX, MSGL_ERR, "get_tuner_type(%d, %s), ERROR IN OPENING FRONTEND DEVICE %s: %d\n", priv->card, dvb_frontenddev[priv->card], errno);
+  	mp_msg(MSGT_DEMUX, MSGL_ERR, "get_tuner_type(card %d), ERROR IN OPENING FRONTEND DEVICE %s: ERRNO %d\n", priv->card, dvb_frontenddev[priv->card], errno);
 	return 0;
   }
   
@@ -104,7 +104,7 @@
 	priv->fe_fd = open(dvb_frontenddev[priv->card], O_RDWR);
 	if(priv->fe_fd < 0)
 	{
-		mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR IN OPENING FRONTEND DEVICE %s: %d\n", dvb_frontenddev[priv->card], errno);
+		mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR IN OPENING FRONTEND DEVICE %s: ERRNO %d\n", dvb_frontenddev[priv->card], errno);
 		return 0;
 	}
 #ifdef HAVE_DVB_HEAD
@@ -113,7 +113,7 @@
 	priv->sec_fd = open(dvb_secdev[priv->card], O_RDWR);
     if(priv->sec_fd < 0)
     {
-		mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR IN OPENING SEC DEVICE %s: %d\n", dvb_secdev[priv->card], errno);
+		mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR IN OPENING SEC DEVICE %s: ERRNO %d\n", dvb_secdev[priv->card], errno);
 		close(priv->fe_fd);
       	return 0;
     }
@@ -209,7 +209,7 @@
 	
 	if(freq > 100000000)
 	{
-		tune_it(priv->fe_fd, 0, freq, 0, 0, tone, specInv, diseqc, modulation, HP_CodeRate, TransmissionMode, guardInterval, bandWidth);
+		tune_it(priv->fe_fd, 0, freq, srate, 0, tone, specInv, diseqc, modulation, HP_CodeRate, TransmissionMode, guardInterval, bandWidth);
 	}
 	else if(freq != 0)
 	{

Index: dvbin.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/dvbin.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- dvbin.c	27 Aug 2003 17:08:58 -0000	1.3
+++ dvbin.c	1 Nov 2003 15:17:01 -0000	1.4
@@ -127,7 +127,7 @@
 	int fields, row_count;
 	dvb_channel_t *ptr;
 	char *tmp_lcr, *tmp_hier, *inv, *bw, *cr, *mod, *transm, *gi;
-	const char *cbl_conf = "%a[^:]:%d:%c:%d:%a[^:]:%a[^:]:%d:%d\n";
+	const char *cbl_conf = "%a[^:]:%d:%a[^:]:%d:%a[^:]:%a[^:]:%d:%d\n";
 	const char *sat_conf = "%a[^:]:%d:%c:%d:%d:%d:%d:%d:%d:%d\n";
 	const char *ter_conf = "%a[^:]:%d:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%a[^:]:%d:%d\n";
 
@@ -296,10 +296,8 @@
 
 	mp_msg(MSGT_DEMUX, MSGL_V, "dvb_streaming_read(%d)\n", size);
 
-	if(priv->retry)
-		tries = 5;
-	else
-		tries = 1;
+	tries = priv->retry + 1;
+	
 	while(pos < size)
 	{
 		pfds[0].fd = fd;
@@ -375,10 +373,10 @@
 		dvb_demux_stop(priv->demux_fd[0]);
 		dvb_demux_stop(priv->demux_fd[1]);
 		priv->retry = 0;
-		while(stream_read(stream, buf, 4096));	//empty both the stream's and driver's buffer
+		while(dvb_streaming_read(stream, buf, 4096) > 0);	//empty both the stream's and driver's buffer
 	}
 
-	priv->retry = 1;
+	priv->retry = 5;
 	mp_msg(MSGT_DEMUX, MSGL_V, "DVB_SET_CHANNEL: channel %d\n", n);
 	list = priv->list;
 	if(list == NULL)
@@ -424,7 +422,7 @@
 	}
 	else
 	{
-		mp_msg(MSGT_DEMUX, MSGL_V, "SAME TUNING, NO TUNING\n");
+		mp_msg(MSGT_DEMUX, MSGL_V, "SAME TUNING PARAMETERS, NO TUNING\n");
 		do_tuning = 0;
 	}
 
@@ -638,7 +636,7 @@
 	struct stream_priv_s* p = (struct stream_priv_s*)opts;
 	char *name = NULL, *filename;
 	dvb_priv_t *priv;
-	int tuner_type;
+	int tuner_type = 0;
 
 
 
@@ -684,6 +682,13 @@
 		}
 	}
 
+	if(tuner_type == 0)
+	{
+		mp_msg(MSGT_DEMUX, MSGL_V, "OPEN_DVB: UNKNOWN OR UNDETECTABLE TUNER TYPE, EXIT\n");
+		return STREAM_ERROR;
+	}
+
+
 	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",
@@ -696,20 +701,23 @@
 		{
 			if((dvb_list_ptr = dvb_get_channels(filename, tuner_type)) == NULL)
 				mp_msg(MSGT_DEMUX, MSGL_ERR, "EMPTY CHANNELS LIST FROM FILE %s!\n", filename);
-			else
-			{
-				priv->list = dvb_list_ptr;
-			}
+			priv->list = dvb_list_ptr;
 		}
 		else
 		{
-			dvb_list_ptr = NULL;
+			priv->list = dvb_list_ptr = NULL;
 			mp_msg(MSGT_DEMUX, MSGL_WARN, "NO CHANNELS FILE FOUND!\n");
 		}
 	}
 	else
 		priv->list = dvb_list_ptr;
 
+
+	if(priv->list == NULL)
+	{
+		mp_msg(MSGT_DEMUX, MSGL_ERR, "NO CHANNELS AVAILABLE, EXIT!\n");
+		return STREAM_ERROR;
+	}
 
 	if(! strcmp(p->prog, ""))
 	{



More information about the MPlayer-cvslog mailing list