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

Side by Side Diff: media/base/decryptor.h

Issue 11226019: Encrypted Media: Replace DecryptorClient with key event callbacks. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: resolve ddorwin's comments Created 8 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 unified diff | Download patch
« no previous file with comments | « no previous file | media/base/decryptor_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.
94 typedef base::Callback<void()> KeyAddedCB; 94 typedef base::Callback<void()> NewKeyCB;
ddorwin 2012/12/21 20:05:30 I think it's not a new key. :) My question really
xhwang 2012/12/22 00:46:34 I agree this name needs to be improved. But I don'
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
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/eme-v0.1b/encrypted-media/encrypted -media.html#event-summary
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,
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_
OLDNEW
« 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