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

Side by Side Diff: media/mp4/box_definitions.cc

Issue 10827079: Ignore unrecognized protection schemes in ISO BMFF files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "media/mp4/box_definitions.h" 5 #include "media/mp4/box_definitions.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "media/mp4/es_descriptor.h" 8 #include "media/mp4/es_descriptor.h"
9 #include "media/mp4/rcheck.h" 9 #include "media/mp4/rcheck.h"
10 10
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 84 }
85 85
86 SchemeType::SchemeType() : type(FOURCC_NULL), version(0) {} 86 SchemeType::SchemeType() : type(FOURCC_NULL), version(0) {}
87 SchemeType::~SchemeType() {} 87 SchemeType::~SchemeType() {}
88 FourCC SchemeType::BoxType() const { return FOURCC_SCHM; } 88 FourCC SchemeType::BoxType() const { return FOURCC_SCHM; }
89 89
90 bool SchemeType::Parse(BoxReader* reader) { 90 bool SchemeType::Parse(BoxReader* reader) {
91 RCHECK(reader->ReadFullBoxHeader() && 91 RCHECK(reader->ReadFullBoxHeader() &&
92 reader->ReadFourCC(&type) && 92 reader->ReadFourCC(&type) &&
93 reader->Read4(&version)); 93 reader->Read4(&version));
94 RCHECK(type == FOURCC_CENC);
95 return true; 94 return true;
96 } 95 }
97 96
98 TrackEncryption::TrackEncryption() 97 TrackEncryption::TrackEncryption()
99 : is_encrypted(false), default_iv_size(0) { 98 : is_encrypted(false), default_iv_size(0) {
100 } 99 }
101 TrackEncryption::~TrackEncryption() {} 100 TrackEncryption::~TrackEncryption() {}
102 FourCC TrackEncryption::BoxType() const { return FOURCC_TENC; } 101 FourCC TrackEncryption::BoxType() const { return FOURCC_TENC; }
103 102
104 bool TrackEncryption::Parse(BoxReader* reader) { 103 bool TrackEncryption::Parse(BoxReader* reader) {
(...skipping 20 matching lines...) Expand all
125 return reader->ScanChildren() && reader->ReadChild(&track_encryption); 124 return reader->ScanChildren() && reader->ReadChild(&track_encryption);
126 } 125 }
127 126
128 ProtectionSchemeInfo::ProtectionSchemeInfo() {} 127 ProtectionSchemeInfo::ProtectionSchemeInfo() {}
129 ProtectionSchemeInfo::~ProtectionSchemeInfo() {} 128 ProtectionSchemeInfo::~ProtectionSchemeInfo() {}
130 FourCC ProtectionSchemeInfo::BoxType() const { return FOURCC_SINF; } 129 FourCC ProtectionSchemeInfo::BoxType() const { return FOURCC_SINF; }
131 130
132 bool ProtectionSchemeInfo::Parse(BoxReader* reader) { 131 bool ProtectionSchemeInfo::Parse(BoxReader* reader) {
133 RCHECK(reader->ScanChildren() && 132 RCHECK(reader->ScanChildren() &&
134 reader->ReadChild(&format) && 133 reader->ReadChild(&format) &&
135 reader->ReadChild(&type) && 134 reader->ReadChild(&type));
136 reader->ReadChild(&info)); 135 if (type.type == FOURCC_CENC)
136 RCHECK(reader->ReadChild(&info));
137 // Other protection schemes are silently ignored. Since the protection scheme
138 // type can't be determined until this box is opened, we return 'true' for
139 // non-CENC protection scheme types. It is the parent box's responsibility to
140 // ensure that this scheme type is a supported one.
137 return true; 141 return true;
138 } 142 }
139 143
140 MovieHeader::MovieHeader() 144 MovieHeader::MovieHeader()
141 : creation_time(0), 145 : creation_time(0),
142 modification_time(0), 146 modification_time(0),
143 timescale(0), 147 timescale(0),
144 duration(0), 148 duration(0),
145 rate(-1), 149 rate(-1),
146 volume(-1), 150 volume(-1),
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 RCHECK(reader->SkipBytes(6) && 378 RCHECK(reader->SkipBytes(6) &&
375 reader->Read2(&data_reference_index) && 379 reader->Read2(&data_reference_index) &&
376 reader->SkipBytes(16) && 380 reader->SkipBytes(16) &&
377 reader->Read2(&width) && 381 reader->Read2(&width) &&
378 reader->Read2(&height) && 382 reader->Read2(&height) &&
379 reader->SkipBytes(50)); 383 reader->SkipBytes(50));
380 384
381 RCHECK(reader->ScanChildren() && 385 RCHECK(reader->ScanChildren() &&
382 reader->MaybeReadChild(&pixel_aspect)); 386 reader->MaybeReadChild(&pixel_aspect));
383 387
384 if (format == FOURCC_ENCV) 388 if (format == FOURCC_ENCV) {
385 RCHECK(reader->ReadChild(&sinf)); 389 // Continue scanning until a recognized protection scheme is found, or until
390 // we run out of protection schemes.
391 while (sinf.type.type != FOURCC_CENC)
392 RCHECK(reader->ReadChild(&sinf));
ddorwin 2012/07/28 00:41:21 This causes a DLOG(ERROR) even though it will happ
393 }
394
386 if (format == FOURCC_AVC1 || 395 if (format == FOURCC_AVC1 ||
387 (format == FOURCC_ENCV && sinf.format.format == FOURCC_AVC1)) { 396 (format == FOURCC_ENCV && sinf.format.format == FOURCC_AVC1)) {
388 RCHECK(reader->ReadChild(&avcc)); 397 RCHECK(reader->ReadChild(&avcc));
389 } 398 }
390 return true; 399 return true;
391 } 400 }
392 401
393 ElementaryStreamDescriptor::ElementaryStreamDescriptor() 402 ElementaryStreamDescriptor::ElementaryStreamDescriptor()
394 : object_type(kForbidden) {} 403 : object_type(kForbidden) {}
395 404
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 reader->Read2(&data_reference_index) && 444 reader->Read2(&data_reference_index) &&
436 reader->SkipBytes(8) && 445 reader->SkipBytes(8) &&
437 reader->Read2(&channelcount) && 446 reader->Read2(&channelcount) &&
438 reader->Read2(&samplesize) && 447 reader->Read2(&samplesize) &&
439 reader->SkipBytes(4) && 448 reader->SkipBytes(4) &&
440 reader->Read4(&samplerate)); 449 reader->Read4(&samplerate));
441 // Convert from 16.16 fixed point to integer 450 // Convert from 16.16 fixed point to integer
442 samplerate >>= 16; 451 samplerate >>= 16;
443 452
444 RCHECK(reader->ScanChildren()); 453 RCHECK(reader->ScanChildren());
445 if (format == FOURCC_ENCA) 454 if (format == FOURCC_ENCA) {
446 RCHECK(reader->ReadChild(&sinf)); 455 // Continue scanning until a recognized protection scheme is found, or until
456 // we run out of protection schemes.
457 while (sinf.type.type != FOURCC_CENC)
458 RCHECK(reader->ReadChild(&sinf));
459 }
460
447 RCHECK(reader->ReadChild(&esds)); 461 RCHECK(reader->ReadChild(&esds));
448 return true; 462 return true;
449 } 463 }
450 464
451 MediaHeader::MediaHeader() 465 MediaHeader::MediaHeader()
452 : creation_time(0), 466 : creation_time(0),
453 modification_time(0), 467 modification_time(0),
454 timescale(0), 468 timescale(0),
455 duration(0) {} 469 duration(0) {}
456 MediaHeader::~MediaHeader() {} 470 MediaHeader::~MediaHeader() {}
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 bool MovieFragment::Parse(BoxReader* reader) { 738 bool MovieFragment::Parse(BoxReader* reader) {
725 RCHECK(reader->ScanChildren() && 739 RCHECK(reader->ScanChildren() &&
726 reader->ReadChild(&header) && 740 reader->ReadChild(&header) &&
727 reader->ReadChildren(&tracks) && 741 reader->ReadChildren(&tracks) &&
728 reader->MaybeReadChildren(&pssh)); 742 reader->MaybeReadChildren(&pssh));
729 return true; 743 return true;
730 } 744 }
731 745
732 } // namespace mp4 746 } // namespace mp4
733 } // namespace media 747 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698