vdr-plugin-softhddevice-drm-gles 1.5.9-20e15de
cReassemblyBufferVideo Class Reference

Video stream reassembly buffer. More...

#include <pes.h>

Public Member Functions

 cReassemblyBufferVideo ()
 
AVPacket * PopAvPacket () override
 
bool ParseCodecHeader (const uint8_t *, int)
 Parse video codec header to detect codec type.
 
bool HasLeadingZero (const uint8_t *, int)
 Check if video data has a leading zero byte before the start code.
 
- Public Member Functions inherited from cReassemblyBuffer
virtual void Push (const uint8_t *data, int size, int64_t pts)
 
bool IsEmpty ()
 
size_t GetSize ()
 
void Reset ()
 Reset the reassembly buffer.
 
AVCodecID GetCodec ()
 

Static Private Attributes

static constexpr uint32_t VIDEO_FRAME_START_CODE = 0x00'0001
 
static constexpr int VIDEO_FRAME_START_CODE_LEN = 3
 
static constexpr uint8_t MPEG2_STREAM_TYPE = 0xB3
 
static constexpr uint8_t H264_STREAM_TYPE = 0x09
 
static constexpr uint8_t HEVC_STREAM_TYPE = 0x46
 

Additional Inherited Members

- Protected Member Functions inherited from cReassemblyBuffer
 cReassemblyBuffer (const char *identifier)
 
AVPacket * PopAvPacket (int)
 Pop an AVPacket from the reassembly buffer.
 
- Protected Attributes inherited from cReassemblyBuffer
AVCodecID m_codec = AV_CODEC_ID_NONE
 detected codec ID
 
cPtsTrackingBuffer m_buffer
 fragmentation buffer
 
int64_t m_lastPoppedPts = AV_NOPTS_VALUE
 PTS of the last popped AVPacket.
 

Detailed Description

Video stream reassembly buffer.

Reassembles video elementary streams (MPEG2, H.264, HEVC) by detecting frame start codes and codec headers.

Definition at line 141 of file pes.h.

Constructor & Destructor Documentation

◆ cReassemblyBufferVideo()

cReassemblyBufferVideo::cReassemblyBufferVideo ( )
inline

Definition at line 143 of file pes.h.

Member Function Documentation

◆ HasLeadingZero()

bool cReassemblyBufferVideo::HasLeadingZero ( const uint8_t *  data,
int  size 
)

Check if video data has a leading zero byte before the start code.

Some H.264/HEVC streams include a leading zero byte (0x00) before the standard start code (0x000001). This method detects that pattern.

Parameters
dataPointer to video data
sizeSize of the data in bytes
Returns
true if a leading zero is present, false otherwise

Definition at line 431 of file pes.cpp.

References ReadBytes(), VIDEO_FRAME_START_CODE, and VIDEO_FRAME_START_CODE_LEN.

Referenced by ParseCodecHeader(), cSoftHdDevice::PlayVideoInternal(), and TEST_CASE().

◆ ParseCodecHeader()

bool cReassemblyBufferVideo::ParseCodecHeader ( const uint8_t *  fragment,
int  size 
)

Parse video codec header to detect codec type.

Analyzes video frame start codes and stream type bytes to identify the codec. Supports MPEG2, H.264, and HEVC video codecs.

Parameters
fragmentPointer to video frame data
sizeSize of the fragment in bytes
Returns
true if a codec was detected, false otherwise

Definition at line 398 of file pes.cpp.

References H264_STREAM_TYPE, HasLeadingZero(), HEVC_STREAM_TYPE, cReassemblyBuffer::m_codec, MPEG2_STREAM_TYPE, ReadBytes(), VIDEO_FRAME_START_CODE, and VIDEO_FRAME_START_CODE_LEN.

Referenced by cSoftHdDevice::PlayVideoInternal(), TEST_CASE(), TEST_CASE(), TEST_CASE(), TEST_CASE(), and TEST_CASE().

◆ PopAvPacket()

AVPacket * cReassemblyBufferVideo::PopAvPacket ( )
inlineoverridevirtual

Member Data Documentation

◆ H264_STREAM_TYPE

constexpr uint8_t cReassemblyBufferVideo::H264_STREAM_TYPE = 0x09
staticconstexprprivate

Definition at line 152 of file pes.h.

Referenced by ParseCodecHeader().

◆ HEVC_STREAM_TYPE

constexpr uint8_t cReassemblyBufferVideo::HEVC_STREAM_TYPE = 0x46
staticconstexprprivate

Definition at line 153 of file pes.h.

Referenced by ParseCodecHeader().

◆ MPEG2_STREAM_TYPE

constexpr uint8_t cReassemblyBufferVideo::MPEG2_STREAM_TYPE = 0xB3
staticconstexprprivate

Definition at line 151 of file pes.h.

Referenced by ParseCodecHeader().

◆ VIDEO_FRAME_START_CODE

constexpr uint32_t cReassemblyBufferVideo::VIDEO_FRAME_START_CODE = 0x00'0001
staticconstexprprivate

Definition at line 148 of file pes.h.

Referenced by HasLeadingZero(), and ParseCodecHeader().

◆ VIDEO_FRAME_START_CODE_LEN

constexpr int cReassemblyBufferVideo::VIDEO_FRAME_START_CODE_LEN = 3
staticconstexprprivate

Definition at line 149 of file pes.h.

Referenced by HasLeadingZero(), and ParseCodecHeader().


The documentation for this class was generated from the following files: