Improved clearing the MTD buffer and syncing on TS packets

This commit is contained in:
Klaus Schmidinger
2017-03-26 13:07:01 +02:00
parent 9e808255f8
commit b313d88db1
5 changed files with 45 additions and 24 deletions

11
remux.h
View File

@@ -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);