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

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

Issue 10822026: Implement "Key Presence" step in "Encrypted Block Encounted" algorithm in EME. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/content_tests.gypi ('k') | media/base/mock_filters.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 <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "media/base/media_export.h" 13 #include "media/base/media_export.h"
14 14
15 namespace media { 15 namespace media {
16 16
17 class DecoderBuffer; 17 class DecoderBuffer;
18 18
19 // Performs key operations and decrypts encrypted buffer. 19 // Performs key operations and decrypts encrypted buffer.
20 // All public methods other than Decrypt() will be called on the renderer 20 // All public methods other than Decrypt() will be called on the renderer
21 // thread. Therefore, these calls should be fast and nonblocking, with key 21 // thread. Therefore, these calls should be fast and nonblocking, with key
22 // events fired asynchronously. Decrypt() will be called on the (video/audio) 22 // events fired asynchronously. Decrypt() will be called on the (video/audio)
23 // decoder thread synchronously. 23 // decoder thread.
24 class MEDIA_EXPORT Decryptor { 24 class MEDIA_EXPORT Decryptor {
25 public: 25 public:
26 enum KeyError { 26 enum KeyError {
27 kUnknownError = 1, 27 kUnknownError = 1,
28 kClientError, 28 kClientError,
29 kServiceError, 29 kServiceError,
30 kOutputError, 30 kOutputError,
31 kHardwareChangeError, 31 kHardwareChangeError,
32 kDomainError 32 kDomainError
33 }; 33 };
34 34
35 enum DecryptStatus { 35 enum DecryptStatus {
36 kSuccess, // Decryption successfully completed. Decrypted buffer ready. 36 kSuccess, // Decryption successfully completed. Decrypted buffer ready.
37 kError // Error occurred during decryption. 37 kNoKey, // No key is available to decrypt.
38 kError // Key is available but an error occurred during decryption.
38 }; 39 };
39 40
40 Decryptor() {} 41 Decryptor() {}
41 virtual ~Decryptor() {} 42 virtual ~Decryptor() {}
42 43
43 // Generates a key request for the |key_system| with |init_data| provided. 44 // Generates a key request for the |key_system| with |init_data| provided.
44 virtual void GenerateKeyRequest(const std::string& key_system, 45 virtual void GenerateKeyRequest(const std::string& key_system,
45 const uint8* init_data, 46 const uint8* init_data,
46 int init_data_length) = 0; 47 int init_data_length) = 0;
47 48
(...skipping 13 matching lines...) Expand all
61 const std::string& session_id) = 0; 62 const std::string& session_id) = 0;
62 63
63 // Decrypts the |encrypted| buffer. The decrypt status and decrypted buffer 64 // Decrypts the |encrypted| buffer. The decrypt status and decrypted buffer
64 // are returned via the provided callback |decrypt_cb|. The |encrypted| buffer 65 // are returned via the provided callback |decrypt_cb|. The |encrypted| buffer
65 // must not be NULL. 66 // must not be NULL.
66 // 67 //
67 // Note that the callback maybe called synchronously or asynchronously. 68 // Note that the callback maybe called synchronously or asynchronously.
68 // 69 //
69 // If the returned status is kSuccess, the |encrypted| buffer is successfully 70 // If the returned status is kSuccess, the |encrypted| buffer is successfully
70 // decrypted and the decrypted buffer is ready to be read. 71 // decrypted and the decrypted buffer is ready to be read.
72 // If the returned status is kNoKey, no decryption key is available to decrypt
73 // |encrypted| buffer. In this case the decrypted buffer must be NULL.
71 // If the returned status is kError, unexpected error has occurred. In this 74 // If the returned status is kError, unexpected error has occurred. In this
72 // case the decrypted buffer must be NULL. 75 // case the decrypted buffer must be NULL.
73 typedef base::Callback<void(DecryptStatus, 76 typedef base::Callback<void(DecryptStatus,
74 const scoped_refptr<DecoderBuffer>&)> DecryptCB; 77 const scoped_refptr<DecoderBuffer>&)> DecryptCB;
75 virtual void Decrypt(const scoped_refptr<DecoderBuffer>& encrypted, 78 virtual void Decrypt(const scoped_refptr<DecoderBuffer>& encrypted,
76 const DecryptCB& decrypt_cb) = 0; 79 const DecryptCB& decrypt_cb) = 0;
77 80
81 // Stops the decryptor and fires any pending DecryptCB immediately with kError
82 // and NULL buffer.
83 virtual void Stop() = 0;
84
78 private: 85 private:
79 DISALLOW_COPY_AND_ASSIGN(Decryptor); 86 DISALLOW_COPY_AND_ASSIGN(Decryptor);
80 }; 87 };
81 88
82 } // namespace media 89 } // namespace media
83 90
84 #endif // MEDIA_BASE_DECRYPTOR_H_ 91 #endif // MEDIA_BASE_DECRYPTOR_H_
OLDNEW
« no previous file with comments | « content/content_tests.gypi ('k') | media/base/mock_filters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698