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

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

Issue 1998333002: MP4 support for Common Encryption 'cbcs' scheme. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ddorwin more detailed comments Created 4 years, 2 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 <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "media/base/decrypt_config.h" 15 #include "media/base/decrypt_config.h"
16 #include "media/base/media_export.h" 16 #include "media/base/media_export.h"
17 #include "media/base/media_log.h" 17 #include "media/base/media_log.h"
18 #include "media/base/video_codecs.h" 18 #include "media/base/video_codecs.h"
19 #include "media/formats/mp4/aac.h" 19 #include "media/formats/mp4/aac.h"
20 #include "media/formats/mp4/avc.h" 20 #include "media/formats/mp4/avc.h"
21 #include "media/formats/mp4/box_reader.h" 21 #include "media/formats/mp4/box_reader.h"
22 #include "media/formats/mp4/fourccs.h" 22 #include "media/formats/mp4/fourccs.h"
23 #include "media/media_features.h"
23 24
24 namespace media { 25 namespace media {
25 namespace mp4 { 26 namespace mp4 {
26 27
27 enum TrackType { kInvalid = 0, kVideo, kAudio, kText, kHint }; 28 enum TrackType { kInvalid = 0, kVideo, kAudio, kText, kHint };
28 29
29 enum SampleFlags { 30 enum SampleFlags {
30 kSampleIsNonSyncSample = 0x10000 31 kSampleIsNonSyncSample = 0x10000
31 }; 32 };
32 33
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 uint32_t version; 123 uint32_t version;
123 }; 124 };
124 125
125 struct MEDIA_EXPORT TrackEncryption : Box { 126 struct MEDIA_EXPORT TrackEncryption : Box {
126 DECLARE_BOX_METHODS(TrackEncryption); 127 DECLARE_BOX_METHODS(TrackEncryption);
127 128
128 // Note: this definition is specific to the CENC protection type. 129 // Note: this definition is specific to the CENC protection type.
129 bool is_encrypted; 130 bool is_encrypted;
130 uint8_t default_iv_size; 131 uint8_t default_iv_size;
131 std::vector<uint8_t> default_kid; 132 std::vector<uint8_t> default_kid;
133 #if BUILDFLAG(ENABLE_CBCS_ENCRYPTION_SCHEME)
134 uint8_t default_crypt_byte_block;
135 uint8_t default_skip_byte_block;
136 uint8_t default_constant_iv_size;
137 uint8_t default_constant_iv[16];
138 #endif
132 }; 139 };
133 140
134 struct MEDIA_EXPORT SchemeInfo : Box { 141 struct MEDIA_EXPORT SchemeInfo : Box {
135 DECLARE_BOX_METHODS(SchemeInfo); 142 DECLARE_BOX_METHODS(SchemeInfo);
136 143
137 TrackEncryption track_encryption; 144 TrackEncryption track_encryption;
138 }; 145 };
139 146
140 struct MEDIA_EXPORT ProtectionSchemeInfo : Box { 147 struct MEDIA_EXPORT ProtectionSchemeInfo : Box {
141 DECLARE_BOX_METHODS(ProtectionSchemeInfo); 148 DECLARE_BOX_METHODS(ProtectionSchemeInfo);
142 149
143 OriginalFormat format; 150 OriginalFormat format;
144 SchemeType type; 151 SchemeType type;
145 SchemeInfo info; 152 SchemeInfo info;
153
154 bool HasSupportedScheme() const;
146 }; 155 };
147 156
148 struct MEDIA_EXPORT MovieHeader : Box { 157 struct MEDIA_EXPORT MovieHeader : Box {
149 DECLARE_BOX_METHODS(MovieHeader); 158 DECLARE_BOX_METHODS(MovieHeader);
150 159
151 uint8_t version; 160 uint8_t version;
152 uint64_t creation_time; 161 uint64_t creation_time;
153 uint64_t modification_time; 162 uint64_t modification_time;
154 uint32_t timescale; 163 uint32_t timescale;
155 uint64_t duration; 164 uint64_t duration;
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
282 291
283 TrackType type; 292 TrackType type;
284 std::vector<VideoSampleEntry> video_entries; 293 std::vector<VideoSampleEntry> video_entries;
285 std::vector<AudioSampleEntry> audio_entries; 294 std::vector<AudioSampleEntry> audio_entries;
286 }; 295 };
287 296
288 struct MEDIA_EXPORT CencSampleEncryptionInfoEntry { 297 struct MEDIA_EXPORT CencSampleEncryptionInfoEntry {
289 CencSampleEncryptionInfoEntry(); 298 CencSampleEncryptionInfoEntry();
290 CencSampleEncryptionInfoEntry(const CencSampleEncryptionInfoEntry& other); 299 CencSampleEncryptionInfoEntry(const CencSampleEncryptionInfoEntry& other);
291 ~CencSampleEncryptionInfoEntry(); 300 ~CencSampleEncryptionInfoEntry();
301 bool Parse(BoxReader* reader);
292 302
293 bool is_encrypted; 303 bool is_encrypted;
294 uint8_t iv_size; 304 uint8_t iv_size;
295 std::vector<uint8_t> key_id; 305 std::vector<uint8_t> key_id;
306 #if BUILDFLAG(ENABLE_CBCS_ENCRYPTION_SCHEME)
307 uint8_t crypt_byte_block;
308 uint8_t skip_byte_block;
309 uint8_t constant_iv_size;
310 uint8_t constant_iv[16];
311 #endif
296 }; 312 };
297 313
298 struct MEDIA_EXPORT SampleGroupDescription : Box { // 'sgpd'. 314 struct MEDIA_EXPORT SampleGroupDescription : Box { // 'sgpd'.
299 DECLARE_BOX_METHODS(SampleGroupDescription); 315 DECLARE_BOX_METHODS(SampleGroupDescription);
300 316
301 uint32_t grouping_type; 317 uint32_t grouping_type;
302 std::vector<CencSampleEncryptionInfoEntry> entries; 318 std::vector<CencSampleEncryptionInfoEntry> entries;
303 }; 319 };
304 320
305 struct MEDIA_EXPORT SampleTable : Box { 321 struct MEDIA_EXPORT SampleTable : Box {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
478 std::vector<TrackFragment> tracks; 494 std::vector<TrackFragment> tracks;
479 std::vector<ProtectionSystemSpecificHeader> pssh; 495 std::vector<ProtectionSystemSpecificHeader> pssh;
480 }; 496 };
481 497
482 #undef DECLARE_BOX 498 #undef DECLARE_BOX
483 499
484 } // namespace mp4 500 } // namespace mp4
485 } // namespace media 501 } // namespace media
486 502
487 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_ 503 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698