changeset 10708:a57e8d980652

This patch fixes: 1) if channels (in the list) are invalid excludes them 2) on encrypted/unreadable channels mplayer goes to the next/previous 3) when changing channel uninit all components but stream and input. Nico <nsabbi@libero.it>
author alex
date Wed, 27 Aug 2003 17:08:58 +0000
parents 0d9ef9b4841c
children 9ab19ded1b39
files libmpdemux/dvbin.c mplayer.c
diffstat 2 files changed, 48 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/dvbin.c	Wed Aug 27 16:44:09 2003 +0000
+++ b/libmpdemux/dvbin.c	Wed Aug 27 17:08:58 2003 +0000
@@ -156,9 +156,10 @@
 	row_count = 0;
 	while(! feof(f) && row_count < 512)
 	{
-		if( fgets(line, CHANNEL_LINE_LEN, f) == NULL ) continue;
+		if( fgets(line, CHANNEL_LINE_LEN, f) == NULL )
+			continue;
 
-		if(line[0] == '#')
+		if((line[0] == '#') || (strlen(line) == 0))
 			continue;
 
 		ptr =  &(list->channels[list->NUM_CHANNELS]);
@@ -168,12 +169,22 @@
 			fields = sscanf(line, ter_conf,
 				&ptr->name, &ptr->freq, &inv, &bw, &cr, &tmp_lcr, &mod,
 				&transm, &gi, &tmp_hier, &ptr->vpid, &ptr->apid1);
+			/*
+			mp_msg(MSGT_DEMUX, MSGL_V,
+				"NUM: %d, NUM_FIELDS: %d, NAME: %s, FREQ: %d, VPID: %d, APID1: %d\n",
+				list->NUM_CHANNELS, fields, ptr->name, ptr->freq, ptr->vpid, ptr->apid1);
+			*/
 		}
 		else if(type == TUNER_CBL)
 		{
 			fields = sscanf(line, cbl_conf,
 				&ptr->name, &ptr->freq, &inv, &ptr->srate,
 				&cr, &mod, &ptr->vpid, &ptr->apid1);
+			/*
+			mp_msg(MSGT_DEMUX, MSGL_V,
+				"NUM: %d, NUM_FIELDS: %d, NAME: %s, FREQ: %d, SRATE: %d, VPID: %d, APID1: %d\n",
+				list->NUM_CHANNELS, fields, ptr->name, ptr->freq, ptr->srate, ptr->vpid, ptr->apid1);
+			*/
 		}
 		else //SATELLITE
 		{
@@ -185,11 +196,15 @@
 			ptr->srate *=  1000UL;
 			ptr->tone = -1;
 			mp_msg(MSGT_DEMUX, MSGL_V,
-				"NUM_FIELDS: %d, NAME: %s, FREQ: %d, SRATE: %d, POL: %c, DISEQC: %d, TONE: %d, VPID: %d, APID1: %d, APID2: %d, TPID: %d, PROGID: %d, NUM: %d\n",
-				fields, ptr->name, ptr->freq, ptr->srate, ptr->pol, ptr->diseqc, ptr->tone, ptr->vpid, ptr->apid1, ptr->apid2, ptr->tpid, ptr->progid, list->NUM_CHANNELS);
+				"NUM: %d, NUM_FIELDS: %d, NAME: %s, FREQ: %d, SRATE: %d, POL: %c, DISEQC: %d, TONE: %d, VPID: %d, APID1: %d, APID2: %d, TPID: %d, PROGID: %d\n",
+				list->NUM_CHANNELS, fields, ptr->name, ptr->freq, ptr->srate, ptr->pol, ptr->diseqc, ptr->tone, ptr->vpid, ptr->apid1, ptr->apid2, ptr->tpid, ptr->progid);
 		}
 
 
+		if(((ptr->vpid <= 0) && (ptr->apid1 <=0)) || (ptr->freq == 0))
+			continue;
+
+
 		if((type == TUNER_TER) || (type == TUNER_CBL))
 		{
 			if(! strcmp(inv, "INVERSION_ON"))
--- a/mplayer.c	Wed Aug 27 16:44:09 2003 +0000
+++ b/mplayer.c	Wed Aug 27 17:08:58 2003 +0000
@@ -100,6 +100,7 @@
 
 #ifdef HAS_DVBIN_SUPPORT
 #include "libmpdemux/dvbin.h"
+static int last_dvb_step = 1;
 #endif
 
 
@@ -1532,6 +1533,27 @@
 
 if(!sh_video && !sh_audio){
     mp_msg(MSGT_CPLAYER,MSGL_FATAL, MSGTR_NoStreamFound);
+#ifdef HAS_DVBIN_SUPPORT
+	if((stream->type == STREAMTYPE_DVB) && stream->priv)
+	{
+	  dvb_priv_t *priv = (dvb_priv_t*) stream->priv;
+	  if(priv->is_on)
+	  {
+		int dir;
+		int v = last_dvb_step;
+		if(v > 0)
+			dir = DVB_CHANNEL_HIGHER;
+		else
+			dir = DVB_CHANNEL_LOWER;
+			
+		if(dvb_step_channel(priv, dir))
+		{
+	  		uninit_player(INITED_ALL-(INITED_STREAM|INITED_INPUT));
+			goto goto_open_demuxer;
+		}
+	  }
+	}
+#endif	
     goto goto_next_file; // exit_player(MSGTR_Exit_error);
 }
 
@@ -2868,7 +2890,8 @@
 	  {
 		int dir;
 		int v = cmd->args[0].v.i;
-		
+	    
+		last_dvb_step = v;	
 		if(v > 0)
 			dir = DVB_CHANNEL_HIGHER;
 		else
@@ -2904,6 +2927,11 @@
 	  dvb_priv_t *priv = (dvb_priv_t*) stream->priv;
 	  if(priv->is_on)
 	  {
+		if(priv->list->current <= cmd->args[0].v.i)
+		    last_dvb_step = 1;
+		else
+		    last_dvb_step = -1;
+
   		if(dvb_set_channel(priv, cmd->args[0].v.i))
 		{
 	  	  uninit_player(INITED_ALL-(INITED_STREAM|INITED_INPUT));