Blob Blame History Raw
diff -Nurp vdr-2.4.6.orig/channels.c vdr-2.4.6/channels.c
--- vdr-2.4.6.orig/channels.c	2020-04-11 11:22:05.000000000 +0200
+++ vdr-2.4.6/channels.c	2021-01-02 14:56:49.883831519 +0100
@@ -16,6 +16,8 @@
 // format characters in order to allow any number of blanks after a numeric
 // value!
 
+#define CHANNELMARKOBSOLETE "OBSOLETE"
+
 // --- tChannelID ------------------------------------------------------------
 
 const tChannelID tChannelID::InvalidID;
@@ -434,6 +436,24 @@ void cChannel::SetSeen(void)
   seen = time(NULL);
 }
 
+bool cChannel::ClearObsoleteChannel(void)
+{
+  bool ChannelsModified = false;
+  if (endswith(name, CHANNELMARKOBSOLETE)) {
+     int mlen = strlen(CHANNELMARKOBSOLETE);
+     int e = strlen(name) - mlen - 1;
+     name[e] = '\0';
+     cString clrname = cString::sprintf("%s", name);
+     name[e] = ' ';
+
+     int OldShowChannelNamesWithSource = Setup.ShowChannelNamesWithSource;
+     Setup.ShowChannelNamesWithSource = 0;
+     ChannelsModified |= SetName(clrname, shortName, provider + mlen + 1);
+     Setup.ShowChannelNamesWithSource = OldShowChannelNamesWithSource;
+     }
+  return ChannelsModified;
+}
+
 void cChannel::DelLinkChannel(cChannel *LinkChannel)
 {
   if (linkChannels) {
@@ -1112,7 +1132,6 @@ cChannel *cChannels::NewChannel(const cC
   return NULL;
 }
 
-#define CHANNELMARKOBSOLETE "OBSOLETE"
 #define CHANNELTIMEOBSOLETE 3600 // seconds to wait before declaring a channel obsolete (in case it has actually been seen before)
 
 bool cChannels::MarkObsoleteChannels(int Source, int Nid, int Tid)
diff -Nurp vdr-2.4.6.orig/channels.h vdr-2.4.6/channels.h
--- vdr-2.4.6.orig/channels.h	2020-06-10 16:00:36.000000000 +0200
+++ vdr-2.4.6/channels.h	2021-01-02 12:58:13.693581025 +0100
@@ -202,6 +202,7 @@ public:
   void SetRefChannel(cChannel *RefChannel);
   bool SetSubtitlingDescriptors(uchar *SubtitlingTypes, uint16_t *CompositionPageIds, uint16_t *AncillaryPageIds);
   void SetSeen(void);
+  bool ClearObsoleteChannel(void);
   void DelLinkChannel(cChannel *LinkChannel);
   };
 
diff -Nurp vdr-2.4.6.orig/pat.c vdr-2.4.6/pat.c
--- vdr-2.4.6.orig/pat.c	2020-12-18 15:51:57.000000000 +0100
+++ vdr-2.4.6/pat.c	2021-01-02 12:56:25.480243876 +0100
@@ -489,6 +489,9 @@ void cPatFilter::Process(u_short Pid, u_
         SwitchToNextPmtPid();
      cChannel *Channel = Channels->GetByServiceID(Source(), Transponder(), pmt.getServiceId());
      if (Channel) {
+        bool seen = Channel->Seen();
+        if (!seen) // not yet seen in sdt.c
+           Channel->SetSeen();
         SI::CaDescriptor *d;
         cCaDescriptors *CaDescriptors = new cCaDescriptors(Channel->Source(), Channel->Transponder(), Channel->Sid(), Pid);
         // Scan the common loop:
@@ -723,6 +726,8 @@ void cPatFilter::Process(u_short Pid, u_
            ChannelsModified |= Channel->SetCaIds(CaDescriptors->CaIds());
            ChannelsModified |= Channel->SetSubtitlingDescriptors(SubtitlingTypes, CompositionPageIds, AncillaryPageIds);
            }
+        if (!seen && (Setup.UpdateChannels == 1 || Setup.UpdateChannels >= 3))
+           ChannelsModified |= Channel->ClearObsoleteChannel(); // just in case
         ChannelsModified |= Channel->SetCaDescriptors(CaDescriptorHandler.AddCaDescriptors(CaDescriptors));
         }
      StateKey.Remove(ChannelsModified);