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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 typedef std::vector<uint8> SPS; | 172 typedef std::vector<uint8> SPS; |
172 typedef std::vector<uint8> PPS; | 173 typedef std::vector<uint8> PPS; |
173 | 174 |
174 std::vector<SPS> sps_list; | 175 std::vector<SPS> sps_list; |
175 std::vector<PPS> pps_list; | 176 std::vector<PPS> pps_list; |
176 | 177 |
177 private: | 178 private: |
178 bool ParseInternal(BufferReader* reader, const LogCB& log_cb); | 179 bool ParseInternal(BufferReader* reader, const LogCB& log_cb); |
179 }; | 180 }; |
180 | 181 |
| 182 #if defined(ENABLE_HEVC_DEMUXING) |
| 183 struct MEDIA_EXPORT HEVCDecoderConfigurationRecord : Box { |
| 184 DECLARE_BOX_METHODS(HEVCDecoderConfigurationRecord); |
| 185 |
| 186 // Parses HEVCDecoderConfigurationRecord data encoded in |data|. |
| 187 // Note: This method is intended to parse data outside the MP4StreamParser |
| 188 // context and therefore the box header is not expected to be present |
| 189 // in |data|. |
| 190 // Returns true if |data| was successfully parsed. |
| 191 bool Parse(const uint8* data, int data_size); |
| 192 |
| 193 uint8 configurationVersion; |
| 194 uint8 general_profile_space; |
| 195 uint8 general_tier_flag; |
| 196 uint8 general_profile_idc; |
| 197 uint32 general_profile_compatibility_flags; |
| 198 uint64 general_constraint_indicator_flags; |
| 199 uint8 general_level_idc; |
| 200 uint16 min_spatial_segmentation_idc; |
| 201 uint8 parallelismType; |
| 202 uint8 chromaFormat; |
| 203 uint8 bitDepthLumaMinus8; |
| 204 uint8 bitDepthChromaMinus8; |
| 205 uint16 avgFrameRate; |
| 206 uint8 constantFrameRate; |
| 207 uint8 numTemporalLayers; |
| 208 uint8 temporalIdNested; |
| 209 uint8 lengthSizeMinusOne; |
| 210 uint8 numOfArrays; |
| 211 |
| 212 uint8 length_size; |
| 213 |
| 214 typedef std::vector<uint8> HVCCNALUnit; |
| 215 struct HVCCNALArray { |
| 216 HVCCNALArray(); |
| 217 ~HVCCNALArray(); |
| 218 uint8 first_byte; |
| 219 std::vector<HVCCNALUnit> units; |
| 220 }; |
| 221 std::vector<HVCCNALArray> arrays; |
| 222 |
| 223 private: |
| 224 bool ParseInternal(BufferReader* reader, const LogCB& log_cb); |
| 225 }; |
| 226 #endif |
| 227 |
181 struct MEDIA_EXPORT PixelAspectRatioBox : Box { | 228 struct MEDIA_EXPORT PixelAspectRatioBox : Box { |
182 DECLARE_BOX_METHODS(PixelAspectRatioBox); | 229 DECLARE_BOX_METHODS(PixelAspectRatioBox); |
183 | 230 |
184 uint32 h_spacing; | 231 uint32 h_spacing; |
185 uint32 v_spacing; | 232 uint32 v_spacing; |
186 }; | 233 }; |
187 | 234 |
188 struct MEDIA_EXPORT VideoSampleEntry : Box { | 235 struct MEDIA_EXPORT VideoSampleEntry : Box { |
189 DECLARE_BOX_METHODS(VideoSampleEntry); | 236 DECLARE_BOX_METHODS(VideoSampleEntry); |
190 | 237 |
191 FourCC format; | 238 FourCC format; |
192 uint16 data_reference_index; | 239 uint16 data_reference_index; |
193 uint16 width; | 240 uint16 width; |
194 uint16 height; | 241 uint16 height; |
195 | 242 |
196 PixelAspectRatioBox pixel_aspect; | 243 PixelAspectRatioBox pixel_aspect; |
197 ProtectionSchemeInfo sinf; | 244 ProtectionSchemeInfo sinf; |
198 | 245 |
199 // Currently expected to be present regardless of format. | 246 // avcConfig is used for H.264/avc video |
200 AVCDecoderConfigurationRecord avcc; | 247 AVCDecoderConfigurationRecord avcConfig; |
| 248 #if defined(ENABLE_HEVC_DEMUXING) |
| 249 // hevcConfig is used for H.265/hevc video |
| 250 HEVCDecoderConfigurationRecord hevcConfig; |
| 251 #endif |
201 | 252 |
202 bool IsFormatValid() const; | 253 VideoDecoderConfig video_decoder_config_; |
| 254 VideoDecoderConfig GetVideoDecoderConfig() const; |
203 }; | 255 }; |
204 | 256 |
205 struct MEDIA_EXPORT ElementaryStreamDescriptor : Box { | 257 struct MEDIA_EXPORT ElementaryStreamDescriptor : Box { |
206 DECLARE_BOX_METHODS(ElementaryStreamDescriptor); | 258 DECLARE_BOX_METHODS(ElementaryStreamDescriptor); |
207 | 259 |
208 uint8 object_type; | 260 uint8 object_type; |
209 AAC aac; | 261 AAC aac; |
210 }; | 262 }; |
211 | 263 |
212 struct MEDIA_EXPORT AudioSampleEntry : Box { | 264 struct MEDIA_EXPORT AudioSampleEntry : Box { |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
429 std::vector<TrackFragment> tracks; | 481 std::vector<TrackFragment> tracks; |
430 std::vector<ProtectionSystemSpecificHeader> pssh; | 482 std::vector<ProtectionSystemSpecificHeader> pssh; |
431 }; | 483 }; |
432 | 484 |
433 #undef DECLARE_BOX | 485 #undef DECLARE_BOX |
434 | 486 |
435 } // namespace mp4 | 487 } // namespace mp4 |
436 } // namespace media | 488 } // namespace media |
437 | 489 |
438 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_ | 490 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_ |
OLD | NEW |