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

Unified Diff: media/base/encryption_scheme.cc

Issue 1490613005: media config: expand is_encrypted to a struct. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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/base/encryption_scheme.cc
diff --git a/media/base/encryption_scheme.cc b/media/base/encryption_scheme.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1a8aa37ddaf8415cafb3bc761e3703783dce3c77
--- /dev/null
+++ b/media/base/encryption_scheme.cc
@@ -0,0 +1,59 @@
+// Copyright 2015 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/base/encryption_scheme.h"
+
+#include "base/logging.h"
ddorwin 2015/12/10 18:36:01 I don't think this is currently used, but it may b
dougsteed 2016/03/02 18:07:52 Done.
+
+namespace media {
+
+EncryptionScheme::EncryptionScheme()
+ : is_encrypted_(false), mode_(kCipherModeAesCtr), pattern_() {}
ddorwin 2015/12/10 18:36:00 Why not kCipherModeUnknown?
dougsteed 2015/12/14 21:19:01 Up until now, AES-CTR is the default (at least for
+
+EncryptionScheme::EncryptionScheme(bool is_encrypted)
+ : is_encrypted_(is_encrypted), mode_(kCipherModeAesCtr), pattern_() {}
+
+EncryptionScheme::EncryptionScheme(CipherMode mode)
+ : is_encrypted_(true), mode_(mode), pattern_() {}
+
+EncryptionScheme::EncryptionScheme(CipherMode mode, const PatternSpec& pattern)
+ : is_encrypted_(true), mode_(mode), pattern_(pattern) {}
+
+EncryptionScheme::EncryptionScheme(bool is_encrypted,
+ CipherMode mode,
+ const PatternSpec& pattern)
+ : is_encrypted_(is_encrypted), mode_(mode), pattern_(pattern) {}
+
+void EncryptionScheme::Initialize(bool is_encrypted,
+ CipherMode mode,
+ const PatternSpec& pattern) {
+ is_encrypted_ = is_encrypted;
+ mode_ = mode;
+ pattern_ = pattern;
+}
+
+bool EncryptionScheme::Matches(const EncryptionScheme& other) const {
+ return is_encrypted_ == other.is_encrypted_ && mode_ == other.mode_ &&
+ pattern_.Matches(other.pattern_);
+}
+
+EncryptionScheme::PatternSpec::PatternSpec()
ddorwin 2015/12/10 18:36:00 nit: Define in the same order as declared. This in
dougsteed 2015/12/14 21:19:01 Done.
+ : encrypt_blocks_(0), skip_blocks_(0) {}
+
+EncryptionScheme::PatternSpec::PatternSpec(uint32_t encrypt_blocks,
+ uint32_t skip_blocks)
+ : encrypt_blocks_(encrypt_blocks), skip_blocks_(skip_blocks) {}
+
+void EncryptionScheme::PatternSpec::Initialize(uint32_t encrypt_blocks,
+ uint32_t skip_blocks) {
+ encrypt_blocks_ = encrypt_blocks;
+ skip_blocks_ = skip_blocks;
+}
+
+bool EncryptionScheme::PatternSpec::Matches(const PatternSpec& other) const {
+ return encrypt_blocks_ == other.encrypt_blocks() &&
+ skip_blocks_ == other.skip_blocks();
+}
+
+} // namespace media

Powered by Google App Engine
This is Rietveld 408576698