Adapted cFrameDetector::Analyze() to HD NTSC broadcasts that split frames over several payload units

This commit is contained in:
Klaus Schmidinger
2009-03-27 13:38:59 +01:00
parent e7ea3b3c70
commit 323969e58d
5 changed files with 113 additions and 53 deletions

23
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 2.8 2009/03/08 12:05:12 kls Exp $
* $Id: remux.h 2.9 2009/03/27 13:38:59 kls Exp $
*/
#ifndef __REMUX_H
@@ -267,14 +267,22 @@ void PesDump(const char *Name, const u_char *Data, int Length);
class cFrameDetector {
private:
enum { MaxPtsValues = 150 };
int pid;
int type;
bool synced;
bool newFrame;
bool independentFrame;
int64_t lastPts;
uint32_t ptsValues[MaxPtsValues]; // 32 bit is enough - we only need the delta
int numPtsValues;
int numIFrames;
bool isVideo;
int frameDuration;
int framesPerPayloadUnit;
int framesInPayloadUnit;
int framesPerPayloadUnit; // Some broadcasters send one frame per payload unit (== 1),
// some put an entire GOP into one payload unit (> 1), and
// some spread a single frame over several payload units (< 0).
int payloadUnitOfFrame;
bool scanning;
uint32_t scanner;
public:
@@ -282,10 +290,11 @@ public:
int Analyze(const uchar *Data, int Length);
///< Analyzes the TS packets pointed to by Data. Length is the number of
///< bytes Data points to, and must be a multiple of 188.
///< Returns the number of bytes that have been analyzed and may be written
///< to the recording file. If the return value is 0, the data was not
///< sufficient for analyzing and Analyze() needs to be called again with
///< more actual data.
///< Returns the number of bytes that have been analyzed.
///< If the return value is 0, the data was not sufficient for analyzing and
///< Analyze() needs to be called again with more actual data.
bool Synced(void) { return synced; }
///< Returns true if the frame detector has synced on the data stream.
bool NewFrame(void) { return newFrame; }
///< Returns true if the data given to the last call to Analyze() started a
///< new frame.