summaryrefslogtreecommitdiff
path: root/filter.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2015-03-17 15:10:57 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2015-03-17 15:10:57 +0100
commit62596f991ebf30a61cdbe1de15acd2c63f598149 (patch)
tree2eeb04febf502fe7de88062ba193f52a6b07c89e /filter.c
parentfd7ccc7627b08ab66122d644cb301aba42ae0c06 (diff)
downloadvdr-62596f991ebf30a61cdbe1de15acd2c63f598149.tar.gz
vdr-62596f991ebf30a61cdbe1de15acd2c63f598149.tar.bz2
Improved syncing on sections when parsing the NIT and SDT
Diffstat (limited to 'filter.c')
-rw-r--r--filter.c31
1 files changed, 20 insertions, 11 deletions
diff --git a/filter.c b/filter.c
index 08bde5a4..331983a8 100644
--- a/filter.c
+++ b/filter.c
@@ -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 -----------------------------------------------------------