| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // From private/ppb_content_decryptor_private.idl, | 5 // From private/ppb_content_decryptor_private.idl, |
| 6 // modified Thu Mar 28 11:12:59 2013. | 6 // modified Tue Apr 16 11:25:44 2013. |
| 7 | 7 |
| 8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
| 9 #include "ppapi/c/private/ppb_content_decryptor_private.h" | 9 #include "ppapi/c/private/ppb_content_decryptor_private.h" |
| 10 #include "ppapi/shared_impl/tracked_callback.h" | 10 #include "ppapi/shared_impl/tracked_callback.h" |
| 11 #include "ppapi/thunk/enter.h" | 11 #include "ppapi/thunk/enter.h" |
| 12 #include "ppapi/thunk/ppb_instance_api.h" | 12 #include "ppapi/thunk/ppb_instance_api.h" |
| 13 #include "ppapi/thunk/resource_creation_api.h" | 13 #include "ppapi/thunk/resource_creation_api.h" |
| 14 #include "ppapi/thunk/thunk.h" | 14 #include "ppapi/thunk/thunk.h" |
| 15 | 15 |
| 16 namespace ppapi { | 16 namespace ppapi { |
| 17 namespace thunk { | 17 namespace thunk { |
| 18 | 18 |
| 19 namespace { | 19 namespace { |
| 20 | 20 |
| 21 void NeedKey(PP_Instance instance, | 21 void NeedKey(PP_Instance instance, |
| 22 struct PP_Var key_system, | 22 struct PP_Var key_system, |
| 23 struct PP_Var session_id, | 23 struct PP_Var session_id, |
| 24 struct PP_Var init_data) { | 24 struct PP_Var init_data) { |
| 25 VLOG(4) << "PPB_ContentDecryptor_Private::NeedKey()"; | 25 VLOG(4) << "PPB_ContentDecryptor_Private::NeedKey()"; |
| 26 EnterInstance enter(instance); | 26 EnterInstance enter(instance); |
| 27 if (enter.succeeded()) | 27 if (enter.failed()) |
| 28 enter.functions()->NeedKey(instance, key_system, session_id, init_data); | 28 return; |
| 29 enter.functions()->NeedKey(instance, key_system, session_id, init_data); |
| 29 } | 30 } |
| 30 | 31 |
| 31 void KeyAdded(PP_Instance instance, | 32 void KeyAdded(PP_Instance instance, |
| 32 struct PP_Var key_system, | 33 struct PP_Var key_system, |
| 33 struct PP_Var session_id) { | 34 struct PP_Var session_id) { |
| 34 VLOG(4) << "PPB_ContentDecryptor_Private::KeyAdded()"; | 35 VLOG(4) << "PPB_ContentDecryptor_Private::KeyAdded()"; |
| 35 EnterInstance enter(instance); | 36 EnterInstance enter(instance); |
| 36 if (enter.succeeded()) | 37 if (enter.failed()) |
| 37 enter.functions()->KeyAdded(instance, key_system, session_id); | 38 return; |
| 39 enter.functions()->KeyAdded(instance, key_system, session_id); |
| 38 } | 40 } |
| 39 | 41 |
| 40 void KeyMessage(PP_Instance instance, | 42 void KeyMessage(PP_Instance instance, |
| 41 struct PP_Var key_system, | 43 struct PP_Var key_system, |
| 42 struct PP_Var session_id, | 44 struct PP_Var session_id, |
| 43 struct PP_Var message, | 45 struct PP_Var message, |
| 44 struct PP_Var default_url) { | 46 struct PP_Var default_url) { |
| 45 VLOG(4) << "PPB_ContentDecryptor_Private::KeyMessage()"; | 47 VLOG(4) << "PPB_ContentDecryptor_Private::KeyMessage()"; |
| 46 EnterInstance enter(instance); | 48 EnterInstance enter(instance); |
| 47 if (enter.succeeded()) | 49 if (enter.failed()) |
| 48 enter.functions()->KeyMessage(instance, | 50 return; |
| 49 key_system, | 51 enter.functions()->KeyMessage(instance, |
| 50 session_id, | 52 key_system, |
| 51 message, | 53 session_id, |
| 52 default_url); | 54 message, |
| 55 default_url); |
| 53 } | 56 } |
| 54 | 57 |
| 55 void KeyError(PP_Instance instance, | 58 void KeyError(PP_Instance instance, |
| 56 struct PP_Var key_system, | 59 struct PP_Var key_system, |
| 57 struct PP_Var session_id, | 60 struct PP_Var session_id, |
| 58 int32_t media_error, | 61 int32_t media_error, |
| 59 int32_t system_code) { | 62 int32_t system_code) { |
| 60 VLOG(4) << "PPB_ContentDecryptor_Private::KeyError()"; | 63 VLOG(4) << "PPB_ContentDecryptor_Private::KeyError()"; |
| 61 EnterInstance enter(instance); | 64 EnterInstance enter(instance); |
| 62 if (enter.succeeded()) | 65 if (enter.failed()) |
| 63 enter.functions()->KeyError(instance, | 66 return; |
| 64 key_system, | 67 enter.functions()->KeyError(instance, |
| 65 session_id, | 68 key_system, |
| 66 media_error, | 69 session_id, |
| 67 system_code); | 70 media_error, |
| 71 system_code); |
| 68 } | 72 } |
| 69 | 73 |
| 70 void DeliverBlock(PP_Instance instance, | 74 void DeliverBlock(PP_Instance instance, |
| 71 PP_Resource decrypted_block, | 75 PP_Resource decrypted_block, |
| 72 const struct PP_DecryptedBlockInfo* decrypted_block_info) { | 76 const struct PP_DecryptedBlockInfo* decrypted_block_info) { |
| 73 VLOG(4) << "PPB_ContentDecryptor_Private::DeliverBlock()"; | 77 VLOG(4) << "PPB_ContentDecryptor_Private::DeliverBlock()"; |
| 74 EnterInstance enter(instance); | 78 EnterInstance enter(instance); |
| 75 if (enter.succeeded()) | 79 if (enter.failed()) |
| 76 enter.functions()->DeliverBlock(instance, | 80 return; |
| 77 decrypted_block, | 81 enter.functions()->DeliverBlock(instance, |
| 78 decrypted_block_info); | 82 decrypted_block, |
| 83 decrypted_block_info); |
| 79 } | 84 } |
| 80 | 85 |
| 81 void DecoderInitializeDone(PP_Instance instance, | 86 void DecoderInitializeDone(PP_Instance instance, |
| 82 PP_DecryptorStreamType decoder_type, | 87 PP_DecryptorStreamType decoder_type, |
| 83 uint32_t request_id, | 88 uint32_t request_id, |
| 84 PP_Bool success) { | 89 PP_Bool success) { |
| 85 VLOG(4) << "PPB_ContentDecryptor_Private::DecoderInitializeDone()"; | 90 VLOG(4) << "PPB_ContentDecryptor_Private::DecoderInitializeDone()"; |
| 86 EnterInstance enter(instance); | 91 EnterInstance enter(instance); |
| 87 if (enter.succeeded()) | 92 if (enter.failed()) |
| 88 enter.functions()->DecoderInitializeDone(instance, | 93 return; |
| 89 decoder_type, | 94 enter.functions()->DecoderInitializeDone(instance, |
| 90 request_id, | 95 decoder_type, |
| 91 success); | 96 request_id, |
| 97 success); |
| 92 } | 98 } |
| 93 | 99 |
| 94 void DecoderDeinitializeDone(PP_Instance instance, | 100 void DecoderDeinitializeDone(PP_Instance instance, |
| 95 PP_DecryptorStreamType decoder_type, | 101 PP_DecryptorStreamType decoder_type, |
| 96 uint32_t request_id) { | 102 uint32_t request_id) { |
| 97 VLOG(4) << "PPB_ContentDecryptor_Private::DecoderDeinitializeDone()"; | 103 VLOG(4) << "PPB_ContentDecryptor_Private::DecoderDeinitializeDone()"; |
| 98 EnterInstance enter(instance); | 104 EnterInstance enter(instance); |
| 99 if (enter.succeeded()) | 105 if (enter.failed()) |
| 100 enter.functions()->DecoderDeinitializeDone(instance, | 106 return; |
| 101 decoder_type, | 107 enter.functions()->DecoderDeinitializeDone(instance, |
| 102 request_id); | 108 decoder_type, |
| 109 request_id); |
| 103 } | 110 } |
| 104 | 111 |
| 105 void DecoderResetDone(PP_Instance instance, | 112 void DecoderResetDone(PP_Instance instance, |
| 106 PP_DecryptorStreamType decoder_type, | 113 PP_DecryptorStreamType decoder_type, |
| 107 uint32_t request_id) { | 114 uint32_t request_id) { |
| 108 VLOG(4) << "PPB_ContentDecryptor_Private::DecoderResetDone()"; | 115 VLOG(4) << "PPB_ContentDecryptor_Private::DecoderResetDone()"; |
| 109 EnterInstance enter(instance); | 116 EnterInstance enter(instance); |
| 110 if (enter.succeeded()) | 117 if (enter.failed()) |
| 111 enter.functions()->DecoderResetDone(instance, decoder_type, request_id); | 118 return; |
| 119 enter.functions()->DecoderResetDone(instance, decoder_type, request_id); |
| 112 } | 120 } |
| 113 | 121 |
| 114 void DeliverFrame(PP_Instance instance, | 122 void DeliverFrame(PP_Instance instance, |
| 115 PP_Resource decrypted_frame, | 123 PP_Resource decrypted_frame, |
| 116 const struct PP_DecryptedFrameInfo* decrypted_frame_info) { | 124 const struct PP_DecryptedFrameInfo* decrypted_frame_info) { |
| 117 VLOG(4) << "PPB_ContentDecryptor_Private::DeliverFrame()"; | 125 VLOG(4) << "PPB_ContentDecryptor_Private::DeliverFrame()"; |
| 118 EnterInstance enter(instance); | 126 EnterInstance enter(instance); |
| 119 if (enter.succeeded()) | 127 if (enter.failed()) |
| 120 enter.functions()->DeliverFrame(instance, | 128 return; |
| 121 decrypted_frame, | 129 enter.functions()->DeliverFrame(instance, |
| 122 decrypted_frame_info); | 130 decrypted_frame, |
| 131 decrypted_frame_info); |
| 123 } | 132 } |
| 124 | 133 |
| 125 void DeliverSamples( | 134 void DeliverSamples( |
| 126 PP_Instance instance, | 135 PP_Instance instance, |
| 127 PP_Resource audio_frames, | 136 PP_Resource audio_frames, |
| 128 const struct PP_DecryptedBlockInfo* decrypted_block_info) { | 137 const struct PP_DecryptedBlockInfo* decrypted_block_info) { |
| 129 VLOG(4) << "PPB_ContentDecryptor_Private::DeliverSamples()"; | 138 VLOG(4) << "PPB_ContentDecryptor_Private::DeliverSamples()"; |
| 130 EnterInstance enter(instance); | 139 EnterInstance enter(instance); |
| 131 if (enter.succeeded()) | 140 if (enter.failed()) |
| 132 enter.functions()->DeliverSamples(instance, | 141 return; |
| 133 audio_frames, | 142 enter.functions()->DeliverSamples(instance, |
| 134 decrypted_block_info); | 143 audio_frames, |
| 144 decrypted_block_info); |
| 135 } | 145 } |
| 136 | 146 |
| 137 const PPB_ContentDecryptor_Private_0_6 | 147 const PPB_ContentDecryptor_Private_0_6 |
| 138 g_ppb_contentdecryptor_private_thunk_0_6 = { | 148 g_ppb_contentdecryptor_private_thunk_0_6 = { |
| 139 &NeedKey, | 149 &NeedKey, |
| 140 &KeyAdded, | 150 &KeyAdded, |
| 141 &KeyMessage, | 151 &KeyMessage, |
| 142 &KeyError, | 152 &KeyError, |
| 143 &DeliverBlock, | 153 &DeliverBlock, |
| 144 &DecoderInitializeDone, | 154 &DecoderInitializeDone, |
| 145 &DecoderDeinitializeDone, | 155 &DecoderDeinitializeDone, |
| 146 &DecoderResetDone, | 156 &DecoderResetDone, |
| 147 &DeliverFrame, | 157 &DeliverFrame, |
| 148 &DeliverSamples | 158 &DeliverSamples |
| 149 }; | 159 }; |
| 150 | 160 |
| 151 } // namespace | 161 } // namespace |
| 152 | 162 |
| 153 const PPB_ContentDecryptor_Private_0_6* | 163 const PPB_ContentDecryptor_Private_0_6* |
| 154 GetPPB_ContentDecryptor_Private_0_6_Thunk() { | 164 GetPPB_ContentDecryptor_Private_0_6_Thunk() { |
| 155 return &g_ppb_contentdecryptor_private_thunk_0_6; | 165 return &g_ppb_contentdecryptor_private_thunk_0_6; |
| 156 } | 166 } |
| 157 | 167 |
| 158 } // namespace thunk | 168 } // namespace thunk |
| 159 } // namespace ppapi | 169 } // namespace ppapi |
| OLD | NEW |