H264::KeyframeSequencer Class Reference

#include <h264utils.h>

List of all members.


Detailed Description

Minimalist state machine class used to detect H.264 keyframes.

Theory of operation: A true H.264 keyframe is an IDR (instantaneous decoding refresh) slice.

You submit bytes to instances of this class, and it will tell you if you're synced on a NAL unit. More bytes and you get the type. Keep going and you'll be know when you're on keyframes.

As a bonus, if you submit stream offsets, it will track access unit offsets such that you can seek in a stream and please H.264 decoders.

This class only applies to the byte stream format as specified by ITU-T Rec. H.264 (03/2005) Annex B.

Definition at line 143 of file h264utils.h.


Public Member Functions

 KeyframeSequencer ()
bool IsErrored (void) const
bool HasStateChanged (void) const
void Reset (void)
uint32_t AddBytes (const uint8_t *bytes, const uint32_t byte_count, const int64_t stream_offset)
 This function more or less follows the method in ITU-T Rec.
uint8_t LastSyncedType (void) const
 This function returns the NAL unit type of the last synced unit.
bool IsOnFrame (void) const
bool IsOnKeyframe (void) const
int64_t KeyframeAUStreamOffset (void) const

Private Member Functions

void KeyframePredicate (const uint8_t new_first_NAL_byte)

Private Attributes

bool errored
bool state_changed
uint32_t sync_accumulator
int64_t sync_stream_offset
uint8_t first_NAL_byte
bool saw_AU_delimiter
bool saw_first_VCL_NAL_unit
bool saw_sps
bool did_evaluate_once
bool keyframe
int64_t keyframe_sync_stream_offset

Constructor & Destructor Documentation

H264::KeyframeSequencer::KeyframeSequencer (  ) 

Definition at line 50 of file h264utils.cpp.


Member Function Documentation

bool H264::KeyframeSequencer::IsErrored ( void   )  const [inline]

Definition at line 148 of file h264utils.h.

bool H264::KeyframeSequencer::HasStateChanged ( void   )  const [inline]

void H264::KeyframeSequencer::Reset ( void   ) 

uint32_t H264::KeyframeSequencer::AddBytes ( const uint8_t *  bytes,
const uint32_t  byte_count,
const int64_t  stream_offset 
)

This function more or less follows the method in ITU-T Rec.

H.264 (03/2005) B.2. It returns the number of bytes it has consumed when the sequencer's state has changed or when there are no bytes left to process.

Definition at line 139 of file h264utils.cpp.

Referenced by DTVRecorder::FindH264Keyframes(), and AvFormatDecoder::H264PreProcessPkt().

uint8_t H264::KeyframeSequencer::LastSyncedType ( void   )  const [inline]

This function returns the NAL unit type of the last synced unit.

Definition at line 165 of file h264utils.h.

Referenced by DTVRecorder::FindH264Keyframes().

bool H264::KeyframeSequencer::IsOnFrame ( void   )  const

Definition at line 170 of file h264utils.cpp.

Referenced by DTVRecorder::FindH264Keyframes().

bool H264::KeyframeSequencer::IsOnKeyframe ( void   )  const [inline]

int64_t H264::KeyframeSequencer::KeyframeAUStreamOffset ( void   )  const [inline]

Definition at line 172 of file h264utils.h.

Referenced by DTVRecorder::HandleH264Keyframe().

void H264::KeyframeSequencer::KeyframePredicate ( const uint8_t  new_first_NAL_byte  )  [private]

Definition at line 74 of file h264utils.cpp.

Referenced by AddBytes().


Member Data Documentation

Definition at line 178 of file h264utils.h.

Referenced by IsErrored(), and Reset().

Definition at line 179 of file h264utils.h.

Referenced by AddBytes(), HasStateChanged(), KeyframePredicate(), and Reset().

Definition at line 181 of file h264utils.h.

Referenced by AddBytes(), and Reset().

Definition at line 182 of file h264utils.h.

Referenced by AddBytes(), KeyframePredicate(), and Reset().

Definition at line 184 of file h264utils.h.

Referenced by AddBytes(), KeyframePredicate(), LastSyncedType(), and Reset().

Definition at line 186 of file h264utils.h.

Referenced by KeyframePredicate(), and Reset().

Definition at line 187 of file h264utils.h.

Referenced by IsOnFrame(), KeyframePredicate(), and Reset().

Definition at line 188 of file h264utils.h.

Referenced by KeyframePredicate(), and Reset().

Definition at line 190 of file h264utils.h.

Referenced by KeyframePredicate(), and Reset().

Definition at line 191 of file h264utils.h.

Referenced by AddBytes(), IsOnKeyframe(), KeyframePredicate(), and Reset().

Definition at line 192 of file h264utils.h.

Referenced by KeyframeAUStreamOffset(), KeyframePredicate(), and Reset().


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

Generated on Sat Dec 18 05:16:14 2010 for MythTV by  doxygen 1.5.5