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

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

Issue 10837116: Update EME MediaKeyNeededEvent.initData for ISO BMFF to match current spec. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address review comments. Created 8 years, 3 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
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
11 namespace media { 11 namespace media {
12 namespace mp4 { 12 namespace mp4 {
13 13
14 FileType::FileType() {} 14 FileType::FileType() {}
15 FileType::~FileType() {} 15 FileType::~FileType() {}
16 FourCC FileType::BoxType() const { return FOURCC_FTYP; } 16 FourCC FileType::BoxType() const { return FOURCC_FTYP; }
17 17
18 bool FileType::Parse(BoxReader* reader) { 18 bool FileType::Parse(BoxReader* reader) {
19 RCHECK(reader->ReadFourCC(&major_brand) && reader->Read4(&minor_version)); 19 RCHECK(reader->ReadFourCC(&major_brand) && reader->Read4(&minor_version));
20 size_t num_brands = (reader->size() - reader->pos()) / sizeof(FourCC); 20 size_t num_brands = (reader->size() - reader->pos()) / sizeof(FourCC);
21 return reader->SkipBytes(sizeof(FourCC) * num_brands); // compatible_brands 21 return reader->SkipBytes(sizeof(FourCC) * num_brands); // compatible_brands
22 } 22 }
23 23
24 ProtectionSystemSpecificHeader::ProtectionSystemSpecificHeader() {} 24 ProtectionSystemSpecificHeader::ProtectionSystemSpecificHeader() {}
25 ProtectionSystemSpecificHeader::~ProtectionSystemSpecificHeader() {} 25 ProtectionSystemSpecificHeader::~ProtectionSystemSpecificHeader() {}
26 FourCC ProtectionSystemSpecificHeader::BoxType() const { return FOURCC_PSSH; } 26 FourCC ProtectionSystemSpecificHeader::BoxType() const { return FOURCC_PSSH; }
27 27
28 bool ProtectionSystemSpecificHeader::Parse(BoxReader* reader) { 28 bool ProtectionSystemSpecificHeader::Parse(BoxReader* reader) {
29 // Validate the box's contents and hang on to the system ID.
29 uint32 size; 30 uint32 size;
30 return reader->ReadFullBoxHeader() && 31 RCHECK(reader->ReadFullBoxHeader() &&
31 reader->ReadVec(&system_id, 16) && 32 reader->ReadVec(&system_id, 16) &&
32 reader->Read4(&size) && 33 reader->Read4(&size) &&
33 reader->ReadVec(&data, size); 34 reader->HasBytes(size));
35
36 // Copy the entire box, including the header, for passing to EME as initData.
37 DCHECK(raw_box.empty());
38 raw_box.assign(reader->data(), reader->data() + reader->size());
39 return true;
34 } 40 }
35 41
36 SampleAuxiliaryInformationOffset::SampleAuxiliaryInformationOffset() {} 42 SampleAuxiliaryInformationOffset::SampleAuxiliaryInformationOffset() {}
37 SampleAuxiliaryInformationOffset::~SampleAuxiliaryInformationOffset() {} 43 SampleAuxiliaryInformationOffset::~SampleAuxiliaryInformationOffset() {}
38 FourCC SampleAuxiliaryInformationOffset::BoxType() const { return FOURCC_SAIO; } 44 FourCC SampleAuxiliaryInformationOffset::BoxType() const { return FOURCC_SAIO; }
39 45
40 bool SampleAuxiliaryInformationOffset::Parse(BoxReader* reader) { 46 bool SampleAuxiliaryInformationOffset::Parse(BoxReader* reader) {
41 RCHECK(reader->ReadFullBoxHeader()); 47 RCHECK(reader->ReadFullBoxHeader());
42 if (reader->flags() & 1) 48 if (reader->flags() & 1)
43 RCHECK(reader->SkipBytes(8)); 49 RCHECK(reader->SkipBytes(8));
(...skipping 698 matching lines...) Expand 10 before | Expand all | Expand 10 after
742 bool MovieFragment::Parse(BoxReader* reader) { 748 bool MovieFragment::Parse(BoxReader* reader) {
743 RCHECK(reader->ScanChildren() && 749 RCHECK(reader->ScanChildren() &&
744 reader->ReadChild(&header) && 750 reader->ReadChild(&header) &&
745 reader->ReadChildren(&tracks) && 751 reader->ReadChildren(&tracks) &&
746 reader->MaybeReadChildren(&pssh)); 752 reader->MaybeReadChildren(&pssh));
747 return true; 753 return true;
748 } 754 }
749 755
750 } // namespace mp4 756 } // namespace mp4
751 } // namespace media 757 } // namespace media
OLDNEW
« no previous file with comments | « media/mp4/box_definitions.h ('k') | media/mp4/box_reader.h » ('j') | media/mp4/box_reader.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698