[Mplayer-cvslog] CVS: main/libmpdemux tv.c,1.54,1.55

Alex Beregszaszi alex at mplayerhq.hu
Fri Oct 17 16:00:07 CEST 2003


Update of /cvsroot/mplayer/main/libmpdemux
In directory mail:/var/tmp.root/cvs-serv10614

Modified Files:
	tv.c 
Log Message:
abilty to set tv channel by name on commandline, patch by Ivan Szanto <szivan at duticai.TWI.TUDelft.NL>

Index: tv.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/tv.c,v
retrieving revision 1.54
retrieving revision 1.55
diff -u -r1.54 -r1.55
--- tv.c	18 Apr 2003 18:36:22 -0000	1.54
+++ tv.c	28 Apr 2003 16:11:42 -0000	1.55
@@ -328,16 +328,36 @@
 
     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));



More information about the MPlayer-cvslog mailing list