[MPlayer-cvslog] r19799 - in trunk: help/help_mp-en.h help/help_mp-ru.h stream/stream_radio.c
voroshil
subversion at mplayerhq.hu
Mon Sep 11 20:41:15 CEST 2006
Author: voroshil
Date: Mon Sep 11 20:41:14 2006
New Revision: 19799
Modified:
trunk/help/help_mp-en.h
trunk/stream/stream_radio.c
Changes in other areas also in this revision:
Modified:
trunk/help/help_mp-ru.h
Log:
ability to pass channel name (not only number) to radio_set_channel
Modified: trunk/help/help_mp-en.h
==============================================================================
--- trunk/help/help_mp-en.h (original)
+++ trunk/help/help_mp-en.h Mon Sep 11 20:41:14 2006
@@ -1821,6 +1821,7 @@
#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"
+#define MSGTR_RADIO_WrongChannelName "[radio] Wrong channel name: %s\n"
#define MSGTR_RADIO_FreqParameterDetected "[radio] Radio frequency parameter detected.\n"
#define MSGTR_RADIO_DoneParsingChannels "[radio] Done parsing channels.\n"
#define MSGTR_RADIO_GetTunerFailed "[radio] Warning: ioctl get tuner failed: %s. Setting frac to %d.\n"
Modified: trunk/stream/stream_radio.c
==============================================================================
--- trunk/stream/stream_radio.c (original)
+++ trunk/stream/stream_radio.c Mon Sep 11 20:41:14 2006
@@ -862,10 +862,24 @@
radio_priv_t* priv=(radio_priv_t*)stream->priv;
int i, channel_int;
radio_channels_t* tmp;
+ char* endptr;
+ if (*channel=='\0')
+ mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_WrongChannelName,channel);
+
if (priv->radio_channel_list) {
- channel_int = atoi(channel);
+ channel_int = strtol(channel,&endptr,10);
tmp = priv->radio_channel_list;
+ if (*endptr!='\0'){
+ //channel is not a number, so it contains channel name
+ for ( ; tmp; tmp=tmp->next)
+ if (!strncmp(channel,tmp->name,sizeof(tmp->name)-1))
+ break;
+ if (!tmp){
+ mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_WrongChannelName,channel);
+ return 0;
+ }
+ }else{
for (i = 1; i < channel_int; i++)
if (tmp->next)
tmp = tmp->next;
@@ -875,6 +889,7 @@
mp_msg(MSGT_RADIO,MSGL_ERR,MSGTR_RADIO_WrongChannelNumberInt,channel_int);
return 0;
}
+ }
priv->radio_channel_current=tmp;
mp_msg(MSGT_RADIO, MSGL_V, MSGTR_RADIO_SelectedChannel, priv->radio_channel_current->index,
priv->radio_channel_current->name, priv->radio_channel_current->freq);
More information about the MPlayer-cvslog
mailing list