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/media_log.h" | 14 #include "media/base/media_log.h" |
| 15 #include "media/base/video_decoder_config.h" |
15 #include "media/formats/mp4/aac.h" | 16 #include "media/formats/mp4/aac.h" |
16 #include "media/formats/mp4/avc.h" | 17 #include "media/formats/mp4/avc.h" |
17 #include "media/formats/mp4/box_reader.h" | 18 #include "media/formats/mp4/box_reader.h" |
18 #include "media/formats/mp4/fourccs.h" | 19 #include "media/formats/mp4/fourccs.h" |
19 | 20 |
20 namespace media { | 21 namespace media { |
21 namespace mp4 { | 22 namespace mp4 { |
22 | 23 |
23 enum TrackType { | 24 enum TrackType { |
24 kInvalid = 0, | 25 kInvalid = 0, |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 typedef std::vector<uint8> SPS; | 182 typedef std::vector<uint8> SPS; |
182 typedef std::vector<uint8> PPS; | 183 typedef std::vector<uint8> PPS; |
183 | 184 |
184 std::vector<SPS> sps_list; | 185 std::vector<SPS> sps_list; |
185 std::vector<PPS> pps_list; | 186 std::vector<PPS> pps_list; |
186 | 187 |
187 private: | 188 private: |
188 bool ParseInternal(BufferReader* reader, const LogCB& log_cb); | 189 bool ParseInternal(BufferReader* reader, const LogCB& log_cb); |
189 }; | 190 }; |
190 | 191 |
| 192 #if defined(ENABLE_HEVC_DEMUXING) |
| 193 struct MEDIA_EXPORT HEVCDecoderConfigurationRecord : Box { |
| 194 DECLARE_BOX_METHODS(HEVCDecoderConfigurationRecord); |
| 195 |
| 196 // Parses HEVCDecoderConfigurationRecord data encoded in |data|. |
| 197 // Note: This method is intended to parse data outside the MP4StreamParser |
| 198 // context and therefore the box header is not expected to be present |
| 199 // in |data|. |
| 200 // Returns true if |data| was successfully parsed. |
| 201 bool Parse(const uint8* data, int data_size); |
| 202 |
| 203 uint8 configurationVersion; |
| 204 uint8 general_profile_space; |
| 205 uint8 general_tier_flag; |
| 206 uint8 general_profile_idc; |
| 207 uint32 general_profile_compatibility_flags; |
| 208 uint64 general_constraint_indicator_flags; |
| 209 uint8 general_level_idc; |
| 210 uint16 min_spatial_segmentation_idc; |
| 211 uint8 parallelismType; |
| 212 uint8 chromaFormat; |
| 213 uint8 bitDepthLumaMinus8; |
| 214 uint8 bitDepthChromaMinus8; |
| 215 uint16 avgFrameRate; |
| 216 uint8 constantFrameRate; |
| 217 uint8 numTemporalLayers; |
| 218 uint8 temporalIdNested; |
| 219 uint8 lengthSizeMinusOne; |
| 220 uint8 numOfArrays; |
| 221 |
| 222 uint8 length_size; |
| 223 |
| 224 typedef std::vector<uint8> HVCCNALUnit; |
| 225 struct HVCCNALArray { |
| 226 HVCCNALArray(); |
| 227 ~HVCCNALArray(); |
| 228 uint8 first_byte; |
| 229 std::vector<HVCCNALUnit> units; |
| 230 }; |
| 231 std::vector<HVCCNALArray> arrays; |
| 232 |
| 233 private: |
| 234 bool ParseInternal(BufferReader* reader, const LogCB& log_cb); |
| 235 }; |
| 236 #endif |
| 237 |
191 struct MEDIA_EXPORT PixelAspectRatioBox : Box { | 238 struct MEDIA_EXPORT PixelAspectRatioBox : Box { |
192 DECLARE_BOX_METHODS(PixelAspectRatioBox); | 239 DECLARE_BOX_METHODS(PixelAspectRatioBox); |
193 | 240 |
194 uint32 h_spacing; | 241 uint32 h_spacing; |
195 uint32 v_spacing; | 242 uint32 v_spacing; |
196 }; | 243 }; |
197 | 244 |
198 struct MEDIA_EXPORT VideoSampleEntry : Box { | 245 struct MEDIA_EXPORT VideoSampleEntry : Box { |
199 DECLARE_BOX_METHODS(VideoSampleEntry); | 246 DECLARE_BOX_METHODS(VideoSampleEntry); |
200 | 247 |
201 FourCC format; | 248 FourCC format; |
202 uint16 data_reference_index; | 249 uint16 data_reference_index; |
203 uint16 width; | 250 uint16 width; |
204 uint16 height; | 251 uint16 height; |
205 | 252 |
206 PixelAspectRatioBox pixel_aspect; | 253 PixelAspectRatioBox pixel_aspect; |
207 ProtectionSchemeInfo sinf; | 254 ProtectionSchemeInfo sinf; |
208 | 255 |
209 // Currently expected to be present regardless of format. | 256 // avcConfig is used for H.264/avc video |
210 AVCDecoderConfigurationRecord avcc; | 257 AVCDecoderConfigurationRecord avcConfig; |
| 258 #if defined(ENABLE_HEVC_DEMUXING) |
| 259 // hevcConfig is used for H.265/hevc video |
| 260 HEVCDecoderConfigurationRecord hevcConfig; |
| 261 #endif |
211 | 262 |
212 bool IsFormatValid() const; | 263 VideoDecoderConfig video_decoder_config_; |
| 264 VideoDecoderConfig GetVideoDecoderConfig() const; |
213 }; | 265 }; |
214 | 266 |
215 struct MEDIA_EXPORT ElementaryStreamDescriptor : Box { | 267 struct MEDIA_EXPORT ElementaryStreamDescriptor : Box { |
216 DECLARE_BOX_METHODS(ElementaryStreamDescriptor); | 268 DECLARE_BOX_METHODS(ElementaryStreamDescriptor); |
217 | 269 |
218 uint8 object_type; | 270 uint8 object_type; |
219 AAC aac; | 271 AAC aac; |
220 }; | 272 }; |
221 | 273 |
222 struct MEDIA_EXPORT AudioSampleEntry : Box { | 274 struct MEDIA_EXPORT AudioSampleEntry : Box { |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 std::vector<TrackFragment> tracks; | 491 std::vector<TrackFragment> tracks; |
440 std::vector<ProtectionSystemSpecificHeader> pssh; | 492 std::vector<ProtectionSystemSpecificHeader> pssh; |
441 }; | 493 }; |
442 | 494 |
443 #undef DECLARE_BOX | 495 #undef DECLARE_BOX |
444 | 496 |
445 } // namespace mp4 | 497 } // namespace mp4 |
446 } // namespace media | 498 } // namespace media |
447 | 499 |
448 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_ | 500 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_ |
OLD | NEW |