From patchwork Fri May 22 09:59:18 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Klaus Schmidinger X-Patchwork-Id: 29787 Received: from localhost ([127.0.0.1] helo=www.linuxtv.org) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1Yvjjh-0005z1-Hs; Fri, 22 May 2015 11:59:25 +0200 Received: from mail.tu-berlin.de ([130.149.7.33]) by www.linuxtv.org with esmtp (Exim 4.72) (envelope-from ) id 1Yvjjd-0005ym-L1 for vdr@linuxtv.org; Fri, 22 May 2015 11:59:22 +0200 X-tubIT-Incoming-IP: 88.198.76.220 Received: from racoon.tvdr.de ([88.198.76.220]) by mail.tu-berlin.de (exim-4.76/mailfrontend-6) with esmtps [UNKNOWN:AES256-GCM-SHA384:256] for id 1Yvjjc-0007gH-3v; Fri, 22 May 2015 11:59:21 +0200 Received: from dolphin.tvdr.de (dolphin.tvdr.de [192.168.100.2]) by racoon.tvdr.de (8.14.9/8.14.9) with ESMTP id t4M9xJFd020798 for ; Fri, 22 May 2015 11:59:19 +0200 Received: from [192.168.100.11] (falcon.tvdr.de [192.168.100.11]) by dolphin.tvdr.de (8.14.4/8.14.4) with ESMTP id t4M9xIhS021485 for ; Fri, 22 May 2015 11:59:18 +0200 Message-ID: <555EFDF6.3040805@tvdr.de> Date: Fri, 22 May 2015 11:59:18 +0200 From: Klaus Schmidinger User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: vdr@linuxtv.org References: <555A5EC1.4080601@tvdr.de> <555C9F21.3020207@gmail.com> <555DBAA5.8030200@tvdr.de> <555EB3CB.3010900@gmail.com> In-Reply-To: <555EB3CB.3010900@gmail.com> X-PMX-Version: 6.0.0.2142326, Antispam-Engine: 2.7.2.2107409, Antispam-Data: 2015.5.22.94816 X-PMX-Spam: Gauge=IIIIIIII, Probability=8%, Report=' HTML_00_01 0.05, HTML_00_10 0.05, MIME_TEXT_ONLY_MP_MIXED 0.05, BODYTEXTP_SIZE_3000_LESS 0, BODY_SIZE_10000_PLUS 0, REFERENCES 0, __ANY_URI 0, __BAT_BOUNDARY 0, __BOUNCE_CHALLENGE_SUBJ 0, __BOUNCE_NDR_SUBJ_EXEMPT 0, __CT 0, __CTYPE_HAS_BOUNDARY 0, __CTYPE_MULTIPART 0, __CTYPE_MULTIPART_MIXED 0, __FORWARDED_MSG 0, __HAS_FROM 0, __HAS_MSGID 0, __IN_REP_TO 0, __MIME_TEXT_ONLY 0, __MIME_VERSION 0, __MOZILLA_MSGID 0, __MOZILLA_USER_AGENT 0, __REFERENCES 0, __SANE_MSGID 0, __SUBJ_ALPHA_END 0, __SUBJ_ALPHA_NEGATE 0, __TO_MALFORMED_2 0, __TO_NO_NAME 0, __URI_NO_MAILTO 0, __URI_NO_PATH 0, __URI_NO_WWW 0, __USER_AGENT 0' X-LSpam-Score: -1.1 (-) X-LSpam-Report: No, score=-1.1 required=5.0 tests=BAYES_00=-1.9, RDNS_NONE=0.793 autolearn=no Subject: Re: [vdr] OBSOLETE chnnels X-BeenThere: vdr@linuxtv.org X-Mailman-Version: 2.1.13 Precedence: list Reply-To: VDR Mailing List List-Id: VDR Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: vdr-bounces@linuxtv.org Errors-To: vdr-bounces@linuxtv.org On 22.05.2015 06:42, Marx wrote: > W dniu 2015-05-21 12:59, Klaus Schmidinger pisze: >> On 20.05.2015 16:50, Marx wrote: >>> W dniu 2015-05-18 23:50, Klaus Schmidinger pisze: >>>> On 18.05.2015 21:15, Marx wrote: >>>>> Hello >>>>> I've recently upgraded VDR and all my DVB-T channels has "OBSOLETE" >>>>> attached to the name. Is it already fixed? >>>> >>>> Which version of VDR are you running? >>>> >>>> What is the setting of "Setup/DVB/Update channels"? >>>> >>>> Are there any log entries that might help? >>> >>> I use 2.2.0-1~etobi4 >>> >>> UpdateChannels = 3 >> >> Please try setting this to 5. >> Maybe the channels have changed in some way that '3' doesn't cover. >> > will it also add automatically new channels to the list? I don't want to enable it then, because I only use subset of channels, and my channel list shouldn't be changed. My guess was that maybe the channels have changed in such a way that they need to be newly added and the old ones are obsolete. You could make a backup copy of your current channels.conf file and restore that one after doing this test. > I think there is sth wrong with detection of obsolete channels. It probably work with sattelite channels, but not with DVB-T I also have DVB-T here and no such problems. Please try the attached patch. It was originally made to fix a problem with DVB-S, but maybe it also fixes your problem. Klaus --- ./nit.c 2015/02/04 09:13:54 4.0 +++ ./nit.c 2015/03/16 15:22:47 @@ -19,19 +19,22 @@ #define DVB_SYSTEM_1 0 // see also dvbdevice.c #define DVB_SYSTEM_2 1 +#define MAXNETWORKNAME Utf8BufSize(256) + +// Set to 'true' for debug output: +static bool DebugNit = true;//XXX false; + +#define dbgnit(a...) if (DebugNit) fprintf(stderr, a) + cNitFilter::cNitFilter(cSdtFilter *SdtFilter) { sdtFilter = SdtFilter; - numNits = 0; - networkId = 0; - Set(0x10, 0x40); // NIT + Set(0x10, SI::TableIdNIT); } void cNitFilter::SetStatus(bool On) { cFilter::SetStatus(On); - numNits = 0; - networkId = 0; sectionSyncer.Reset(); } @@ -40,63 +43,28 @@ SI::NIT nit(Data, false); if (!nit.CheckCRCAndParse()) return; - // Some broadcasters send more than one NIT, with no apparent way of telling which - // one is the right one to use. This is an attempt to find the NIT that contains - // the transponder it was transmitted on and use only that one: - int ThisNIT = -1; - if (!networkId) { - for (int i = 0; i < numNits; i++) { - if (nits[i].networkId == nit.getNetworkId()) { - if (nit.getSectionNumber() == 0) { - // all NITs have passed by - for (int j = 0; j < numNits; j++) { - if (nits[j].hasTransponder) { - networkId = nits[j].networkId; - //printf("taking NIT with network ID %d\n", networkId); - //XXX what if more than one NIT contains this transponder??? - break; - } - } - if (!networkId) { - //printf("none of the NITs contains transponder %d\n", Transponder()); - return; - } - } - else { - ThisNIT = i; - break; - } - } - } - if (!networkId && ThisNIT < 0 && numNits < MAXNITS) { - if (nit.getSectionNumber() == 0) { - *nits[numNits].name = 0; - SI::Descriptor *d; - for (SI::Loop::Iterator it; (d = nit.commonDescriptors.getNext(it)); ) { - switch (d->getDescriptorTag()) { - case SI::NetworkNameDescriptorTag: { - SI::NetworkNameDescriptor *nnd = (SI::NetworkNameDescriptor *)d; - nnd->name.getText(nits[numNits].name, MAXNETWORKNAME); - } - break; - default: ; - } - delete d; - } - nits[numNits].networkId = nit.getNetworkId(); - nits[numNits].hasTransponder = false; - //printf("NIT[%d] %5d '%s'\n", numNits, nits[numNits].networkId, nits[numNits].name); - ThisNIT = numNits; - numNits++; + if (!sectionSyncer.Sync(nit.getVersionNumber(), nit.getSectionNumber(), nit.getLastSectionNumber())) + return; + if (DebugNit) { + char NetworkName[MAXNETWORKNAME] = ""; + SI::Descriptor *d; + for (SI::Loop::Iterator it; (d = nit.commonDescriptors.getNext(it)); ) { + switch (d->getDescriptorTag()) { + case SI::NetworkNameDescriptorTag: { + SI::NetworkNameDescriptor *nnd = (SI::NetworkNameDescriptor *)d; + nnd->name.getText(NetworkName, MAXNETWORKNAME); + } + break; + default: ; } - } + delete d; + } + dbgnit("NIT: %02X %2d %2d %2d %s %d %d '%s'\n", Tid, nit.getVersionNumber(), nit.getSectionNumber(), nit.getLastSectionNumber(), *cSource::ToString(Source()), nit.getNetworkId(), Transponder(), NetworkName); } - else if (networkId != nit.getNetworkId()) - return; // ignore all other NITs - else if (!sectionSyncer.Sync(nit.getVersionNumber(), nit.getSectionNumber(), nit.getLastSectionNumber())) - return; - if (!Channels.Lock(true, 10)) + if (!Channels.Lock(true, 10)) { + sectionSyncer.Reset(); // let's not miss any section of the NIT return; + } SI::NIT::TransportStream ts; for (SI::Loop::Iterator it; nit.transportStreamLoop.getNext(ts, it); ) { SI::Descriptor *d; @@ -118,6 +86,7 @@ default: ; } Frequencies[n++] = f; + dbgnit(" Frequencies[%d] = %d\n", n - 1, f); } } else @@ -142,16 +111,7 @@ static int RollOffs[] = { ROLLOFF_35, ROLLOFF_25, ROLLOFF_20, ROLLOFF_AUTO }; dtp.SetRollOff(sd->getModulationSystem() ? RollOffs[sd->getRollOff()] : ROLLOFF_AUTO); int SymbolRate = BCD2INT(sd->getSymbolRate()) / 10; - if (ThisNIT >= 0) { - for (int n = 0; n < NumFrequencies; n++) { - if (ISTRANSPONDER(cChannel::Transponder(Frequencies[n], dtp.Polarization()), Transponder())) { - nits[ThisNIT].hasTransponder = true; - //printf("has transponder %d\n", Transponder()); - break; - } - } - break; - } + dbgnit(" %s %d %c %d %d\n", *cSource::ToString(Source), Frequency, Polarizations[sd->getPolarization()], SymbolRate, cChannel::Transponder(Frequency, Polarizations[sd->getPolarization()])); if (Setup.UpdateChannels >= 5) { bool found = false; bool forceTransponderUpdate = false; @@ -184,7 +144,8 @@ } } } - sdtFilter->Trigger(Source); + if (ISTRANSPONDER(cChannel::Transponder(Frequency, dtp.Polarization()), Transponder())) + sdtFilter->Trigger(Source); } break; case SI::S2SatelliteDeliverySystemDescriptorTag: { @@ -213,16 +174,7 @@ static int Modulations[] = { QPSK, QAM_16, QAM_32, QAM_64, QAM_128, QAM_256, QAM_AUTO }; dtp.SetModulation(Modulations[min(sd->getModulation(), 6)]); int SymbolRate = BCD2INT(sd->getSymbolRate()) / 10; - if (ThisNIT >= 0) { - for (int n = 0; n < NumFrequencies; n++) { - if (ISTRANSPONDER(Frequencies[n] / 1000, Transponder())) { - nits[ThisNIT].hasTransponder = true; - //printf("has transponder %d\n", Transponder()); - break; - } - } - break; - } + dbgnit(" %s %d %d %d %d\n", *cSource::ToString(Source), Frequency, CodeRates[sd->getFecInner()], Modulations[min(sd->getModulation(), 6)], SymbolRate); if (Setup.UpdateChannels >= 5) { bool found = false; bool forceTransponderUpdate = false; @@ -255,7 +207,8 @@ } } } - sdtFilter->Trigger(Source); + if (ISTRANSPONDER(Frequency / 1000, Transponder())) + sdtFilter->Trigger(Source); } break; case SI::TerrestrialDeliverySystemDescriptorTag: { @@ -277,16 +230,7 @@ dtp.SetGuard(GuardIntervals[sd->getGuardInterval()]); static int TransmissionModes[] = { TRANSMISSION_MODE_2K, TRANSMISSION_MODE_8K, TRANSMISSION_MODE_4K, TRANSMISSION_MODE_AUTO }; dtp.SetTransmission(TransmissionModes[sd->getTransmissionMode()]); - if (ThisNIT >= 0) { - for (int n = 0; n < NumFrequencies; n++) { - if (ISTRANSPONDER(Frequencies[n] / 1000000, Transponder())) { - nits[ThisNIT].hasTransponder = true; - //printf("has transponder %d\n", Transponder()); - break; - } - } - break; - } + dbgnit(" %s %d %d %d %d %d %d %d %d\n", *cSource::ToString(Source), Frequency, Bandwidths[sd->getBandwidth()], Constellations[sd->getConstellation()], Hierarchies[sd->getHierarchy()], CodeRates[sd->getCodeRateHP()], CodeRates[sd->getCodeRateLP()], GuardIntervals[sd->getGuardInterval()], TransmissionModes[sd->getTransmissionMode()]); if (Setup.UpdateChannels >= 5) { bool found = false; bool forceTransponderUpdate = false; @@ -319,7 +263,8 @@ } } } - sdtFilter->Trigger(Source); + if (ISTRANSPONDER(Frequency / 1000000, Transponder())) + sdtFilter->Trigger(Source); } break; case SI::ExtensionDescriptorTag: { --- ./nit.h 2014/03/10 14:12:05 4.0 +++ ./nit.h 2015/03/16 12:41:38 @@ -13,24 +13,10 @@ #include "filter.h" #include "sdt.h" -#define MAXNITS 16 -#define MAXNETWORKNAME Utf8BufSize(256) - class cNitFilter : public cFilter { private: - - class cNit { - public: - u_short networkId; - char name[MAXNETWORKNAME]; - bool hasTransponder; - }; - cSectionSyncer sectionSyncer; cSdtFilter *sdtFilter; - cNit nits[MAXNITS]; - u_short networkId; - int numNits; protected: virtual void Process(u_short Pid, u_char Tid, const u_char *Data, int Length); public: --- ./sdt.c 2015/01/04 14:33:35 4.0 +++ ./sdt.c 2015/03/16 15:22:56 @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: sdt.c 4.0 2015/01/04 14:33:35 kls Exp $ + * $Id: sdt.c 4.2 2015/03/14 12:51:42 kls Exp kls $ */ #include "sdt.h" @@ -13,6 +13,11 @@ #include "libsi/section.h" #include "libsi/descriptor.h" +// Set to 'true' for debug output: +static bool DebugSdt = true;//XXX false; + +#define dbgsdt(a...) if (DebugSdt) fprintf(stderr, a) + // --- cSdtFilter ------------------------------------------------------------ cSdtFilter::cSdtFilter(cPatFilter *PatFilter) @@ -47,8 +52,11 @@ return; if (!sectionSyncer.Sync(sdt.getVersionNumber(), sdt.getSectionNumber(), sdt.getLastSectionNumber())) return; - if (!Channels.Lock(true, 10)) + if (!Channels.Lock(true, 10)) { + sectionSyncer.Reset(); // let's not miss any section of the SDT return; + } + dbgsdt("SDT: %2d %2d %2d %s %d\n", sdt.getVersionNumber(), sdt.getSectionNumber(), sdt.getLastSectionNumber(), *cSource::ToString(source), Transponder()); SI::SDT::Service SiSdtService; for (SI::Loop::Iterator it; sdt.serviceLoop.getNext(SiSdtService, it); ) { cChannel *channel = Channels.GetByChannelID(tChannelID(source, sdt.getOriginalNetworkId(), sdt.getTransportStreamId(), SiSdtService.getServiceId())); @@ -104,7 +112,9 @@ // channel->SetCa(SiSdtService.getFreeCaMode() ? 0xFFFF : 0); } else if (*pn && Setup.UpdateChannels >= 4) { + dbgsdt(" %5d %5d %5d %s/%s %d %s\n", sdt.getOriginalNetworkId(), sdt.getTransportStreamId(), SiSdtService.getServiceId(), *cSource::ToString(Channel()->Source()), *cSource::ToString(source), Channel()->Transponder(), pn); channel = Channels.NewChannel(Channel(), pn, ps, pp, sdt.getOriginalNetworkId(), sdt.getTransportStreamId(), SiSdtService.getServiceId()); + channel->SetSource(source); // in case this comes from a satellite with a slightly different position patFilter->Trigger(SiSdtService.getServiceId()); } } @@ -153,8 +163,11 @@ } } if (sdt.getSectionNumber() == sdt.getLastSectionNumber()) { - if (Setup.UpdateChannels == 1 || Setup.UpdateChannels >= 3) - Channels.MarkObsoleteChannels(Source(), sdt.getOriginalNetworkId(), sdt.getTransportStreamId()); + if (Setup.UpdateChannels == 1 || Setup.UpdateChannels >= 3) { + Channels.MarkObsoleteChannels(source, sdt.getOriginalNetworkId(), sdt.getTransportStreamId()); + if (source != Source()) + Channels.MarkObsoleteChannels(Source(), sdt.getOriginalNetworkId(), sdt.getTransportStreamId()); + } } Channels.Unlock(); } --- channels.c 2015/02/01 13:47:05 4.0 +++ channels.c 2015/03/13 11:34:28 @@ -229,6 +229,18 @@ return true; } +void cChannel::SetSource(int Source) +{ + if (source != Source) { + if (Number()) { + dsyslog("changing source of channel %d (%s) from %s to %s", Number(), name, *cSource::ToString(source), *cSource::ToString(Source)); + modification |= CHANNELMOD_TRANSP; + Channels.SetModified(); + } + source = Source; + } +} + void cChannel::SetId(int Nid, int Tid, int Sid, int Rid) { if (nid != Nid || tid != Tid || sid != Sid || rid != Rid) { --- channels.h 2015/02/01 13:30:26 4.0 +++ channels.h 2015/03/13 11:20:50 @@ -193,6 +193,7 @@ time_t Seen(void) { return seen; } void CopyTransponderData(const cChannel *Channel); bool SetTransponderData(int Source, int Frequency, int Srate, const char *Parameters, bool Quiet = false); + void SetSource(int Source); void SetId(int Nid, int Tid, int Sid, int Rid = 0); void SetLcn(int Lcn); void SetName(const char *Name, const char *ShortName, const char *Provider);