summaryrefslogtreecommitdiffstats
path: root/media/mp4/box_definitions.cc
diff options
context:
space:
mode:
authorstrobe@google.com <strobe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-26 00:49:59 +0000
committerstrobe@google.com <strobe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-26 00:49:59 +0000
commit9746f9132e55a91d2ec3d866711277b874574743 (patch)
treeb0f6d236afc3515855403363b6e9fe455a6c801d /media/mp4/box_definitions.cc
parent7db8893ab741949612cebfed89e11d267daacbf9 (diff)
downloadchromium_src-9746f9132e55a91d2ec3d866711277b874574743.zip
chromium_src-9746f9132e55a91d2ec3d866711277b874574743.tar.gz
chromium_src-9746f9132e55a91d2ec3d866711277b874574743.tar.bz2
Add Common Encryption support to BMFF, including subsample decryption.
BUG=132351 TEST=AesDecryptorTest, plus manual playback in browser Review URL: https://chromiumcodereview.appspot.com/10651006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@148453 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/mp4/box_definitions.cc')
-rw-r--r--media/mp4/box_definitions.cc36
1 files changed, 17 insertions, 19 deletions
diff --git a/media/mp4/box_definitions.cc b/media/mp4/box_definitions.cc
index c9245d8..d6ab0fc 100644
--- a/media/mp4/box_definitions.cc
+++ b/media/mp4/box_definitions.cc
@@ -27,7 +27,7 @@ FourCC ProtectionSystemSpecificHeader::BoxType() const { return FOURCC_PSSH; }
bool ProtectionSystemSpecificHeader::Parse(BoxReader* reader) {
uint32 size;
- return reader->SkipBytes(4) &&
+ return reader->ReadFullBoxHeader() &&
reader->ReadVec(&system_id, 16) &&
reader->Read4(&size) &&
reader->ReadVec(&data, size);
@@ -88,7 +88,7 @@ SchemeType::~SchemeType() {}
FourCC SchemeType::BoxType() const { return FOURCC_SCHM; }
bool SchemeType::Parse(BoxReader* reader) {
- RCHECK(reader->SkipBytes(4) &&
+ RCHECK(reader->ReadFullBoxHeader() &&
reader->ReadFourCC(&type) &&
reader->Read4(&version));
RCHECK(type == FOURCC_CENC);
@@ -103,7 +103,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));
@@ -129,9 +130,11 @@ ProtectionSchemeInfo::~ProtectionSchemeInfo() {}
FourCC ProtectionSchemeInfo::BoxType() const { return FOURCC_SINF; }
bool ProtectionSchemeInfo::Parse(BoxReader* reader) {
- return reader->ScanChildren() &&
+ RCHECK(reader->ScanChildren() &&
+ reader->ReadChild(&format) &&
reader->ReadChild(&type) &&
- reader->ReadChild(&info);
+ reader->ReadChild(&info));
+ return true;
}
MovieHeader::MovieHeader()
@@ -375,20 +378,15 @@ bool VideoSampleEntry::Parse(BoxReader* reader) {
reader->Read2(&height) &&
reader->SkipBytes(50));
- RCHECK(reader->ScanChildren());
- RCHECK(reader->MaybeReadChild(&pixel_aspect));
- if (format == FOURCC_ENCV) {
- RCHECK(reader->ReadChild(&sinf));
- }
+ RCHECK(reader->ScanChildren() &&
+ reader->MaybeReadChild(&pixel_aspect));
- // TODO(strobe): finalize format signaling for encrypted media
- // (http://crbug.com/132351)
- //
- // if (format == FOURCC_AVC1 ||
- // (format == FOURCC_ENCV &&
- // sinf.format.format == FOURCC_AVC1)) {
+ if (format == FOURCC_ENCV)
+ RCHECK(reader->ReadChild(&sinf));
+ if (format == FOURCC_AVC1 ||
+ (format == FOURCC_ENCV && sinf.format.format == FOURCC_AVC1)) {
RCHECK(reader->ReadChild(&avcc));
- // }
+ }
return true;
}
@@ -444,9 +442,8 @@ bool AudioSampleEntry::Parse(BoxReader* reader) {
samplerate >>= 16;
RCHECK(reader->ScanChildren());
- if (format == FOURCC_ENCA) {
+ if (format == FOURCC_ENCA)
RCHECK(reader->ReadChild(&sinf));
- }
RCHECK(reader->ReadChild(&esds));
return true;
}
@@ -597,6 +594,7 @@ bool MovieFragmentHeader::Parse(BoxReader* reader) {
TrackFragmentHeader::TrackFragmentHeader()
: track_id(0),
+ sample_description_index(0),
default_sample_duration(0),
default_sample_size(0),
default_sample_flags(0),