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 Fri Dec 6 12:16:22 2013. 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/ppb_instance_api.h" 13#include "ppapi/thunk/resource_creation_api.h" 14#include "ppapi/thunk/thunk.h" 15 16namespace ppapi { 17namespace thunk { 18 19namespace { 20 21void SessionCreated(PP_Instance instance, 22 uint32_t session_id, 23 struct PP_Var web_session_id) { 24 VLOG(4) << "PPB_ContentDecryptor_Private::SessionCreated()"; 25 EnterInstance enter(instance); 26 if (enter.failed()) 27 return; 28 enter.functions()->SessionCreated(instance, session_id, web_session_id); 29} 30 31void SessionMessage(PP_Instance instance, 32 uint32_t session_id, 33 struct PP_Var message, 34 struct PP_Var destination_url) { 35 VLOG(4) << "PPB_ContentDecryptor_Private::SessionMessage()"; 36 EnterInstance enter(instance); 37 if (enter.failed()) 38 return; 39 enter.functions()->SessionMessage(instance, 40 session_id, 41 message, 42 destination_url); 43} 44 45void SessionReady(PP_Instance instance, uint32_t session_id) { 46 VLOG(4) << "PPB_ContentDecryptor_Private::SessionReady()"; 47 EnterInstance enter(instance); 48 if (enter.failed()) 49 return; 50 enter.functions()->SessionReady(instance, session_id); 51} 52 53void SessionClosed(PP_Instance instance, uint32_t session_id) { 54 VLOG(4) << "PPB_ContentDecryptor_Private::SessionClosed()"; 55 EnterInstance enter(instance); 56 if (enter.failed()) 57 return; 58 enter.functions()->SessionClosed(instance, session_id); 59} 60 61void SessionError(PP_Instance instance, 62 uint32_t session_id, 63 int32_t media_error, 64 int32_t system_code) { 65 VLOG(4) << "PPB_ContentDecryptor_Private::SessionError()"; 66 EnterInstance enter(instance); 67 if (enter.failed()) 68 return; 69 enter.functions()->SessionError(instance, 70 session_id, 71 media_error, 72 system_code); 73} 74 75void DeliverBlock(PP_Instance instance, 76 PP_Resource decrypted_block, 77 const struct PP_DecryptedBlockInfo* decrypted_block_info) { 78 VLOG(4) << "PPB_ContentDecryptor_Private::DeliverBlock()"; 79 EnterInstance enter(instance); 80 if (enter.failed()) 81 return; 82 enter.functions()->DeliverBlock(instance, 83 decrypted_block, 84 decrypted_block_info); 85} 86 87void DecoderInitializeDone(PP_Instance instance, 88 PP_DecryptorStreamType decoder_type, 89 uint32_t request_id, 90 PP_Bool success) { 91 VLOG(4) << "PPB_ContentDecryptor_Private::DecoderInitializeDone()"; 92 EnterInstance enter(instance); 93 if (enter.failed()) 94 return; 95 enter.functions()->DecoderInitializeDone(instance, 96 decoder_type, 97 request_id, 98 success); 99} 100 101void DecoderDeinitializeDone(PP_Instance instance, 102 PP_DecryptorStreamType decoder_type, 103 uint32_t request_id) { 104 VLOG(4) << "PPB_ContentDecryptor_Private::DecoderDeinitializeDone()"; 105 EnterInstance enter(instance); 106 if (enter.failed()) 107 return; 108 enter.functions()->DecoderDeinitializeDone(instance, 109 decoder_type, 110 request_id); 111} 112 113void DecoderResetDone(PP_Instance instance, 114 PP_DecryptorStreamType decoder_type, 115 uint32_t request_id) { 116 VLOG(4) << "PPB_ContentDecryptor_Private::DecoderResetDone()"; 117 EnterInstance enter(instance); 118 if (enter.failed()) 119 return; 120 enter.functions()->DecoderResetDone(instance, decoder_type, request_id); 121} 122 123void DeliverFrame(PP_Instance instance, 124 PP_Resource decrypted_frame, 125 const struct PP_DecryptedFrameInfo* decrypted_frame_info) { 126 VLOG(4) << "PPB_ContentDecryptor_Private::DeliverFrame()"; 127 EnterInstance enter(instance); 128 if (enter.failed()) 129 return; 130 enter.functions()->DeliverFrame(instance, 131 decrypted_frame, 132 decrypted_frame_info); 133} 134 135void DeliverSamples( 136 PP_Instance instance, 137 PP_Resource audio_frames, 138 const struct PP_DecryptedSampleInfo* decrypted_sample_info) { 139 VLOG(4) << "PPB_ContentDecryptor_Private::DeliverSamples()"; 140 EnterInstance enter(instance); 141 if (enter.failed()) 142 return; 143 enter.functions()->DeliverSamples(instance, 144 audio_frames, 145 decrypted_sample_info); 146} 147 148const PPB_ContentDecryptor_Private_0_9 149 g_ppb_contentdecryptor_private_thunk_0_9 = { 150 &SessionCreated, 151 &SessionMessage, 152 &SessionReady, 153 &SessionClosed, 154 &SessionError, 155 &DeliverBlock, 156 &DecoderInitializeDone, 157 &DecoderDeinitializeDone, 158 &DecoderResetDone, 159 &DeliverFrame, 160 &DeliverSamples 161}; 162 163} // namespace 164 165const PPB_ContentDecryptor_Private_0_9* 166 GetPPB_ContentDecryptor_Private_0_9_Thunk() { 167 return &g_ppb_contentdecryptor_private_thunk_0_9; 168} 169 170} // namespace thunk 171} // namespace ppapi 172