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

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: accommodate comments Created 4 years, 7 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 DECLARE_BOX_METHODS(SchemeType); 120 DECLARE_BOX_METHODS(SchemeType);
120 121
121 FourCC type; 122 FourCC type;
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;
ddorwin 2016/05/27 23:05:59 As KQ noted, initialize all the values consistentl
dougsteed 2016/06/09 22:38:27 Done.
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 = 0;
135 uint8_t default_skip_byte_block = 0;
136 uint8_t default_constant_iv_size = 0;
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 uint64_t creation_time; 160 uint64_t creation_time;
152 uint64_t modification_time; 161 uint64_t modification_time;
153 uint32_t timescale; 162 uint32_t timescale;
154 uint64_t duration; 163 uint64_t duration;
155 int32_t rate; 164 int32_t rate;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 284
276 TrackType type; 285 TrackType type;
277 std::vector<VideoSampleEntry> video_entries; 286 std::vector<VideoSampleEntry> video_entries;
278 std::vector<AudioSampleEntry> audio_entries; 287 std::vector<AudioSampleEntry> audio_entries;
279 }; 288 };
280 289
281 struct MEDIA_EXPORT CencSampleEncryptionInfoEntry { 290 struct MEDIA_EXPORT CencSampleEncryptionInfoEntry {
282 CencSampleEncryptionInfoEntry(); 291 CencSampleEncryptionInfoEntry();
283 CencSampleEncryptionInfoEntry(const CencSampleEncryptionInfoEntry& other); 292 CencSampleEncryptionInfoEntry(const CencSampleEncryptionInfoEntry& other);
284 ~CencSampleEncryptionInfoEntry(); 293 ~CencSampleEncryptionInfoEntry();
294 bool Parse(BoxReader* reader);
285 295
286 bool is_encrypted; 296 bool is_encrypted;
287 uint8_t iv_size; 297 uint8_t iv_size;
288 std::vector<uint8_t> key_id; 298 std::vector<uint8_t> key_id;
299 #if BUILDFLAG(ENABLE_CBCS_ENCRYPTION_SCHEME)
300 uint8_t crypt_byte_block = 0;
301 uint8_t skip_byte_block = 0;
302 uint8_t constant_iv_size = 0;
303 uint8_t constant_iv[16];
304 #endif
289 }; 305 };
290 306
291 struct MEDIA_EXPORT SampleGroupDescription : Box { // 'sgpd'. 307 struct MEDIA_EXPORT SampleGroupDescription : Box { // 'sgpd'.
292 DECLARE_BOX_METHODS(SampleGroupDescription); 308 DECLARE_BOX_METHODS(SampleGroupDescription);
293 309
294 uint32_t grouping_type; 310 uint32_t grouping_type;
295 std::vector<CencSampleEncryptionInfoEntry> entries; 311 std::vector<CencSampleEncryptionInfoEntry> entries;
296 }; 312 };
297 313
298 struct MEDIA_EXPORT SampleTable : Box { 314 struct MEDIA_EXPORT SampleTable : Box {
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 std::vector<TrackFragment> tracks; 487 std::vector<TrackFragment> tracks;
472 std::vector<ProtectionSystemSpecificHeader> pssh; 488 std::vector<ProtectionSystemSpecificHeader> pssh;
473 }; 489 };
474 490
475 #undef DECLARE_BOX 491 #undef DECLARE_BOX
476 492
477 } // namespace mp4 493 } // namespace mp4
478 } // namespace media 494 } // namespace media
479 495
480 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_ 496 #endif // MEDIA_FORMATS_MP4_BOX_DEFINITIONS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698