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

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

Issue 10534172: Implement ISO BMFF support in Media Source (try 2). (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "media/mp4/cenc.h"
6
7 #include "media/mp4/box_reader.h"
8 #include "media/mp4/rcheck.h"
9
10 namespace media {
11 namespace mp4 {
12
13 FrameCENCInfo::FrameCENCInfo() {}
14 FrameCENCInfo::~FrameCENCInfo() {}
15
16 bool FrameCENCInfo::Parse(int iv_size, BufferReader* reader) {
17 const int kEntrySize = 6;
18
19 // Mandated by CENC spec
20 RCHECK(iv_size == 8 || iv_size == 16);
21 iv.resize(iv_size);
22
23 uint16 subsample_count;
24 RCHECK(reader->ReadVec(&iv, iv_size) &&
25 reader->Read2(&subsample_count) &&
26 reader->HasBytes(subsample_count * kEntrySize));
27 subsamples.resize(subsample_count);
28
29 for (int i = 0; i < subsample_count; i++) {
30 RCHECK(reader->Read2(&subsamples[i].clear_size) &&
31 reader->Read4(&subsamples[i].encrypted_size));
32 }
33 return true;
34 }
35
36 size_t FrameCENCInfo::GetTotalSize() const {
37 size_t size = 0;
38 for (size_t i = 0; i < subsamples.size(); i++) {
39 size += subsamples[i].clear_size + subsamples[i].encrypted_size;
40 }
41 return size;
42 }
43
44 } // namespace mp4
45 } // namespace media
OLDNEW
« no previous file with comments | « media/mp4/cenc.h ('k') | media/mp4/fourccs.h » ('j') | media/mp4/track_run_iterator.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698