OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_MEDIA_BASE_DECRYPT_CONTEXT_H_ | 5 #ifndef CHROMECAST_MEDIA_BASE_DECRYPT_CONTEXT_IMPL_H_ |
6 #define CHROMECAST_MEDIA_BASE_DECRYPT_CONTEXT_H_ | 6 #define CHROMECAST_MEDIA_BASE_DECRYPT_CONTEXT_IMPL_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "chromecast/media/base/key_systems_common.h" | 10 #include "chromecast/media/base/key_systems_common.h" |
| 11 #include "chromecast/public/media/decrypt_context.h" |
11 | 12 |
12 namespace crypto { | 13 namespace crypto { |
13 class SymmetricKey; | 14 class SymmetricKey; |
14 } | 15 } |
15 | 16 |
16 namespace chromecast { | 17 namespace chromecast { |
17 namespace media { | 18 namespace media { |
18 | 19 |
19 // Base class of a decryption context: a decryption context gathers all the | 20 // Base class of a decryption context: a decryption context gathers all the |
20 // information needed to decrypt frames with a given key id. | 21 // information needed to decrypt frames with a given key id. |
21 // Each CDM should implement this and add fields needed to fully describe a | 22 // Each CDM should implement this and add fields needed to fully describe a |
22 // decryption context. | 23 // decryption context. |
23 // | 24 // |
24 class DecryptContext : public base::RefCountedThreadSafe<DecryptContext> { | 25 class DecryptContextImpl : public DecryptContext { |
25 public: | 26 public: |
26 explicit DecryptContext(CastKeySystem key_system); | 27 explicit DecryptContextImpl(CastKeySystem key_system); |
| 28 ~DecryptContextImpl() override; |
27 | 29 |
28 CastKeySystem key_system() const { return key_system_; } | 30 // DecryptContext implementation: |
| 31 CastKeySystem GetKeySystem() override; |
| 32 bool Decrypt(CastDecoderBuffer* buffer, |
| 33 std::vector<uint8_t>* output) override; |
29 | 34 |
30 // Returns the clear key if available, NULL otherwise. | 35 // Returns the clear key if available, NULL otherwise. |
31 virtual crypto::SymmetricKey* GetKey() const; | 36 virtual crypto::SymmetricKey* GetKey() const; |
32 | 37 |
33 protected: | |
34 friend class base::RefCountedThreadSafe<DecryptContext>; | |
35 virtual ~DecryptContext(); | |
36 | |
37 private: | 38 private: |
38 CastKeySystem key_system_; | 39 CastKeySystem key_system_; |
39 | 40 |
40 DISALLOW_COPY_AND_ASSIGN(DecryptContext); | 41 DISALLOW_COPY_AND_ASSIGN(DecryptContextImpl); |
41 }; | 42 }; |
42 | 43 |
43 } // namespace media | 44 } // namespace media |
44 } // namespace chromecast | 45 } // namespace chromecast |
45 | 46 |
46 #endif // CHROMECAST_MEDIA_BASE_DECRYPT_CONTEXT_H_ | 47 #endif // CHROMECAST_MEDIA_BASE_DECRYPT_CONTEXT_IMPL_H_ |
OLD | NEW |