5 #ifndef PACKAGER_MEDIA_CODECS_ES_DESCRIPTOR_H_
6 #define PACKAGER_MEDIA_CODECS_ES_DESCRIPTOR_H_
21 enum class ObjectType : uint8_t {
24 kISO_13818_7_AAC_LC = 0x67,
25 kISO_13818_3_MPEG1 = 0x69,
26 kISO_11172_3_MPEG1 = 0x6B,
33 enum class DescriptorTag {
36 kDecoderConfig = 0x04,
37 kDecoderSpecificInfo = 0x05,
49 bool Parse(
const std::vector<uint8_t>& data);
74 virtual bool ReadData(
BitReader* reader) = 0;
78 virtual size_t ComputeDataSize() = 0;
80 DescriptorTag tag_ = DescriptorTag::kForbidden;
81 size_t data_size_ = 0;
91 const std::vector<uint8_t>& data()
const {
return data_; }
93 void set_data(
const std::vector<uint8_t>& data) { data_ = data; }
96 bool ReadData(
BitReader* reader)
override;
98 size_t ComputeDataSize()
override;
100 std::vector<uint8_t> data_;
109 uint32_t buffer_size_db()
const {
return buffer_size_db_; }
110 void set_buffer_size_db(uint32_t buffer_size_db) {
111 buffer_size_db_ = buffer_size_db;
114 uint32_t max_bitrate()
const {
return max_bitrate_; }
115 void set_max_bitrate(uint32_t max_bitrate) { max_bitrate_ = max_bitrate; }
117 uint32_t avg_bitrate()
const {
return avg_bitrate_; }
118 void set_avg_bitrate(uint32_t avg_bitrate) { avg_bitrate_ = avg_bitrate; }
120 ObjectType object_type()
const {
return object_type_; }
121 void set_object_type(ObjectType object_type) { object_type_ = object_type; }
125 return object_type_ == ObjectType::kISO_14496_3 ||
126 object_type_ == ObjectType::kISO_13818_7_AAC_LC;
131 return object_type_ == ObjectType::kDTSC ||
132 object_type_ == ObjectType::kDTSE ||
133 object_type_ == ObjectType::kDTSH ||
134 object_type_ == ObjectType::kDTSL;
139 return decoder_specific_info_descriptor_;
142 DecoderSpecificInfoDescriptor* mutable_decoder_specific_info_descriptor() {
143 return &decoder_specific_info_descriptor_;
147 bool ReadData(BitReader* reader)
override;
148 void WriteInternal(BufferWriter* writer)
override;
149 size_t ComputeDataSize()
override;
151 ObjectType object_type_ = ObjectType::kForbidden;
152 uint32_t buffer_size_db_ = 0;
153 uint32_t max_bitrate_ = 0;
154 uint32_t avg_bitrate_ = 0;
155 DecoderSpecificInfoDescriptor decoder_specific_info_descriptor_;
165 bool ReadData(
BitReader* reader)
override;
167 size_t ComputeDataSize()
override;
177 uint16_t esid()
const {
return esid_; }
180 return decoder_config_descriptor_;
184 return &decoder_config_descriptor_;
188 bool ReadData(
BitReader* reader)
override;
190 size_t ComputeDataSize()
override;
201 #endif // PACKAGER_MEDIA_CODECS_ES_DESCRIPTOR_H_