OLD | NEW |
(Empty) | |
| 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 #include "ppapi/c/dev/ppb_content_decryptor_dev.h" |
| 6 #include "ppapi/thunk/thunk.h" |
| 7 #include "ppapi/thunk/enter.h" |
| 8 #include "ppapi/thunk/ppb_instance_api.h" |
| 9 |
| 10 namespace ppapi { |
| 11 namespace thunk { |
| 12 |
| 13 namespace { |
| 14 |
| 15 void NeedKey(PP_Instance instance, |
| 16 PP_Var key_system, |
| 17 PP_Var session_id, |
| 18 PP_Var init_data) { |
| 19 EnterInstance enter(instance); |
| 20 if (enter.succeeded()) { |
| 21 enter.functions()->NeedKey(instance, key_system, session_id, init_data); |
| 22 } |
| 23 } |
| 24 |
| 25 void KeyAdded(PP_Instance instance, |
| 26 PP_Var key_system, |
| 27 PP_Var session_id) { |
| 28 EnterInstance enter(instance); |
| 29 if (enter.succeeded()) { |
| 30 enter.functions()->KeyAdded(instance, key_system, session_id); |
| 31 } |
| 32 } |
| 33 |
| 34 void KeyMessage(PP_Instance instance, |
| 35 PP_Var key_system, |
| 36 PP_Var session_id, |
| 37 PP_Resource message, |
| 38 PP_Var default_url) { |
| 39 EnterInstance enter(instance); |
| 40 if (enter.succeeded()) { |
| 41 enter.functions()->KeyMessage(instance, key_system, session_id, message, |
| 42 default_url); |
| 43 } |
| 44 } |
| 45 |
| 46 void KeyError(PP_Instance instance, |
| 47 PP_Var key_system, |
| 48 PP_Var session_id, |
| 49 int32_t media_error, |
| 50 int32_t system_error) { |
| 51 EnterInstance enter(instance); |
| 52 if (enter.succeeded()) { |
| 53 enter.functions()->KeyError(instance, key_system, session_id, media_error, |
| 54 system_error); |
| 55 } |
| 56 } |
| 57 |
| 58 void DeliverBlock(PP_Instance instance, |
| 59 PP_Resource decrypted_block, |
| 60 PP_CompletionCallback callback) { |
| 61 EnterInstance enter(instance); |
| 62 if (enter.succeeded()) { |
| 63 enter.functions()->DeliverBlock(instance, decrypted_block, callback); |
| 64 } |
| 65 } |
| 66 |
| 67 void DeliverFrame(PP_Instance instance, |
| 68 PP_Resource decrypted_frame, |
| 69 PP_CompletionCallback callback) { |
| 70 EnterInstance enter(instance); |
| 71 if (enter.succeeded()) { |
| 72 enter.functions()->DeliverFrame(instance, decrypted_frame, callback); |
| 73 } |
| 74 } |
| 75 |
| 76 void DeliverSamples(PP_Instance instance, |
| 77 PP_Resource decrypted_samples, |
| 78 PP_CompletionCallback callback) { |
| 79 EnterInstance enter(instance); |
| 80 if (enter.succeeded()) { |
| 81 enter.functions()->DeliverSamples(instance, decrypted_samples, callback); |
| 82 } |
| 83 } |
| 84 |
| 85 const PPB_ContentDecryptor_Dev g_ppb_decryption_thunk = { |
| 86 &NeedKey, |
| 87 &KeyAdded, |
| 88 &KeyMessage, |
| 89 &KeyError, |
| 90 &DeliverBlock, |
| 91 &DeliverFrame, |
| 92 &DeliverSamples |
| 93 }; |
| 94 |
| 95 } // namespace |
| 96 |
| 97 const PPB_ContentDecryptor_Dev* GetPPB_ContentDecryptor_Dev_0_1_Thunk() { |
| 98 return &g_ppb_decryption_thunk; |
| 99 } |
| 100 |
| 101 } // namespace thunk |
| 102 } // namespace ppapi |
OLD | NEW |