Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef MEDIA_BASE_DECRYPTOR_H_ | 5 #ifndef MEDIA_BASE_DECRYPTOR_H_ |
| 6 #define MEDIA_BASE_DECRYPTOR_H_ | 6 #define MEDIA_BASE_DECRYPTOR_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 83 const uint8* key, | 83 const uint8* key, |
| 84 int key_length, | 84 int key_length, |
| 85 const uint8* init_data, | 85 const uint8* init_data, |
| 86 int init_data_length, | 86 int init_data_length, |
| 87 const std::string& session_id) = 0; | 87 const std::string& session_id) = 0; |
| 88 | 88 |
| 89 // Cancels the key request specified by |session_id|. | 89 // Cancels the key request specified by |session_id|. |
| 90 virtual void CancelKeyRequest(const std::string& key_system, | 90 virtual void CancelKeyRequest(const std::string& key_system, |
| 91 const std::string& session_id) = 0; | 91 const std::string& session_id) = 0; |
| 92 | 92 |
| 93 // Indicates that a key has been added to the Decryptor. | 93 // Indicates that a new key has been added to the Decryptor. |
|
ddorwin
2012/12/21 04:19:06
Is it really "new"? It could be called when we get
xhwang
2012/12/21 05:50:07
I added "new" here only to make is consistent with
| |
| 94 typedef base::Callback<void()> KeyAddedCB; | 94 typedef base::Callback<void()> NewKeyCB; |
|
ddorwin
2012/12/21 04:19:06
Should CB's have verb names? (I realize the ones f
xhwang
2012/12/21 05:50:07
At least this is not a rule in media code. We hace
| |
| 95 | 95 |
| 96 // Registers a KeyAddedCB which should be called when a key is added to the | 96 // Registers a NewKeyCB which should be called when a new key is added to the |
| 97 // decryptor. Only one KeyAddedCB can be registered for one |stream_type|. | 97 // decryptor. Only one NewKeyCB can be registered for one |stream_type|. |
| 98 // If this function is called multiple times for the same |stream_type|, the | 98 // If this function is called multiple times for the same |stream_type|, the |
| 99 // previously registered callback will be replaced. In other words, | 99 // previously registered callback will be replaced. In other words, |
| 100 // registering a null callback cancels the originally registered callback. | 100 // registering a null callback cancels the originally registered callback. |
| 101 virtual void RegisterKeyAddedCB(StreamType stream_type, | 101 virtual void RegisterNewKeyCB(StreamType stream_type, |
| 102 const KeyAddedCB& key_added_cb) = 0; | 102 const NewKeyCB& key_added_cb) = 0; |
| 103 | 103 |
| 104 // Indicates completion of a decryption operation. | 104 // Indicates completion of a decryption operation. |
| 105 // | 105 // |
| 106 // First parameter: The status of the decryption operation. | 106 // First parameter: The status of the decryption operation. |
| 107 // - Set to kSuccess if the encrypted buffer is successfully decrypted and | 107 // - Set to kSuccess if the encrypted buffer is successfully decrypted and |
| 108 // the decrypted buffer is ready to be read. | 108 // the decrypted buffer is ready to be read. |
| 109 // - Set to kNoKey if no decryption key is available to decrypt the encrypted | 109 // - Set to kNoKey if no decryption key is available to decrypt the encrypted |
| 110 // buffer. In this case the decrypted buffer must be NULL. | 110 // buffer. In this case the decrypted buffer must be NULL. |
| 111 // - Set to kError if unexpected error has occurred. In this case the | 111 // - Set to kError if unexpected error has occurred. In this case the |
| 112 // decrypted buffer must be NULL. | 112 // decrypted buffer must be NULL. |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 209 | 209 |
| 210 // Callback to set/cancel a DecryptorReadyCB. | 210 // Callback to set/cancel a DecryptorReadyCB. |
| 211 // Calling this callback with a non-null callback registers decryptor ready | 211 // Calling this callback with a non-null callback registers decryptor ready |
| 212 // notification. When the decryptor is ready, notification will be sent | 212 // notification. When the decryptor is ready, notification will be sent |
| 213 // through the provided callback. | 213 // through the provided callback. |
| 214 // Calling this callback with a null callback cancels previously registered | 214 // Calling this callback with a null callback cancels previously registered |
| 215 // decryptor ready notification. Any previously provided callback will be | 215 // decryptor ready notification. Any previously provided callback will be |
| 216 // fired immediately with NULL. | 216 // fired immediately with NULL. |
| 217 typedef base::Callback<void(const DecryptorReadyCB&)> SetDecryptorReadyCB; | 217 typedef base::Callback<void(const DecryptorReadyCB&)> SetDecryptorReadyCB; |
| 218 | 218 |
| 219 | |
| 220 // Key event callbacks. See the spec for details: | |
| 221 // http://dvcs.w3.org/hg/html-media/raw-file/tip/encrypted-media/encrypted-media .html#event-summary | |
|
ddorwin
2012/12/21 04:19:06
s/tip/eme-v0.1b/. These don't exist (in the same f
xhwang
2012/12/21 05:50:07
Done.
| |
| 222 typedef base::Callback<void(const std::string& key_system, | |
| 223 const std::string& session_id)> KeyAddedCB; | |
| 224 | |
| 225 typedef base::Callback<void(const std::string& key_system, | |
| 226 const std::string& session_id, | |
| 227 media::Decryptor::KeyError error_code, | |
| 228 int system_code)> KeyErrorCB; | |
| 229 | |
| 230 typedef base::Callback<void(const std::string& key_system, | |
| 231 const std::string& session_id, | |
| 232 const std::string& message, | |
| 233 const std::string& default_url)> KeyMessageCB; | |
| 234 | |
| 235 typedef base::Callback<void(const std::string& key_system, | |
| 236 const std::string& session_id, | |
| 237 const std::string& type, | |
| 238 scoped_array<uint8> init_data, | |
|
ddorwin
2012/12/21 04:19:06
Odd that message is a string but init_data isn't.
xhwang
2012/12/21 05:50:07
Agreed. I talked to dmichael the other day. We all
| |
| 239 int init_data_size)> NeedKeyCB; | |
| 240 | |
| 219 } // namespace media | 241 } // namespace media |
| 220 | 242 |
| 221 #endif // MEDIA_BASE_DECRYPTOR_H_ | 243 #endif // MEDIA_BASE_DECRYPTOR_H_ |
| OLD | NEW |