7 #ifndef MEDIA_CODECS_NALU_READER_H_
8 #define MEDIA_CODECS_NALU_READER_H_
13 #include "packager/base/compiler_specific.h"
14 #include "packager/base/macros.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 bool Initialize(CodecType
type,
93 uint64_t size) WARN_UNUSED_RESULT;
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);
174 static bool FindStartCode(
const uint8_t* data,
177 uint8_t* start_code_size);
191 kAnnexbByteStreamFormat,
202 bool LocateNaluByStartCode(uint64_t* nalu_size, uint8_t* start_code_size);
205 const uint8_t* stream_;
207 uint64_t stream_size_;
209 Nalu::CodecType nalu_type_;
212 uint8_t nalu_length_size_;
222 #endif // MEDIA_CODECS_NALU_READER_H_