OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_CDM_CAST_CDM_PROXY_H_ | 5 #ifndef CHROMECAST_MEDIA_CDM_CAST_CDM_PROXY_H_ |
6 #define CHROMECAST_MEDIA_CDM_CAST_CDM_PROXY_H_ | 6 #define CHROMECAST_MEDIA_CDM_CAST_CDM_PROXY_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/threading/thread_checker.h" | 10 #include "base/threading/thread_checker.h" |
11 #include "chromecast/media/cdm/cast_cdm.h" | 11 #include "chromecast/media/cdm/cast_cdm.h" |
jrummell
2016/12/12 22:08:39
nit: Should include content_decryption_module.h si
xhwang
2016/12/12 22:32:50
Done.
| |
12 | 12 |
13 namespace base { | 13 namespace base { |
14 class SingleThreadTaskRunner; | 14 class SingleThreadTaskRunner; |
15 } | 15 } |
16 | 16 |
17 namespace chromecast { | 17 namespace chromecast { |
18 namespace media { | 18 namespace media { |
19 | 19 |
20 // MediaKeys implementation that lives on the UI thread and forwards all calls | 20 // ContentDecryptionModule implementation that lives on the UI thread and |
21 // to a CastCdm instance on the CMA thread. This is used to simplify the | 21 // forwards all calls to a CastCdm instance on the CMA thread. This is used to |
22 // UI-CMA threading interaction. | 22 // simplify the UI-CMA threading interaction. |
23 // TODO(slan): Remove this class when CMA is deprecated. | 23 // TODO(slan): Remove this class when CMA is deprecated. |
24 class CastCdmProxy : public ::media::MediaKeys { | 24 class CastCdmProxy : public ::media::ContentDecryptionModule { |
25 public: | 25 public: |
26 CastCdmProxy(const scoped_refptr<CastCdm>& cast_cdm, | 26 CastCdmProxy(const scoped_refptr<CastCdm>& cast_cdm, |
27 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | 27 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
28 | 28 |
29 // Returns the CDM instance which lives on the CMA thread. | 29 // Returns the CDM instance which lives on the CMA thread. |
30 CastCdm* cast_cdm() const; | 30 CastCdm* cast_cdm() const; |
31 | 31 |
32 private: | 32 private: |
33 ~CastCdmProxy() override; | 33 ~CastCdmProxy() override; |
34 | 34 |
35 // ::media::MediaKeys implementation: | 35 // ::media::ContentDecryptionModule implementation: |
36 void SetServerCertificate( | 36 void SetServerCertificate( |
37 const std::vector<uint8_t>& certificate, | 37 const std::vector<uint8_t>& certificate, |
38 std::unique_ptr<::media::SimpleCdmPromise> promise) override; | 38 std::unique_ptr<::media::SimpleCdmPromise> promise) override; |
39 void CreateSessionAndGenerateRequest( | 39 void CreateSessionAndGenerateRequest( |
40 ::media::MediaKeys::SessionType session_type, | 40 ::media::ContentDecryptionModule::SessionType session_type, |
41 ::media::EmeInitDataType init_data_type, | 41 ::media::EmeInitDataType init_data_type, |
42 const std::vector<uint8_t>& init_data, | 42 const std::vector<uint8_t>& init_data, |
43 std::unique_ptr<::media::NewSessionCdmPromise> promise) override; | 43 std::unique_ptr<::media::NewSessionCdmPromise> promise) override; |
44 void LoadSession( | 44 void LoadSession( |
45 ::media::MediaKeys::SessionType session_type, | 45 ::media::ContentDecryptionModule::SessionType session_type, |
46 const std::string& session_id, | 46 const std::string& session_id, |
47 std::unique_ptr<::media::NewSessionCdmPromise> promise) override; | 47 std::unique_ptr<::media::NewSessionCdmPromise> promise) override; |
48 void UpdateSession( | 48 void UpdateSession( |
49 const std::string& session_id, | 49 const std::string& session_id, |
50 const std::vector<uint8_t>& response, | 50 const std::vector<uint8_t>& response, |
51 std::unique_ptr<::media::SimpleCdmPromise> promise) override; | 51 std::unique_ptr<::media::SimpleCdmPromise> promise) override; |
52 void CloseSession( | 52 void CloseSession( |
53 const std::string& session_id, | 53 const std::string& session_id, |
54 std::unique_ptr<::media::SimpleCdmPromise> promise) override; | 54 std::unique_ptr<::media::SimpleCdmPromise> promise) override; |
55 void RemoveSession( | 55 void RemoveSession( |
56 const std::string& session_id, | 56 const std::string& session_id, |
57 std::unique_ptr<::media::SimpleCdmPromise> promise) override; | 57 std::unique_ptr<::media::SimpleCdmPromise> promise) override; |
58 ::media::CdmContext* GetCdmContext() override; | 58 ::media::CdmContext* GetCdmContext() override; |
59 | 59 |
60 scoped_refptr<CastCdm> cast_cdm_; | 60 scoped_refptr<CastCdm> cast_cdm_; |
61 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 61 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
62 | 62 |
63 base::ThreadChecker thread_checker_; | 63 base::ThreadChecker thread_checker_; |
64 | 64 |
65 DISALLOW_COPY_AND_ASSIGN(CastCdmProxy); | 65 DISALLOW_COPY_AND_ASSIGN(CastCdmProxy); |
66 }; | 66 }; |
67 | 67 |
68 } // namespace media | 68 } // namespace media |
69 } // namespace chromecast | 69 } // namespace chromecast |
70 | 70 |
71 #endif // CHROMECAST_MEDIA_CDM_CAST_CDM_PROXY_H_ | 71 #endif // CHROMECAST_MEDIA_CDM_CAST_CDM_PROXY_H_ |
OLD | NEW |