OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_ | 5 #ifndef MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_ |
6 #define MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_ | 6 #define MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "media/base/media_export.h" | 13 #include "media/base/media_export.h" |
| 14 #include "media/base/video_decoder_config.h" |
14 #include "media/formats/mp4/aac.h" | 15 #include "media/formats/mp4/aac.h" |
15 #include "media/formats/mp4/avc.h" | 16 #include "media/formats/mp4/avc.h" |
16 #include "media/formats/mp4/box_reader.h" | 17 #include "media/formats/mp4/box_reader.h" |
17 #include "media/formats/mp4/fourccs.h" | 18 #include "media/formats/mp4/fourccs.h" |
18 | 19 |
19 namespace media { | 20 namespace media { |
20 namespace mp4 { | 21 namespace mp4 { |
21 | 22 |
22 enum TrackType { | 23 enum TrackType { |
23 kInvalid = 0, | 24 kInvalid = 0, |
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
170 typedef std::vector<uint8> SPS; | 171 typedef std::vector<uint8> SPS; |
171 typedef std::vector<uint8> PPS; | 172 typedef std::vector<uint8> PPS; |
172 | 173 |
173 std::vector<SPS> sps_list; | 174 std::vector<SPS> sps_list; |
174 std::vector<PPS> pps_list; | 175 std::vector<PPS> pps_list; |
175 | 176 |
176 private: | 177 private: |
177 bool ParseInternal(BufferReader* reader, const LogCB& log_cb); | 178 bool ParseInternal(BufferReader* reader, const LogCB& log_cb); |
178 }; | 179 }; |
179 | 180 |
| 181 #if defined(ENABLE_HEVC_DEMUXING) |
| 182 struct MEDIA_EXPORT HEVCDecoderConfigurationRecord : Box { |
| 183 DECLARE_BOX_METHODS(HEVCDecoderConfigurationRecord); |
| 184 |
| 185 // Parses HEVCDecoderConfigurationRecord data encoded in |data|. |
| 186 // Note: This method is intended to parse data outside the MP4StreamParser |
| 187 // context and therefore the box header is not expected to be present |
| 188 // in |data|. |
| 189 // Returns true if |data| was successfully parsed. |
| 190 bool Parse(const uint8* data, int data_size); |
| 191 |
| 192 uint8 configurationVersion; |
| 193 uint8 general_profile_space; |
| 194 uint8 general_tier_flag; |
| 195 uint8 general_profile_idc; |
| 196 uint32 general_profile_compatibility_flags; |
| 197 uint64 general_constraint_indicator_flags; |
| 198 uint8 general_level_idc; |
| 199 uint16 min_spatial_segmentation_idc; |
| 200 uint8 parallelismType; |
| 201 uint8 chromaFormat; |
| 202 uint8 bitDepthLumaMinus8; |
| 203 uint8 bitDepthChromaMinus8; |
| 204 uint16 avgFrameRate; |
| 205 uint8 constantFrameRate; |
| 206 uint8 numTemporalLayers; |
| 207 uint8 temporalIdNested; |
| 208 uint8 lengthSizeMinusOne; |
| 209 uint8 numOfArrays; |
| 210 |
| 211 uint8 length_size; |
| 212 |
| 213 typedef std::vector<uint8> HVCCNALUnit; |
| 214 struct HVCCNALArray { |
| 215 HVCCNALArray(); |
| 216 ~HVCCNALArray(); |
| 217 uint8 first_byte; |
| 218 std::vector<HVCCNALUnit> units; |
| 219 }; |
| 220 std::vector<HVCCNALArray> arrays; |
| 221 |
| 222 private: |
| 223 bool ParseInternal(BufferReader* reader, const LogCB& log_cb); |
| 224 }; |
| 225 #endif |
| 226 |
180 struct MEDIA_EXPORT PixelAspectRatioBox : Box { | 227 struct MEDIA_EXPORT PixelAspectRatioBox : Box { |
181 DECLARE_BOX_METHODS(PixelAspectRatioBox); | 228 DECLARE_BOX_METHODS(PixelAspectRatioBox); |
182 | 229 |
183 uint32 h_spacing; | 230 uint32 h_spacing; |
184 uint32 v_spacing; | 231 uint32 v_spacing; |
185 }; | 232 }; |
186 | 233 |
187 struct MEDIA_EXPORT VideoSampleEntry : Box { | 234 struct MEDIA_EXPORT VideoSampleEntry : Box { |
188 DECLARE_BOX_METHODS(VideoSampleEntry); | 235 DECLARE_BOX_METHODS(VideoSampleEntry); |
189 | 236 |
190 FourCC format; | 237 FourCC format; |
191 uint16 data_reference_index; | 238 uint16 data_reference_index; |
192 uint16 width; | 239 uint16 width; |
193 uint16 height; | 240 uint16 height; |
194 | 241 |
195 PixelAspectRatioBox pixel_aspect; | 242 PixelAspectRatioBox pixel_aspect; |
196 ProtectionSchemeInfo sinf; | 243 ProtectionSchemeInfo sinf; |
197 | 244 |
198 // Currently expected to be present regardless of format. | 245 // avcConfig is used for H.264/avc video |
199 AVCDecoderConfigurationRecord avcc; | 246 AVCDecoderConfigurationRecord avcConfig; |
| 247 #if defined(ENABLE_HEVC_DEMUXING) |
| 248 // hevcConfig is used for H.265/hevc video |
| 249 HEVCDecoderConfigurationRecord hevcConfig; |
| 250 #endif |
200 | 251 |
201 bool IsFormatValid() const; | 252 VideoDecoderConfig video_decoder_config_; |
| 253 VideoDecoderConfig GetVideoDecoderConfig() const; |
202 }; | 254 }; |
203 | 255 |
204 struct MEDIA_EXPORT ElementaryStreamDescriptor : Box { | 256 struct MEDIA_EXPORT ElementaryStreamDescriptor : Box { |
205 DECLARE_BOX_METHODS(ElementaryStreamDescriptor); | 257 DECLARE_BOX_METHODS(ElementaryStreamDescriptor); |
206 | 258 |
207 uint8 object_type; | 259 uint8 object_type; |
208 AAC aac; | 260 AAC aac; |
209 }; | 261 }; |
210 | 262 |
211 struct MEDIA_EXPORT AudioSampleEntry : Box { | 263 struct MEDIA_EXPORT AudioSampleEntry : Box { |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 std::vector<TrackFragment> tracks; | 480 std::vector<TrackFragment> tracks; |
429 std::vector<ProtectionSystemSpecificHeader> pssh; | 481 std::vector<ProtectionSystemSpecificHeader> pssh; |
430 }; | 482 }; |
431 | 483 |
432 #undef DECLARE_BOX | 484 #undef DECLARE_BOX |
433 | 485 |
434 } // namespace mp4 | 486 } // namespace mp4 |
435 } // namespace media | 487 } // namespace media |
436 | 488 |
437 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_ | 489 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_ |
OLD | NEW |