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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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, | 189 bool ParseInternal(BufferReader* reader, |
189 const scoped_refptr<MediaLog>& media_log); | 190 const scoped_refptr<MediaLog>& media_log); |
190 }; | 191 }; |
191 | 192 |
| 193 #if defined(ENABLE_HEVC_DEMUXING) |
| 194 struct MEDIA_EXPORT HEVCDecoderConfigurationRecord : Box { |
| 195 DECLARE_BOX_METHODS(HEVCDecoderConfigurationRecord); |
| 196 |
| 197 // Parses HEVCDecoderConfigurationRecord data encoded in |data|. |
| 198 // Note: This method is intended to parse data outside the MP4StreamParser |
| 199 // context and therefore the box header is not expected to be present |
| 200 // in |data|. |
| 201 // Returns true if |data| was successfully parsed. |
| 202 bool Parse(const uint8* data, int data_size); |
| 203 |
| 204 uint8 configurationVersion; |
| 205 uint8 general_profile_space; |
| 206 uint8 general_tier_flag; |
| 207 uint8 general_profile_idc; |
| 208 uint32 general_profile_compatibility_flags; |
| 209 uint64 general_constraint_indicator_flags; |
| 210 uint8 general_level_idc; |
| 211 uint16 min_spatial_segmentation_idc; |
| 212 uint8 parallelismType; |
| 213 uint8 chromaFormat; |
| 214 uint8 bitDepthLumaMinus8; |
| 215 uint8 bitDepthChromaMinus8; |
| 216 uint16 avgFrameRate; |
| 217 uint8 constantFrameRate; |
| 218 uint8 numTemporalLayers; |
| 219 uint8 temporalIdNested; |
| 220 uint8 lengthSizeMinusOne; |
| 221 uint8 numOfArrays; |
| 222 |
| 223 typedef std::vector<uint8> HVCCNALUnit; |
| 224 struct HVCCNALArray { |
| 225 HVCCNALArray(); |
| 226 ~HVCCNALArray(); |
| 227 uint8 first_byte; |
| 228 std::vector<HVCCNALUnit> units; |
| 229 }; |
| 230 std::vector<HVCCNALArray> arrays; |
| 231 |
| 232 private: |
| 233 bool ParseInternal(BufferReader* reader, |
| 234 const scoped_refptr<MediaLog>& media_log); |
| 235 }; |
| 236 #endif |
| 237 |
192 struct MEDIA_EXPORT PixelAspectRatioBox : Box { | 238 struct MEDIA_EXPORT PixelAspectRatioBox : Box { |
193 DECLARE_BOX_METHODS(PixelAspectRatioBox); | 239 DECLARE_BOX_METHODS(PixelAspectRatioBox); |
194 | 240 |
195 uint32 h_spacing; | 241 uint32 h_spacing; |
196 uint32 v_spacing; | 242 uint32 v_spacing; |
197 }; | 243 }; |
198 | 244 |
199 struct MEDIA_EXPORT VideoSampleEntry : Box { | 245 struct MEDIA_EXPORT VideoSampleEntry : Box { |
200 DECLARE_BOX_METHODS(VideoSampleEntry); | 246 DECLARE_BOX_METHODS(VideoSampleEntry); |
201 | 247 |
202 FourCC format; | 248 FourCC format; |
203 uint16 data_reference_index; | 249 uint16 data_reference_index; |
204 uint16 width; | 250 uint16 width; |
205 uint16 height; | 251 uint16 height; |
206 | 252 |
207 PixelAspectRatioBox pixel_aspect; | 253 PixelAspectRatioBox pixel_aspect; |
208 ProtectionSchemeInfo sinf; | 254 ProtectionSchemeInfo sinf; |
209 | 255 |
| 256 VideoCodec video_codec; |
| 257 VideoCodecProfile video_codec_profile; |
| 258 |
210 bool IsFormatValid() const; | 259 bool IsFormatValid() const; |
211 | 260 |
212 scoped_refptr<BitstreamConverter> frame_bitstream_converter; | 261 scoped_refptr<BitstreamConverter> frame_bitstream_converter; |
213 }; | 262 }; |
214 | 263 |
215 struct MEDIA_EXPORT ElementaryStreamDescriptor : Box { | 264 struct MEDIA_EXPORT ElementaryStreamDescriptor : Box { |
216 DECLARE_BOX_METHODS(ElementaryStreamDescriptor); | 265 DECLARE_BOX_METHODS(ElementaryStreamDescriptor); |
217 | 266 |
218 uint8 object_type; | 267 uint8 object_type; |
219 AAC aac; | 268 AAC aac; |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 std::vector<TrackFragment> tracks; | 477 std::vector<TrackFragment> tracks; |
429 std::vector<ProtectionSystemSpecificHeader> pssh; | 478 std::vector<ProtectionSystemSpecificHeader> pssh; |
430 }; | 479 }; |
431 | 480 |
432 #undef DECLARE_BOX | 481 #undef DECLARE_BOX |
433 | 482 |
434 } // namespace mp4 | 483 } // namespace mp4 |
435 } // namespace media | 484 } // namespace media |
436 | 485 |
437 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_ | 486 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_ |
OLD | NEW |