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

Unified Diff: media/mp4/cenc.cc

Issue 10536014: Implement ISO BMFF support in Media Source. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: A thorough sign-ification 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 side-by-side diff with in-line comments
Download patch
Index: media/mp4/cenc.cc
diff --git a/media/mp4/cenc.cc b/media/mp4/cenc.cc
new file mode 100644
index 0000000000000000000000000000000000000000..e1ffa69b7afdf77eea44e4dc8d00244dbe3f0985
--- /dev/null
+++ b/media/mp4/cenc.cc
@@ -0,0 +1,45 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "media/mp4/cenc.h"
+
+#include "media/mp4/box_reader.h"
+#include "media/mp4/rcheck.h"
+
+namespace media {
+namespace mp4 {
+
+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.
+FrameCENCInfo::~FrameCENCInfo() {};
+
+bool FrameCENCInfo::Parse(int iv_size, BufferReader* reader) {
+ const int kEntrySize = 6;
+
+ // Mandated by CENC spec
+ RCHECK(iv_size == 8 || iv_size == 16);
+ iv.resize(iv_size);
+
+ uint16 subsample_count;
+ RCHECK(reader->ReadVec(&iv, iv_size) &&
+ reader->Read2(&subsample_count) &&
+ reader->HasBytes(subsample_count * kEntrySize));
+ subsamples.resize(subsample_count);
+
+ for (int i = 0; i < subsample_count; i++) {
+ RCHECK(reader->Read2(&subsamples[i].clear_size) &&
+ reader->Read4(&subsamples[i].encrypted_size));
+ }
+ return true;
+}
+
+size_t FrameCENCInfo::GetTotalSize() const {
+ size_t size = 0;
+ for (size_t i = 0; i < subsamples.size(); i++) {
+ size += subsamples[i].clear_size + subsamples[i].encrypted_size;
+ }
+ return size;
+}
+
+} // namespace mp4
+} // namespace media

Powered by Google App Engine
This is Rietveld 408576698