7 #ifndef MEDIA_FILTERS_NALU_READER_H_
8 #define MEDIA_FILTERS_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_video_slice()
const {
return is_video_slice_; }
114 bool can_start_access_unit()
const {
return can_start_access_unit_; }
117 bool InitializeFromH264(
const uint8_t* data, uint64_t size);
118 bool InitializeFromH265(
const uint8_t* data, uint64_t size);
122 const uint8_t* data_;
125 uint64_t header_size_;
127 uint64_t payload_size_;
131 int nuh_temporal_id_;
133 bool is_video_slice_;
134 bool can_start_access_unit_;
155 uint8_t nal_length_size,
156 const uint8_t* stream,
157 uint64_t stream_size);
169 static bool FindStartCode(
const uint8_t* data,
172 uint8_t* start_code_size);
186 kAnnexbByteStreamFormat,
197 bool LocateNaluByStartCode(uint64_t* nalu_size, uint8_t* start_code_size);
200 const uint8_t* stream_;
202 uint64_t stream_size_;
204 Nalu::CodecType nalu_type_;
207 uint8_t nalu_length_size_;
217 #endif // MEDIA_FILTERS_NALU_READER_H_