diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2020-05-04 08:50:20 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2020-05-04 08:50:20 +0200 |
commit | 5705ffbd2ba1cd6644e7bc7b10686963d3d8ef9f (patch) | |
tree | 0ca2f43b1c5d9e2674e364bd01ba8cdd30dbac74 /sdt.c | |
parent | 6e0f5287ea4df66847f97489f00f2c8214bad605 (diff) | |
download | vdr-5705ffbd2ba1cd6644e7bc7b10686963d3d8ef9f.tar.gz vdr-5705ffbd2ba1cd6644e7bc7b10686963d3d8ef9f.tar.bz2 |
Now retuning if the received transponder's SDT doesn't contain the expected values for NID and TID
Diffstat (limited to 'sdt.c')
-rw-r--r-- | sdt.c | 40 |
1 files changed, 36 insertions, 4 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: sdt.c 4.5 2015/08/02 11:33:23 kls Exp $ + * $Id: sdt.c 4.6 2020/05/04 08:50:20 kls Exp $ */ #include "sdt.h" @@ -23,8 +23,13 @@ static bool DebugSdt = false; cSdtFilter::cSdtFilter(cPatFilter *PatFilter) { source = cSource::stNone; + lastSource = cSource::stNone; + lastTransponder = 0; + lastNid = 0; + lastTid = 0; patFilter = PatFilter; - Set(0x11, 0x42); // SDT + transponderState = tsUnknown; + Set(0x11, 0x42); // SDT actual TS } void cSdtFilter::SetStatus(bool On) @@ -34,6 +39,7 @@ void cSdtFilter::SetStatus(bool On) sectionSyncer.Reset(); if (!On) source = cSource::stNone; + transponderState = tsUnknown; } void cSdtFilter::Trigger(int Source) @@ -45,11 +51,37 @@ void cSdtFilter::Trigger(int Source) void cSdtFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length) { cMutexLock MutexLock(&mutex); - if (!(source && Transponder())) - return; SI::SDT sdt(Data, false); if (!sdt.CheckCRCAndParse()) return; + if (transponderState == tsUnknown) { + // The transponder can be verified with any section, no sync required: + int Nid = sdt.getOriginalNetworkId(); + int Tid = sdt.getTransportStreamId(); + if (Source() != lastSource || !ISTRANSPONDER(Transponder(), lastTransponder)) { + // We expect a change in NID/TID: + if (Nid && Tid && Nid == lastNid && Tid == lastTid) { + transponderState = tsWrong; + dsyslog("SDT: channel %d NID/TID (%d/%d) not found, got %d/%d", Channel()->Number(), Channel()->Nid(), Channel()->Tid(), Nid, Tid); + return; + } + } + // NID/TID is acceptable: + lastSource = Source(); + lastTransponder = Transponder(); + lastNid = Nid; + lastTid = Tid; + if (Nid == Channel()->Nid() && Tid == Channel()->Tid()) { + // NID/TID correspond with the channel data: + transponderState = tsVerified; + } + else { + // NID/TID differ from the channel data, but we accept it, since this *is* the data for this transponder: + transponderState = tsAccepted; + } + } + if (!(source && Transponder())) + return; if (!sectionSyncer.Sync(sdt.getVersionNumber(), sdt.getSectionNumber(), sdt.getLastSectionNumber())) return; cStateKey StateKey; |