summaryrefslogtreecommitdiff
path: root/tsstreamerrorcounter.h
diff options
context:
space:
mode:
Diffstat (limited to 'tsstreamerrorcounter.h')
-rw-r--r--tsstreamerrorcounter.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/tsstreamerrorcounter.h b/tsstreamerrorcounter.h
new file mode 100644
index 0000000..4f21fbc
--- /dev/null
+++ b/tsstreamerrorcounter.h
@@ -0,0 +1,31 @@
+#ifndef __TSCHECKER_H
+#define __TSCHECKER_H
+
+#define TS_SYNC_BYTE 0x47
+#define TS_SIZE 188
+
+// TS stream error counter:
+// Count (continuity) errors in a TS packet stream
+
+#define MAX_PIDS 20
+typedef unsigned char uchar;
+
+class cTsStreamErrorCounter {
+private:
+ int errorCount;
+ int pids[MAX_PIDS];
+ uchar counters[MAX_PIDS];
+public:
+ cTsStreamErrorCounter(void);
+ void CheckTsPackets(uchar* Data, int Length);
+ ///< Check for errors in the TS packets pointed to by Data. Length is the
+ ///< number of bytes Data points to, and must be a multiple of 188.
+ int ErrorCount(void) const { return errorCount; };
+ ///< Return the number of errors found in the analyzed TS packet stream.
+ ///< Right now, only continuity errors are reported.
+private:
+ void CheckTsPacketContinuity(int pid, int counter);
+ };
+
+
+#endif // __TSCHECKER_H