| 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 16 matching lines...) Expand all Loading... |
| 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 Loading... |
| 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 |
| 78 private: | 81 private: |
| 79 DISALLOW_COPY_AND_ASSIGN(Decryptor); | 82 DISALLOW_COPY_AND_ASSIGN(Decryptor); |
| 80 }; | 83 }; |
| 81 | 84 |
| 82 } // namespace media | 85 } // namespace media |
| 83 | 86 |
| 84 #endif // MEDIA_BASE_DECRYPTOR_H_ | 87 #endif // MEDIA_BASE_DECRYPTOR_H_ |
| OLD | NEW |