changeset 22619:86edaa8501c1

Allow to specify frequencies in channels option.
author voroshil
date Fri, 16 Mar 2007 19:42:41 +0000
parents 1e97d8fc86b3
children 565f3290908e
files DOCS/man/en/mplayer.1 stream/tv.c
diffstat 2 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/DOCS/man/en/mplayer.1	Fri Mar 16 19:21:54 2007 +0000
+++ b/DOCS/man/en/mplayer.1	Fri Mar 16 19:42:41 2007 +0000
@@ -1751,6 +1751,10 @@
 available: europe-east, europe-west, us-bcast, us-cable, etc
 .IPs channels=<channel>\-<name>,<channel>\-<name>,...
 Set names for channels.
+.I NOTE:
+If <channel> is an integer greater than 1000, it will be treated as frequency (in kHz)
+rather than channel name from frequency table.
+.br
 Use _ for spaces in names (or play with quoting ;-).
 The channel names will then be written using OSD, and the slave commands
 tv_step_channel, tv_set_channel and tv_last_channel will be usable for
--- a/stream/tv.c	Fri Mar 16 19:21:54 2007 +0000
+++ b/stream/tv.c	Fri Mar 16 19:42:41 2007 +0000
@@ -361,10 +361,16 @@
 		        sizeof(tv_channel_current->name));
 		sep[0] = '\0';
 		strncpy(tv_channel_current->number, tmp, 5);
+		tv_channel_current->number[4]='\0';
 
 		while ((sep=strchr(tv_channel_current->name, '_')))
 		    sep[0] = ' ';
 
+		// if channel number is a number and larger than 1000 threat it as frequency
+                // tmp still contain pointer to null-terminated string with channel number here
+		if (atoi(tmp)>1000){ 
+		    tv_channel_current->freq=atoi(tmp);
+		}else{
 		tv_channel_current->freq = 0;
 		for (i = 0; i < chanlists[tvh->chanlist].count; i++) {
 		    cl = tvh->chanlist_s[i];
@@ -373,6 +379,7 @@
 			break;
 		    }
 		}
+		}
 	        if (tv_channel_current->freq == 0)
 		    mp_msg(MSGT_TV, MSGL_ERR, "Couldn't find frequency for channel %s (%s)\n",
 				    tv_channel_current->number, tv_channel_current->name);