Mailing List archive

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

[vdr] Re: Feature Request for 1.3 - Zap back to previous



Am Samstag, 14. Juni 2003 23:12 schrieben Sie:
> Hi List,
>
> now since 1.2 got stable I want to make a feature request for the future
> development branch; an improved "zap back" function.
>
> Currently, the key "0" serves this functionality, it zaps back to the
> channel you watched before you switched to the current.
>
> For example, if you've been on channel 3 and switch to channel 5, key "0"
> gets you back to channel 3.
>
> Nothing wrong with that - except that you have to key in the channel 5
> directly to be able to zap back to channel 3. If you use the channel-up
> keys to zap to 5, which means that you have to switch to channel 4 first to
> get to 5, "0" would get you back to _4_ and not to 3, which is where you
> actually startet and probably would want to go back to.
>
> Thus I propose that VDR should regard a channel as "current" after a second
> or more of actually watching as "current" and discard channels you just
> have been on for a fraction of a second to not confuse the zap-back
> function.
>
> I hope you get what I mean ;)
>
> Do you think this would be possible?
>
> Cheers
> Thomas
Hi,
the following patch adds your requested behavior with a delay of 2secs before 
changing the previous channel.

Greetings
diff -Nru vdr-1.2.1/vdr.c vdr-1.2.1patch/vdr.c
--- vdr-1.2.1/vdr.c	2003-06-14 10:40:44.000000000 +0200
+++ vdr-1.2.1patch/vdr.c	2003-06-15 03:01:01.000000000 +0200
@@ -455,11 +455,12 @@
   int LastChannel = -1;
   int LastTimerChannel = -1;
   int PreviousChannel = cDevice::CurrentChannel();
+  int LastLastChannel = PreviousChannel;
   time_t LastActivity = 0;
   int MaxLatencyTime = 0;
   bool ForceShutdown = false;
   bool UserShutdown = false;
-
+  time_t LastChannelChanged = time(NULL);
   while (!Interrupted) {
         // Handle emergency exits:
         if (cThread::EmergencyExit()) {
@@ -492,10 +493,15 @@
         if (!EITScanner.Active() && cDevice::CurrentChannel() != LastChannel) {
            if (!Menu)
               Menu = Temp = new cDisplayChannel(cDevice::CurrentChannel(), LastChannel > 0);
-           if (LastChannel > 0)
-              PreviousChannel = LastChannel;
            LastChannel = cDevice::CurrentChannel();
+	   LastChannelChanged = time(NULL);
            }
+	if (LastLastChannel != LastChannel && time(NULL) - LastChannelChanged > 2) {
+           if (LastLastChannel > 0 ){
+              PreviousChannel = LastLastChannel;
+              LastLastChannel = cDevice::CurrentChannel();
+	      }
+	   }
         // Timers and Recordings:
         if (!Timers.BeingEdited()) {
            time_t Now = time(NULL); // must do both following calls with the exact same time!

Home | Main Index | Thread Index