summaryrefslogtreecommitdiffstats
path: root/media/base/decryptor.h
diff options
context:
space:
mode:
authorxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-02 23:04:03 +0000
committerxhwang@chromium.org <xhwang@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-02 23:04:03 +0000
commit82d7abd7b2726db828134466e4bd98910246d41f (patch)
tree4a16ab1817df9f1ba4e758c303ddef271fa7d27e /media/base/decryptor.h
parenta45d8566cf820425ce3c95d3b5d21950767f3b0e (diff)
downloadchromium_src-82d7abd7b2726db828134466e4bd98910246d41f.zip
chromium_src-82d7abd7b2726db828134466e4bd98910246d41f.tar.gz
chromium_src-82d7abd7b2726db828134466e4bd98910246d41f.tar.bz2
Add RegisterKeyAddedCB in Decryptor interface.
Previously KeyAddedCB is registered with InitializeXXXDecoder calls. Generalize this to a separate RegisterKeyAddedCB call so that we can also support the decrypt-only path. BUG=123421 TEST=media_unittests passes. EME demo page still works. Review URL: https://chromiumcodereview.appspot.com/11348056 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@165792 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/decryptor.h')
-rw-r--r--media/base/decryptor.h21
1 files changed, 13 insertions, 8 deletions
diff --git a/media/base/decryptor.h b/media/base/decryptor.h
index de293e9..2efd03b 100644
--- a/media/base/decryptor.h
+++ b/media/base/decryptor.h
@@ -89,6 +89,17 @@ class MEDIA_EXPORT Decryptor {
virtual void CancelKeyRequest(const std::string& key_system,
const std::string& session_id) = 0;
+ // Indicates that a key has been added to the Decryptor.
+ typedef base::Callback<void()> KeyAddedCB;
+
+ // Registers a KeyAddedCB which should be called when a key is added to the
+ // decryptor. Only one KeyAddedCB can be registered for one |stream_type|.
+ // If this function is called multiple times for the same |stream_type|, the
+ // previously registered callback will be replaced. In other words,
+ // registering a null callback cancels the originally registered callback.
+ virtual void RegisterKeyAddedCB(StreamType stream_type,
+ const KeyAddedCB& key_added_cb) = 0;
+
// Indicates completion of a decryption operation.
//
// First parameter: The status of the decryption operation.
@@ -125,18 +136,12 @@ class MEDIA_EXPORT Decryptor {
// - Set to true if initialization was successful. False if an error occurred.
typedef base::Callback<void(bool)> DecoderInitCB;
- // Indicates that a key has been added to the Decryptor.
- typedef base::Callback<void()> KeyAddedCB;
-
// Initializes a decoder with the given |config|, executing the |init_cb|
// upon completion.
- // |key_added_cb| should be called when a key is added to the decryptor.
virtual void InitializeAudioDecoder(scoped_ptr<AudioDecoderConfig> config,
- const DecoderInitCB& init_cb,
- const KeyAddedCB& key_added_cb) = 0;
+ const DecoderInitCB& init_cb) = 0;
virtual void InitializeVideoDecoder(scoped_ptr<VideoDecoderConfig> config,
- const DecoderInitCB& init_cb,
- const KeyAddedCB& key_added_cb) = 0;
+ const DecoderInitCB& init_cb) = 0;
// Helper structure for managing multiple decoded audio buffers per input.
// TODO(xhwang): Rename this to AudioFrames.