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 13 matching lines...) Expand all Loading... |
24 return 0; | 24 return 0; |
25 return enter.functions()->CreateAudioInput(instance); | 25 return enter.functions()->CreateAudioInput(instance); |
26 } | 26 } |
27 | 27 |
28 PP_Bool IsAudioInput(PP_Resource resource) { | 28 PP_Bool IsAudioInput(PP_Resource resource) { |
29 VLOG(4) << "PPB_AudioInput_Dev::IsAudioInput()"; | 29 VLOG(4) << "PPB_AudioInput_Dev::IsAudioInput()"; |
30 EnterResource<PPB_AudioInput_API> enter(resource, false); | 30 EnterResource<PPB_AudioInput_API> enter(resource, false); |
31 return PP_FromBool(enter.succeeded()); | 31 return PP_FromBool(enter.succeeded()); |
32 } | 32 } |
33 | 33 |
34 int32_t EnumerateDevices_0_2(PP_Resource audio_input, | |
35 PP_Resource* devices, | |
36 struct PP_CompletionCallback callback) { | |
37 VLOG(4) << "PPB_AudioInput_Dev::EnumerateDevices()"; | |
38 EnterResource<PPB_AudioInput_API> enter(audio_input, callback, true); | |
39 if (enter.failed()) | |
40 return enter.retval(); | |
41 return enter.SetResult(enter.object()->EnumerateDevices0_2( | |
42 devices, | |
43 enter.callback())); | |
44 } | |
45 | |
46 int32_t EnumerateDevices(PP_Resource audio_input, | 34 int32_t EnumerateDevices(PP_Resource audio_input, |
47 struct PP_ArrayOutput output, | 35 struct PP_ArrayOutput output, |
48 struct PP_CompletionCallback callback) { | 36 struct PP_CompletionCallback callback) { |
49 VLOG(4) << "PPB_AudioInput_Dev::EnumerateDevices()"; | 37 VLOG(4) << "PPB_AudioInput_Dev::EnumerateDevices()"; |
50 EnterResource<PPB_AudioInput_API> enter(audio_input, callback, true); | 38 EnterResource<PPB_AudioInput_API> enter(audio_input, callback, true); |
51 if (enter.failed()) | 39 if (enter.failed()) |
52 return enter.retval(); | 40 return enter.retval(); |
53 return enter.SetResult(enter.object()->EnumerateDevices(output, | 41 return enter.SetResult(enter.object()->EnumerateDevices(output, |
54 enter.callback())); | 42 enter.callback())); |
55 } | 43 } |
56 | 44 |
57 int32_t MonitorDeviceChange(PP_Resource audio_input, | 45 int32_t MonitorDeviceChange(PP_Resource audio_input, |
58 PP_MonitorDeviceChangeCallback callback, | 46 PP_MonitorDeviceChangeCallback callback, |
59 void* user_data) { | 47 void* user_data) { |
60 VLOG(4) << "PPB_AudioInput_Dev::MonitorDeviceChange()"; | 48 VLOG(4) << "PPB_AudioInput_Dev::MonitorDeviceChange()"; |
61 EnterResource<PPB_AudioInput_API> enter(audio_input, true); | 49 EnterResource<PPB_AudioInput_API> enter(audio_input, true); |
62 if (enter.failed()) | 50 if (enter.failed()) |
63 return enter.retval(); | 51 return enter.retval(); |
64 return enter.object()->MonitorDeviceChange(callback, user_data); | 52 return enter.object()->MonitorDeviceChange(callback, user_data); |
65 } | 53 } |
66 | 54 |
67 int32_t Open_0_2(PP_Resource audio_input, | 55 int32_t Open_0_3(PP_Resource audio_input, |
68 PP_Resource device_ref, | 56 PP_Resource device_ref, |
69 PP_Resource config, | 57 PP_Resource config, |
70 PPB_AudioInput_Callback_0_2 audio_input_callback, | 58 PPB_AudioInput_Callback_0_3 audio_input_callback, |
71 void* user_data, | 59 void* user_data, |
72 struct PP_CompletionCallback callback) { | 60 struct PP_CompletionCallback callback) { |
73 VLOG(4) << "PPB_AudioInput_Dev::Open()"; | 61 VLOG(4) << "PPB_AudioInput_Dev::Open()"; |
74 EnterResource<PPB_AudioInput_API> enter(audio_input, callback, true); | 62 EnterResource<PPB_AudioInput_API> enter(audio_input, callback, true); |
75 if (enter.failed()) | 63 if (enter.failed()) |
76 return enter.retval(); | 64 return enter.retval(); |
77 return enter.SetResult(enter.object()->Open0_2(device_ref, | 65 return enter.SetResult(enter.object()->Open0_3(device_ref, |
78 config, | 66 config, |
79 audio_input_callback, | 67 audio_input_callback, |
80 user_data, | 68 user_data, |
81 enter.callback())); | 69 enter.callback())); |
82 } | 70 } |
83 | 71 |
84 int32_t Open(PP_Resource audio_input, | 72 int32_t Open(PP_Resource audio_input, |
85 PP_Resource device_ref, | 73 PP_Resource device_ref, |
86 PP_Resource config, | 74 PP_Resource config, |
87 PPB_AudioInput_Callback audio_input_callback, | 75 PPB_AudioInput_Callback audio_input_callback, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 } | 111 } |
124 | 112 |
125 void Close(PP_Resource audio_input) { | 113 void Close(PP_Resource audio_input) { |
126 VLOG(4) << "PPB_AudioInput_Dev::Close()"; | 114 VLOG(4) << "PPB_AudioInput_Dev::Close()"; |
127 EnterResource<PPB_AudioInput_API> enter(audio_input, true); | 115 EnterResource<PPB_AudioInput_API> enter(audio_input, true); |
128 if (enter.failed()) | 116 if (enter.failed()) |
129 return; | 117 return; |
130 enter.object()->Close(); | 118 enter.object()->Close(); |
131 } | 119 } |
132 | 120 |
133 const PPB_AudioInput_Dev_0_2 g_ppb_audioinput_dev_thunk_0_2 = { | |
134 &Create, | |
135 &IsAudioInput, | |
136 &EnumerateDevices_0_2, | |
137 &Open_0_2, | |
138 &GetCurrentConfig, | |
139 &StartCapture, | |
140 &StopCapture, | |
141 &Close | |
142 }; | |
143 | |
144 const PPB_AudioInput_Dev_0_3 g_ppb_audioinput_dev_thunk_0_3 = { | 121 const PPB_AudioInput_Dev_0_3 g_ppb_audioinput_dev_thunk_0_3 = { |
145 &Create, | 122 &Create, |
146 &IsAudioInput, | 123 &IsAudioInput, |
147 &EnumerateDevices, | 124 &EnumerateDevices, |
148 &MonitorDeviceChange, | 125 &MonitorDeviceChange, |
149 &Open_0_2, | 126 &Open_0_3, |
150 &GetCurrentConfig, | 127 &GetCurrentConfig, |
151 &StartCapture, | 128 &StartCapture, |
152 &StopCapture, | 129 &StopCapture, |
153 &Close | 130 &Close |
154 }; | 131 }; |
155 | 132 |
156 const PPB_AudioInput_Dev_0_4 g_ppb_audioinput_dev_thunk_0_4 = { | 133 const PPB_AudioInput_Dev_0_4 g_ppb_audioinput_dev_thunk_0_4 = { |
157 &Create, | 134 &Create, |
158 &IsAudioInput, | 135 &IsAudioInput, |
159 &EnumerateDevices, | 136 &EnumerateDevices, |
160 &MonitorDeviceChange, | 137 &MonitorDeviceChange, |
161 &Open, | 138 &Open, |
162 &GetCurrentConfig, | 139 &GetCurrentConfig, |
163 &StartCapture, | 140 &StartCapture, |
164 &StopCapture, | 141 &StopCapture, |
165 &Close | 142 &Close |
166 }; | 143 }; |
167 | 144 |
168 } // namespace | 145 } // namespace |
169 | 146 |
170 const PPB_AudioInput_Dev_0_2* GetPPB_AudioInput_Dev_0_2_Thunk() { | |
171 return &g_ppb_audioinput_dev_thunk_0_2; | |
172 } | |
173 | |
174 const PPB_AudioInput_Dev_0_3* GetPPB_AudioInput_Dev_0_3_Thunk() { | 147 const PPB_AudioInput_Dev_0_3* GetPPB_AudioInput_Dev_0_3_Thunk() { |
175 return &g_ppb_audioinput_dev_thunk_0_3; | 148 return &g_ppb_audioinput_dev_thunk_0_3; |
176 } | 149 } |
177 | 150 |
178 const PPB_AudioInput_Dev_0_4* GetPPB_AudioInput_Dev_0_4_Thunk() { | 151 const PPB_AudioInput_Dev_0_4* GetPPB_AudioInput_Dev_0_4_Thunk() { |
179 return &g_ppb_audioinput_dev_thunk_0_4; | 152 return &g_ppb_audioinput_dev_thunk_0_4; |
180 } | 153 } |
181 | 154 |
182 } // namespace thunk | 155 } // namespace thunk |
183 } // namespace ppapi | 156 } // namespace ppapi |
OLD | NEW |