| 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 #include "ppapi/c/pp_errors.h" | 5 #include "ppapi/c/pp_errors.h" |
| 6 #include "ppapi/shared_impl/ppb_device_ref_shared.h" | 6 #include "ppapi/shared_impl/ppb_device_ref_shared.h" |
| 7 #include "ppapi/shared_impl/tracked_callback.h" | 7 #include "ppapi/shared_impl/tracked_callback.h" |
| 8 #include "ppapi/thunk/enter.h" | 8 #include "ppapi/thunk/enter.h" |
| 9 #include "ppapi/thunk/ppb_device_ref_api.h" | 9 #include "ppapi/thunk/ppb_device_ref_api.h" |
| 10 #include "ppapi/thunk/ppb_audio_input_api.h" | 10 #include "ppapi/thunk/ppb_audio_input_api.h" |
| 11 #include "ppapi/thunk/resource_creation_api.h" | 11 #include "ppapi/thunk/resource_creation_api.h" |
| 12 #include "ppapi/thunk/thunk.h" | 12 #include "ppapi/thunk/thunk.h" |
| 13 | 13 |
| 14 namespace ppapi { | 14 namespace ppapi { |
| 15 namespace thunk { | 15 namespace thunk { |
| 16 | 16 |
| 17 namespace { | 17 namespace { |
| 18 | 18 |
| 19 typedef EnterResource<PPB_AudioInput_API> EnterAudioInput; | 19 typedef EnterResource<PPB_AudioInput_API> EnterAudioInput; |
| 20 | 20 |
| 21 PP_Resource Create0_1(PP_Instance instance, | 21 PP_Resource Create(PP_Instance instance) { |
| 22 PP_Resource config, | |
| 23 PPB_AudioInput_Callback audio_input_callback, | |
| 24 void* user_data) { | |
| 25 EnterResourceCreation enter(instance); | 22 EnterResourceCreation enter(instance); |
| 26 if (enter.failed()) | 23 if (enter.failed()) |
| 27 return 0; | 24 return 0; |
| 28 | |
| 29 return enter.functions()->CreateAudioInput0_1( | |
| 30 instance, config, audio_input_callback, user_data); | |
| 31 } | |
| 32 | |
| 33 PP_Resource Create0_2(PP_Instance instance) { | |
| 34 EnterResourceCreation enter(instance); | |
| 35 if (enter.failed()) | |
| 36 return 0; | |
| 37 | 25 |
| 38 return enter.functions()->CreateAudioInput(instance); | 26 return enter.functions()->CreateAudioInput(instance); |
| 39 } | 27 } |
| 40 | 28 |
| 41 PP_Bool IsAudioInput(PP_Resource resource) { | 29 PP_Bool IsAudioInput(PP_Resource resource) { |
| 42 EnterAudioInput enter(resource, false); | 30 EnterAudioInput enter(resource, false); |
| 43 return PP_FromBool(enter.succeeded()); | 31 return PP_FromBool(enter.succeeded()); |
| 44 } | 32 } |
| 45 | 33 |
| 46 int32_t EnumerateDevices(PP_Resource audio_input, | 34 int32_t EnumerateDevices(PP_Resource audio_input, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 88 |
| 101 return enter.object()->StopCapture(); | 89 return enter.object()->StopCapture(); |
| 102 } | 90 } |
| 103 | 91 |
| 104 void Close(PP_Resource audio_input) { | 92 void Close(PP_Resource audio_input) { |
| 105 EnterAudioInput enter(audio_input, true); | 93 EnterAudioInput enter(audio_input, true); |
| 106 if (enter.succeeded()) | 94 if (enter.succeeded()) |
| 107 enter.object()->Close(); | 95 enter.object()->Close(); |
| 108 } | 96 } |
| 109 | 97 |
| 110 const PPB_AudioInput_Dev_0_1 g_ppb_audioinput_0_1_thunk = { | |
| 111 &Create0_1, | |
| 112 &IsAudioInput, | |
| 113 &GetCurrentConfig, | |
| 114 &StartCapture, | |
| 115 &StopCapture | |
| 116 }; | |
| 117 | |
| 118 const PPB_AudioInput_Dev_0_2 g_ppb_audioinput_0_2_thunk = { | 98 const PPB_AudioInput_Dev_0_2 g_ppb_audioinput_0_2_thunk = { |
| 119 &Create0_2, | 99 &Create, |
| 120 &IsAudioInput, | 100 &IsAudioInput, |
| 121 &EnumerateDevices, | 101 &EnumerateDevices, |
| 122 &Open, | 102 &Open, |
| 123 &GetCurrentConfig, | 103 &GetCurrentConfig, |
| 124 &StartCapture, | 104 &StartCapture, |
| 125 &StopCapture, | 105 &StopCapture, |
| 126 &Close | 106 &Close |
| 127 }; | 107 }; |
| 128 | 108 |
| 129 } // namespace | 109 } // namespace |
| 130 | 110 |
| 131 const PPB_AudioInput_Dev_0_1* GetPPB_AudioInput_Dev_0_1_Thunk() { | |
| 132 return &g_ppb_audioinput_0_1_thunk; | |
| 133 } | |
| 134 | |
| 135 const PPB_AudioInput_Dev_0_2* GetPPB_AudioInput_Dev_0_2_Thunk() { | 111 const PPB_AudioInput_Dev_0_2* GetPPB_AudioInput_Dev_0_2_Thunk() { |
| 136 return &g_ppb_audioinput_0_2_thunk; | 112 return &g_ppb_audioinput_0_2_thunk; |
| 137 } | 113 } |
| 138 | 114 |
| 139 } // namespace thunk | 115 } // namespace thunk |
| 140 } // namespace ppapi | 116 } // namespace ppapi |
| OLD | NEW |