Chromium Code Reviews| OLD | NEW |
|---|---|
| (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() {}; | |
|
acolwell GONE FROM CHROMIUM
2012/06/08 16:10:38
lint nit: remove ; here and next line.
strobe_
2012/06/11 18:44:21
Done.
| |
| 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 | |
| OLD | NEW |