5 #ifndef PACKAGER_MEDIA_CODECS_ES_DESCRIPTOR_H_
6 #define PACKAGER_MEDIA_CODECS_ES_DESCRIPTOR_H_
20 enum class ObjectType : uint8_t {
23 kISO_13818_7_AAC_LC = 0x67,
24 kISO_13818_3_MPEG1 = 0x69,
25 kISO_11172_3_MPEG1 = 0x6B,
32 enum class DescriptorTag {
35 kDecoderConfig = 0x04,
36 kDecoderSpecificInfo = 0x05,
48 bool Parse(
const std::vector<uint8_t>& data);
73 virtual bool ReadData(
BitReader* reader) = 0;
77 virtual size_t ComputeDataSize() = 0;
79 DescriptorTag tag_ = DescriptorTag::kForbidden;
80 size_t data_size_ = 0;
90 const std::vector<uint8_t>& data()
const {
return data_; }
92 void set_data(
const std::vector<uint8_t>& data) { data_ = data; }
95 bool ReadData(
BitReader* reader)
override;
97 size_t ComputeDataSize()
override;
99 std::vector<uint8_t> data_;
108 uint32_t buffer_size_db()
const {
return buffer_size_db_; }
109 void set_buffer_size_db(uint32_t buffer_size_db) {
110 buffer_size_db_ = buffer_size_db;
113 uint32_t max_bitrate()
const {
return max_bitrate_; }
114 void set_max_bitrate(uint32_t max_bitrate) { max_bitrate_ = max_bitrate; }
116 uint32_t avg_bitrate()
const {
return avg_bitrate_; }
117 void set_avg_bitrate(uint32_t avg_bitrate) { avg_bitrate_ = avg_bitrate; }
119 ObjectType object_type()
const {
return object_type_; }
120 void set_object_type(ObjectType object_type) { object_type_ = object_type; }
124 return object_type_ == ObjectType::kISO_14496_3 ||
125 object_type_ == ObjectType::kISO_13818_7_AAC_LC;
130 return object_type_ == ObjectType::kDTSC ||
131 object_type_ == ObjectType::kDTSE ||
132 object_type_ == ObjectType::kDTSH ||
133 object_type_ == ObjectType::kDTSL;
138 return decoder_specific_info_descriptor_;
141 DecoderSpecificInfoDescriptor* mutable_decoder_specific_info_descriptor() {
142 return &decoder_specific_info_descriptor_;
146 bool ReadData(BitReader* reader)
override;
147 void WriteInternal(BufferWriter* writer)
override;
148 size_t ComputeDataSize()
override;
150 ObjectType object_type_ = ObjectType::kForbidden;
151 uint32_t buffer_size_db_ = 0;
152 uint32_t max_bitrate_ = 0;
153 uint32_t avg_bitrate_ = 0;
154 DecoderSpecificInfoDescriptor decoder_specific_info_descriptor_;
164 bool ReadData(
BitReader* reader)
override;
166 size_t ComputeDataSize()
override;
176 uint16_t esid()
const {
return esid_; }
179 return decoder_config_descriptor_;
183 return &decoder_config_descriptor_;
187 bool ReadData(
BitReader* reader)
override;
189 size_t ComputeDataSize()
override;
All the methods that are virtual are virtual for mocking.