[MPlayer-cvslog] r20774 - in trunk: DOCS/man/en/mplayer.1 help/help_mp-en.h stream/stream_radio.c
voroshil
subversion at mplayerhq.hu
Wed Nov 8 08:02:44 CET 2006
Author: voroshil
Date: Wed Nov 8 08:02:43 2006
New Revision: 20774
Modified:
trunk/help/help_mp-en.h
trunk/stream/stream_radio.c
Changes in other areas also in this revision:
Modified:
trunk/DOCS/man/en/mplayer.1
Log:
Adding ability to check allowed frequency range.
Modified: trunk/help/help_mp-en.h
==============================================================================
--- trunk/help/help_mp-en.h (original)
+++ trunk/help/help_mp-en.h Wed Nov 8 08:02:43 2006
@@ -1846,6 +1846,7 @@
// stream/stream_radio.c
#define MSGTR_RADIO_ChannelNamesDetected "[radio] Radio channel names detected.\n"
+#define MSGTR_RADIO_FreqRange "[radio] Allowable frequency range is %.2f-%.2f MHz\n"
#define MSGTR_RADIO_WrongFreqForChannel "[radio] Wrong frequency for channel %s\n"
#define MSGTR_RADIO_WrongChannelNumberFloat "[radio] Wrong channel number: %.2f\n"
#define MSGTR_RADIO_WrongChannelNumberInt "[radio] Wrong channel number: %d\n"
Modified: trunk/stream/stream_radio.c
==============================================================================
--- trunk/stream/stream_radio.c (original)
+++ trunk/stream/stream_radio.c Wed Nov 8 08:02:43 2006
@@ -112,6 +112,8 @@
int frac; ///< fraction value (see comment to init_frac)
radio_channels_t* radio_channel_list;
radio_channels_t* radio_channel_current;
+ float rangelow; ///< lowest tunable frequency in MHz
+ float rangehigh; ///< highest tunable frequency in MHz
int driver;
int old_snd_volume;
#ifdef USE_RADIO_CAPTURE
@@ -186,7 +188,7 @@
priv->radio_channel_current->freq=atof(tmp);
- if (priv->radio_channel_current->freq == 0)
+ if ((priv->radio_channel_current->freq>priv->rangehigh)||(priv->radio_channel_current->freq<priv->rangelow))
mp_msg(MSGT_RADIO, MSGL_ERR, MSGTR_RADIO_WrongFreqForChannel,
priv->radio_channel_current->name);
@@ -272,6 +274,10 @@
priv->frac=16;
mp_msg(MSGT_RADIO,MSGL_DBG2,MSGTR_RADIO_TunerCapLowNo,priv->frac);
}
+
+ priv->rangelow=((float)tuner.rangelow)/priv->frac;
+ priv->rangehigh=((float)tuner.rangehigh)/priv->frac;
+ mp_msg(MSGT_RADIO,MSGL_V,MSGTR_RADIO_FreqRange,priv->rangelow,priv->rangehigh);
return STREAM_OK;
}
@@ -415,6 +421,11 @@
priv->frac=16;
mp_msg(MSGT_RADIO,MSGL_DBG2,MSGTR_RADIO_TunerCapLowNo,priv->frac);
}
+
+ priv->rangelow=((float)tuner.rangelow)/priv->frac;
+ priv->rangehigh=((float)tuner.rangehigh)/priv->frac;
+ mp_msg(MSGT_RADIO,MSGL_V,MSGTR_RADIO_FreqRange,priv->rangelow,priv->rangehigh);
+
return STREAM_OK;
}
@@ -524,6 +535,10 @@
return STREAM_ERROR;
}
static inline int set_frequency(radio_priv_t* priv,float frequency){
+ if ((frequency<priv->rangelow)||(frequency>priv->rangehigh)){
+ mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_WrongFreq,frequency);
+ return STREAM_ERROR;
+ }
switch(priv->driver){
#ifdef HAVE_RADIO_V4L
case RADIO_DRIVER_V4L:
@@ -1034,7 +1049,7 @@
return STREAM_ERROR;
}
- if (frequency==0){
+ if ((frequency<priv->rangelow)||(frequency>priv->rangehigh)){
mp_msg(MSGT_RADIO, MSGL_ERR, MSGTR_RADIO_WrongFreq,frequency);
close_s(stream);
return STREAM_ERROR;
More information about the MPlayer-cvslog
mailing list