1 // Copyright (c) 2012 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 // From private/ppb_content_decryptor_private.idl,
6 // modified Mon Aug 25 13:52:39 2014.
7
8 #include "ppapi/c/pp_errors.h"
9 #include "ppapi/c/private/ppb_content_decryptor_private.h"
10 #include "ppapi/shared_impl/tracked_callback.h"
11 #include "ppapi/thunk/enter.h"
12 #include "ppapi/thunk/ppapi_thunk_export.h"
13
14 namespace ppapi {
15 namespace thunk {
16
17 namespace {
18
PromiseResolved(PP_Instance instance,uint32_t promise_id)19 void PromiseResolved(PP_Instance instance, uint32_t promise_id) {
20 VLOG(4) << "PPB_ContentDecryptor_Private::PromiseResolved()";
21 EnterInstance enter(instance);
22 if (enter.failed())
23 return;
24 enter.functions()->PromiseResolved(instance, promise_id);
25 }
26
PromiseResolvedWithSession(PP_Instance instance,uint32_t promise_id,struct PP_Var web_session_id)27 void PromiseResolvedWithSession(PP_Instance instance,
28 uint32_t promise_id,
29 struct PP_Var web_session_id) {
30 VLOG(4) << "PPB_ContentDecryptor_Private::PromiseResolvedWithSession()";
31 EnterInstance enter(instance);
32 if (enter.failed())
33 return;
34 enter.functions()->PromiseResolvedWithSession(instance,
35 promise_id,
36 web_session_id);
37 }
38
PromiseResolvedWithKeyIds(PP_Instance instance,uint32_t promise_id,struct PP_Var key_ids_array)39 void PromiseResolvedWithKeyIds(PP_Instance instance,
40 uint32_t promise_id,
41 struct PP_Var key_ids_array) {
42 VLOG(4) << "PPB_ContentDecryptor_Private::PromiseResolvedWithKeyIds()";
43 EnterInstance enter(instance);
44 if (enter.failed())
45 return;
46 enter.functions()->PromiseResolvedWithKeyIds(instance,
47 promise_id,
48 key_ids_array);
49 }
50
PromiseRejected(PP_Instance instance,uint32_t promise_id,PP_CdmExceptionCode exception_code,uint32_t system_code,struct PP_Var error_description)51 void PromiseRejected(PP_Instance instance,
52 uint32_t promise_id,
53 PP_CdmExceptionCode exception_code,
54 uint32_t system_code,
55 struct PP_Var error_description) {
56 VLOG(4) << "PPB_ContentDecryptor_Private::PromiseRejected()";
57 EnterInstance enter(instance);
58 if (enter.failed())
59 return;
60 enter.functions()->PromiseRejected(instance,
61 promise_id,
62 exception_code,
63 system_code,
64 error_description);
65 }
66
SessionMessage(PP_Instance instance,struct PP_Var web_session_id,struct PP_Var message,struct PP_Var destination_url)67 void SessionMessage(PP_Instance instance,
68 struct PP_Var web_session_id,
69 struct PP_Var message,
70 struct PP_Var destination_url) {
71 VLOG(4) << "PPB_ContentDecryptor_Private::SessionMessage()";
72 EnterInstance enter(instance);
73 if (enter.failed())
74 return;
75 enter.functions()->SessionMessage(instance,
76 web_session_id,
77 message,
78 destination_url);
79 }
80
SessionKeysChange(PP_Instance instance,struct PP_Var web_session_id,PP_Bool has_additional_usable_key)81 void SessionKeysChange(PP_Instance instance,
82 struct PP_Var web_session_id,
83 PP_Bool has_additional_usable_key) {
84 VLOG(4) << "PPB_ContentDecryptor_Private::SessionKeysChange()";
85 EnterInstance enter(instance);
86 if (enter.failed())
87 return;
88 enter.functions()->SessionKeysChange(instance,
89 web_session_id,
90 has_additional_usable_key);
91 }
92
SessionExpirationChange(PP_Instance instance,struct PP_Var web_session_id,PP_Time new_expiry_time)93 void SessionExpirationChange(PP_Instance instance,
94 struct PP_Var web_session_id,
95 PP_Time new_expiry_time) {
96 VLOG(4) << "PPB_ContentDecryptor_Private::SessionExpirationChange()";
97 EnterInstance enter(instance);
98 if (enter.failed())
99 return;
100 enter.functions()->SessionExpirationChange(instance,
101 web_session_id,
102 new_expiry_time);
103 }
104
SessionReady(PP_Instance instance,struct PP_Var web_session_id)105 void SessionReady(PP_Instance instance, struct PP_Var web_session_id) {
106 VLOG(4) << "PPB_ContentDecryptor_Private::SessionReady()";
107 EnterInstance enter(instance);
108 if (enter.failed())
109 return;
110 enter.functions()->SessionReady(instance, web_session_id);
111 }
112
SessionClosed(PP_Instance instance,struct PP_Var web_session_id)113 void SessionClosed(PP_Instance instance, struct PP_Var web_session_id) {
114 VLOG(4) << "PPB_ContentDecryptor_Private::SessionClosed()";
115 EnterInstance enter(instance);
116 if (enter.failed())
117 return;
118 enter.functions()->SessionClosed(instance, web_session_id);
119 }
120
SessionError(PP_Instance instance,struct PP_Var web_session_id,PP_CdmExceptionCode exception_code,uint32_t system_code,struct PP_Var error_description)121 void SessionError(PP_Instance instance,
122 struct PP_Var web_session_id,
123 PP_CdmExceptionCode exception_code,
124 uint32_t system_code,
125 struct PP_Var error_description) {
126 VLOG(4) << "PPB_ContentDecryptor_Private::SessionError()";
127 EnterInstance enter(instance);
128 if (enter.failed())
129 return;
130 enter.functions()->SessionError(instance,
131 web_session_id,
132 exception_code,
133 system_code,
134 error_description);
135 }
136
DeliverBlock(PP_Instance instance,PP_Resource decrypted_block,const struct PP_DecryptedBlockInfo * decrypted_block_info)137 void DeliverBlock(PP_Instance instance,
138 PP_Resource decrypted_block,
139 const struct PP_DecryptedBlockInfo* decrypted_block_info) {
140 VLOG(4) << "PPB_ContentDecryptor_Private::DeliverBlock()";
141 EnterInstance enter(instance);
142 if (enter.failed())
143 return;
144 enter.functions()->DeliverBlock(instance,
145 decrypted_block,
146 decrypted_block_info);
147 }
148
DecoderInitializeDone(PP_Instance instance,PP_DecryptorStreamType decoder_type,uint32_t request_id,PP_Bool success)149 void DecoderInitializeDone(PP_Instance instance,
150 PP_DecryptorStreamType decoder_type,
151 uint32_t request_id,
152 PP_Bool success) {
153 VLOG(4) << "PPB_ContentDecryptor_Private::DecoderInitializeDone()";
154 EnterInstance enter(instance);
155 if (enter.failed())
156 return;
157 enter.functions()->DecoderInitializeDone(instance,
158 decoder_type,
159 request_id,
160 success);
161 }
162
DecoderDeinitializeDone(PP_Instance instance,PP_DecryptorStreamType decoder_type,uint32_t request_id)163 void DecoderDeinitializeDone(PP_Instance instance,
164 PP_DecryptorStreamType decoder_type,
165 uint32_t request_id) {
166 VLOG(4) << "PPB_ContentDecryptor_Private::DecoderDeinitializeDone()";
167 EnterInstance enter(instance);
168 if (enter.failed())
169 return;
170 enter.functions()->DecoderDeinitializeDone(instance,
171 decoder_type,
172 request_id);
173 }
174
DecoderResetDone(PP_Instance instance,PP_DecryptorStreamType decoder_type,uint32_t request_id)175 void DecoderResetDone(PP_Instance instance,
176 PP_DecryptorStreamType decoder_type,
177 uint32_t request_id) {
178 VLOG(4) << "PPB_ContentDecryptor_Private::DecoderResetDone()";
179 EnterInstance enter(instance);
180 if (enter.failed())
181 return;
182 enter.functions()->DecoderResetDone(instance, decoder_type, request_id);
183 }
184
DeliverFrame(PP_Instance instance,PP_Resource decrypted_frame,const struct PP_DecryptedFrameInfo * decrypted_frame_info)185 void DeliverFrame(PP_Instance instance,
186 PP_Resource decrypted_frame,
187 const struct PP_DecryptedFrameInfo* decrypted_frame_info) {
188 VLOG(4) << "PPB_ContentDecryptor_Private::DeliverFrame()";
189 EnterInstance enter(instance);
190 if (enter.failed())
191 return;
192 enter.functions()->DeliverFrame(instance,
193 decrypted_frame,
194 decrypted_frame_info);
195 }
196
DeliverSamples(PP_Instance instance,PP_Resource audio_frames,const struct PP_DecryptedSampleInfo * decrypted_sample_info)197 void DeliverSamples(
198 PP_Instance instance,
199 PP_Resource audio_frames,
200 const struct PP_DecryptedSampleInfo* decrypted_sample_info) {
201 VLOG(4) << "PPB_ContentDecryptor_Private::DeliverSamples()";
202 EnterInstance enter(instance);
203 if (enter.failed())
204 return;
205 enter.functions()->DeliverSamples(instance,
206 audio_frames,
207 decrypted_sample_info);
208 }
209
210 const PPB_ContentDecryptor_Private_0_12
211 g_ppb_contentdecryptor_private_thunk_0_12 = {
212 &PromiseResolved,
213 &PromiseResolvedWithSession,
214 &PromiseResolvedWithKeyIds,
215 &PromiseRejected,
216 &SessionMessage,
217 &SessionKeysChange,
218 &SessionExpirationChange,
219 &SessionReady,
220 &SessionClosed,
221 &SessionError,
222 &DeliverBlock,
223 &DecoderInitializeDone,
224 &DecoderDeinitializeDone,
225 &DecoderResetDone,
226 &DeliverFrame,
227 &DeliverSamples
228 };
229
230 } // namespace
231
232 PPAPI_THUNK_EXPORT const PPB_ContentDecryptor_Private_0_12*
GetPPB_ContentDecryptor_Private_0_12_Thunk()233 GetPPB_ContentDecryptor_Private_0_12_Thunk() {
234 return &g_ppb_contentdecryptor_private_thunk_0_12;
235 }
236
237 } // namespace thunk
238 } // namespace ppapi
239