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

Unified Diff: media/base/decryptor.h

Issue 10539150: Add Decryptor interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase 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
« no previous file with comments | « no previous file | media/base/decryptor_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/decryptor.h
diff --git a/media/base/decryptor.h b/media/base/decryptor.h
new file mode 100644
index 0000000000000000000000000000000000000000..924f3ac111482bff72c4202de5070692daeea95e
--- /dev/null
+++ b/media/base/decryptor.h
@@ -0,0 +1,69 @@
+// 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.
+
+#ifndef MEDIA_BASE_DECRYPTOR_H_
+#define MEDIA_BASE_DECRYPTOR_H_
+
+#include <string>
+
+#include "base/basictypes.h"
+#include "base/memory/ref_counted.h"
+#include "media/base/media_export.h"
+
+namespace media {
+
+class DecoderBuffer;
+
+// Performs key operations and decrypts encrypted buffer.
+// All public methods other than Decrypt() will be called on the renderer
+// thread. Therefore, these calls should be fast and nonblocking, with key
+// events fired asynchronously. Decrypt() will be called on the (video/audio)
+// decoder thread synchronously.
+class MEDIA_EXPORT Decryptor {
+ public:
+ enum KeyError {
+ kUnknownError = 1,
+ kClientError,
+ kServiceError,
+ kOutputError,
+ kHardwareChangeError,
+ kDomainError
+ };
+
+ Decryptor() {}
+ virtual ~Decryptor() {}
+
+ // Generates a key request for the |key_system| with |init_data| provided.
+ virtual void GenerateKeyRequest(const std::string& key_system,
+ const uint8* init_data,
+ int init_data_length) = 0;
+
+ // Adds a |key| to the |key_system|. The |key| is not limited to a decryption
+ // key. It can be any data that the key system accepts, such as a license.
+ // If multiple calls of this function set different keys for the same
+ // key ID, the older key will be replaced by the newer key.
+ virtual void AddKey(const std::string& key_system,
+ const uint8* key,
+ int key_length,
+ const uint8* init_data,
+ int init_data_length,
+ const std::string& session_id) = 0;
+
+ // Cancels the key request specified by |session_id|.
+ virtual void CancelKeyRequest(const std::string& key_system,
+ const std::string& session_id) = 0;
+
+ // Decrypts the |input| buffer, which should not be NULL.
+ // Returns a DecoderBuffer with the decrypted data if decryption succeeded.
+ // Returns NULL if decryption failed.
+ virtual scoped_refptr<DecoderBuffer> Decrypt(
+ const scoped_refptr<DecoderBuffer>& input) = 0;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Decryptor);
+};
+
+} // namespace media
+
+#endif // MEDIA_BASE_DECRYPTOR_H_
« no previous file with comments | « no previous file | media/base/decryptor_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698