changeset 20659:31b525f90395

nonsense removal: compare old and new frequency in order to skip tuning
author nicodvb
date Sat, 04 Nov 2006 23:03:52 +0000
parents ed20cbab07a4
children 89b78ea6bc70
files stream/dvbin.h stream/stream_dvb.c
diffstat 2 files changed, 3 insertions(+), 43 deletions(-) [+]
line wrap: on
line diff
--- a/stream/dvbin.h	Sat Nov 04 22:01:51 2006 +0000
+++ b/stream/dvbin.h	Sat Nov 04 23:03:52 2006 +0000
@@ -100,9 +100,9 @@
 	int tuner_type;
 	int is_on;
 	stream_t *stream;
-	char new_tuning[256], prev_tuning[256];
 	int retry;
 	int timeout;
+	int last_freq;
 } dvb_priv_t;
 
 
--- a/stream/stream_dvb.c	Sat Nov 04 22:01:51 2006 +0000
+++ b/stream/stream_dvb.c	Sat Nov 04 23:03:52 2006 +0000
@@ -458,7 +458,6 @@
 {
 	dvb_channels_list *new_list;
 	dvb_channel_t *channel;
-	int do_tuning;
 	stream_t *stream  = (stream_t*) priv->stream;
 	char buf[4096];
 	dvb_config_t *conf = (dvb_config_t *) priv->config;
@@ -495,7 +494,6 @@
 				mp_msg(MSGT_DEMUX, MSGL_ERR, "DVB_SET_CHANNEL, COULDN'T OPEN DEVICES OF CARD: %d, EXIT\n", card);
 				return 0;
 			}
-			strcpy(priv->prev_tuning, "");
 		}
 		else	//close all demux_fds with pos > pids required for the new channel or open other demux_fds if we have too few
 		{	
@@ -510,7 +508,6 @@
 			mp_msg(MSGT_DEMUX, MSGL_ERR, "DVB_SET_CHANNEL2, COULDN'T OPEN DEVICES OF CARD: %d, EXIT\n", card);
 			return 0;
 		}
-		strcpy(priv->prev_tuning, "");
 	}
 
 	dvb_config->priv = priv;
@@ -521,52 +518,16 @@
 	stream->fd = priv->dvr_fd;
 	mp_msg(MSGT_DEMUX, MSGL_V, "DVB_SET_CHANNEL: new channel name=%s, card: %d, channel %d\n", channel->name, card, n);
 
-	switch(priv->tuner_type)
-	{
-		case TUNER_SAT:
-			sprintf(priv->new_tuning, "%d|%09d|%09d|%d|%c", priv->card, channel->freq, channel->srate, channel->diseqc, channel->pol);
-			break;
-
-		case TUNER_TER:
-			sprintf(priv->new_tuning, "%d|%09d|%d|%d|%d|%d|%d|%d", priv->card, channel->freq, channel->inv,
-				channel->bw, channel->cr, channel->mod, channel->trans, channel->gi);
-		  break;
-
-		case TUNER_CBL:
-			sprintf(priv->new_tuning, "%d|%09d|%d|%d|%d|%d", priv->card, channel->freq, channel->inv, channel->srate,
-				channel->cr, channel->mod);
-		break;
-#ifdef DVB_ATSC
-		case TUNER_ATSC:
-			sprintf(priv->new_tuning, "%d|%09d|%d", priv->card, channel->freq, channel->mod);
-		break;
-#endif
-	}
-
-
-
-	if(strcmp(priv->prev_tuning, priv->new_tuning))
-	{
-		mp_msg(MSGT_DEMUX, MSGL_V, "DIFFERENT TUNING THAN THE PREVIOUS: %s  -> %s\n", priv->prev_tuning, priv->new_tuning);
-		strcpy(priv->prev_tuning, priv->new_tuning);
-		do_tuning = 1;
-	}
-	else
-	{
-		mp_msg(MSGT_DEMUX, MSGL_V, "SAME TUNING PARAMETERS, NO TUNING\n");
-		do_tuning = 0;
-	}
-
 	stream->eof=1;
 	stream_reset(stream);
 
 
-	if(do_tuning)
+	if(channel->freq != priv->last_freq)
 		if (! dvb_tune(priv, channel->freq, channel->pol, channel->srate, channel->diseqc, channel->tone,
 			channel->inv, channel->mod, channel->gi, channel->trans, channel->bw, channel->cr, channel->cr_lp, channel->hier, priv->timeout))
 			return 0;
 
-
+	priv->last_freq = channel->freq;
 	priv->is_on = 1;
 
 	//sets demux filters and restart the stream
@@ -666,7 +627,6 @@
 	}
 
 
-	strcpy(priv->prev_tuning, "");
 	if(!dvb_set_channel(priv, priv->card, priv->list->current))
 	{
 		mp_msg(MSGT_DEMUX, MSGL_ERR, "ERROR, COULDN'T SET CHANNEL  %i: ", priv->list->current);