class H264BitstreamBuffer

Defined at line 24 of file ../../src/media/third_party/chromium_media/media/filters/h264_bitstream_buffer.h

Holds one or more NALUs as a raw bitstream buffer in H.264 Annex-B format.

Note that this class currently does NOT insert emulation prevention

three-byte sequences (spec 7.3.1) by default.

Public Methods

void H264BitstreamBuffer (bool insert_emulation_prevention_bytes)

This is used by VA-API encoder and D3D12 encoder.

- For VA-API encoder, set |insert_emulation_prevention_bytes| to |false| as

VA-API takes SPS/PPS RBSP and outputs the AnnexB bitstream.

- For D3D12 encoder, set |insert_emulation_prevention_bytes| to |true| as

it only outputs slice NALU. We add SPS/PPS with EPB in Chromium to create

an AnnexB bitstream.

Defined at line 11 of file ../../src/media/third_party/chromium_media/media/filters/h264_bitstream_buffer.cc

void ~H264BitstreamBuffer ()

Defined at line 16 of file ../../src/media/third_party/chromium_media/media/filters/h264_bitstream_buffer.cc

void Reset ()

Discard all data and reset the buffer for reuse.

Defined at line 18 of file ../../src/media/third_party/chromium_media/media/filters/h264_bitstream_buffer.cc

void H264BitstreamBuffer (const H264BitstreamBuffer & )

Defined at line 34 of file ../../src/media/third_party/chromium_media/media/filters/h264_bitstream_buffer.h

H264BitstreamBuffer & operator= (const H264BitstreamBuffer & )

Defined at line 35 of file ../../src/media/third_party/chromium_media/media/filters/h264_bitstream_buffer.h

template <typename T>
void AppendBits (size_t num_bits, T val)

Append |num_bits| bits to the stream from |val|.

|val| is interpreted in the host endianness.

Defined at line 43 of file ../../src/media/third_party/chromium_media/media/filters/h264_bitstream_buffer.h

void AppendBits (size_t num_bits, bool val)

Defined at line 47 of file ../../src/media/third_party/chromium_media/media/filters/h264_bitstream_buffer.h

void AppendBool (bool val)

Append a one-bit bool/flag value |val| to the stream.

Defined at line 115 of file ../../src/media/third_party/chromium_media/media/filters/h264_bitstream_buffer.cc

void AppendSE (int val)

Append a signed value in |val| in Exp-Golomb code.

Defined at line 125 of file ../../src/media/third_party/chromium_media/media/filters/h264_bitstream_buffer.cc

void AppendUE (unsigned int val)

Append an unsigned value in |val| in Exp-Golomb code.

Defined at line 132 of file ../../src/media/third_party/chromium_media/media/filters/h264_bitstream_buffer.cc

void BeginNALU (H264NALU::Type nalu_type, int nal_ref_idc)

Start a new NALU of type |nalu_type| and with given |nal_ref_idc|

(see spec). Note, that until FinishNALU() is called, some of the bits

may not be flushed into the buffer and the data will not be correctly

aligned with trailing bits.

Defined at line 150 of file ../../src/media/third_party/chromium_media/media/filters/h264_bitstream_buffer.cc

void FinishNALU ()

Finish current NALU. This will flush any cached bits and correctly align

the buffer with RBSP trailing bits. This MUST be called for the stream

returned by data() to be correct.

Defined at line 167 of file ../../src/media/third_party/chromium_media/media/filters/h264_bitstream_buffer.cc

void Flush ()

Finishes current bit stream. This will flush any cached bits in the reg

without RBSP trailing bits alignment. e.g. for packed slice header, it is

not a complete NALU, the slice data and RBSP trailing will be filled by

user mode driver. This MUST be called for the stream returned by data() to

be correct.

Defined at line 178 of file ../../src/media/third_party/chromium_media/media/filters/h264_bitstream_buffer.cc

size_t BytesInBuffer ()

Return number of full bytes in the stream. Note that FinishNALU() has to

be called to flush cached bits, or the return value will not include them.

Defined at line 187 of file ../../src/media/third_party/chromium_media/media/filters/h264_bitstream_buffer.cc

size_t BitsInBuffer ()

Returns number of bits in the stream. Note that FinishNALU() or Flush() has

to be called to flush cached bits, or the return value will not include

them.

Defined at line 183 of file ../../src/media/third_party/chromium_media/media/filters/h264_bitstream_buffer.cc

const uint8_t * data ()

Return a pointer to the stream. FinishNALU() must be called before

accessing the stream, otherwise some bits may still be cached and not in

the buffer.

TODO(crbug.com/40284755): Return a span up to `pos_` which is the range of

initialized bytes in `data_`.

Defined at line 192 of file ../../src/media/third_party/chromium_media/media/filters/h264_bitstream_buffer.cc