• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 Thu Jun  5 13:39:15 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 
PromiseRejected(PP_Instance instance,uint32_t promise_id,PP_CdmExceptionCode exception_code,uint32_t system_code,struct PP_Var error_description)39 void PromiseRejected(PP_Instance instance,
40                      uint32_t promise_id,
41                      PP_CdmExceptionCode exception_code,
42                      uint32_t system_code,
43                      struct PP_Var error_description) {
44   VLOG(4) << "PPB_ContentDecryptor_Private::PromiseRejected()";
45   EnterInstance enter(instance);
46   if (enter.failed())
47     return;
48   enter.functions()->PromiseRejected(instance,
49                                      promise_id,
50                                      exception_code,
51                                      system_code,
52                                      error_description);
53 }
54 
SessionMessage(PP_Instance instance,struct PP_Var web_session_id,struct PP_Var message,struct PP_Var destination_url)55 void SessionMessage(PP_Instance instance,
56                     struct PP_Var web_session_id,
57                     struct PP_Var message,
58                     struct PP_Var destination_url) {
59   VLOG(4) << "PPB_ContentDecryptor_Private::SessionMessage()";
60   EnterInstance enter(instance);
61   if (enter.failed())
62     return;
63   enter.functions()->SessionMessage(instance,
64                                     web_session_id,
65                                     message,
66                                     destination_url);
67 }
68 
SessionReady(PP_Instance instance,struct PP_Var web_session_id)69 void SessionReady(PP_Instance instance, struct PP_Var web_session_id) {
70   VLOG(4) << "PPB_ContentDecryptor_Private::SessionReady()";
71   EnterInstance enter(instance);
72   if (enter.failed())
73     return;
74   enter.functions()->SessionReady(instance, web_session_id);
75 }
76 
SessionClosed(PP_Instance instance,struct PP_Var web_session_id)77 void SessionClosed(PP_Instance instance, struct PP_Var web_session_id) {
78   VLOG(4) << "PPB_ContentDecryptor_Private::SessionClosed()";
79   EnterInstance enter(instance);
80   if (enter.failed())
81     return;
82   enter.functions()->SessionClosed(instance, web_session_id);
83 }
84 
SessionError(PP_Instance instance,struct PP_Var web_session_id,PP_CdmExceptionCode exception_code,uint32_t system_code,struct PP_Var error_description)85 void SessionError(PP_Instance instance,
86                   struct PP_Var web_session_id,
87                   PP_CdmExceptionCode exception_code,
88                   uint32_t system_code,
89                   struct PP_Var error_description) {
90   VLOG(4) << "PPB_ContentDecryptor_Private::SessionError()";
91   EnterInstance enter(instance);
92   if (enter.failed())
93     return;
94   enter.functions()->SessionError(instance,
95                                   web_session_id,
96                                   exception_code,
97                                   system_code,
98                                   error_description);
99 }
100 
DeliverBlock(PP_Instance instance,PP_Resource decrypted_block,const struct PP_DecryptedBlockInfo * decrypted_block_info)101 void DeliverBlock(PP_Instance instance,
102                   PP_Resource decrypted_block,
103                   const struct PP_DecryptedBlockInfo* decrypted_block_info) {
104   VLOG(4) << "PPB_ContentDecryptor_Private::DeliverBlock()";
105   EnterInstance enter(instance);
106   if (enter.failed())
107     return;
108   enter.functions()->DeliverBlock(instance,
109                                   decrypted_block,
110                                   decrypted_block_info);
111 }
112 
DecoderInitializeDone(PP_Instance instance,PP_DecryptorStreamType decoder_type,uint32_t request_id,PP_Bool success)113 void DecoderInitializeDone(PP_Instance instance,
114                            PP_DecryptorStreamType decoder_type,
115                            uint32_t request_id,
116                            PP_Bool success) {
117   VLOG(4) << "PPB_ContentDecryptor_Private::DecoderInitializeDone()";
118   EnterInstance enter(instance);
119   if (enter.failed())
120     return;
121   enter.functions()->DecoderInitializeDone(instance,
122                                            decoder_type,
123                                            request_id,
124                                            success);
125 }
126 
DecoderDeinitializeDone(PP_Instance instance,PP_DecryptorStreamType decoder_type,uint32_t request_id)127 void DecoderDeinitializeDone(PP_Instance instance,
128                              PP_DecryptorStreamType decoder_type,
129                              uint32_t request_id) {
130   VLOG(4) << "PPB_ContentDecryptor_Private::DecoderDeinitializeDone()";
131   EnterInstance enter(instance);
132   if (enter.failed())
133     return;
134   enter.functions()->DecoderDeinitializeDone(instance,
135                                              decoder_type,
136                                              request_id);
137 }
138 
DecoderResetDone(PP_Instance instance,PP_DecryptorStreamType decoder_type,uint32_t request_id)139 void DecoderResetDone(PP_Instance instance,
140                       PP_DecryptorStreamType decoder_type,
141                       uint32_t request_id) {
142   VLOG(4) << "PPB_ContentDecryptor_Private::DecoderResetDone()";
143   EnterInstance enter(instance);
144   if (enter.failed())
145     return;
146   enter.functions()->DecoderResetDone(instance, decoder_type, request_id);
147 }
148 
DeliverFrame(PP_Instance instance,PP_Resource decrypted_frame,const struct PP_DecryptedFrameInfo * decrypted_frame_info)149 void DeliverFrame(PP_Instance instance,
150                   PP_Resource decrypted_frame,
151                   const struct PP_DecryptedFrameInfo* decrypted_frame_info) {
152   VLOG(4) << "PPB_ContentDecryptor_Private::DeliverFrame()";
153   EnterInstance enter(instance);
154   if (enter.failed())
155     return;
156   enter.functions()->DeliverFrame(instance,
157                                   decrypted_frame,
158                                   decrypted_frame_info);
159 }
160 
DeliverSamples(PP_Instance instance,PP_Resource audio_frames,const struct PP_DecryptedSampleInfo * decrypted_sample_info)161 void DeliverSamples(
162     PP_Instance instance,
163     PP_Resource audio_frames,
164     const struct PP_DecryptedSampleInfo* decrypted_sample_info) {
165   VLOG(4) << "PPB_ContentDecryptor_Private::DeliverSamples()";
166   EnterInstance enter(instance);
167   if (enter.failed())
168     return;
169   enter.functions()->DeliverSamples(instance,
170                                     audio_frames,
171                                     decrypted_sample_info);
172 }
173 
174 const PPB_ContentDecryptor_Private_0_12
175     g_ppb_contentdecryptor_private_thunk_0_12 = {
176   &PromiseResolved,
177   &PromiseResolvedWithSession,
178   &PromiseRejected,
179   &SessionMessage,
180   &SessionReady,
181   &SessionClosed,
182   &SessionError,
183   &DeliverBlock,
184   &DecoderInitializeDone,
185   &DecoderDeinitializeDone,
186   &DecoderResetDone,
187   &DeliverFrame,
188   &DeliverSamples
189 };
190 
191 }  // namespace
192 
193 PPAPI_THUNK_EXPORT const PPB_ContentDecryptor_Private_0_12*
GetPPB_ContentDecryptor_Private_0_12_Thunk()194     GetPPB_ContentDecryptor_Private_0_12_Thunk() {
195   return &g_ppb_contentdecryptor_private_thunk_0_12;
196 }
197 
198 }  // namespace thunk
199 }  // namespace ppapi
200