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

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

Issue 9557007: PPB_AudioInput_Dev: support multiple audio input devices - Part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 9 months 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
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 Mon Nov 28 22:30:37 2011. */ 6 /* From dev/ppb_audio_input_dev.idl modified Wed Feb 29 11:25:47 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/pp_bool.h" 11 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_completion_callback.h"
12 #include "ppapi/c/pp_instance.h" 13 #include "ppapi/c/pp_instance.h"
13 #include "ppapi/c/pp_macros.h" 14 #include "ppapi/c/pp_macros.h"
14 #include "ppapi/c/pp_resource.h" 15 #include "ppapi/c/pp_resource.h"
15 #include "ppapi/c/pp_stdint.h" 16 #include "ppapi/c/pp_stdint.h"
16 17
17 #define PPB_AUDIO_INPUT_DEV_INTERFACE_0_1 "PPB_AudioInput(Dev);0.1" 18 #define PPB_AUDIO_INPUT_DEV_INTERFACE_0_1 "PPB_AudioInput(Dev);0.1"
18 #define PPB_AUDIO_INPUT_DEV_INTERFACE PPB_AUDIO_INPUT_DEV_INTERFACE_0_1 19 #define PPB_AUDIO_INPUT_DEV_INTERFACE_0_2 "PPB_AudioInput(Dev);0.2"
20 #define PPB_AUDIO_INPUT_DEV_INTERFACE PPB_AUDIO_INPUT_DEV_INTERFACE_0_2
19 21
20 /** 22 /**
21 * @file 23 * @file
22 * This file defines the <code>PPB_AudioInput_Dev</code> interface, which 24 * This file defines the <code>PPB_AudioInput_Dev</code> interface, which
23 * provides realtime audio input capture. 25 * provides realtime audio input capture.
24 */ 26 */
25 27
26 28
27 /** 29 /**
28 * @addtogroup Typedefs 30 * @addtogroup Typedefs
(...skipping 12 matching lines...) Expand all
41 */ 43 */
42 44
43 /** 45 /**
44 * @addtogroup Interfaces 46 * @addtogroup Interfaces
45 * @{ 47 * @{
46 */ 48 */
47 /** 49 /**
48 * The <code>PPB_AudioInput_Dev</code> interface contains pointers to several 50 * The <code>PPB_AudioInput_Dev</code> interface contains pointers to several
49 * functions for handling audio input resources. 51 * functions for handling audio input resources.
50 */ 52 */
51 struct PPB_AudioInput_Dev_0_1 { 53 struct PPB_AudioInput_Dev_0_2 {
52 /** 54 /**
53 * Create is a pointer to a function that creates an audio input resource. 55 * Creates an audio input resource.
54 * No sound will be captured until StartCapture() is called. 56 *
57 * @param[in] instance A <code>PP_Instance</code> identifying one instance of
58 * a module.
59 *
60 * @return A <code>PP_Resource</code> corresponding to an audio input resource
61 * if successful, 0 if failed.
55 */ 62 */
56 PP_Resource (*Create)(PP_Instance instance, 63 PP_Resource (*Create)(PP_Instance instance);
57 PP_Resource config,
58 PPB_AudioInput_Callback audio_input_callback,
59 void* user_data);
60 /** 64 /**
61 * IsAudioInput is a pointer to a function that determines if the given 65 * IsAudioInput is a pointer to a function that determines if the given
62 * resource is an audio input resource. 66 * resource is an audio input resource.
63 * 67 *
64 * @param[in] resource A PP_Resource containing a resource. 68 * @param[in] resource A <code>PP_Resource</code> containing a resource.
65 * 69 *
66 * @return A PP_BOOL containing containing PP_TRUE if the given resource is 70 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the given
67 * an audio input resource, otherwise PP_FALSE. 71 * resource is an audio input resource, otherwise <code>PP_FALSE</code>.
68 */ 72 */
69 PP_Bool (*IsAudioInput)(PP_Resource audio_input); 73 PP_Bool (*IsAudioInput)(PP_Resource resource);
74 /**
75 * Enumerates audio input devices.
76 *
77 * Please note that:
78 * - this method ignores the previous value pointed to by <code>devices</code>
79 * (won't release reference even if it is not 0);
80 * - <code>devices</code> must be valid until <code>callback</code> is called,
81 * if the method returns <code>PP_OK_COMPLETIONPENDING</code>;
82 * - the ref count of the returned <code>devices</code> has already been
83 * increased by 1 for the caller.
84 *
85 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio
86 * input resource.
87 * @param[out] devices Once the operation is completed successfully,
88 * <code>devices</code> will be set to a <code>PPB_ResourceArray_Dev</code>
89 * resource, which holds a list of <code>PPB_DeviceRef_Dev</code> resources.
90 * @param[in] callback A <code>PP_CompletionCallback</code> to run on
91 * completion.
92 *
93 * @return An error code from <code>pp_errors.h</code>.
94 */
95 int32_t (*EnumerateDevices)(PP_Resource audio_input,
96 PP_Resource* devices,
97 struct PP_CompletionCallback callback);
98 /**
99 * Opens an audio input device. No sound will be captured until
100 * StartCapture() is called.
101 *
102 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio
103 * input resource.
104 * @param[in] device_ref Identifies an audio input device. It could be one of
105 * the resource in the array returned by EnumerateDevices(), or 0 which means
106 * the default device.
107 * @param[in] config A <code>PPB_AudioConfig</code> audio configuration
108 * resource.
109 * @param[in] audio_input_callback A <code>PPB_AudioInput_Callback</code>
110 * function that will be called when data is available.
111 * @param[inout] user_data An opaque pointer that will be passed into
112 * <code>audio_input_callback</code>.
113 * @param[in] callback A <code>PP_CompletionCallback</code> to run when this
114 * open operation is completed.
115 *
116 * @return An error code from <code>pp_errors.h</code>.
117 */
118 int32_t (*Open)(PP_Resource audio_input,
119 PP_Resource device_ref,
120 PP_Resource config,
121 PPB_AudioInput_Callback audio_input_callback,
122 void* user_data,
123 struct PP_CompletionCallback callback);
70 /** 124 /**
71 * GetCurrrentConfig() returns an audio config resource for the given audio 125 * GetCurrrentConfig() returns an audio config resource for the given audio
72 * resource. 126 * input resource.
73 * 127 *
74 * @param[in] config A <code>PP_Resource</code> corresponding to an audio 128 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio
75 * resource. 129 * input resource.
76 * 130 *
77 * @return A <code>PP_Resource</code> containing the audio config resource if 131 * @return A <code>PP_Resource</code> containing the audio config resource if
78 * successful. 132 * successful.
79 */ 133 */
80 PP_Resource (*GetCurrentConfig)(PP_Resource audio_input); 134 PP_Resource (*GetCurrentConfig)(PP_Resource audio_input);
81 /** 135 /**
82 * StartCapture() starts the capture of the audio input resource and begins 136 * StartCapture() starts the capture of the audio input resource and begins
83 * periodically calling the callback. 137 * periodically calling the callback.
84 * 138 *
85 * @param[in] config A <code>PP_Resource</code> corresponding to an audio 139 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio
86 * input resource. 140 * input resource.
87 * 141 *
88 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if 142 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if
89 * successful, otherwise <code>PP_FALSE</code>. Also returns 143 * successful, otherwise <code>PP_FALSE</code>.
90 * <code>PP_TRUE</code> (and be a no-op) if called while callback is already
91 * in progress.
92 */ 144 */
93 PP_Bool (*StartCapture)(PP_Resource audio_input); 145 PP_Bool (*StartCapture)(PP_Resource audio_input);
94 /** 146 /**
95 * StopCapture is a pointer to a function that stops the capture of 147 * StopCapture is a pointer to a function that stops the capture of
96 * the audio input resource. 148 * the audio input resource.
97 * 149 *
98 * @param[in] config A PP_Resource containing the audio input resource. 150 * @param[in] audio_input A PP_Resource containing the audio input resource.
99 * 151 *
100 * @return A PP_BOOL containing PP_TRUE if successful, otherwise PP_FALSE. 152 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if
101 * Also returns PP_TRUE (and is a no-op) if called while capture is already 153 * successful, otherwise <code>PP_FALSE</code>.
102 * stopped. If a buffer is being captured, StopCapture will block until the 154 * Also returns <code>PP_TRUE</code> (and is a no-op) if called while capture
103 * call completes. 155 * is already stopped. If a buffer is being captured, StopCapture will block
156 * until the call completes.
104 */ 157 */
105 PP_Bool (*StopCapture)(PP_Resource audio_input); 158 PP_Bool (*StopCapture)(PP_Resource audio_input);
159 /**
160 * Closes the audio input device, and stops capturing if necessary. It is
161 * not valid to call Open() again after a call to this method.
162 * If an audio input resource is destroyed while a device is still open, then
163 * it will be implicitly closed, so you are not required to call this method.
164 *
165 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio
166 * input resource.
167 */
168 void (*Close)(PP_Resource audio_input);
106 }; 169 };
107 170
108 typedef struct PPB_AudioInput_Dev_0_1 PPB_AudioInput_Dev; 171 typedef struct PPB_AudioInput_Dev_0_2 PPB_AudioInput_Dev;
172
173 struct PPB_AudioInput_Dev_0_1 {
174 PP_Resource (*Create)(PP_Instance instance,
175 PP_Resource config,
176 PPB_AudioInput_Callback audio_input_callback,
177 void* user_data);
178 PP_Bool (*IsAudioInput)(PP_Resource resource);
179 PP_Resource (*GetCurrentConfig)(PP_Resource audio_input);
180 PP_Bool (*StartCapture)(PP_Resource audio_input);
181 PP_Bool (*StopCapture)(PP_Resource audio_input);
182 };
109 /** 183 /**
110 * @} 184 * @}
111 */ 185 */
112 186
113 #endif /* PPAPI_C_DEV_PPB_AUDIO_INPUT_DEV_H_ */ 187 #endif /* PPAPI_C_DEV_PPB_AUDIO_INPUT_DEV_H_ */
114 188
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698