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> |
11 #include <string> | 11 #include <string> |
12 #include <vector> | 12 #include <vector> |
13 | 13 |
14 #include "base/callback.h" | 14 #include "base/callback.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
17 #include "base/sequenced_task_runner_helpers.h" | 17 #include "base/sequenced_task_runner_helpers.h" |
18 #include "base/threading/thread_checker.h" | 18 #include "base/threading/thread_checker.h" |
| 19 #include "chromecast/public/media/cast_key_status.h" |
19 #include "media/base/media_keys.h" | 20 #include "media/base/media_keys.h" |
20 #include "media/base/player_tracker.h" | 21 #include "media/base/player_tracker.h" |
21 #include "media/cdm/json_web_key.h" | 22 #include "media/cdm/json_web_key.h" |
22 | 23 |
23 namespace base { | 24 namespace base { |
24 class SingleThreadTaskRunner; | 25 class SingleThreadTaskRunner; |
25 } | 26 } |
26 | 27 |
27 namespace media { | 28 namespace media { |
28 class PlayerTrackerImpl; | 29 class PlayerTrackerImpl; |
(...skipping 26 matching lines...) Expand all Loading... |
55 int RegisterPlayer(const base::Closure& new_key_cb, | 56 int RegisterPlayer(const base::Closure& new_key_cb, |
56 const base::Closure& cdm_unset_cb) override; | 57 const base::Closure& cdm_unset_cb) override; |
57 void UnregisterPlayer(int registration_id) override; | 58 void UnregisterPlayer(int registration_id) override; |
58 | 59 |
59 // Returns the decryption context needed to decrypt frames encrypted with | 60 // Returns the decryption context needed to decrypt frames encrypted with |
60 // |key_id|. | 61 // |key_id|. |
61 // Returns null if |key_id| is not available. | 62 // Returns null if |key_id| is not available. |
62 virtual scoped_ptr<DecryptContextImpl> GetDecryptContext( | 63 virtual scoped_ptr<DecryptContextImpl> GetDecryptContext( |
63 const std::string& key_id) const = 0; | 64 const std::string& key_id) const = 0; |
64 | 65 |
| 66 // Notifies that key status has changed (e.g. if expiry is detected by |
| 67 // hardware decoder). |
| 68 virtual void SetKeyStatus(const std::string& key_id, |
| 69 CastKeyStatus key_status, |
| 70 uint32_t system_code) = 0; |
| 71 |
65 protected: | 72 protected: |
66 ~BrowserCdmCast() override; | 73 ~BrowserCdmCast() override; |
67 | 74 |
68 void OnSessionMessage(const std::string& session_id, | 75 void OnSessionMessage(const std::string& session_id, |
69 const std::vector<uint8_t>& message, | 76 const std::vector<uint8_t>& message, |
70 const GURL& destination_url, | 77 const GURL& destination_url, |
71 ::media::MediaKeys::MessageType message_type); | 78 ::media::MediaKeys::MessageType message_type); |
72 void OnSessionClosed(const std::string& session_id); | 79 void OnSessionClosed(const std::string& session_id); |
73 void OnSessionKeysChange(const std::string& session_id, | 80 void OnSessionKeysChange(const std::string& session_id, |
74 const ::media::KeyIdAndKeyPairs& keys); | 81 bool newly_usable_keys, |
| 82 ::media::CdmKeysInfo keys_info); |
| 83 |
| 84 void KeyIdAndKeyPairsToInfo(const ::media::KeyIdAndKeyPairs& keys, |
| 85 ::media::CdmKeysInfo* key_info); |
75 | 86 |
76 private: | 87 private: |
77 friend class BrowserCdmCastUi; | 88 friend class BrowserCdmCastUi; |
78 | 89 |
79 // Allow subclasses to override to provide key sysytem specific | 90 // Allow subclasses to override to provide key sysytem specific |
80 // initialization. | 91 // initialization. |
81 virtual void InitializeInternal(); | 92 virtual void InitializeInternal(); |
82 | 93 |
83 ::media::SessionMessageCB session_message_cb_; | 94 ::media::SessionMessageCB session_message_cb_; |
84 ::media::SessionClosedCB session_closed_cb_; | 95 ::media::SessionClosedCB session_closed_cb_; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 | 143 |
133 base::ThreadChecker thread_checker_; | 144 base::ThreadChecker thread_checker_; |
134 | 145 |
135 DISALLOW_COPY_AND_ASSIGN(BrowserCdmCastUi); | 146 DISALLOW_COPY_AND_ASSIGN(BrowserCdmCastUi); |
136 }; | 147 }; |
137 | 148 |
138 } // namespace media | 149 } // namespace media |
139 } // namespace chromecast | 150 } // namespace chromecast |
140 | 151 |
141 #endif // CHROMECAST_MEDIA_CDM_BROWSER_CDM_CAST_H_ | 152 #endif // CHROMECAST_MEDIA_CDM_BROWSER_CDM_CAST_H_ |
OLD | NEW |