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 <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 14 matching lines...) Expand all Loading... |
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 Status { |
36 kSuccess, // Decryption successfully completed. Decrypted buffer ready. | 36 kSuccess, // Decryption successfully completed. Decrypted buffer ready. |
37 kNoKey, // No key is available to decrypt. | 37 kNoKey, // No key is available to decrypt. |
38 kError // Key is available but an error occurred during decryption. | 38 kError // Key is available but an error occurred during decryption. |
39 }; | 39 }; |
40 | 40 |
41 Decryptor() {} | 41 Decryptor() {} |
42 virtual ~Decryptor() {} | 42 virtual ~Decryptor() {} |
43 | 43 |
44 // 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. |
45 virtual void GenerateKeyRequest(const std::string& key_system, | 45 virtual void GenerateKeyRequest(const std::string& key_system, |
(...skipping 20 matching lines...) Expand all Loading... |
66 // must not be NULL. | 66 // must not be NULL. |
67 // | 67 // |
68 // Note that the callback maybe called synchronously or asynchronously. | 68 // Note that the callback maybe called synchronously or asynchronously. |
69 // | 69 // |
70 // If the returned status is kSuccess, the |encrypted| buffer is successfully | 70 // If the returned status is kSuccess, the |encrypted| buffer is successfully |
71 // 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 | 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. | 73 // |encrypted| buffer. In this case the decrypted buffer must be NULL. |
74 // 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 |
75 // case the decrypted buffer must be NULL. | 75 // case the decrypted buffer must be NULL. |
76 typedef base::Callback<void(DecryptStatus, | 76 typedef base::Callback<void(Status, |
77 const scoped_refptr<DecoderBuffer>&)> DecryptCB; | 77 const scoped_refptr<DecoderBuffer>&)> DecryptCB; |
78 virtual void Decrypt(const scoped_refptr<DecoderBuffer>& encrypted, | 78 virtual void Decrypt(const scoped_refptr<DecoderBuffer>& encrypted, |
79 const DecryptCB& decrypt_cb) = 0; | 79 const DecryptCB& decrypt_cb) = 0; |
80 | 80 |
81 // Stops the decryptor and fires any pending DecryptCB immediately with kError | 81 // Stops the decryptor and fires any pending DecryptCB immediately with kError |
82 // and NULL buffer. | 82 // and NULL buffer. |
83 virtual void Stop() = 0; | 83 virtual void Stop() = 0; |
84 | 84 |
85 private: | 85 private: |
86 DISALLOW_COPY_AND_ASSIGN(Decryptor); | 86 DISALLOW_COPY_AND_ASSIGN(Decryptor); |
87 }; | 87 }; |
88 | 88 |
89 } // namespace media | 89 } // namespace media |
90 | 90 |
91 #endif // MEDIA_BASE_DECRYPTOR_H_ | 91 #endif // MEDIA_BASE_DECRYPTOR_H_ |
OLD | NEW |