diff options
author | teravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-25 17:18:04 +0000 |
---|---|---|
committer | teravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-25 17:18:04 +0000 |
commit | 8917a67934617e7627d9241e8fb31545d4141429 (patch) | |
tree | 6e21410ab64832a51499bd05716c5e98836e2667 /ppapi/thunk/ppb_audio_input_dev_thunk.cc | |
parent | 60780f41729ab40ba08b93ad4c279fbe0aee4c13 (diff) | |
download | chromium_src-8917a67934617e7627d9241e8fb31545d4141429.zip chromium_src-8917a67934617e7627d9241e8fb31545d4141429.tar.gz chromium_src-8917a67934617e7627d9241e8fb31545d4141429.tar.bz2 |
Pepper IDL: Autogenerate thunk for ppb_audio_input
BUG=
Review URL: https://chromiumcodereview.appspot.com/12212166
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184424 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/thunk/ppb_audio_input_dev_thunk.cc')
-rw-r--r-- | ppapi/thunk/ppb_audio_input_dev_thunk.cc | 141 |
1 files changed, 141 insertions, 0 deletions
diff --git a/ppapi/thunk/ppb_audio_input_dev_thunk.cc b/ppapi/thunk/ppb_audio_input_dev_thunk.cc new file mode 100644 index 0000000..7a23c63 --- /dev/null +++ b/ppapi/thunk/ppb_audio_input_dev_thunk.cc @@ -0,0 +1,141 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// From dev/ppb_audio_input_dev.idl modified Fri Feb 22 11:43:43 2013. + +#include "ppapi/c/dev/ppb_audio_input_dev.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_errors.h" +#include "ppapi/shared_impl/tracked_callback.h" +#include "ppapi/thunk/enter.h" +#include "ppapi/thunk/ppb_audio_input_api.h" +#include "ppapi/thunk/ppb_instance_api.h" +#include "ppapi/thunk/resource_creation_api.h" +#include "ppapi/thunk/thunk.h" + +namespace ppapi { +namespace thunk { + +namespace { + +PP_Resource Create(PP_Instance instance) { + EnterResourceCreation enter(instance); + if (enter.failed()) + return 0; + return enter.functions()->CreateAudioInput(instance); +} + +PP_Bool IsAudioInput(PP_Resource resource) { + EnterResource<PPB_AudioInput_API> enter(resource, false); + return PP_FromBool(enter.succeeded()); +} + +int32_t EnumerateDevices_0_2(PP_Resource audio_input, + PP_Resource* devices, + struct PP_CompletionCallback callback) { + EnterResource<PPB_AudioInput_API> enter(audio_input, callback, true); + if (enter.failed()) + return enter.retval(); + return enter.SetResult(enter.object()->EnumerateDevices0_2( + devices, + enter.callback())); +} + +int32_t EnumerateDevices(PP_Resource audio_input, + struct PP_ArrayOutput output, + struct PP_CompletionCallback callback) { + EnterResource<PPB_AudioInput_API> enter(audio_input, callback, true); + if (enter.failed()) + return enter.retval(); + return enter.SetResult(enter.object()->EnumerateDevices(output, + enter.callback())); +} + +int32_t MonitorDeviceChange(PP_Resource audio_input, + PP_MonitorDeviceChangeCallback callback, + void* user_data) { + EnterResource<PPB_AudioInput_API> enter(audio_input, true); + if (enter.failed()) + return enter.retval(); + return enter.object()->MonitorDeviceChange(callback, user_data); +} + +int32_t Open(PP_Resource audio_input, + PP_Resource device_ref, + PP_Resource config, + PPB_AudioInput_Callback audio_input_callback, + void* user_data, + struct PP_CompletionCallback callback) { + EnterResource<PPB_AudioInput_API> enter(audio_input, callback, true); + if (enter.failed()) + return enter.retval(); + return enter.SetResult(enter.object()->Open(device_ref, + config, + audio_input_callback, + user_data, + enter.callback())); +} + +PP_Resource GetCurrentConfig(PP_Resource audio_input) { + EnterResource<PPB_AudioInput_API> enter(audio_input, true); + if (enter.failed()) + return 0; + return enter.object()->GetCurrentConfig(); +} + +PP_Bool StartCapture(PP_Resource audio_input) { + EnterResource<PPB_AudioInput_API> enter(audio_input, true); + if (enter.failed()) + return PP_FALSE; + return enter.object()->StartCapture(); +} + +PP_Bool StopCapture(PP_Resource audio_input) { + EnterResource<PPB_AudioInput_API> enter(audio_input, true); + if (enter.failed()) + return PP_FALSE; + return enter.object()->StopCapture(); +} + +void Close(PP_Resource audio_input) { + EnterResource<PPB_AudioInput_API> enter(audio_input, true); + if (enter.succeeded()) + enter.object()->Close(); +} + +const PPB_AudioInput_Dev_0_2 g_ppb_audioinput_dev_thunk_0_2 = { + &Create, + &IsAudioInput, + &EnumerateDevices_0_2, + &Open, + &GetCurrentConfig, + &StartCapture, + &StopCapture, + &Close +}; + +const PPB_AudioInput_Dev_0_3 g_ppb_audioinput_dev_thunk_0_3 = { + &Create, + &IsAudioInput, + &EnumerateDevices, + &MonitorDeviceChange, + &Open, + &GetCurrentConfig, + &StartCapture, + &StopCapture, + &Close +}; + +} // namespace + +const PPB_AudioInput_Dev_0_2* GetPPB_AudioInput_Dev_0_2_Thunk() { + return &g_ppb_audioinput_dev_thunk_0_2; +} + +const PPB_AudioInput_Dev_0_3* GetPPB_AudioInput_Dev_0_3_Thunk() { + return &g_ppb_audioinput_dev_thunk_0_3; +} + +} // namespace thunk +} // namespace ppapi |