Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(160)

Side by Side Diff: media/formats/mp4/box_definitions.h

Issue 816353010: Implemented HEVC video demuxing and parsing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed wolenetz@ review feedback Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
ddorwin 2015/09/08 18:55:44 Is this necessary?
servolk 2015/09/08 19:22:02 Yes, this is necessary, since media::VideoCodec an
ddorwin 2015/09/08 19:54:36 Hmm. We should consider extracting those into a vi
servolk 2015/09/08 20:27:25 Ok, I'll do that in a follow up CL.
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
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 {
ddorwin 2015/09/08 18:55:44 Can we put this in an HEVC-specific file? It's not
servolk 2015/09/08 19:22:02 Yeah, I was pondering which path to take - put thi
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
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698