vdr  2.4.1
Classes | Macros | Functions | Variables
remux.c File Reference
#include "remux.h"
#include "device.h"
#include "libsi/si.h"
#include "libsi/section.h"
#include "libsi/descriptor.h"
#include "recording.h"
#include "shutdown.h"
#include "tools.h"

Go to the source code of this file.

Classes

class  cFrameParser
 
class  cAudioParser
 
class  cMpeg2Parser
 
class  cH264Parser
 
class  cH265Parser
 

Macros

#define dbgpatpmt(a...)   if (DebugPatPmt) fprintf(stderr, a)
 
#define dbgframes(a...)   if (DebugFrames) fprintf(stderr, a)
 
#define MAX_TS_PACKETS_FOR_VIDEO_FRAME_DETECTION   6
 
#define WRN_TS_PACKETS_FOR_VIDEO_FRAME_DETECTION   (MAX_TS_PACKETS_FOR_VIDEO_FRAME_DETECTION / 2)
 
#define WRN_TS_PACKETS_FOR_FRAME_DETECTOR   (MIN_TS_PACKETS_FOR_FRAME_DETECTOR / 2)
 
#define EMPTY_SCANNER   (0xFFFFFFFF)
 
#define VIDEO_STREAM_S   0xE0
 
#define P_TSID   0x8008
 
#define P_PMT_PID   0x0084
 
#define MAXPID   0x2000
 
#define SETPID(p)   { if ((p) >= 0 && (p) < MAXPID) Used[p] = true; }
 
#define SETPIDS(l)   { const int *p = l; while (*p) { SETPID(*p); p++; } }
 
#define MAXPESLENGTH   0xFFF0
 

Functions

ePesHeader AnalyzePesHeader (const uchar *Data, int Count, int &PesPayloadOffset, bool *ContinuationHeader)
 
void TsHidePayload (uchar *p)
 
void TsSetPcr (uchar *p, int64_t Pcr)
 
int TsSync (const uchar *Data, int Length, const char *File, const char *Function, int Line)
 
int64_t TsGetPts (const uchar *p, int l)
 
int64_t TsGetDts (const uchar *p, int l)
 
void TsSetPts (uchar *p, int l, int64_t Pts)
 
void TsSetDts (uchar *p, int l, int64_t Dts)
 
void PesSetPts (uchar *p, int64_t Pts)
 
void PesSetDts (uchar *p, int64_t Dts)
 
int64_t PtsDiff (int64_t Pts1, int64_t Pts2)
 
void TsExtendAdaptionField (unsigned char *Packet, int ToLength)
 
void BlockDump (const char *Name, const u_char *Data, int Length)
 
void TsDump (const char *Name, const u_char *Data, int Length)
 
void PesDump (const char *Name, const u_char *Data, int Length)
 
static int CmpUint32 (const void *p1, const void *p2)
 

Variables

static bool DebugPatPmt = false
 
static bool DebugFrames = false
 

Macro Definition Documentation

◆ dbgframes

#define dbgframes (   a...)    if (DebugFrames) fprintf(stderr, a)

Definition at line 24 of file remux.c.

◆ dbgpatpmt

#define dbgpatpmt (   a...)    if (DebugPatPmt) fprintf(stderr, a)

Definition at line 23 of file remux.c.

◆ EMPTY_SCANNER

#define EMPTY_SCANNER   (0xFFFFFFFF)

Definition at line 30 of file remux.c.

◆ MAX_TS_PACKETS_FOR_VIDEO_FRAME_DETECTION

#define MAX_TS_PACKETS_FOR_VIDEO_FRAME_DETECTION   6

Definition at line 26 of file remux.c.

◆ MAXPESLENGTH

#define MAXPESLENGTH   0xFFF0

Definition at line 1109 of file remux.c.

◆ MAXPID

#define MAXPID   0x2000

Definition at line 500 of file remux.c.

◆ P_PMT_PID

#define P_PMT_PID   0x0084

Definition at line 499 of file remux.c.

◆ P_TSID

#define P_TSID   0x8008

Definition at line 498 of file remux.c.

◆ SETPID

#define SETPID (   p)    { if ((p) >= 0 && (p) < MAXPID) Used[p] = true; }

◆ SETPIDS

#define SETPIDS (   l)    { const int *p = l; while (*p) { SETPID(*p); p++; } }

◆ VIDEO_STREAM_S

#define VIDEO_STREAM_S   0xE0

Definition at line 98 of file remux.c.

◆ WRN_TS_PACKETS_FOR_FRAME_DETECTOR

#define WRN_TS_PACKETS_FOR_FRAME_DETECTOR   (MIN_TS_PACKETS_FOR_FRAME_DETECTOR / 2)

Definition at line 28 of file remux.c.

◆ WRN_TS_PACKETS_FOR_VIDEO_FRAME_DETECTION

#define WRN_TS_PACKETS_FOR_VIDEO_FRAME_DETECTION   (MAX_TS_PACKETS_FOR_VIDEO_FRAME_DETECTION / 2)

Definition at line 27 of file remux.c.

Function Documentation

◆ AnalyzePesHeader()

ePesHeader AnalyzePesHeader ( const uchar Data,
int  Count,
int &  PesPayloadOffset,
bool *  ContinuationHeader 
)

Definition at line 32 of file remux.c.

References PesPayloadOffset(), phInvalid, phMPEG1, phMPEG2, and phNeedMoreData.

Referenced by cRemux::SetBrokenLink().

Here is the caller graph for this function:

◆ BlockDump()

void BlockDump ( const char *  Name,
const u_char *  Data,
int  Length 
)

Definition at line 1174 of file remux.c.

◆ CmpUint32()

static int CmpUint32 ( const void *  p1,
const void *  p2 
)
static

Definition at line 1664 of file remux.c.

Referenced by cFrameDetector::Analyze().

◆ PesDump()

void PesDump ( const char *  Name,
const u_char *  Data,
int  Length 
)

Definition at line 1200 of file remux.c.

References TsDump().

◆ PesSetDts()

void PesSetDts ( uchar p,
int64_t  Dts 
)

Definition at line 225 of file remux.c.

Referenced by TsSetDts().

Here is the caller graph for this function:

◆ PesSetPts()

void PesSetPts ( uchar p,
int64_t  Pts 
)

Definition at line 216 of file remux.c.

Referenced by TsSetPts().

Here is the caller graph for this function:

◆ PtsDiff()

int64_t PtsDiff ( int64_t  Pts1,
int64_t  Pts2 
)

Returns the difference between two PTS values.

The result of Pts2 - Pts1 is the actual number of 90kHz time ticks that pass from Pts1 to Pts2, properly taking into account the 33bit wrap around. If Pts2 is "before" Pts1, the result is negative.

Definition at line 234 of file remux.c.

References MAX33BIT.

Referenced by cCuttingThread::FixFrame(), and cCuttingThread::GetPendingPackets().

Here is the caller graph for this function:

◆ TsDump()

void TsDump ( const char *  Name,
const u_char *  Data,
int  Length 
)

Definition at line 1185 of file remux.c.

References max(), and min().

Referenced by PesDump().

Here is the caller graph for this function:

◆ TsExtendAdaptionField()

void TsExtendAdaptionField ( unsigned char *  Packet,
int  ToLength 
)

Definition at line 359 of file remux.c.

References TS_ADAPT_FIELD_EXISTS, TS_PAYLOAD_EXISTS, TS_SIZE, and TsPayloadOffset().

Referenced by cNaluDumper::ProcessTSPacket().

Here is the caller graph for this function:

◆ TsGetDts()

int64_t TsGetDts ( const uchar p,
int  l 
)

Definition at line 173 of file remux.c.

References PesGetDts(), PesHasDts(), TS_SIZE, TsGetPayload(), and TsPayloadStart().

Referenced by cCuttingThread::FixFrame().

Here is the caller graph for this function:

◆ TsGetPts()

int64_t TsGetPts ( const uchar p,
int  l 
)

Definition at line 160 of file remux.c.

References PesGetPts(), PesHasPts(), TS_SIZE, TsGetPayload(), and TsPayloadStart().

Referenced by cDvbPlayer::Action(), cCuttingThread::FixFrame(), cCuttingThread::GetPendingPackets(), and cDvbPlayer::Goto().

Here is the caller graph for this function:

◆ TsHidePayload()

void TsHidePayload ( uchar p)

Definition at line 121 of file remux.c.

References TS_ADAPT_FIELD_EXISTS, TS_PAYLOAD_EXISTS, TS_PAYLOAD_START, and TS_SIZE.

Referenced by cCuttingThread::FixFrame().

Here is the caller graph for this function:

◆ TsSetDts()

void TsSetDts ( uchar p,
int  l,
int64_t  Dts 
)

Definition at line 200 of file remux.c.

References PesHasDts(), PesSetDts(), TS_SIZE, TsGetPayload(), and TsPayloadStart().

Referenced by cCuttingThread::FixFrame().

Here is the caller graph for this function:

◆ TsSetPcr()

void TsSetPcr ( uchar p,
int64_t  Pcr 
)

Definition at line 131 of file remux.c.

References PCRFACTOR, TS_ADAPT_PCR, and TsHasAdaptationField().

Referenced by cCuttingThread::FixFrame().

Here is the caller graph for this function:

◆ TsSetPts()

void TsSetPts ( uchar p,
int  l,
int64_t  Pts 
)

Definition at line 186 of file remux.c.

References PesHasPts(), PesSetPts(), TS_SIZE, TsGetPayload(), and TsPayloadStart().

Referenced by cCuttingThread::FixFrame().

Here is the caller graph for this function:

◆ TsSync()

int TsSync ( const uchar Data,
int  Length,
const char *  File,
const char *  Function,
int  Line 
)

Definition at line 147 of file remux.c.

References esyslog, TS_SIZE, and TS_SYNC_BYTE.

Variable Documentation

◆ DebugFrames

bool DebugFrames = false
static

Definition at line 21 of file remux.c.

◆ DebugPatPmt

bool DebugPatPmt = false
static

Definition at line 20 of file remux.c.