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 #include <numeric> | |
| 10 | |
| 11 namespace media { | |
| 12 namespace mp4 { | |
| 13 | |
| 14 FrameCENCInfo::FrameCENCInfo() {}; | |
| 15 FrameCENCInfo::~FrameCENCInfo() {}; | |
| 16 | |
| 17 bool Parse(size_t iv_size, FrameCENCInfo* cenc, BufferReader* r) { | |
|
acolwell GONE FROM CHROMIUM
2012/06/06 17:32:39
r -> reader
strobe_
2012/06/07 16:33:54
Done.
| |
| 18 const size_t kEntrySize = sizeof(uint16) + sizeof(uint32); | |
| 19 | |
| 20 // Mandated by CENC spec | |
| 21 RCHECK(iv_size == 8 || iv_size == 16); | |
| 22 cenc->iv.resize(iv_size); | |
| 23 | |
| 24 uint16 subsample_count; | |
| 25 RCHECK(r->Read(&cenc->iv, iv_size) && | |
| 26 r->Read(&subsample_count) && | |
| 27 r->HasBytes(subsample_count * kEntrySize)); | |
| 28 cenc->subsamples.resize(subsample_count); | |
| 29 | |
| 30 for (size_t i = 0; i < subsample_count; i++) { | |
| 31 RCHECK(r->Read(&cenc->subsamples[i].clear_size) && | |
| 32 r->Read(&cenc->subsamples[i].encrypted_size)); | |
| 33 } | |
| 34 return true; | |
| 35 } | |
| 36 | |
| 37 size_t FrameCENCInfo::GetTotalSize() const { | |
| 38 size_t sz = 0; | |
|
acolwell GONE FROM CHROMIUM
2012/06/06 17:32:39
sz -> size
strobe_
2012/06/07 16:33:54
Done.
| |
| 39 for (size_t i = 0; i < subsamples.size(); i++) { | |
| 40 sz += subsamples[i].clear_size + subsamples[i].encrypted_size; | |
| 41 } | |
| 42 return sz; | |
| 43 } | |
| 44 | |
| 45 } // namespace mp4 | |
| 46 } // namespace media | |
| OLD | NEW |