summaryrefslogtreecommitdiffstats
path: root/libmpdemux
diff options
context:
space:
mode:
authoralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-04-28 16:11:42 +0000
committeralex <alex@b3059339-0415-0410-9bf9-f77b7e298cf2>2003-04-28 16:11:42 +0000
commit7e677ff7cfa8f11888303d78cb342add509c4ff7 (patch)
tree661c3af9d1d86e5469f244c62d9dba6b0a4a3dcd /libmpdemux
parentdd159b2530e2d9491f17ae86205923a8b5567359 (diff)
downloadmpv-7e677ff7cfa8f11888303d78cb342add509c4ff7.tar.bz2
mpv-7e677ff7cfa8f11888303d78cb342add509c4ff7.tar.xz
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan@duticai.TWI.TUDelft.NL>
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10012 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'libmpdemux')
-rw-r--r--libmpdemux/tv.c22
1 files changed, 21 insertions, 1 deletions
diff --git a/libmpdemux/tv.c b/libmpdemux/tv.c
index ff6b175959..9c0450cbc8 100644
--- a/libmpdemux/tv.c
+++ b/libmpdemux/tv.c
@@ -328,16 +328,36 @@ static int open_tv(tvi_handle_t *tvh)
if (tv_channel_list) {
int i;
- int channel;
+ int channel = 0;
if (tv_param_channel)
+ {
+ if (isdigit(*tv_param_channel))
+ /* if tv_param_channel begins with a digit interpret it as a number */
channel = atoi(tv_param_channel);
+ else
+ {
+ /* if tv_param_channel does not begin with a digit
+ set the first channel that contains tv_param_channel in its name */
+
+ tv_channel_current = tv_channel_list;
+ while ( tv_channel_current ) {
+ if ( strstr(tv_channel_current->name, tv_param_channel) )
+ break;
+ tv_channel_current = tv_channel_current->next;
+ }
+ if ( !tv_channel_current ) tv_channel_current = tv_channel_list;
+ }
+ }
else
channel = 1;
+ if ( channel ) {
tv_channel_current = tv_channel_list;
for (i = 1; i < channel; i++)
if (tv_channel_current->next)
tv_channel_current = tv_channel_current->next;
+ }
+
mp_msg(MSGT_TV, MSGL_INFO, "Selected channel: %s - %s (freq: %.3f)\n", tv_channel_current->number,
tv_channel_current->name, (float)tv_channel_current->freq/1000);
tv_set_freq(tvh, (unsigned long)(((float)tv_channel_current->freq/1000)*16));