summaryrefslogtreecommitdiff
path: root/remux.h
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2017-03-26 13:07:01 +0200
committerKlaus Schmidinger <vdr@tvdr.de>2017-03-26 13:07:01 +0200
commitb313d88db13d1e90f81f9967af1fba8c8f84e59d (patch)
tree7f97ed5e6ca7727bb52ff4ca016125b60e96fe8b /remux.h
parent9e808255f842067e0c0c9ee2344f6c1aa2860e08 (diff)
downloadvdr-b313d88db13d1e90f81f9967af1fba8c8f84e59d.tar.gz
vdr-b313d88db13d1e90f81f9967af1fba8c8f84e59d.tar.bz2
Improved clearing the MTD buffer and syncing on TS packets
Diffstat (limited to 'remux.h')
-rw-r--r--remux.h11
1 files changed, 10 insertions, 1 deletions
diff --git a/remux.h b/remux.h
index 28dfde4b..7dd5b163 100644
--- a/remux.h
+++ b/remux.h
@@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
- * $Id: remux.h 4.2 2017/02/27 16:11:57 kls Exp $
+ * $Id: remux.h 4.3 2017/03/26 13:06:37 kls Exp $
*/
#ifndef __REMUX_H
@@ -144,6 +144,15 @@ inline int64_t TsGetPcr(const uchar *p)
void TsHidePayload(uchar *p);
void TsSetPcr(uchar *p, int64_t Pcr);
+// Helper macro and function to quickly check whether Data points to the beginning
+// of a TS packet. The return value is the number of bytes that need to be skipped
+// to synchronize on the next TS packet (zero if already sync'd). TsSync() can be
+// called directly, the macro just performs the initial check inline and adds some
+// debug information for logging.
+
+#define TS_SYNC(Data, Length) (*Data == TS_SYNC_BYTE ? 0 : TsSync(Data, Length, __FILE__, __FUNCTION__, __LINE__))
+int TsSync(const uchar *Data, int Length, const char *File = NULL, const char *Function = NULL, int Line = 0);
+
// The following functions all take a pointer to a sequence of complete TS packets.
int64_t TsGetPts(const uchar *p, int l);