]> git.sesse.net Git - decode_sdt/commitdiff
Do our own SDT deduplication, to avoid infinite loops on Astra.
authorSteinar H. Gunderson <sesse@samfundet.no>
Tue, 16 Sep 2014 19:43:10 +0000 (21:43 +0200)
committerSteinar H. Gunderson <sesse@samfundet.no>
Tue, 16 Sep 2014 19:43:10 +0000 (21:43 +0200)
decode_sdt.cc [moved from decode_sdt.c with 97% similarity]

similarity index 97%
rename from decode_sdt.c
rename to decode_sdt.cc
index ffd17b86d84e0a5bb7d01a482da277c1d5f127cc..916505a3e49fc7aab91f06f3274b709dd953df2f 100644 (file)
@@ -44,6 +44,8 @@
 #include <dvbpsi/sdt.h>
 #include <dvbpsi/nit.h>
 
+#include <set>
+
 static int packet_num = 0;
 static int last_used_packet_num = 0;
 
@@ -181,6 +183,13 @@ has_stuff:
 
 static void ParseSDT(void *p_zero, dvbpsi_sdt_t * p_sdt)
 {
+       // Do our own deduplication, since libdvbpsi only deduplicates against
+       // the last version seen, not the entire history.
+       static std::set<std::pair<uint8_t, bool> > seen_sdt_tables;
+       if (!seen_sdt_tables.insert(std::make_pair(p_sdt->i_version, p_sdt->b_current_next)).second) {
+               return;
+       }
+
        last_used_packet_num = packet_num;
        dvbpsi_sdt_service_t *p_service = p_sdt->p_first_service;
        for (dvbpsi_sdt_service_t * p_service = p_sdt->p_first_service;