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 #include "media/remoting/remoting_cdm.h" | |
6 | |
7 #include "media/base/cdm_promise.h" | |
8 | |
9 namespace media { | |
10 | |
11 namespace { | |
12 // Used as an identifier for RemotingCdm::From(). | |
13 void* const kClassIdentifier = const_cast<void**>(&kClassIdentifier); | |
xhwang
2016/11/01 08:21:28
This will work, but I wonder how is this better th
xjz
2016/11/01 21:55:52
I used the same way as here: https://cs.chromium.o
xhwang
2016/11/02 06:47:05
+miu
yeah, I did code search and found this patte
| |
14 } // namespace | |
15 | |
16 // TODO(xjz): Merge this with Eric's implementation. | |
17 RemotingCdm::RemotingCdm( | |
18 const std::string& key_system, | |
19 const GURL& security_origin, | |
20 const CdmConfig& cdm_config, | |
21 const SessionMessageCB& session_message_cb, | |
22 const SessionClosedCB& session_closed_cb, | |
23 const SessionKeysChangeCB& session_keys_change_cb, | |
24 const SessionExpirationUpdateCB& session_expiration_update_cb, | |
25 const CdmCreatedCB& cdm_created_cb, | |
26 std::unique_ptr<RemotingCdmController> remoting_controller) | |
27 : remoting_controller_(std::move(remoting_controller)) { | |
28 DCHECK(remoting_controller_); | |
29 | |
30 // TODO(xjz): Not implemented. Need to merge with Eric's implementation. | |
31 } | |
32 | |
33 RemotingCdm::~RemotingCdm() {} | |
34 | |
35 RemotingCdm* RemotingCdm::From(CdmContext* cdm) { | |
36 if (cdm && cdm->GetClassIdentifier() == kClassIdentifier) | |
37 return static_cast<RemotingCdm*>(cdm); | |
38 return nullptr; | |
39 } | |
40 | |
41 void RemotingCdm::SetServerCertificate( | |
42 const std::vector<uint8_t>& certificate, | |
43 std::unique_ptr<SimpleCdmPromise> promise) { | |
44 // TODO(xjz): Merge with Eric's implementation. | |
45 NOTIMPLEMENTED(); | |
46 } | |
47 | |
48 void RemotingCdm::CreateSessionAndGenerateRequest( | |
49 SessionType session_type, | |
50 EmeInitDataType init_data_type, | |
51 const std::vector<uint8_t>& init_data, | |
52 std::unique_ptr<NewSessionCdmPromise> promise) { | |
53 // TODO(xjz): Merge with Eric's implementation. | |
54 NOTIMPLEMENTED(); | |
55 } | |
56 | |
57 void RemotingCdm::LoadSession(SessionType session_type, | |
58 const std::string& session_id, | |
59 std::unique_ptr<NewSessionCdmPromise> promise) { | |
60 // TODO(xjz): Merge with Eric's implementation. | |
61 NOTIMPLEMENTED(); | |
62 } | |
63 | |
64 void RemotingCdm::UpdateSession(const std::string& session_id, | |
65 const std::vector<uint8_t>& response, | |
66 std::unique_ptr<SimpleCdmPromise> promise) { | |
67 // TODO(xjz): Merge with Eric's implementation. | |
68 NOTIMPLEMENTED(); | |
69 } | |
70 | |
71 void RemotingCdm::CloseSession(const std::string& session_id, | |
72 std::unique_ptr<SimpleCdmPromise> promise) { | |
73 // TODO(xjz): Merge with Eric's implementation. | |
74 NOTIMPLEMENTED(); | |
75 } | |
76 | |
77 void RemotingCdm::RemoveSession(const std::string& session_id, | |
78 std::unique_ptr<SimpleCdmPromise> promise) { | |
79 // TODO(xjz): Merge with Eric's implementation. | |
80 NOTIMPLEMENTED(); | |
81 } | |
82 | |
83 CdmContext* RemotingCdm::GetCdmContext() { | |
84 return this; | |
85 } | |
86 | |
87 Decryptor* RemotingCdm::GetDecryptor() { | |
88 // TODO(xjz): Merge with Eric's implementation. | |
89 return nullptr; | |
90 } | |
91 | |
92 int RemotingCdm::GetCdmId() const { | |
93 // TODO(xjz): Merge with Eric's implementation. | |
94 return CdmContext::kInvalidCdmId; | |
95 } | |
96 | |
97 void* RemotingCdm::GetClassIdentifier() const { | |
98 return kClassIdentifier; | |
99 } | |
100 | |
101 RemotingSourceImpl* RemotingCdm::GetRemotingSource() { | |
102 return remoting_controller_->remoting_source(); | |
103 } | |
104 | |
105 } // namespace media | |
OLD | NEW |