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

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: Changes in response to Trung's comments. 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
« no previous file with comments | « ppapi/api/dev/ppb_audio_input_dev.idl ('k') | ppapi/cpp/dev/audio_input_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 Mon Nov 28 22:30:37 2011. */ 6 /* From dev/ppb_audio_input_dev.idl modified Sat Mar 3 23:06:35 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 * Determines if the given resource is an audio input resource.
62 * resource is an audio input resource.
63 * 66 *
64 * @param[in] resource A PP_Resource containing a resource. 67 * @param[in] resource A <code>PP_Resource</code> containing a resource.
65 * 68 *
66 * @return A PP_BOOL containing containing PP_TRUE if the given resource is 69 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the given
67 * an audio input resource, otherwise PP_FALSE. 70 * resource is an audio input resource, otherwise <code>PP_FALSE</code>.
68 */ 71 */
69 PP_Bool (*IsAudioInput)(PP_Resource audio_input); 72 PP_Bool (*IsAudioInput)(PP_Resource resource);
70 /** 73 /**
71 * GetCurrrentConfig() returns an audio config resource for the given audio 74 * Enumerates audio input devices.
75 *
76 * Please note that:
77 * - this method ignores the previous value pointed to by <code>devices</code>
78 * (won't release reference even if it is not 0);
79 * - <code>devices</code> must be valid until <code>callback</code> is called,
80 * if the method returns <code>PP_OK_COMPLETIONPENDING</code>;
81 * - the ref count of the returned <code>devices</code> has already been
82 * increased by 1 for the caller.
83 *
84 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio
85 * input resource.
86 * @param[out] devices Once the operation is completed successfully,
87 * <code>devices</code> will be set to a <code>PPB_ResourceArray_Dev</code>
88 * resource, which holds a list of <code>PPB_DeviceRef_Dev</code> resources.
89 * @param[in] callback A <code>PP_CompletionCallback</code> to run on
90 * completion.
91 *
92 * @return An error code from <code>pp_errors.h</code>.
93 */
94 int32_t (*EnumerateDevices)(PP_Resource audio_input,
95 PP_Resource* devices,
96 struct PP_CompletionCallback callback);
97 /**
98 * Opens an audio input device. No sound will be captured until
99 * StartCapture() is called.
100 *
101 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio
102 * input resource.
103 * @param[in] device_ref Identifies an audio input device. It could be one of
104 * the resource in the array returned by EnumerateDevices(), or 0 which means
105 * the default device.
106 * @param[in] config A <code>PPB_AudioConfig</code> audio configuration
72 * resource. 107 * resource.
108 * @param[in] audio_input_callback A <code>PPB_AudioInput_Callback</code>
109 * function that will be called when data is available.
110 * @param[inout] user_data An opaque pointer that will be passed into
111 * <code>audio_input_callback</code>.
112 * @param[in] callback A <code>PP_CompletionCallback</code> to run when this
113 * open operation is completed.
73 * 114 *
74 * @param[in] config A <code>PP_Resource</code> corresponding to an audio 115 * @return An error code from <code>pp_errors.h</code>.
75 * resource. 116 */
117 int32_t (*Open)(PP_Resource audio_input,
118 PP_Resource device_ref,
119 PP_Resource config,
120 PPB_AudioInput_Callback audio_input_callback,
121 void* user_data,
122 struct PP_CompletionCallback callback);
123 /**
124 * Returns an audio config resource for the given audio input resource.
125 *
126 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio
127 * input resource.
76 * 128 *
77 * @return A <code>PP_Resource</code> containing the audio config resource if 129 * @return A <code>PP_Resource</code> containing the audio config resource if
78 * successful. 130 * successful.
79 */ 131 */
80 PP_Resource (*GetCurrentConfig)(PP_Resource audio_input); 132 PP_Resource (*GetCurrentConfig)(PP_Resource audio_input);
81 /** 133 /**
82 * StartCapture() starts the capture of the audio input resource and begins 134 * Starts the capture of the audio input resource and begins periodically
83 * periodically calling the callback. 135 * calling the callback.
84 * 136 *
85 * @param[in] config A <code>PP_Resource</code> corresponding to an audio 137 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio
86 * input resource. 138 * input resource.
87 * 139 *
88 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if 140 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if
89 * successful, otherwise <code>PP_FALSE</code>. Also returns 141 * successful, otherwise <code>PP_FALSE</code>.
90 * <code>PP_TRUE</code> (and be a no-op) if called while callback is already 142 * Also returns <code>PP_TRUE</code> (and is a no-op) if called while capture
91 * in progress. 143 * is already started.
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 * Stops the capture of the audio input resource.
96 * the audio input resource.
97 * 148 *
98 * @param[in] config A PP_Resource containing the audio input resource. 149 * @param[in] audio_input A PP_Resource containing the audio input resource.
99 * 150 *
100 * @return A PP_BOOL containing PP_TRUE if successful, otherwise PP_FALSE. 151 * @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 152 * successful, otherwise <code>PP_FALSE</code>.
102 * stopped. If a buffer is being captured, StopCapture will block until the 153 * Also returns <code>PP_TRUE</code> (and is a no-op) if called while capture
103 * call completes. 154 * is already stopped. If a buffer is being captured, StopCapture will block
155 * until the call completes.
104 */ 156 */
105 PP_Bool (*StopCapture)(PP_Resource audio_input); 157 PP_Bool (*StopCapture)(PP_Resource audio_input);
158 /**
159 * Closes the audio input device, and stops capturing if necessary. It is
160 * not valid to call Open() again after a call to this method.
161 * If an audio input resource is destroyed while a device is still open, then
162 * it will be implicitly closed, so you are not required to call this method.
163 *
164 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio
165 * input resource.
166 */
167 void (*Close)(PP_Resource audio_input);
106 }; 168 };
107 169
108 typedef struct PPB_AudioInput_Dev_0_1 PPB_AudioInput_Dev; 170 typedef struct PPB_AudioInput_Dev_0_2 PPB_AudioInput_Dev;
171
172 struct PPB_AudioInput_Dev_0_1 {
173 PP_Resource (*Create)(PP_Instance instance,
174 PP_Resource config,
175 PPB_AudioInput_Callback audio_input_callback,
176 void* user_data);
177 PP_Bool (*IsAudioInput)(PP_Resource resource);
178 PP_Resource (*GetCurrentConfig)(PP_Resource audio_input);
179 PP_Bool (*StartCapture)(PP_Resource audio_input);
180 PP_Bool (*StopCapture)(PP_Resource audio_input);
181 };
109 /** 182 /**
110 * @} 183 * @}
111 */ 184 */
112 185
113 #endif /* PPAPI_C_DEV_PPB_AUDIO_INPUT_DEV_H_ */ 186 #endif /* PPAPI_C_DEV_PPB_AUDIO_INPUT_DEV_H_ */
114 187
OLDNEW
« no previous file with comments | « ppapi/api/dev/ppb_audio_input_dev.idl ('k') | ppapi/cpp/dev/audio_input_dev.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698