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_CDM_BROWSER_CDM_CAST_H_ | 5 #ifndef CHROMECAST_MEDIA_CDM_BROWSER_CDM_CAST_H_ |
6 #define CHROMECAST_MEDIA_CDM_BROWSER_CDM_CAST_H_ | 6 #define CHROMECAST_MEDIA_CDM_BROWSER_CDM_CAST_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
54 const ::media::SessionExpirationUpdateCB& session_expiration_update_cb); | 54 const ::media::SessionExpirationUpdateCB& session_expiration_update_cb); |
55 | 55 |
56 // ::media::PlayerTracker implementation. | 56 // ::media::PlayerTracker implementation. |
57 int RegisterPlayer(const base::Closure& new_key_cb, | 57 int RegisterPlayer(const base::Closure& new_key_cb, |
58 const base::Closure& cdm_unset_cb) override; | 58 const base::Closure& cdm_unset_cb) override; |
59 void UnregisterPlayer(int registration_id) override; | 59 void UnregisterPlayer(int registration_id) override; |
60 | 60 |
61 // Returns the decryption context needed to decrypt frames encrypted with | 61 // Returns the decryption context needed to decrypt frames encrypted with |
62 // |key_id|. | 62 // |key_id|. |
63 // Returns null if |key_id| is not available. | 63 // Returns null if |key_id| is not available. |
64 virtual scoped_ptr<DecryptContextImpl> GetDecryptContext( | 64 virtual std::unique_ptr<DecryptContextImpl> GetDecryptContext( |
65 const std::string& key_id) const = 0; | 65 const std::string& key_id) const = 0; |
66 | 66 |
67 // Notifies that key status has changed (e.g. if expiry is detected by | 67 // Notifies that key status has changed (e.g. if expiry is detected by |
68 // hardware decoder). | 68 // hardware decoder). |
69 virtual void SetKeyStatus(const std::string& key_id, | 69 virtual void SetKeyStatus(const std::string& key_id, |
70 CastKeyStatus key_status, | 70 CastKeyStatus key_status, |
71 uint32_t system_code) = 0; | 71 uint32_t system_code) = 0; |
72 | 72 |
73 protected: | 73 protected: |
74 ~BrowserCdmCast() override; | 74 ~BrowserCdmCast() override; |
(...skipping 17 matching lines...) Expand all Loading... |
92 // initialization. | 92 // initialization. |
93 virtual void InitializeInternal(); | 93 virtual void InitializeInternal(); |
94 | 94 |
95 ::media::SessionMessageCB session_message_cb_; | 95 ::media::SessionMessageCB session_message_cb_; |
96 ::media::SessionClosedCB session_closed_cb_; | 96 ::media::SessionClosedCB session_closed_cb_; |
97 ::media::LegacySessionErrorCB legacy_session_error_cb_; | 97 ::media::LegacySessionErrorCB legacy_session_error_cb_; |
98 ::media::SessionKeysChangeCB session_keys_change_cb_; | 98 ::media::SessionKeysChangeCB session_keys_change_cb_; |
99 ::media::SessionExpirationUpdateCB session_expiration_update_cb_; | 99 ::media::SessionExpirationUpdateCB session_expiration_update_cb_; |
100 | 100 |
101 MediaResourceTracker* media_resource_tracker_; | 101 MediaResourceTracker* media_resource_tracker_; |
102 scoped_ptr<::media::PlayerTrackerImpl> player_tracker_impl_; | 102 std::unique_ptr<::media::PlayerTrackerImpl> player_tracker_impl_; |
103 | 103 |
104 base::ThreadChecker thread_checker_; | 104 base::ThreadChecker thread_checker_; |
105 | 105 |
106 DISALLOW_COPY_AND_ASSIGN(BrowserCdmCast); | 106 DISALLOW_COPY_AND_ASSIGN(BrowserCdmCast); |
107 }; | 107 }; |
108 | 108 |
109 // MediaKeys implementation that lives on the UI thread and forwards all calls | 109 // MediaKeys implementation that lives on the UI thread and forwards all calls |
110 // to a BrowserCdmCast instance on the CMA thread. This is used to simplify the | 110 // to a BrowserCdmCast instance on the CMA thread. This is used to simplify the |
111 // UI-CMA threading interaction. | 111 // UI-CMA threading interaction. |
112 class BrowserCdmCastUi : public ::media::MediaKeys { | 112 class BrowserCdmCastUi : public ::media::MediaKeys { |
113 public: | 113 public: |
114 BrowserCdmCastUi( | 114 BrowserCdmCastUi( |
115 const scoped_refptr<BrowserCdmCast>& browser_cdm_cast, | 115 const scoped_refptr<BrowserCdmCast>& browser_cdm_cast, |
116 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | 116 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
117 | 117 |
118 BrowserCdmCast* browser_cdm_cast() const; | 118 BrowserCdmCast* browser_cdm_cast() const; |
119 | 119 |
120 private: | 120 private: |
121 ~BrowserCdmCastUi() override; | 121 ~BrowserCdmCastUi() override; |
122 | 122 |
123 // ::media::MediaKeys implementation: | 123 // ::media::MediaKeys implementation: |
124 void SetServerCertificate( | 124 void SetServerCertificate( |
125 const std::vector<uint8_t>& certificate, | 125 const std::vector<uint8_t>& certificate, |
126 scoped_ptr<::media::SimpleCdmPromise> promise) override; | 126 std::unique_ptr<::media::SimpleCdmPromise> promise) override; |
127 void CreateSessionAndGenerateRequest( | 127 void CreateSessionAndGenerateRequest( |
128 ::media::MediaKeys::SessionType session_type, | 128 ::media::MediaKeys::SessionType session_type, |
129 ::media::EmeInitDataType init_data_type, | 129 ::media::EmeInitDataType init_data_type, |
130 const std::vector<uint8_t>& init_data, | 130 const std::vector<uint8_t>& init_data, |
131 scoped_ptr<::media::NewSessionCdmPromise> promise) override; | 131 std::unique_ptr<::media::NewSessionCdmPromise> promise) override; |
132 void LoadSession(::media::MediaKeys::SessionType session_type, | 132 void LoadSession( |
133 const std::string& session_id, | 133 ::media::MediaKeys::SessionType session_type, |
134 scoped_ptr<::media::NewSessionCdmPromise> promise) override; | 134 const std::string& session_id, |
135 void UpdateSession(const std::string& session_id, | 135 std::unique_ptr<::media::NewSessionCdmPromise> promise) override; |
136 const std::vector<uint8_t>& response, | 136 void UpdateSession( |
137 scoped_ptr<::media::SimpleCdmPromise> promise) override; | 137 const std::string& session_id, |
138 void CloseSession(const std::string& session_id, | 138 const std::vector<uint8_t>& response, |
139 scoped_ptr<::media::SimpleCdmPromise> promise) override; | 139 std::unique_ptr<::media::SimpleCdmPromise> promise) override; |
140 void RemoveSession(const std::string& session_id, | 140 void CloseSession( |
141 scoped_ptr<::media::SimpleCdmPromise> promise) override; | 141 const std::string& session_id, |
| 142 std::unique_ptr<::media::SimpleCdmPromise> promise) override; |
| 143 void RemoveSession( |
| 144 const std::string& session_id, |
| 145 std::unique_ptr<::media::SimpleCdmPromise> promise) override; |
142 | 146 |
143 scoped_refptr<BrowserCdmCast> browser_cdm_cast_; | 147 scoped_refptr<BrowserCdmCast> browser_cdm_cast_; |
144 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 148 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
145 | 149 |
146 base::ThreadChecker thread_checker_; | 150 base::ThreadChecker thread_checker_; |
147 | 151 |
148 DISALLOW_COPY_AND_ASSIGN(BrowserCdmCastUi); | 152 DISALLOW_COPY_AND_ASSIGN(BrowserCdmCastUi); |
149 }; | 153 }; |
150 | 154 |
151 } // namespace media | 155 } // namespace media |
152 } // namespace chromecast | 156 } // namespace chromecast |
153 | 157 |
154 #endif // CHROMECAST_MEDIA_CDM_BROWSER_CDM_CAST_H_ | 158 #endif // CHROMECAST_MEDIA_CDM_BROWSER_CDM_CAST_H_ |
OLD | NEW |