#include <nalu_reader.h>
|
enum | Result { kOk
, kInvalidStream
, kEOStream
} |
|
|
static bool | FindStartCode (const uint8_t *data, uint64_t data_size, uint64_t *offset, uint8_t *start_code_size) |
|
static bool | FindStartCodeInClearRange (const uint8_t *data, uint64_t data_size, uint64_t *offset, uint8_t *start_code_size, const std::vector< SubsampleEntry > &subsamples) |
|
Helper class used to read NAL units based on several formats:
- Annex B H.264/h.265
- NAL Unit Stream
Definition at line 149 of file nalu_reader.h.
◆ NaluReader() [1/2]
shaka::media::NaluReader::NaluReader |
( |
Nalu::CodecType |
type, |
|
|
uint8_t |
nal_length_size, |
|
|
const uint8_t * |
stream, |
|
|
uint64_t |
stream_size |
|
) |
| |
- Parameters
-
nalu_length_size | should be set to 0 for AnnexB byte streams; otherwise, it indicates the size of NAL unit length for the NAL unit stream. |
Definition at line 214 of file nalu_reader.cc.
◆ NaluReader() [2/2]
shaka::media::NaluReader::NaluReader |
( |
Nalu::CodecType |
type, |
|
|
uint8_t |
nal_length_size, |
|
|
const uint8_t * |
stream, |
|
|
uint64_t |
stream_size, |
|
|
const std::vector< SubsampleEntry > & |
subsamples |
|
) |
| |
- Parameters
-
type | is the codec type of the NALU unit. |
nalu_length_size | should be set to 0 for AnnexB byte streams; otherwise, it indicates the size of NAL unit length for the NAL unit stream. |
stream | is the input stream. |
stream_size | is the size of stream. |
subsamples | specifies the clear and encrypted sections of the stream starting from the beginning of the stream. If subsamples doesn't cover the entire stream, then the rest is assumed to be in the clear. |
Definition at line 224 of file nalu_reader.cc.
◆ Advance()
NaluReader::Result shaka::media::NaluReader::Advance |
( |
Nalu * |
nalu | ) |
|
Reads a NALU from the stream into |*nalu|, if one exists, and then advances to the next NALU.
- Parameters
-
nalu | contains the NALU read if it exists. |
- Returns
- kOk if a NALU is read; kEOStream if the stream is at the end-of-stream; kInvalidStream on error.
Definition at line 241 of file nalu_reader.cc.
◆ FindStartCodeInClearRange()
bool shaka::media::NaluReader::FindStartCodeInClearRange |
( |
const uint8_t * |
data, |
|
|
uint64_t |
data_size, |
|
|
uint64_t * |
offset, |
|
|
uint8_t * |
start_code_size, |
|
|
const std::vector< SubsampleEntry > & |
subsamples |
|
) |
| |
|
static |
Same as FindStartCode() but also specify the subsamples. This searches for start codes in the clear section and will not scan for start codes in the encrypted section. Even if there is a real NALU start code in the encrypted section, this will skip them.
- Parameters
-
subsamples | starting from the start of data. If subsamples does not cover the whole data, the rest is assumed to be in the clear. |
- Returns
- true if it finds a NALU. false otherwise.
Definition at line 346 of file nalu_reader.cc.
◆ StartsWithStartCode()
bool shaka::media::NaluReader::StartsWithStartCode |
( |
| ) |
|
- Returns
- true if the current position points to a start code.
Definition at line 299 of file nalu_reader.cc.
The documentation for this class was generated from the following files: