summaryrefslogtreecommitdiffstats
path: root/media/base/encryption_scheme.cc
diff options
context:
space:
mode:
Diffstat (limited to 'media/base/encryption_scheme.cc')
-rw-r--r--media/base/encryption_scheme.cc37
1 files changed, 37 insertions, 0 deletions
diff --git a/media/base/encryption_scheme.cc b/media/base/encryption_scheme.cc
new file mode 100644
index 0000000..70d133c
--- /dev/null
+++ b/media/base/encryption_scheme.cc
@@ -0,0 +1,37 @@
+// 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"
+
+namespace media {
+
+EncryptionScheme::Pattern::Pattern() {}
+
+EncryptionScheme::Pattern::Pattern(uint32_t encrypt_blocks,
+ uint32_t skip_blocks)
+ : encrypt_blocks_(encrypt_blocks), skip_blocks_(skip_blocks) {}
+
+EncryptionScheme::Pattern::~Pattern() {}
+
+bool EncryptionScheme::Pattern::Matches(const Pattern& other) const {
+ return encrypt_blocks_ == other.encrypt_blocks() &&
+ skip_blocks_ == other.skip_blocks();
+}
+
+bool EncryptionScheme::Pattern::IsInEffect() const {
+ return encrypt_blocks_ != 0 && skip_blocks_ != 0;
+}
+
+EncryptionScheme::EncryptionScheme() {}
+
+EncryptionScheme::EncryptionScheme(CipherMode mode, const Pattern& pattern)
+ : mode_(mode), pattern_(pattern) {}
+
+EncryptionScheme::~EncryptionScheme() {}
+
+bool EncryptionScheme::Matches(const EncryptionScheme& other) const {
+ return mode_ == other.mode_ && pattern_.Matches(other.pattern_);
+}
+
+} // namespace media