7 #ifndef PACKAGER_MEDIA_CODECS_NALU_READER_H_
8 #define PACKAGER_MEDIA_CODECS_NALU_READER_H_
13 #include <packager/macros/classes.h>
14 #include <packager/media/base/decrypt_config.h>
22 const uint8_t kIsAnnexbByteStream = 0;
38 H264_SPSExtension = 13,
39 H264_PrefixNALUnit = 14,
41 H264_DepthParameterSet = 16,
44 H264_CodedSliceExtension = 20,
56 H265_RSV_VCL_N10 = 10,
57 H265_RSV_VCL_R15 = 15,
64 H265_RSV_IRAP_VCL22 = 22,
65 H265_RSV_IRAP_VCL23 = 23,
91 [[nodiscard]]
bool Initialize(CodecType
type,
96 const uint8_t*
data()
const {
return data_; }
104 int ref_idc()
const {
return ref_idc_; }
107 int nuh_layer_id()
const {
return nuh_layer_id_; }
108 int nuh_temporal_id()
const {
return nuh_temporal_id_; }
112 int type()
const {
return type_; }
113 bool is_aud()
const {
return is_aud_; }
114 bool is_vcl()
const {
return is_vcl_; }
117 bool can_start_access_unit()
const {
return can_start_access_unit_; }
120 bool InitializeFromH264(
const uint8_t*
data, uint64_t size);
121 bool InitializeFromH265(
const uint8_t*
data, uint64_t size);
125 const uint8_t* data_ =
nullptr;
128 uint64_t header_size_ = 0;
130 uint64_t payload_size_ = 0;
133 int nuh_layer_id_ = 0;
134 int nuh_temporal_id_ = 0;
136 bool is_aud_ =
false;
137 bool is_vcl_ =
false;
138 bool is_video_slice_ =
false;
139 bool can_start_access_unit_ =
false;
160 uint8_t nal_length_size,
161 const uint8_t* stream,
162 uint64_t stream_size);
175 uint8_t nal_length_size,
176 const uint8_t* stream,
177 uint64_t stream_size,
178 const std::vector<SubsampleEntry>& subsamples);
190 static bool FindStartCode(
const uint8_t* data,
193 uint8_t* start_code_size);
207 uint8_t* start_code_size,
208 const std::vector<SubsampleEntry>& subsamples);
222 kAnnexbByteStreamFormat,
233 bool LocateNaluByStartCode(uint64_t* nalu_size, uint8_t* start_code_size);
236 const uint8_t* stream_;
238 uint64_t stream_size_;
240 Nalu::CodecType nalu_type_;
243 uint8_t nalu_length_size_;
248 std::vector<SubsampleEntry> subsamples_;
All the methods that are virtual are virtual for mocking.