| 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/dev/ppb_audio_input_dev.h" | 5 #include "ppapi/c/dev/ppb_audio_input_dev.h" |
| 6 #include "ppapi/c/pp_completion_callback.h" | 6 #include "ppapi/c/pp_completion_callback.h" |
| 7 #include "ppapi/c/pp_errors.h" | 7 #include "ppapi/c/pp_errors.h" |
| 8 #include "ppapi/shared_impl/tracked_callback.h" | 8 #include "ppapi/shared_impl/tracked_callback.h" |
| 9 #include "ppapi/thunk/enter.h" | 9 #include "ppapi/thunk/enter.h" |
| 10 #include "ppapi/thunk/ppb_audio_input_api.h" | 10 #include "ppapi/thunk/ppb_audio_input_api.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 return PP_FromBool(enter.succeeded()); | 31 return PP_FromBool(enter.succeeded()); |
| 32 } | 32 } |
| 33 | 33 |
| 34 int32_t EnumerateDevices(PP_Resource audio_input, | 34 int32_t EnumerateDevices(PP_Resource audio_input, |
| 35 struct PP_ArrayOutput output, | 35 struct PP_ArrayOutput output, |
| 36 struct PP_CompletionCallback callback) { | 36 struct PP_CompletionCallback callback) { |
| 37 VLOG(4) << "PPB_AudioInput_Dev::EnumerateDevices()"; | 37 VLOG(4) << "PPB_AudioInput_Dev::EnumerateDevices()"; |
| 38 EnterResource<PPB_AudioInput_API> enter(audio_input, callback, true); | 38 EnterResource<PPB_AudioInput_API> enter(audio_input, callback, true); |
| 39 if (enter.failed()) | 39 if (enter.failed()) |
| 40 return enter.retval(); | 40 return enter.retval(); |
| 41 return enter.SetResult(enter.object()->EnumerateDevices(output, | 41 return enter.SetResult( |
| 42 enter.callback())); | 42 enter.object()->EnumerateDevices(output, enter.callback())); |
| 43 } | 43 } |
| 44 | 44 |
| 45 int32_t MonitorDeviceChange(PP_Resource audio_input, | 45 int32_t MonitorDeviceChange(PP_Resource audio_input, |
| 46 PP_MonitorDeviceChangeCallback callback, | 46 PP_MonitorDeviceChangeCallback callback, |
| 47 void* user_data) { | 47 void* user_data) { |
| 48 VLOG(4) << "PPB_AudioInput_Dev::MonitorDeviceChange()"; | 48 VLOG(4) << "PPB_AudioInput_Dev::MonitorDeviceChange()"; |
| 49 EnterResource<PPB_AudioInput_API> enter(audio_input, true); | 49 EnterResource<PPB_AudioInput_API> enter(audio_input, true); |
| 50 if (enter.failed()) | 50 if (enter.failed()) |
| 51 return enter.retval(); | 51 return enter.retval(); |
| 52 return enter.object()->MonitorDeviceChange(callback, user_data); | 52 return enter.object()->MonitorDeviceChange(callback, user_data); |
| 53 } | 53 } |
| 54 | 54 |
| 55 int32_t Open_0_3(PP_Resource audio_input, | 55 int32_t Open_0_3(PP_Resource audio_input, |
| 56 PP_Resource device_ref, | 56 PP_Resource device_ref, |
| 57 PP_Resource config, | 57 PP_Resource config, |
| 58 PPB_AudioInput_Callback_0_3 audio_input_callback, | 58 PPB_AudioInput_Callback_0_3 audio_input_callback, |
| 59 void* user_data, | 59 void* user_data, |
| 60 struct PP_CompletionCallback callback) { | 60 struct PP_CompletionCallback callback) { |
| 61 VLOG(4) << "PPB_AudioInput_Dev::Open()"; | 61 VLOG(4) << "PPB_AudioInput_Dev::Open()"; |
| 62 EnterResource<PPB_AudioInput_API> enter(audio_input, callback, true); | 62 EnterResource<PPB_AudioInput_API> enter(audio_input, callback, true); |
| 63 if (enter.failed()) | 63 if (enter.failed()) |
| 64 return enter.retval(); | 64 return enter.retval(); |
| 65 return enter.SetResult(enter.object()->Open0_3(device_ref, | 65 return enter.SetResult(enter.object()->Open0_3( |
| 66 config, | 66 device_ref, config, audio_input_callback, user_data, enter.callback())); |
| 67 audio_input_callback, | |
| 68 user_data, | |
| 69 enter.callback())); | |
| 70 } | 67 } |
| 71 | 68 |
| 72 int32_t Open(PP_Resource audio_input, | 69 int32_t Open(PP_Resource audio_input, |
| 73 PP_Resource device_ref, | 70 PP_Resource device_ref, |
| 74 PP_Resource config, | 71 PP_Resource config, |
| 75 PPB_AudioInput_Callback audio_input_callback, | 72 PPB_AudioInput_Callback audio_input_callback, |
| 76 void* user_data, | 73 void* user_data, |
| 77 struct PP_CompletionCallback callback) { | 74 struct PP_CompletionCallback callback) { |
| 78 VLOG(4) << "PPB_AudioInput_Dev::Open()"; | 75 VLOG(4) << "PPB_AudioInput_Dev::Open()"; |
| 79 EnterResource<PPB_AudioInput_API> enter(audio_input, callback, true); | 76 EnterResource<PPB_AudioInput_API> enter(audio_input, callback, true); |
| 80 if (enter.failed()) | 77 if (enter.failed()) |
| 81 return enter.retval(); | 78 return enter.retval(); |
| 82 return enter.SetResult(enter.object()->Open(device_ref, | 79 return enter.SetResult(enter.object()->Open( |
| 83 config, | 80 device_ref, config, audio_input_callback, user_data, enter.callback())); |
| 84 audio_input_callback, | |
| 85 user_data, | |
| 86 enter.callback())); | |
| 87 } | 81 } |
| 88 | 82 |
| 89 PP_Resource GetCurrentConfig(PP_Resource audio_input) { | 83 PP_Resource GetCurrentConfig(PP_Resource audio_input) { |
| 90 VLOG(4) << "PPB_AudioInput_Dev::GetCurrentConfig()"; | 84 VLOG(4) << "PPB_AudioInput_Dev::GetCurrentConfig()"; |
| 91 EnterResource<PPB_AudioInput_API> enter(audio_input, true); | 85 EnterResource<PPB_AudioInput_API> enter(audio_input, true); |
| 92 if (enter.failed()) | 86 if (enter.failed()) |
| 93 return 0; | 87 return 0; |
| 94 return enter.object()->GetCurrentConfig(); | 88 return enter.object()->GetCurrentConfig(); |
| 95 } | 89 } |
| 96 | 90 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 112 | 106 |
| 113 void Close(PP_Resource audio_input) { | 107 void Close(PP_Resource audio_input) { |
| 114 VLOG(4) << "PPB_AudioInput_Dev::Close()"; | 108 VLOG(4) << "PPB_AudioInput_Dev::Close()"; |
| 115 EnterResource<PPB_AudioInput_API> enter(audio_input, true); | 109 EnterResource<PPB_AudioInput_API> enter(audio_input, true); |
| 116 if (enter.failed()) | 110 if (enter.failed()) |
| 117 return; | 111 return; |
| 118 enter.object()->Close(); | 112 enter.object()->Close(); |
| 119 } | 113 } |
| 120 | 114 |
| 121 const PPB_AudioInput_Dev_0_3 g_ppb_audioinput_dev_thunk_0_3 = { | 115 const PPB_AudioInput_Dev_0_3 g_ppb_audioinput_dev_thunk_0_3 = { |
| 122 &Create, | 116 &Create, &IsAudioInput, &EnumerateDevices, |
| 123 &IsAudioInput, | 117 &MonitorDeviceChange, &Open_0_3, &GetCurrentConfig, |
| 124 &EnumerateDevices, | 118 &StartCapture, &StopCapture, &Close}; |
| 125 &MonitorDeviceChange, | |
| 126 &Open_0_3, | |
| 127 &GetCurrentConfig, | |
| 128 &StartCapture, | |
| 129 &StopCapture, | |
| 130 &Close | |
| 131 }; | |
| 132 | 119 |
| 133 const PPB_AudioInput_Dev_0_4 g_ppb_audioinput_dev_thunk_0_4 = { | 120 const PPB_AudioInput_Dev_0_4 g_ppb_audioinput_dev_thunk_0_4 = { |
| 134 &Create, | 121 &Create, &IsAudioInput, &EnumerateDevices, |
| 135 &IsAudioInput, | 122 &MonitorDeviceChange, &Open, &GetCurrentConfig, |
| 136 &EnumerateDevices, | 123 &StartCapture, &StopCapture, &Close}; |
| 137 &MonitorDeviceChange, | |
| 138 &Open, | |
| 139 &GetCurrentConfig, | |
| 140 &StartCapture, | |
| 141 &StopCapture, | |
| 142 &Close | |
| 143 }; | |
| 144 | 124 |
| 145 } // namespace | 125 } // namespace |
| 146 | 126 |
| 147 const PPB_AudioInput_Dev_0_3* GetPPB_AudioInput_Dev_0_3_Thunk() { | 127 const PPB_AudioInput_Dev_0_3* GetPPB_AudioInput_Dev_0_3_Thunk() { |
| 148 return &g_ppb_audioinput_dev_thunk_0_3; | 128 return &g_ppb_audioinput_dev_thunk_0_3; |
| 149 } | 129 } |
| 150 | 130 |
| 151 const PPB_AudioInput_Dev_0_4* GetPPB_AudioInput_Dev_0_4_Thunk() { | 131 const PPB_AudioInput_Dev_0_4* GetPPB_AudioInput_Dev_0_4_Thunk() { |
| 152 return &g_ppb_audioinput_dev_thunk_0_4; | 132 return &g_ppb_audioinput_dev_thunk_0_4; |
| 153 } | 133 } |
| 154 | 134 |
| 155 } // namespace thunk | 135 } // namespace thunk |
| 156 } // namespace ppapi | 136 } // namespace ppapi |
| OLD | NEW |