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" |
(...skipping 13 matching lines...) Expand all Loading... |
24 return 0; | 24 return 0; |
25 | 25 |
26 return enter.functions()->CreateAudioInput(instance); | 26 return enter.functions()->CreateAudioInput(instance); |
27 } | 27 } |
28 | 28 |
29 PP_Bool IsAudioInput(PP_Resource resource) { | 29 PP_Bool IsAudioInput(PP_Resource resource) { |
30 EnterAudioInput enter(resource, false); | 30 EnterAudioInput enter(resource, false); |
31 return PP_FromBool(enter.succeeded()); | 31 return PP_FromBool(enter.succeeded()); |
32 } | 32 } |
33 | 33 |
| 34 int32_t EnumerateDevices0_2(PP_Resource audio_input, |
| 35 PP_Resource* devices, |
| 36 PP_CompletionCallback callback) { |
| 37 EnterAudioInput enter(audio_input, callback, true); |
| 38 if (enter.failed()) |
| 39 return enter.retval(); |
| 40 |
| 41 return enter.SetResult(enter.object()->EnumerateDevices0_2(devices, |
| 42 enter.callback())); |
| 43 } |
| 44 |
34 int32_t EnumerateDevices(PP_Resource audio_input, | 45 int32_t EnumerateDevices(PP_Resource audio_input, |
35 PP_Resource* devices, | 46 PP_ArrayOutput output, |
36 PP_CompletionCallback callback) { | 47 PP_CompletionCallback callback) { |
37 EnterAudioInput enter(audio_input, callback, true); | 48 EnterAudioInput enter(audio_input, callback, true); |
38 if (enter.failed()) | 49 if (enter.failed()) |
39 return enter.retval(); | 50 return enter.retval(); |
40 | 51 |
41 return enter.SetResult(enter.object()->EnumerateDevices(devices, | 52 return enter.SetResult(enter.object()->EnumerateDevices(output, |
42 enter.callback())); | 53 enter.callback())); |
43 } | 54 } |
44 | 55 |
| 56 int32_t MonitorDeviceChange(PP_Resource audio_input, |
| 57 PP_MonitorDeviceChangeCallback callback, |
| 58 void* user_data) { |
| 59 EnterAudioInput enter(audio_input, true); |
| 60 if (enter.failed()) |
| 61 return enter.retval(); |
| 62 return enter.object()->MonitorDeviceChange(callback, user_data); |
| 63 } |
| 64 |
45 int32_t Open(PP_Resource audio_input, | 65 int32_t Open(PP_Resource audio_input, |
46 PP_Resource device_ref, | 66 PP_Resource device_ref, |
47 PP_Resource config, | 67 PP_Resource config, |
48 PPB_AudioInput_Callback audio_input_callback, | 68 PPB_AudioInput_Callback audio_input_callback, |
49 void* user_data, | 69 void* user_data, |
50 PP_CompletionCallback callback) { | 70 PP_CompletionCallback callback) { |
51 EnterAudioInput enter(audio_input, callback, true); | 71 EnterAudioInput enter(audio_input, callback, true); |
52 if (enter.failed()) | 72 if (enter.failed()) |
53 return enter.retval(); | 73 return enter.retval(); |
54 | 74 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 111 |
92 void Close(PP_Resource audio_input) { | 112 void Close(PP_Resource audio_input) { |
93 EnterAudioInput enter(audio_input, true); | 113 EnterAudioInput enter(audio_input, true); |
94 if (enter.succeeded()) | 114 if (enter.succeeded()) |
95 enter.object()->Close(); | 115 enter.object()->Close(); |
96 } | 116 } |
97 | 117 |
98 const PPB_AudioInput_Dev_0_2 g_ppb_audioinput_0_2_thunk = { | 118 const PPB_AudioInput_Dev_0_2 g_ppb_audioinput_0_2_thunk = { |
99 &Create, | 119 &Create, |
100 &IsAudioInput, | 120 &IsAudioInput, |
101 &EnumerateDevices, | 121 &EnumerateDevices0_2, |
102 &Open, | 122 &Open, |
103 &GetCurrentConfig, | 123 &GetCurrentConfig, |
104 &StartCapture, | 124 &StartCapture, |
| 125 &StopCapture, |
| 126 &Close |
| 127 }; |
| 128 |
| 129 const PPB_AudioInput_Dev_0_3 g_ppb_audioinput_0_3_thunk = { |
| 130 &Create, |
| 131 &IsAudioInput, |
| 132 &EnumerateDevices, |
| 133 &MonitorDeviceChange, |
| 134 &Open, |
| 135 &GetCurrentConfig, |
| 136 &StartCapture, |
105 &StopCapture, | 137 &StopCapture, |
106 &Close | 138 &Close |
107 }; | 139 }; |
108 | 140 |
109 } // namespace | 141 } // namespace |
110 | 142 |
111 const PPB_AudioInput_Dev_0_2* GetPPB_AudioInput_Dev_0_2_Thunk() { | 143 const PPB_AudioInput_Dev_0_2* GetPPB_AudioInput_Dev_0_2_Thunk() { |
112 return &g_ppb_audioinput_0_2_thunk; | 144 return &g_ppb_audioinput_0_2_thunk; |
113 } | 145 } |
114 | 146 |
| 147 const PPB_AudioInput_Dev_0_3* GetPPB_AudioInput_Dev_0_3_Thunk() { |
| 148 return &g_ppb_audioinput_0_3_thunk; |
| 149 } |
| 150 |
115 } // namespace thunk | 151 } // namespace thunk |
116 } // namespace ppapi | 152 } // namespace ppapi |
OLD | NEW |