Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(182)

Side by Side Diff: ppapi/c/dev/ppb_audio_input_dev.h

Issue 11411047: Introduce PPB_AudioInput_Dev v0.3 and refactor the device enumeration code: (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/api/dev/ppb_device_ref_dev.idl ('k') | ppapi/c/dev/ppb_device_ref_dev.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5
6 /* From dev/ppb_audio_input_dev.idl modified Wed Nov 14 15:08:54 2012. */ 6 /* From dev/ppb_audio_input_dev.idl modified Tue Dec 04 15:13:31 2012. */
7 7
8 #ifndef PPAPI_C_DEV_PPB_AUDIO_INPUT_DEV_H_ 8 #ifndef PPAPI_C_DEV_PPB_AUDIO_INPUT_DEV_H_
9 #define PPAPI_C_DEV_PPB_AUDIO_INPUT_DEV_H_ 9 #define PPAPI_C_DEV_PPB_AUDIO_INPUT_DEV_H_
10 10
11 #include "ppapi/c/dev/ppb_device_ref_dev.h"
12 #include "ppapi/c/pp_array_output.h"
11 #include "ppapi/c/pp_bool.h" 13 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_completion_callback.h" 14 #include "ppapi/c/pp_completion_callback.h"
13 #include "ppapi/c/pp_instance.h" 15 #include "ppapi/c/pp_instance.h"
14 #include "ppapi/c/pp_macros.h" 16 #include "ppapi/c/pp_macros.h"
15 #include "ppapi/c/pp_resource.h" 17 #include "ppapi/c/pp_resource.h"
16 #include "ppapi/c/pp_stdint.h" 18 #include "ppapi/c/pp_stdint.h"
17 19
18 #define PPB_AUDIO_INPUT_DEV_INTERFACE_0_2 "PPB_AudioInput(Dev);0.2" 20 #define PPB_AUDIO_INPUT_DEV_INTERFACE_0_2 "PPB_AudioInput(Dev);0.2"
19 #define PPB_AUDIO_INPUT_DEV_INTERFACE PPB_AUDIO_INPUT_DEV_INTERFACE_0_2 21 #define PPB_AUDIO_INPUT_DEV_INTERFACE_0_3 "PPB_AudioInput(Dev);0.3"
22 #define PPB_AUDIO_INPUT_DEV_INTERFACE PPB_AUDIO_INPUT_DEV_INTERFACE_0_3
20 23
21 /** 24 /**
22 * @file 25 * @file
23 * This file defines the <code>PPB_AudioInput_Dev</code> interface, which 26 * This file defines the <code>PPB_AudioInput_Dev</code> interface, which
24 * provides realtime audio input capture. 27 * provides realtime audio input capture.
25 */ 28 */
26 29
27 30
28 /** 31 /**
29 * @addtogroup Typedefs 32 * @addtogroup Typedefs
(...skipping 25 matching lines...) Expand all
55 * In particular, the params for input assume stereo, but this class takes 58 * In particular, the params for input assume stereo, but this class takes
56 * everything as mono. We either need to not use an audio config resource, or 59 * everything as mono. We either need to not use an audio config resource, or
57 * add mono support. 60 * add mono support.
58 * 61 *
59 * In addition, RecommendSampleFrameCount is completely wrong for audio input. 62 * In addition, RecommendSampleFrameCount is completely wrong for audio input.
60 * RecommendSampleFrameCount returns the frame count for the current 63 * RecommendSampleFrameCount returns the frame count for the current
61 * low-latency output device, which is likely inappropriate for a random input 64 * low-latency output device, which is likely inappropriate for a random input
62 * device. We may want to move the "recommend" functions to the input or output 65 * device. We may want to move the "recommend" functions to the input or output
63 * classes rather than the config. 66 * classes rather than the config.
64 */ 67 */
65 struct PPB_AudioInput_Dev_0_2 { 68 struct PPB_AudioInput_Dev_0_3 {
66 /** 69 /**
67 * Creates an audio input resource. 70 * Creates an audio input resource.
68 * 71 *
69 * @param[in] instance A <code>PP_Instance</code> identifying one instance of 72 * @param[in] instance A <code>PP_Instance</code> identifying one instance of
70 * a module. 73 * a module.
71 * 74 *
72 * @return A <code>PP_Resource</code> corresponding to an audio input resource 75 * @return A <code>PP_Resource</code> corresponding to an audio input resource
73 * if successful, 0 if failed. 76 * if successful, 0 if failed.
74 */ 77 */
75 PP_Resource (*Create)(PP_Instance instance); 78 PP_Resource (*Create)(PP_Instance instance);
76 /** 79 /**
77 * Determines if the given resource is an audio input resource. 80 * Determines if the given resource is an audio input resource.
78 * 81 *
79 * @param[in] resource A <code>PP_Resource</code> containing a resource. 82 * @param[in] resource A <code>PP_Resource</code> containing a resource.
80 * 83 *
81 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the given 84 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the given
82 * resource is an audio input resource, otherwise <code>PP_FALSE</code>. 85 * resource is an audio input resource, otherwise <code>PP_FALSE</code>.
83 */ 86 */
84 PP_Bool (*IsAudioInput)(PP_Resource resource); 87 PP_Bool (*IsAudioInput)(PP_Resource resource);
85 /** 88 /**
86 * Enumerates audio input devices. 89 * Enumerates audio input devices.
87 * 90 *
88 * Please note that:
89 * - this method ignores the previous value pointed to by <code>devices</code>
90 * (won't release reference even if it is not 0);
91 * - <code>devices</code> must be valid until <code>callback</code> is called,
92 * if the method returns <code>PP_OK_COMPLETIONPENDING</code>;
93 * - the ref count of the returned <code>devices</code> has already been
94 * increased by 1 for the caller.
95 *
96 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio 91 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio
97 * input resource. 92 * input resource.
98 * @param[out] devices Once the operation is completed successfully, 93 * @param[in] output An output array which will receive
99 * <code>devices</code> will be set to a <code>PPB_ResourceArray_Dev</code> 94 * <code>PPB_DeviceRef_Dev</code> resources on success. Please note that the
100 * resource, which holds a list of <code>PPB_DeviceRef_Dev</code> resources. 95 * ref count of those resources has already been increased by 1 for the
101 * @param[in] callback A <code>PP_CompletionCallback</code> to run on 96 * caller.
97 * @param[in] callback A <code>PP_CompletionCallback</code> to run on
102 * completion. 98 * completion.
103 * 99 *
104 * @return An error code from <code>pp_errors.h</code>. 100 * @return An error code from <code>pp_errors.h</code>.
105 */ 101 */
106 int32_t (*EnumerateDevices)(PP_Resource audio_input, 102 int32_t (*EnumerateDevices)(PP_Resource audio_input,
107 PP_Resource* devices, 103 struct PP_ArrayOutput output,
108 struct PP_CompletionCallback callback); 104 struct PP_CompletionCallback callback);
109 /** 105 /**
106 * Requests device change notifications.
107 *
108 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio
109 * input resource.
110 * @param[in] callback The callback to receive notifications. If not NULL, it
111 * will be called once for the currently available devices, and then every
112 * time the list of available devices changes. All calls will happen on the
113 * same thread as the one on which MonitorDeviceChange() is called. It will
114 * receive notifications until <code>audio_input</code> is destroyed or
115 * <code>MonitorDeviceChange()</code> is called to set a new callback for
116 * <code>audio_input</code>. You can pass NULL to cancel sending
117 * notifications.
118 * @param[inout] user_data An opaque pointer that will be passed to
119 * <code>callback</code>.
120 *
121 * @return An error code from <code>pp_errors.h</code>.
122 */
123 int32_t (*MonitorDeviceChange)(PP_Resource audio_input,
124 PP_MonitorDeviceChangeCallback callback,
125 void* user_data);
126 /**
110 * Opens an audio input device. No sound will be captured until 127 * Opens an audio input device. No sound will be captured until
111 * StartCapture() is called. 128 * StartCapture() is called.
112 * 129 *
113 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio 130 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio
114 * input resource. 131 * input resource.
115 * @param[in] device_ref Identifies an audio input device. It could be one of 132 * @param[in] device_ref Identifies an audio input device. It could be one of
116 * the resource in the array returned by EnumerateDevices(), or 0 which means 133 * the resource in the array returned by EnumerateDevices(), or 0 which means
117 * the default device. 134 * the default device.
118 * @param[in] config A <code>PPB_AudioConfig</code> audio configuration 135 * @param[in] config A <code>PPB_AudioConfig</code> audio configuration
119 * resource. 136 * resource.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 * not valid to call Open() again after a call to this method. 189 * not valid to call Open() again after a call to this method.
173 * If an audio input resource is destroyed while a device is still open, then 190 * If an audio input resource is destroyed while a device is still open, then
174 * it will be implicitly closed, so you are not required to call this method. 191 * it will be implicitly closed, so you are not required to call this method.
175 * 192 *
176 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio 193 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio
177 * input resource. 194 * input resource.
178 */ 195 */
179 void (*Close)(PP_Resource audio_input); 196 void (*Close)(PP_Resource audio_input);
180 }; 197 };
181 198
182 typedef struct PPB_AudioInput_Dev_0_2 PPB_AudioInput_Dev; 199 typedef struct PPB_AudioInput_Dev_0_3 PPB_AudioInput_Dev;
200
201 struct PPB_AudioInput_Dev_0_2 {
202 PP_Resource (*Create)(PP_Instance instance);
203 PP_Bool (*IsAudioInput)(PP_Resource resource);
204 int32_t (*EnumerateDevices)(PP_Resource audio_input,
205 PP_Resource* devices,
206 struct PP_CompletionCallback callback);
207 int32_t (*Open)(PP_Resource audio_input,
208 PP_Resource device_ref,
209 PP_Resource config,
210 PPB_AudioInput_Callback audio_input_callback,
211 void* user_data,
212 struct PP_CompletionCallback callback);
213 PP_Resource (*GetCurrentConfig)(PP_Resource audio_input);
214 PP_Bool (*StartCapture)(PP_Resource audio_input);
215 PP_Bool (*StopCapture)(PP_Resource audio_input);
216 void (*Close)(PP_Resource audio_input);
217 };
183 /** 218 /**
184 * @} 219 * @}
185 */ 220 */
186 221
187 #endif /* PPAPI_C_DEV_PPB_AUDIO_INPUT_DEV_H_ */ 222 #endif /* PPAPI_C_DEV_PPB_AUDIO_INPUT_DEV_H_ */
188 223
OLDNEW
« no previous file with comments | « ppapi/api/dev/ppb_device_ref_dev.idl ('k') | ppapi/c/dev/ppb_device_ref_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698