diff options
Diffstat (limited to 'remux.c')
-rw-r--r-- | remux.c | 28 |
1 files changed, 27 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.c 2.17 2009/04/05 14:07:48 kls Exp $ + * $Id: remux.c 2.19 2009/04/19 10:59:56 kls Exp $ */ #include "remux.h" @@ -124,6 +124,24 @@ int64_t TsGetPts(const uchar *p, int l) return -1; } +void TsSetTeiOnBrokenPackets(uchar *p, int l) +{ + bool Processed[MAXPID] = { false }; + while (l >= TS_SIZE) { + if (*p != TS_SYNC_BYTE) + break; + int Pid = TsPid(p); + if (!Processed[Pid]) { + if (!TsPayloadStart(p)) + p[1] |= TS_ERROR; + else + Processed[Pid] = true; + } + l -= TS_SIZE; + p += TS_SIZE; + } +} + // --- cPatPmtGenerator ------------------------------------------------------ cPatPmtGenerator::cPatPmtGenerator(cChannel *Channel) @@ -582,6 +600,10 @@ cTsToPes::~cTsToPes() void cTsToPes::PutTs(const uchar *Data, int Length) { + if (TsError(Data)) { + Reset(); + return; // ignore packets with TEI set, and drop any PES data collected so far + } if (TsPayloadStart(Data)) Reset(); else if (!size) @@ -732,6 +754,10 @@ int cFrameDetector::Analyze(const uchar *Data, int Length) frameDuration = 3600; // PAL, 25 fps else if (Delta % 3003 == 0) frameDuration = 3003; // NTSC, 29.97 fps + else if (Delta == 1800) { + frameDuration = 3600; // PAL, 25 fps + framesPerPayloadUnit = -2; + } else if (Delta == 1501) { frameDuration = 3003; // NTSC, 29.97 fps framesPerPayloadUnit = -2; |