VDR automatic channel update and recording annoyance.

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

 



Antti Hartikainen wrote:
> Hi.
> 
> VDR:s automatic channel update while recording is very annoying and it's 
> breaking few seconds of the recording.
> 
> Some channels (like YLE in Finland) changes audio language for example 
> from "fin" to "eng" when program starts. VDR detects there is change in 
> channel information, stops recording, retunes to channel and starts 
> recording again.
> 
> This way there is always missing few seconds from the start of the 
> recording. But on the other hand, this feature is a must. I like new 
> channels to be added and information changed.
> 
> But retuning on such minor issue (and breaking recording) is bad.

Please try the attached patch. With this it should no longer retune
if only the language code changes.

Klaus
-------------- next part --------------
--- channels.h	2005/05/06 13:47:06	1.27
+++ channels.h	2005/05/07 13:07:09
@@ -24,6 +24,7 @@
 #define CHANNELMOD_ID       0x04
 #define CHANNELMOD_CA       0x10
 #define CHANNELMOD_TRANSP   0x20
+#define CHANNELMOD_LANGS    0x40
 #define CHANNELMOD_RETUNE   (CHANNELMOD_PIDS | CHANNELMOD_CA | CHANNELMOD_TRANSP)
 
 #define CHANNELSMOD_NONE    0
--- channels.c	2005/05/06 13:46:57	1.37
+++ channels.c	2005/05/07 13:07:27
@@ -389,15 +389,22 @@
      }
 }
 
-static bool IntArraysDiffer(const int *a, const int *b, const char na[][4] = NULL, const char nb[][4] = NULL)
+#define STRDIFF 0x01
+#define VALDIFF 0x02
+
+static int IntArraysDiffer(const int *a, const int *b, const char na[][4] = NULL, const char nb[][4] = NULL)
 {
-  int i = 0;
-  while (a[i] && b[i]) {
-        if (a[i] != b[i] || na && nb && strcmp(na[i], nb[i]) != 0)
-           return true;
-        i++;
-        }
-  return a[i] != b[i] || a[i] && na && nb && strcmp(na[i], nb[i]) != 0;
+  int result = 0;
+  for (int i = 0; a[i] || b[i]; i++) {
+      if (a[i] && na && nb && strcmp(na[i], nb[i]) != 0)
+         result |= STRDIFF;
+      if (a[i] != b[i])
+         result |= VALDIFF;
+      if (na && nb) fprintf(stderr, "%2d %5d %5d %-3s %-3s  %d\n", i, a[i], b[i], na[i], nb[i], result);//XXX
+      if (!a[i] || !b[i])
+         break;
+      }
+  return result;
 }
 
 static int IntArrayToString(char *s, const int *a, int Base = 10, const char n[][4] = NULL)
@@ -418,10 +425,15 @@
 
 void cChannel::SetPids(int Vpid, int Ppid, int *Apids, char ALangs[][4], int *Dpids, char DLangs[][4], int Tpid)
 {
-  bool modified = vpid != Vpid || ppid != Ppid || tpid != Tpid;
-  if (!modified)
-     modified = IntArraysDiffer(apids, Apids, alangs, ALangs) || IntArraysDiffer(dpids, Dpids, dlangs, DLangs);
-  if (modified) {
+  int mod = CHANNELMOD_NONE;
+  if (vpid != Vpid || ppid != Ppid || tpid != Tpid)
+     mod |= CHANNELMOD_PIDS;
+  int m = IntArraysDiffer(apids, Apids, alangs, ALangs) | IntArraysDiffer(dpids, Dpids, dlangs, DLangs);
+  if (m & STRDIFF)
+     mod |= CHANNELMOD_LANGS;
+  if (m & VALDIFF)
+     mod |= CHANNELMOD_PIDS;
+  if (mod) {
      char OldApidsBuf[(MAXAPIDS + MAXDPIDS) * 10 + 10]; // 10: 5 digits plus delimiting ',' or ';' plus optional '=cod', +10: paranoia
      char NewApidsBuf[(MAXAPIDS + MAXDPIDS) * 10 + 10];
      char *q = OldApidsBuf;
@@ -450,7 +462,7 @@
          strn0cpy(dlangs[i], DLangs[i], 4);
          }
      tpid = Tpid;
-     modification |= CHANNELMOD_PIDS;
+     modification |= mod;
      Channels.SetModified();
      }
 }

[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux