From ac9b9fcd196199c665743c5cbd7e13fac084a14f Mon Sep 17 00:00:00 2001 From: nicodvb Date: Sat, 4 Nov 2006 23:03:52 +0000 Subject: nonsense removal: compare old and new frequency in order to skip tuning git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@20675 b3059339-0415-0410-9bf9-f77b7e298cf2 --- stream/dvbin.h | 2 +- stream/stream_dvb.c | 44 ++------------------------------------------ 2 files changed, 3 insertions(+), 43 deletions(-) (limited to 'stream') diff --git a/stream/dvbin.h b/stream/dvbin.h index 18cdf4f933..2f2ce2c97d 100644 --- a/stream/dvbin.h +++ b/stream/dvbin.h @@ -100,9 +100,9 @@ typedef struct { 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; diff --git a/stream/stream_dvb.c b/stream/stream_dvb.c index 142ce9af7f..b6b782b80c 100644 --- a/stream/stream_dvb.c +++ b/stream/stream_dvb.c @@ -458,7 +458,6 @@ int dvb_set_channel(dvb_priv_t *priv, int card, int n) { 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 @@ int dvb_set_channel(dvb_priv_t *priv, int card, int n) 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 @@ int dvb_set_channel(dvb_priv_t *priv, int card, int n) 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 @@ int dvb_set_channel(dvb_priv_t *priv, int card, int n) 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 @@ static int dvb_streaming_start(dvb_priv_t *priv, struct stream_priv_s *opts, int } - 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); -- cgit v1.2.3