MythTV master
Public Types | Public Member Functions | Static Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
AVCParser Class Reference

#include <libmythtv/mpeg/AVCParser.h>

Inheritance diagram for AVCParser:
[legend]
Collaboration diagram for AVCParser:
[legend]

Public Types

enum  NAL_unit_type : std::int8_t {
  UNKOWN = -1 , SLICE = 1 , SLICE_DPA = 2 , SLICE_DPB = 3 ,
  SLICE_DPC = 4 , SLICE_IDR = 5 , SEI = 6 , SPS = 7 ,
  PPS = 8 , AU_DELIMITER = 9 , END_SEQUENCE = 10 , END_STREAM = 11 ,
  FILLER_DATA = 12 , SPS_EXT = 13 , NALU_prefix = 14 , SPS_subset = 15 ,
  AUXILIARY_SLICE = 19 , SLICE_EXTENSION = 20
}
 
enum  SEI_type : std::uint8_t { SEI_TYPE_PIC_TIMING = 1 , SEI_FILLER_PAYLOAD = 3 , SEI_TYPE_USER_DATA_UNREGISTERED = 5 , SEI_TYPE_RECOVERY_POINT = 6 }
 
- Public Types inherited from H2645Parser
enum  field_type : std::uint8_t { FRAME = 'F' , FIELD_TOP = 'T' , FIELD_BOTTOM = 'B' }
 
enum  NAL_unit_type : std::int8_t { UNKNOWN = -1 }
 
enum  SLICE_type : std::uint8_t {
  SLICE_P = 0 , SLICE_B = 1 , SLICE_I = 2 , SLICE_SP = 3 ,
  SLICE_SI = 4 , SLICE_P_a = 5 , SLICE_B_a = 6 , SLICE_I_a = 7 ,
  SLICE_SP_a = 8 , SLICE_SI_a = 9 , SLICE_UNDEF = 10
}
 

Public Member Functions

field_type getFieldType (void) const override
 
 AVCParser (void)
 
 AVCParser (const AVCParser &rhs)
 
 ~AVCParser (void) override
 
uint32_t addBytes (const uint8_t *bytes, uint32_t byte_count, uint64_t stream_offset) override
 
void Reset (void) override
 
QString NAL_type_str (int8_t type) override
 
void use_I_forKeyframes (bool val)
 
bool using_I_forKeyframes (void) const
 
void parse_SPS (uint8_t *sps, uint32_t sps_size, bool &interlaced, int32_t &max_ref_frames)
 
void reset_SPS (void)
 
bool seen_SPS (void) const
 
bool found_AU (void) const
 
uint8_t lastNALtype (void) const
 
uint getRefFrames (void) const
 
uint pictureWidthCropped (void) const override
 
uint pictureHeightCropped (void) const override
 
double frameRate (void) const
 
MythAVRational getFrameRate () const override
 
void set_AU_pending (void)
 
- Public Member Functions inherited from H2645Parser
 H2645Parser (void)
 
 H2645Parser (const H2645Parser &rhs)
 
virtual ~H2645Parser (void)
 
virtual uint32_t addBytes (const uint8_t *bytes, uint32_t byte_count, uint64_t stream_offset)=0
 
virtual void Reset (void)
 
virtual QString NAL_type_str (int8_t type)=0
 
bool stateChanged (void) const
 
bool onFrameStart (void) const
 
bool onKeyFrameStart (void) const
 
uint pictureWidth (void) const
 
uint pictureHeight (void) const
 
virtual uint pictureWidthCropped (void) const =0
 
virtual uint pictureHeightCropped (void) const =0
 
uint aspectRatio (void) const
 Computes aspect ratio from picture size and sample aspect ratio. More...
 
virtual MythAVRational getFrameRate () const =0
 
virtual field_type getFieldType (void) const =0
 
uint64_t frameAUstreamOffset (void) const
 
uint64_t keyframeAUstreamOffset (void) const
 
uint64_t SPSstreamOffset (void) const
 
uint32_t GetTimeScale (void) const
 
uint32_t GetUnitsInTick (void) const
 
SCAN_t GetScanType (void) const
 

Static Public Member Functions

static bool isKeySlice (uint slice_type)
 
static bool NALisSlice (int8_t nal_type)
 

Protected Member Functions

bool new_AU (void)
 
void processRBSP (bool rbsp_complete)
 
- Protected Member Functions inherited from H2645Parser
void resetRBSP (void)
 
bool fillRBSP (const uint8_t *byteP, uint32_t byte_count, bool found_start_code)
 
void vui_parameters (BitReader &br, bool hevc)
 

Private Member Functions

bool decode_Header (BitReader &br)
 
void decode_SPS (BitReader &br)
 
void decode_PPS (BitReader &br)
 
void decode_SEI (BitReader &br)
 

Private Attributes

int m_deltaPicOrderCntBottom {0}
 
std::array< int, 2 > m_deltaPicOrderCnt {0}
 
int m_frameNum {-1}
 
int m_picOrderCntLsb {0}
 
int m_picParameterSetId {-1}
 
int m_prevDeltaPicOrderCntBottom {0}
 
std::array< int, 2 > m_prevDeltaPicOrderCnt {0}
 
int m_prevFrameNum {-1}
 
int m_prevPicOrderCntLsb {0}
 
int m_prevPicParameterSetId {-1}
 
uint m_idrPicId {65536}
 
uint m_log2MaxFrameNum {0}
 
uint m_log2MaxPicOrderCntLsb {0}
 
uint m_numRefFrames {0}
 
uint m_prevIdrPicId {65536}
 
uint m_redundantPicCnt {0}
 
uint m_seqParameterSetId {0}
 
uint m_sliceType {SLICE_UNDEF}
 
int8_t m_bottomFieldFlag {-1}
 
int8_t m_fieldPicFlag {-1}
 
int8_t m_frameMbsOnlyFlag {-1}
 
int8_t m_nalUnitType {UNKNOWN}
 
int8_t m_picOrderPresentFlag {-1}
 
int8_t m_prevBottomFieldFlag {-1}
 
int8_t m_prevFieldPicFlag {-1}
 
int8_t m_prevNalUnitType {UNKNOWN}
 
int8_t m_redundantPicCntPresentFlag {0}
 
uint8_t m_deltaPicOrderAlwaysZeroFlag {0}
 
uint8_t m_nalRefIdc {111}
 
uint8_t m_picOrderCntType {0}
 
uint8_t m_prevNALRefIdc {111}
 
uint8_t m_prevPicOrderCntType {0}
 
bool m_auContainsKeyframeMessage {false}
 
bool m_iIsKeyframe {true}
 

Additional Inherited Members

- Static Public Attributes inherited from H2645Parser
static constexpr uint16_t kMaxSliceHeaderSize { 256 }
 
- Protected Attributes inherited from H2645Parser
uint64_t m_framecnt {0}
 
uint64_t m_keyframecnt {0}
 
uint64_t m_totalframecnt {0}
 
uint64_t m_totalkeyframecnt {0}
 
uint64_t m_auOffset {0}
 
uint64_t m_frameStartOffset {0}
 
uint64_t m_keyframeStartOffset {0}
 
uint64_t m_pktOffset {0}
 
uint64_t m_spsOffset {0}
 
uint32_t m_consecutiveZeros {0}
 
uint32_t m_rbspBufferSize {188 * 2}
 
uint32_t m_rbspIndex {0}
 
uint32_t m_syncAccumulator {0xffffffff}
 
uint32_t m_timeScale {0}
 
uint32_t m_unitsInTick {0}
 
SCAN_t m_scanType {SCAN_t::UNKNOWN_SCAN}
 
uint m_frameCropBottomOffset {0}
 
uint m_frameCropLeftOffset {0}
 
uint m_frameCropRightOffset {0}
 
uint m_frameCropTopOffset {0}
 
uint m_picHeight {0}
 
uint m_picWidth {0}
 
uint m_sarHeight {0}
 
uint m_sarWidth {0}
 
uint8_t * m_rbspBuffer {nullptr}
 
uint8_t m_aspectRatioIdc {0}
 
int8_t m_chromaFormatIdc {1}
 
bool m_auPending {false}
 
bool m_fixedRate {false}
 
bool m_haveUnfinishedNAL {false}
 
bool m_isKeyframe {false}
 
bool m_onAU {false}
 
bool m_onFrame {false}
 
bool m_onKeyFrame {false}
 
bool m_seenSPS {false}
 
bool m_separateColourPlaneFlag {false}
 
bool m_stateChanged {false}
 
- Static Protected Attributes inherited from H2645Parser
static constexpr uint8_t kExtendedSar { 255 }
 

Detailed Description

Definition at line 30 of file AVCParser.h.

Member Enumeration Documentation

◆ NAL_unit_type

enum AVCParser::NAL_unit_type : std::int8_t
Enumerator
UNKOWN 
SLICE 
SLICE_DPA 
SLICE_DPB 
SLICE_DPC 
SLICE_IDR 
SEI 
SPS 
PPS 
AU_DELIMITER 
END_SEQUENCE 
END_STREAM 
FILLER_DATA 
SPS_EXT 
NALU_prefix 
SPS_subset 
AUXILIARY_SLICE 
SLICE_EXTENSION 

Definition at line 35 of file AVCParser.h.

◆ SEI_type

enum AVCParser::SEI_type : std::uint8_t
Enumerator
SEI_TYPE_PIC_TIMING 
SEI_FILLER_PAYLOAD 
SEI_TYPE_USER_DATA_UNREGISTERED 
SEI_TYPE_RECOVERY_POINT 

Definition at line 56 of file AVCParser.h.

Constructor & Destructor Documentation

◆ AVCParser() [1/2]

AVCParser::AVCParser ( void  )
inline

Definition at line 72 of file AVCParser.h.

◆ AVCParser() [2/2]

AVCParser::AVCParser ( const AVCParser rhs)

◆ ~AVCParser()

AVCParser::~AVCParser ( void  )
inlineoverride

Definition at line 74 of file AVCParser.h.

Member Function Documentation

◆ addBytes()

uint32_t AVCParser::addBytes ( const uint8_t *  bytes,
uint32_t  byte_count,
uint64_t  stream_offset 
)
overridevirtual

Implements H2645Parser.

Definition at line 285 of file AVCParser.cpp.

Referenced by AvFormatDecoder::H264PreProcessPkt().

◆ decode_Header()

bool AVCParser::decode_Header ( BitReader br)
private

Definition at line 495 of file AVCParser.cpp.

Referenced by processRBSP().

◆ decode_PPS()

void AVCParser::decode_PPS ( BitReader br)
private

Definition at line 902 of file AVCParser.cpp.

Referenced by processRBSP().

◆ decode_SEI()

void AVCParser::decode_SEI ( BitReader br)
private

Definition at line 980 of file AVCParser.cpp.

Referenced by processRBSP().

◆ decode_SPS()

void AVCParser::decode_SPS ( BitReader br)
private

Definition at line 695 of file AVCParser.cpp.

Referenced by parse_SPS(), and processRBSP().

◆ found_AU()

bool AVCParser::found_AU ( void  ) const
inline

Definition at line 108 of file AVCParser.h.

◆ frameRate()

double AVCParser::frameRate ( void  ) const

Definition at line 1069 of file AVCParser.cpp.

Referenced by AvFormatDecoder::H264PreProcessPkt().

◆ getFieldType()

H2645Parser::field_type AVCParser::getFieldType ( void  ) const
overridevirtual

Implements H2645Parser.

Definition at line 1050 of file AVCParser.cpp.

Referenced by AvFormatDecoder::H264PreProcessPkt().

◆ getFrameRate()

MythAVRational AVCParser::getFrameRate ( ) const
overridevirtual

Implements H2645Parser.

Definition at line 1077 of file AVCParser.cpp.

◆ getRefFrames()

uint AVCParser::getRefFrames ( void  ) const
inline

Definition at line 112 of file AVCParser.h.

Referenced by AvFormatDecoder::H264PreProcessPkt().

◆ isKeySlice()

static bool AVCParser::isKeySlice ( uint  slice_type)
inlinestatic

Definition at line 84 of file AVCParser.h.

Referenced by decode_Header().

◆ lastNALtype()

uint8_t AVCParser::lastNALtype ( void  ) const
inline

Definition at line 110 of file AVCParser.h.

◆ NAL_type_str()

QString AVCParser::NAL_type_str ( int8_t  type)
overridevirtual

Implements H2645Parser.

Definition at line 130 of file AVCParser.cpp.

◆ NALisSlice()

static bool AVCParser::NALisSlice ( int8_t  nal_type)
inlinestatic

Definition at line 92 of file AVCParser.h.

Referenced by addBytes(), and processRBSP().

◆ new_AU()

bool AVCParser::new_AU ( void  )
protected

Definition at line 166 of file AVCParser.cpp.

Referenced by processRBSP().

◆ parse_SPS()

void AVCParser::parse_SPS ( uint8_t *  sps,
uint32_t  sps_size,
bool interlaced,
int32_t &  max_ref_frames 
)

Definition at line 893 of file AVCParser.cpp.

◆ pictureHeightCropped()

uint AVCParser::pictureHeightCropped ( void  ) const
overridevirtual

Implements H2645Parser.

Definition at line 1039 of file AVCParser.cpp.

Referenced by AvFormatDecoder::H264PreProcessPkt().

◆ pictureWidthCropped()

uint AVCParser::pictureWidthCropped ( void  ) const
overridevirtual

Implements H2645Parser.

Definition at line 1027 of file AVCParser.cpp.

Referenced by AvFormatDecoder::H264PreProcessPkt().

◆ processRBSP()

void AVCParser::processRBSP ( bool  rbsp_complete)
protected

Definition at line 416 of file AVCParser.cpp.

Referenced by addBytes().

◆ Reset()

void AVCParser::Reset ( void  )
overridevirtual

Reimplemented from H2645Parser.

Definition at line 88 of file AVCParser.cpp.

Referenced by AvFormatDecoder::autoSelectVideoTrack(), and AvFormatDecoder::CloseContext().

◆ reset_SPS()

void AVCParser::reset_SPS ( void  )
inline

Definition at line 105 of file AVCParser.h.

◆ seen_SPS()

bool AVCParser::seen_SPS ( void  ) const
inline

Definition at line 106 of file AVCParser.h.

◆ set_AU_pending()

void AVCParser::set_AU_pending ( void  )
inline

Definition at line 120 of file AVCParser.h.

Referenced by addBytes(), and processRBSP().

◆ use_I_forKeyframes()

void AVCParser::use_I_forKeyframes ( bool  val)
inline

Definition at line 99 of file AVCParser.h.

Referenced by AvFormatDecoder::SetIdrOnlyKeyframes().

◆ using_I_forKeyframes()

bool AVCParser::using_I_forKeyframes ( void  ) const
inline

Definition at line 100 of file AVCParser.h.

Member Data Documentation

◆ m_auContainsKeyframeMessage

bool AVCParser::m_auContainsKeyframeMessage {false}
private

Definition at line 177 of file AVCParser.h.

Referenced by decode_SEI(), processRBSP(), and set_AU_pending().

◆ m_bottomFieldFlag

int8_t AVCParser::m_bottomFieldFlag {-1}
private

Definition at line 161 of file AVCParser.h.

Referenced by decode_Header(), getFieldType(), new_AU(), and Reset().

◆ m_deltaPicOrderAlwaysZeroFlag

uint8_t AVCParser::m_deltaPicOrderAlwaysZeroFlag {0}
private

Definition at line 171 of file AVCParser.h.

Referenced by decode_Header(), decode_SPS(), and Reset().

◆ m_deltaPicOrderCnt

std::array<int,2> AVCParser::m_deltaPicOrderCnt {0}
private

Definition at line 142 of file AVCParser.h.

Referenced by decode_Header(), new_AU(), and Reset().

◆ m_deltaPicOrderCntBottom

int AVCParser::m_deltaPicOrderCntBottom {0}
private

Definition at line 141 of file AVCParser.h.

Referenced by decode_Header(), new_AU(), and Reset().

◆ m_fieldPicFlag

int8_t AVCParser::m_fieldPicFlag {-1}
private

Definition at line 162 of file AVCParser.h.

Referenced by decode_Header(), new_AU(), and Reset().

◆ m_frameMbsOnlyFlag

int8_t AVCParser::m_frameMbsOnlyFlag {-1}
private

Definition at line 163 of file AVCParser.h.

Referenced by decode_Header(), decode_SPS(), parse_SPS(), pictureHeightCropped(), and Reset().

◆ m_frameNum

int AVCParser::m_frameNum {-1}
private

Definition at line 143 of file AVCParser.h.

Referenced by decode_Header(), new_AU(), and Reset().

◆ m_idrPicId

uint AVCParser::m_idrPicId {65536}
private

Definition at line 152 of file AVCParser.h.

Referenced by decode_Header(), new_AU(), and Reset().

◆ m_iIsKeyframe

bool AVCParser::m_iIsKeyframe {true}
private

Definition at line 178 of file AVCParser.h.

Referenced by decode_Header(), use_I_forKeyframes(), and using_I_forKeyframes().

◆ m_log2MaxFrameNum

uint AVCParser::m_log2MaxFrameNum {0}
private

Definition at line 153 of file AVCParser.h.

Referenced by decode_Header(), decode_SPS(), and Reset().

◆ m_log2MaxPicOrderCntLsb

uint AVCParser::m_log2MaxPicOrderCntLsb {0}
private

Definition at line 154 of file AVCParser.h.

Referenced by decode_Header(), decode_SPS(), and Reset().

◆ m_nalRefIdc

uint8_t AVCParser::m_nalRefIdc {111}
private

Definition at line 172 of file AVCParser.h.

Referenced by addBytes(), new_AU(), and Reset().

◆ m_nalUnitType

int8_t AVCParser::m_nalUnitType {UNKNOWN}
private

Definition at line 164 of file AVCParser.h.

Referenced by addBytes(), decode_Header(), lastNALtype(), new_AU(), processRBSP(), and Reset().

◆ m_numRefFrames

uint AVCParser::m_numRefFrames {0}
private

Definition at line 155 of file AVCParser.h.

Referenced by decode_SPS(), getRefFrames(), parse_SPS(), and Reset().

◆ m_picOrderCntLsb

int AVCParser::m_picOrderCntLsb {0}
private

Definition at line 144 of file AVCParser.h.

Referenced by decode_Header(), new_AU(), and Reset().

◆ m_picOrderCntType

uint8_t AVCParser::m_picOrderCntType {0}
private

Definition at line 173 of file AVCParser.h.

Referenced by decode_Header(), decode_SPS(), new_AU(), and Reset().

◆ m_picOrderPresentFlag

int8_t AVCParser::m_picOrderPresentFlag {-1}
private

Definition at line 165 of file AVCParser.h.

Referenced by decode_Header(), decode_PPS(), and Reset().

◆ m_picParameterSetId

int AVCParser::m_picParameterSetId {-1}
private

Definition at line 145 of file AVCParser.h.

Referenced by decode_Header(), decode_PPS(), new_AU(), and Reset().

◆ m_prevBottomFieldFlag

int8_t AVCParser::m_prevBottomFieldFlag {-1}
private

Definition at line 166 of file AVCParser.h.

Referenced by new_AU(), and Reset().

◆ m_prevDeltaPicOrderCnt

std::array<int,2> AVCParser::m_prevDeltaPicOrderCnt {0}
private

Definition at line 147 of file AVCParser.h.

Referenced by new_AU(), and Reset().

◆ m_prevDeltaPicOrderCntBottom

int AVCParser::m_prevDeltaPicOrderCntBottom {0}
private

Definition at line 146 of file AVCParser.h.

Referenced by new_AU(), and Reset().

◆ m_prevFieldPicFlag

int8_t AVCParser::m_prevFieldPicFlag {-1}
private

Definition at line 167 of file AVCParser.h.

Referenced by new_AU(), and Reset().

◆ m_prevFrameNum

int AVCParser::m_prevFrameNum {-1}
private

Definition at line 148 of file AVCParser.h.

Referenced by new_AU(), and Reset().

◆ m_prevIdrPicId

uint AVCParser::m_prevIdrPicId {65536}
private

Definition at line 156 of file AVCParser.h.

Referenced by new_AU(), and Reset().

◆ m_prevNALRefIdc

uint8_t AVCParser::m_prevNALRefIdc {111}
private

Definition at line 174 of file AVCParser.h.

Referenced by new_AU(), and Reset().

◆ m_prevNalUnitType

int8_t AVCParser::m_prevNalUnitType {UNKNOWN}
private

Definition at line 168 of file AVCParser.h.

Referenced by new_AU(), and Reset().

◆ m_prevPicOrderCntLsb

int AVCParser::m_prevPicOrderCntLsb {0}
private

Definition at line 149 of file AVCParser.h.

Referenced by new_AU(), and Reset().

◆ m_prevPicOrderCntType

uint8_t AVCParser::m_prevPicOrderCntType {0}
private

Definition at line 175 of file AVCParser.h.

Referenced by new_AU(), and Reset().

◆ m_prevPicParameterSetId

int AVCParser::m_prevPicParameterSetId {-1}
private

Definition at line 150 of file AVCParser.h.

Referenced by new_AU(), and Reset().

◆ m_redundantPicCnt

uint AVCParser::m_redundantPicCnt {0}
private

Definition at line 157 of file AVCParser.h.

Referenced by decode_Header(), and Reset().

◆ m_redundantPicCntPresentFlag

int8_t AVCParser::m_redundantPicCntPresentFlag {0}
private

Definition at line 169 of file AVCParser.h.

Referenced by decode_Header(), decode_PPS(), and Reset().

◆ m_seqParameterSetId

uint AVCParser::m_seqParameterSetId {0}
private

Definition at line 158 of file AVCParser.h.

Referenced by decode_PPS(), and Reset().

◆ m_sliceType

uint AVCParser::m_sliceType {SLICE_UNDEF}
private

Definition at line 159 of file AVCParser.h.

Referenced by decode_Header(), and Reset().


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