OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 CHROMECAST_PUBLIC_MEDIA_DECRYPT_CONTEXT_H_ | 5 #ifndef CHROMECAST_PUBLIC_MEDIA_DECRYPT_CONTEXT_H_ |
6 #define CHROMECAST_PUBLIC_MEDIA_DECRYPT_CONTEXT_H_ | 6 #define CHROMECAST_PUBLIC_MEDIA_DECRYPT_CONTEXT_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "cast_key_system.h" | 11 #include "cast_key_system.h" |
12 | 12 |
13 namespace chromecast { | 13 namespace chromecast { |
14 namespace media { | 14 namespace media { |
15 class CastDecoderBuffer; | 15 class CastDecoderBuffer; |
16 | 16 |
17 // Provides the information needed to decrypt frames. | 17 // Provides the information needed to decrypt frames. |
18 class DecryptContext { | 18 class DecryptContext { |
19 public: | 19 public: |
20 virtual ~DecryptContext() {} | 20 virtual ~DecryptContext() {} |
21 | 21 |
22 // Get the key system to use for decryption. | 22 // Get the key system to use for decryption. |
23 virtual CastKeySystem GetKeySystem() = 0; | 23 virtual CastKeySystem GetKeySystem() = 0; |
24 | 24 |
25 // Decrypts the given buffer. Returns true/false for success/failure, | 25 // Decrypts the given buffer. Returns true/false for success/failure. |
26 // and places the decrypted data in output if successful. | 26 // |
| 27 // The decrypted data will be of size |buffer.data_size()| and there must be |
| 28 // enough space in |output| to store that data. |
| 29 // |
| 30 // If non-zero, |data_offset| specifies an offset to be applied to |output| |
| 31 // before the decrypted data is written. |
27 virtual bool Decrypt(CastDecoderBuffer* buffer, | 32 virtual bool Decrypt(CastDecoderBuffer* buffer, |
28 std::vector<uint8_t>* output) = 0; | 33 uint8_t* output, |
| 34 size_t data_offset) = 0; |
29 }; | 35 }; |
30 | 36 |
31 } // namespace media | 37 } // namespace media |
32 } // namespace chromecast | 38 } // namespace chromecast |
33 | 39 |
34 #endif // CHROMECAST_PUBLIC_MEDIA_DECRYPT_CONTEXT_H_ | 40 #endif // CHROMECAST_PUBLIC_MEDIA_DECRYPT_CONTEXT_H_ |
OLD | NEW |