class H264Parser

Defined at line 419 of file ../../src/media/third_party/chromium_media/media/video/h264_parser.h

Class to parse an Annex-B H.264 stream,

as specified in chapters 7 and Annex B of the H.264 spec.

Public Methods

bool FindStartCode (const uint8_t * data, off_t data_size, off_t * offset, off_t * start_code_size)

Find offset from start of data to next NALU start code

and size of found start code (3 or 4 bytes).

If no start code is found, offset is pointing to the first unprocessed byte

(i.e. the first byte that was not considered as a possible start of a start

code) and |*start_code_size| is set to 0.

Preconditions:

- |data_size| >= 0

Postconditions:

- |*offset| is between 0 and |data_size| included.

It is strictly less than |data_size| if |data_size| > 0.

- |*start_code_size| is either 0, 3 or 4.

Defined at line 372 of file ../../src/media/third_party/chromium_media/media/video/h264_parser.cc

bool FindStartCodeInClearRanges (const uint8_t * data, off_t data_size, const Ranges<const uint8_t *> & ranges, off_t * offset, off_t * start_code_size)

Wrapper for FindStartCode() that skips over start codes that

may appear inside of |encrypted_ranges_|.

Returns true if a start code was found. Otherwise returns false.

Defined at line 463 of file ../../src/media/third_party/chromium_media/media/video/h264_parser.cc

VideoCodecProfile ProfileIDCToVideoCodecProfile (int profile_idc)

static

Defined at line 501 of file ../../src/media/third_party/chromium_media/media/video/h264_parser.cc

bool ParseNALUs (const uint8_t * stream, size_t stream_size, std::vector<H264NALU> * nalus)

Parses the input stream and returns all the NALUs through |nalus|. Returns

false if the stream is invalid.

Defined at line 529 of file ../../src/media/third_party/chromium_media/media/video/h264_parser.cc

void H264Parser ()

Defined at line 305 of file ../../src/media/third_party/chromium_media/media/video/h264_parser.cc

void ~H264Parser ()

Defined at line 309 of file ../../src/media/third_party/chromium_media/media/video/h264_parser.cc

void Reset ()

Defined at line 311 of file ../../src/media/third_party/chromium_media/media/video/h264_parser.cc

void SetStream (const uint8_t * stream, off_t stream_size)

Set current stream pointer to |stream| of |stream_size| in bytes,

|stream| owned by caller.

|subsamples| contains information about what parts of |stream| are

encrypted.

Defined at line 318 of file ../../src/media/third_party/chromium_media/media/video/h264_parser.cc

void SetEncryptedStream (const uint8_t * stream, off_t stream_size, const std::vector<SubsampleEntry> & subsamples)

Defined at line 323 of file ../../src/media/third_party/chromium_media/media/video/h264_parser.cc

void H264Parser (const H264Parser & )

Defined at line 463 of file ../../src/media/third_party/chromium_media/media/video/h264_parser.h

H264Parser & operator= (const H264Parser & )

Defined at line 464 of file ../../src/media/third_party/chromium_media/media/video/h264_parser.h

Result AdvanceToNextNALU (H264NALU * nalu)

Read the stream to find the next NALU, identify it and return

that information in |*nalu|. This advances the stream to the beginning

of this NALU, but not past it, so subsequent calls to NALU-specific

parsing functions (ParseSPS, etc.) will parse this NALU.

If the caller wishes to skip the current NALU, it can call this function

again, instead of any NALU-type specific parse functions below.

Defined at line 602 of file ../../src/media/third_party/chromium_media/media/video/h264_parser.cc

Result ParseSPS (int * sps_id)

SPSes and PPSes are owned by the parser class and the memory for their

structures is managed here, not by the caller, as they are reused

across NALUs.

For accepting variants, the caller passes in a std::unique_ptr

<

> which

transfers ownership from caller to parser class.

Parse/accept an SPS/PPS NALU and save their data in the parser, returning

id of the parsed structure in |*pps_id|/|*sps_id|.

To get a pointer to a given SPS/PPS structure, use GetSPS()/GetPPS(),

passing the returned |*sps_id|/|*pps_id| as parameter.

TODO(posciak,fischman): consider replacing returning Result from Parse*()

methods with a scoped_ptr and adding an AtEOS() function to check for EOS

if Parse*() return NULL.

Defined at line 1034 of file ../../src/media/third_party/chromium_media/media/video/h264_parser.cc

Result AcceptPreparsedSPS (std::unique_ptr<H264SPS> preparsed_sps, int * sps_id)

Defined at line 1157 of file ../../src/media/third_party/chromium_media/media/video/h264_parser.cc

Result ParsePPS (int * pps_id)

Defined at line 1183 of file ../../src/media/third_party/chromium_media/media/video/h264_parser.cc

Result AcceptPreparsedPPS (std::unique_ptr<H264PPS> preparsed_pps, int * pps_id)

Defined at line 1272 of file ../../src/media/third_party/chromium_media/media/video/h264_parser.cc

Result ParseSPSExt (int * sps_id)

Parses the SPS ID from the SPSExt, but otherwise does nothing.

Defined at line 1296 of file ../../src/media/third_party/chromium_media/media/video/h264_parser.cc

const H264SPS * GetSPS (int sps_id)

Return a pointer to SPS/PPS with given |sps_id|/|pps_id| or NULL if not

present.

Defined at line 357 of file ../../src/media/third_party/chromium_media/media/video/h264_parser.cc

const H264PPS * GetPPS (int pps_id)

Defined at line 347 of file ../../src/media/third_party/chromium_media/media/video/h264_parser.cc

Result ParseSliceHeader (const H264NALU & nalu, H264SliceHeader * shdr)

Parse a slice header, returning it in |*shdr|. |*nalu| must be set to

the NALU returned from AdvanceToNextNALU() and corresponding to |*shdr|.

Defined at line 1499 of file ../../src/media/third_party/chromium_media/media/video/h264_parser.cc

Result ParseSEI (H264SEIMessage * sei_msg)

Parse a SEI message, returning it in |*sei_msg|, provided and managed

by the caller.

Defined at line 1667 of file ../../src/media/third_party/chromium_media/media/video/h264_parser.cc

std::vector<SubsampleEntry> GetCurrentSubsamples ()

The return value of this method changes for every successful call to

AdvanceToNextNALU().

This returns the subsample information for the last NALU that was output

from AdvanceToNextNALU().

Defined at line 1705 of file ../../src/media/third_party/chromium_media/media/video/h264_parser.cc

Enumerations

enum Result
Name Value
kOk 0
kInvalidStream 1
kUnsupportedStream 2
kEOStream 3

Defined at line 421 of file ../../src/media/third_party/chromium_media/media/video/h264_parser.h