Mailing List archive

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

[vdr] Re: Patch Zapping-Feature



Mirko Guenther wrote:
> 
> Klaus Schmidinger schrieb:
> > Mirko Guenther wrote:
> >
> >>I've a little patch for the Zapping-Feature Timeout.
> >>Now you came bak to the channel, you've seen before you start zapping
> >>without wait for the timeout.
> >>
> >>--
> >>this mail was send using 100% recycled electrons
> >>
> >>  > >>--- orig/vdr.c  2003-08-02 16:01:32.000000000 +0200
> >>+++ change/vdr.c        2003-08-07 16:18:51.000000000 +0200
> >>@@ -496,6 +496,9 @@
> >>            if (!Menu)
> >>               Menu = Temp = new cDisplayChannel(cDevice::CurrentChannel(), LastChannel > 0);
> >>            LastChannel = cDevice::CurrentChannel();
> >>+          if(time(NULL) - LastChannelChanged >= ZAPTIMEOUT) {
> >>+           PreviousChannel=LastLastChannel;
> >>+           }//if
> >>            LastChannelChanged = time(NULL);
> >>            }
> >>         if (LastLastChannel != LastChannel && time(NULL) - LastChannelChanged >= ZAPTIMEOUT) {
> >
> >
> > I tried this, but I came into situations (although hard to reproduce)
> > where it didn't switch between two channels any more, but rather
> > switched only "between" the same channel.
> >
> > What exactly is it that your patch is supposed to fix?
> >
> > Somehow I'm getting the feeling that this feature is becomming
> > way too complex...
> >
> > Klaus
> >
> >
> 
> Hmmmm... without this patch, I've the problem, that I have to wait for
> the timeout to came back to the channel, I've seen before zapping. When
> I not wait, I came to the previous channel as that channel, I've seen
> before zapping. This patch (should) solve this problem.
> 
> Mirko

Can you please try this patch (against 1.2.2, line numbers may be a little off):

--- vdr.c       2003/08/02 14:01:32     1.162
+++ vdr.c       2003/08/16 15:21:35
@@ -455,8 +457,8 @@
   cOsdObject *Temp = NULL;
   int LastChannel = -1;
   int LastTimerChannel = -1;
-  int PreviousChannel = cDevice::CurrentChannel();
-  int LastLastChannel = PreviousChannel;
+  int PreviousChannel[2] = { 1, 1 };
+  int PreviousChannelIndex = 0;
   time_t LastChannelChanged = time(NULL);
   time_t LastActivity = 0;
   int MaxLatencyTime = 0;
@@ -498,10 +500,8 @@
            LastChannel = cDevice::CurrentChannel();
            LastChannelChanged = time(NULL);
            }
-        if (LastLastChannel != LastChannel && time(NULL) - LastChannelChanged >= ZAPTIMEOUT) {
-           PreviousChannel = LastLastChannel;
-           LastLastChannel = LastChannel;
-           }
+        if (time(NULL) - LastChannelChanged >= ZAPTIMEOUT && LastChannel != PreviousChannel[0] && LastChannel != PreviousChannel[1])
+           PreviousChannel[PreviousChannelIndex ^= 1] = LastChannel;
         // Timers and Recordings:
         if (!Timers.BeingEdited()) {
            time_t Now = time(NULL); // must do both following calls with the exact same time!
@@ -680,9 +680,9 @@
            switch (key) {
              // Toggle channels:
              case k0: {
-                  int CurrentChannel = cDevice::CurrentChannel();
-                  Channels.SwitchTo(PreviousChannel);
-                  PreviousChannel = CurrentChannel;
+                  if (PreviousChannel[PreviousChannelIndex ^ 1] == LastChannel || LastChannel != PreviousChannel[0] && LastChannel != PreviousChannel[1])
+                     PreviousChannelIndex ^= 1;
+                  Channels.SwitchTo(PreviousChannel[PreviousChannelIndex ^= 1]);
                   break;
                   }
              // Direct Channel Select:


As far as I have tested there were no unexpected effects with this one.

@Oliver Endriss: do you see anything unwanted happening with this?

Klaus


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



Home | Main Index | Thread Index