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" |
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 }; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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(DecryptStatus, |
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. | |
scherkus (not reviewing)
2012/08/02 18:05:32
fires the cb with what result?
xhwang
2012/08/03 20:08:10
Done.
| |
82 virtual void Stop() = 0; | |
83 | |
81 private: | 84 private: |
82 DISALLOW_COPY_AND_ASSIGN(Decryptor); | 85 DISALLOW_COPY_AND_ASSIGN(Decryptor); |
83 }; | 86 }; |
84 | 87 |
85 } // namespace media | 88 } // namespace media |
86 | 89 |
87 #endif // MEDIA_BASE_DECRYPTOR_H_ | 90 #endif // MEDIA_BASE_DECRYPTOR_H_ |
OLD | NEW |