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

Unified Diff: media/mp4/box_definitions.cc

Issue 10651006: Add Common Encryption support to BMFF, including subsample decryption. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Remove references to non-public encrypted files in tests Created 8 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: media/mp4/box_definitions.cc
diff --git a/media/mp4/box_definitions.cc b/media/mp4/box_definitions.cc
index 5d18c32182f0db20f236ed283af903a75fa213d5..fb9723006fb8aa7528092ddb9113d5bedc5a329d 100644
--- a/media/mp4/box_definitions.cc
+++ b/media/mp4/box_definitions.cc
@@ -85,7 +85,7 @@ SchemeType::~SchemeType() {}
FourCC SchemeType::BoxType() const { return FOURCC_SCHM; }
bool SchemeType::Parse(BoxReader* reader) {
- RCHECK(reader->SkipBytes(4) &&
+ RCHECK(reader->ReadFullBoxHeader() &&
ddorwin 2012/06/26 06:09:19 Why all the RCHECKs? Macros are discouraged, and t
strobe_ 2012/06/27 02:01:21 The alternatives were worse. ;) There are some tr
reader->ReadFourCC(&type) &&
reader->Read4(&version));
RCHECK(type == FOURCC_CENC);
@@ -100,7 +100,8 @@ FourCC TrackEncryption::BoxType() const { return FOURCC_TENC; }
bool TrackEncryption::Parse(BoxReader* reader) {
uint8 flag;
- RCHECK(reader->SkipBytes(2) &&
+ RCHECK(reader->ReadFullBoxHeader() &&
+ reader->SkipBytes(2) &&
reader->Read1(&flag) &&
reader->Read1(&default_iv_size) &&
reader->ReadVec(&default_kid, 16));
@@ -126,9 +127,10 @@ ProtectionSchemeInfo::~ProtectionSchemeInfo() {}
FourCC ProtectionSchemeInfo::BoxType() const { return FOURCC_SINF; }
bool ProtectionSchemeInfo::Parse(BoxReader* reader) {
- return reader->ScanChildren() &&
+ RCHECK(reader->ScanChildren() &&
reader->ReadChild(&type) &&
- reader->ReadChild(&info);
+ reader->ReadChild(&info));
+ return true;
}
MovieHeader::MovieHeader()
@@ -362,19 +364,12 @@ bool VideoSampleEntry::Parse(BoxReader* reader) {
reader->Read2(&height) &&
reader->SkipBytes(50));
+ // TODO(strobe): Finalize format signaling for encrypted media
+ // (http://crbug.com/132351). For now, we assume that every video track is
+ // AVC, and that any track may have a Common Encryption header regardless of
+ // format.
RCHECK(reader->ScanChildren());
- if (format == FOURCC_ENCV) {
- RCHECK(reader->ReadChild(&sinf));
- }
-
- // TODO(strobe): finalize format signaling for encrypted media
- // (http://crbug.com/132351)
- //
- // if (format == FOURCC_AVC1 ||
- // (format == FOURCC_ENCV &&
- // sinf.format.format == FOURCC_AVC1)) {
- RCHECK(reader->ReadChild(&avcc));
- // }
+ RCHECK(reader->ReadChild(&avcc) && reader->MaybeReadChild(&sinf));
return true;
}
@@ -404,10 +399,8 @@ bool AudioSampleEntry::Parse(BoxReader* reader) {
// Convert from 16.16 fixed point to integer
samplerate >>= 16;
- RCHECK(reader->ScanChildren());
- if (format == FOURCC_ENCA) {
- RCHECK(reader->ReadChild(&sinf));
- }
+ RCHECK(reader->ScanChildren() &&
+ reader->MaybeReadChild(&sinf));
return true;
}

Powered by Google App Engine
This is Rietveld 408576698