Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[vdr] Faster channel number input, patch



  Hi Klaus and everyone,

  Inputting channel numbers from remote can be made 1 second faster with
the following patch.  When typing the numbers, if you only have say 20
channels, if you type '3' vdr knows there are no channels with more digits
in channel number and can change channel immediately without waiting for
1 second for the next key.

  There needs to be some tuning on channel display but I suppose someone
can do it better than me.  Feel free to write more beautiful code too :-)

Have fun,
Jaakko

--- old/vdr-1.2.1/menu.c	Sat Jun  7 15:31:57 2003
+++ vdr-1.2.1/menu.c	Fri Jun 13 09:07:27 2003
@@ -2740,6 +2740,40 @@
             number = number * 10 + Key - k0;
             if (number > 0) {
                cChannel *channel = Channels.GetByNumber(number);
+
+	       // Check if keying more numbers is not needed because
+	       // longer channel numbers do not exist.  This could
+	       // check deeper but this is enough for most channel
+	       // numbering schemes.
+
+	       if (number * 10  > Channels.MaxNumber()
+		   || (number * 100 > Channels.MaxNumber()
+		       && !Channels.GetByNumber(number * 10)
+		       && !Channels.GetByNumber(number * 10 + 1)
+		       && !Channels.GetByNumber(number * 10 + 2)
+		       && !Channels.GetByNumber(number * 10 + 3)
+		       && !Channels.GetByNumber(number * 10 + 4)
+		       && !Channels.GetByNumber(number * 10 + 5)
+		       && !Channels.GetByNumber(number * 10 + 6)
+		       && !Channels.GetByNumber(number * 10 + 7)
+		       && !Channels.GetByNumber(number * 10 + 8)
+		       && !Channels.GetByNumber(number * 10 + 9))) {
+		 if (channel) {
+
+		   // TODO: when changing to a single digit channel
+		   // when there are no double digit channels staring
+		   // with that digit, there is no info display.
+		   // I do not know how to fix this. -Jaakko
+
+		   Channels.SwitchTo(number);
+		   return osEnd;
+		   }
+		 number = 0;
+		 DisplayChannel(NULL);
+		 lastTime = time_ms();
+		 return osContinue;
+		 }
+
                DisplayChannel(channel);
                lastTime = time_ms();
                }

-- 
Foreca Ltd                                           Jaakko.Hyvatti@foreca.com
Pursimiehenkatu 29-31 B, FIN-00150 Helsinki, Finland     http://www.foreca.com


-- 
Info:
To unsubscribe send a mail to ecartis@linuxtv.org with "unsubscribe vdr" as subject.



Home | Main Index | Thread Index