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