diff options
-rw-r--r-- | HISTORY | 1 | ||||
-rw-r--r-- | filter.c | 31 | ||||
-rw-r--r-- | filter.h | 6 | ||||
-rw-r--r-- | nit.c | 4 | ||||
-rw-r--r-- | sdt.c | 4 |
5 files changed, 29 insertions, 17 deletions
@@ -8618,3 +8618,4 @@ Video Disk Recorder Revision History network. - Added some comment to cPixmap about the relation between OSD, ViewPort and DrawPort (suggested by Thomas Reufer). +- Improved syncing on sections when parsing the NIT and SDT. @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: filter.c 1.4 2004/01/11 13:31:34 kls Exp $ + * $Id: filter.c 4.1 2015/03/17 15:04:39 kls Exp $ */ #include "filter.h" @@ -19,22 +19,31 @@ cSectionSyncer::cSectionSyncer(void) void cSectionSyncer::Reset(void) { + lastVersion = thisVersion = 0xFF; + nextNumber = 0; +} + +void cSectionSyncer::Repeat(void) +{ lastVersion = 0xFF; - synced = false; + nextNumber--; } bool cSectionSyncer::Sync(uchar Version, int Number, int LastNumber) { - if (Version == lastVersion) - return false; - if (!synced) { - if (Number != 0) - return false; // sync on first section - synced = true; + if (Version != lastVersion) { + if (Version != thisVersion) { + thisVersion = Version; + nextNumber = 0; + } + if (Number == nextNumber) { + if (Number == LastNumber) + lastVersion = Version; + nextNumber++; + return true; + } } - if (Number == LastNumber) - lastVersion = Version; - return synced; + return false; } // --- cFilterData ----------------------------------------------------------- @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: filter.h 1.3 2004/01/11 13:31:59 kls Exp $ + * $Id: filter.h 4.1 2015/03/17 15:00:08 kls Exp $ */ #ifndef __FILTER_H @@ -16,10 +16,12 @@ class cSectionSyncer { private: int lastVersion; - bool synced; + int thisVersion; + int nextNumber; public: cSectionSyncer(void); void Reset(void); + void Repeat(void); bool Sync(uchar Version, int Number, int LastNumber); }; @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: nit.c 4.1 2015/03/16 15:24:18 kls Exp $ + * $Id: nit.c 4.2 2015/03/17 15:10:09 kls Exp $ */ #include "nit.h" @@ -62,7 +62,7 @@ void cNitFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length 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); } if (!Channels.Lock(true, 10)) { - sectionSyncer.Reset(); // let's not miss any section of the NIT + sectionSyncer.Repeat(); // let's not miss any section of the NIT return; } SI::NIT::TransportStream ts; @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: sdt.c 4.3 2015/03/16 15:24:12 kls Exp $ + * $Id: sdt.c 4.4 2015/03/17 15:09:54 kls Exp $ */ #include "sdt.h" @@ -53,7 +53,7 @@ void cSdtFilter::Process(u_short Pid, u_char Tid, const u_char *Data, int Length if (!sectionSyncer.Sync(sdt.getVersionNumber(), sdt.getSectionNumber(), sdt.getLastSectionNumber())) return; if (!Channels.Lock(true, 10)) { - sectionSyncer.Reset(); // let's not miss any section of the SDT + sectionSyncer.Repeat(); // 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()); |