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 24 matching lines...) Expand all Loading... |
35 enum Status { | 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 // Returns true if generating key request succeeded, false otherwise. |
| 46 // Note: AddKey() and CancelKeyRequest() should only be called after |
| 47 // GenerateKeyRequest() returns true. |
| 48 virtual bool GenerateKeyRequest(const std::string& key_system, |
46 const uint8* init_data, | 49 const uint8* init_data, |
47 int init_data_length) = 0; | 50 int init_data_length) = 0; |
48 | 51 |
49 // Adds a |key| to the |key_system|. The |key| is not limited to a decryption | 52 // Adds a |key| to the |key_system|. The |key| is not limited to a decryption |
50 // key. It can be any data that the key system accepts, such as a license. | 53 // key. It can be any data that the key system accepts, such as a license. |
51 // If multiple calls of this function set different keys for the same | 54 // If multiple calls of this function set different keys for the same |
52 // key ID, the older key will be replaced by the newer key. | 55 // key ID, the older key will be replaced by the newer key. |
53 virtual void AddKey(const std::string& key_system, | 56 virtual void AddKey(const std::string& key_system, |
54 const uint8* key, | 57 const uint8* key, |
55 int key_length, | 58 int key_length, |
(...skipping 26 matching lines...) Expand all Loading... |
82 // and NULL buffer. | 85 // and NULL buffer. |
83 virtual void Stop() = 0; | 86 virtual void Stop() = 0; |
84 | 87 |
85 private: | 88 private: |
86 DISALLOW_COPY_AND_ASSIGN(Decryptor); | 89 DISALLOW_COPY_AND_ASSIGN(Decryptor); |
87 }; | 90 }; |
88 | 91 |
89 } // namespace media | 92 } // namespace media |
90 | 93 |
91 #endif // MEDIA_BASE_DECRYPTOR_H_ | 94 #endif // MEDIA_BASE_DECRYPTOR_H_ |
OLD | NEW |