diff options
Diffstat (limited to 'remux.h')
-rw-r--r-- | remux.h | 11 |
1 files changed, 10 insertions, 1 deletions
@@ -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); |