OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef MEDIA_REMOTING_REMOTING_CDM_H_ | |
6 #define MEDIA_REMOTING_REMOTING_CDM_H_ | |
7 | |
8 #include "media/base/cdm_context.h" | |
9 #include "media/base/cdm_factory.h" | |
10 #include "media/base/media_keys.h" | |
11 #include "media/remoting/remoting_controller.h" | |
12 | |
13 namespace media { | |
14 | |
15 struct CdmConfig; | |
16 | |
17 // TODO(xjz): Merge the implementation with Eric's change. | |
18 class RemotingCdm : public MediaKeys, public CdmContext { | |
19 public: | |
20 static void Create( | |
21 const std::string& key_system, | |
22 const GURL& security_origin, | |
23 const CdmConfig& cdm_config, | |
24 const SessionMessageCB& session_message_cb, | |
25 const SessionClosedCB& session_closed_cb, | |
26 const SessionKeysChangeCB& session_keys_change_cb, | |
27 const SessionExpirationUpdateCB& session_expiration_update_cb, | |
28 const CdmCreatedCB& cdm_created_cb, | |
29 std::unique_ptr<RemotingController> remoting_controller); | |
30 | |
31 // If |cdm| is an instance of RemotingCdm, return a type-casted pointer to it. | |
32 // Otherwise, return nullptr. | |
33 static RemotingCdm* From(CdmContext* cdm); | |
34 | |
35 // Pass the ownership of |remoting_controller_| to the caller. | |
36 std::unique_ptr<RemotingController> remoting_controller() { | |
miu
2016/10/08 01:06:16
naming: This isn't an accessor method. So, I'd sug
xjz
2016/10/20 21:25:27
Not applicable.
| |
37 return std::move(remoting_controller_); | |
38 } | |
39 | |
40 // MediaKeys implementations. | |
41 void SetServerCertificate(const std::vector<uint8_t>& certificate, | |
42 std::unique_ptr<SimpleCdmPromise> promise) override; | |
43 void CreateSessionAndGenerateRequest( | |
44 SessionType session_type, | |
45 EmeInitDataType init_data_type, | |
46 const std::vector<uint8_t>& init_data, | |
47 std::unique_ptr<NewSessionCdmPromise> promise) override; | |
48 void LoadSession(SessionType session_type, | |
49 const std::string& session_id, | |
50 std::unique_ptr<NewSessionCdmPromise> promise) override; | |
51 void UpdateSession(const std::string& session_id, | |
52 const std::vector<uint8_t>& response, | |
53 std::unique_ptr<SimpleCdmPromise> promise) override; | |
54 void CloseSession(const std::string& session_id, | |
55 std::unique_ptr<SimpleCdmPromise> promise) override; | |
56 void RemoveSession(const std::string& session_id, | |
57 std::unique_ptr<SimpleCdmPromise> promise) override; | |
58 CdmContext* GetCdmContext() override; | |
59 | |
60 // CdmContext implementations. | |
61 Decryptor* GetDecryptor() override; | |
62 int GetCdmId() const override; | |
63 void* GetClassIdentifier() const override; | |
64 | |
65 private: | |
66 RemotingCdm(const std::string& key_system, | |
67 const GURL& security_origin, | |
68 const CdmConfig& cdm_config, | |
69 const SessionMessageCB& session_message_cb, | |
70 const SessionClosedCB& session_closed_cb, | |
71 const SessionKeysChangeCB& session_keys_change_cb, | |
72 const SessionExpirationUpdateCB& session_expiration_update_cb, | |
73 const CdmCreatedCB& cdm_created_cb, | |
74 std::unique_ptr<RemotingController> remoting_controller); | |
75 ~RemotingCdm() override; | |
76 | |
77 std::unique_ptr<RemotingController> remoting_controller_; | |
78 | |
79 DISALLOW_COPY_AND_ASSIGN(RemotingCdm); | |
80 }; | |
81 | |
82 } // namespace media | |
83 | |
84 #endif // MEDIA_REMOTING_REMOTING_CDM_H_ | |
OLD | NEW |