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

Side by Side Diff: ppapi/api/dev/ppb_audio_input_dev.idl

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 Brett'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 | « no previous file | ppapi/c/dev/ppb_audio_input_dev.h » ('j') | ppapi/cpp/dev/audio_input_dev.h » ('J')
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 /** 6 /**
7 * This file defines the <code>PPB_AudioInput_Dev</code> interface, which 7 * This file defines the <code>PPB_AudioInput_Dev</code> interface, which
8 * provides realtime audio input capture. 8 * provides realtime audio input capture.
9 */ 9 */
10 10
11 label Chrome { 11 label Chrome {
12 M17 = 0.1 12 M17 = 0.1,
13 M19 = 0.2
13 }; 14 };
14 15
15 /** 16 /**
16 * <code>PPB_AudioInput_Callback</code> defines the type of an audio callback 17 * <code>PPB_AudioInput_Callback</code> defines the type of an audio callback
17 * function used to provide the audio buffer with data. This callback will be 18 * function used to provide the audio buffer with data. This callback will be
18 * called on a separate thread from the creation thread. 19 * called on a separate thread from the creation thread.
19 */ 20 */
20 typedef void PPB_AudioInput_Callback([in] mem_t sample_buffer, 21 typedef void PPB_AudioInput_Callback([in] mem_t sample_buffer,
21 [in] uint32_t buffer_size_in_bytes, 22 [in] uint32_t buffer_size_in_bytes,
22 [inout] mem_t user_data); 23 [inout] mem_t user_data);
23 24
24 /** 25 /**
25 * The <code>PPB_AudioInput_Dev</code> interface contains pointers to several 26 * The <code>PPB_AudioInput_Dev</code> interface contains pointers to several
26 * functions for handling audio input resources. 27 * functions for handling audio input resources.
27 */ 28 */
28 [version=0.1, macro="PPB_AUDIO_INPUT_DEV_INTERFACE"] 29 [macro="PPB_AUDIO_INPUT_DEV_INTERFACE"]
29 interface PPB_AudioInput_Dev { 30 interface PPB_AudioInput_Dev {
30 /** 31 [version=0.1]
viettrungluu 2012/03/06 19:17:28 Probably this should have a "deprecate" label.
yzshen1 2012/03/07 00:30:36 Done.
31 * Create is a pointer to a function that creates an audio input resource.
32 * No sound will be captured until StartCapture() is called.
33 */
34 PP_Resource Create( 32 PP_Resource Create(
35 [in] PP_Instance instance, 33 [in] PP_Instance instance,
36 [in] PP_Resource config, 34 [in] PP_Resource config,
37 [in] PPB_AudioInput_Callback audio_input_callback, 35 [in] PPB_AudioInput_Callback audio_input_callback,
38 [inout] mem_t user_data); 36 [inout] mem_t user_data);
39 37
40 /** 38 /**
41 * IsAudioInput is a pointer to a function that determines if the given 39 * Creates an audio input resource.
42 * resource is an audio input resource.
43 * 40 *
44 * @param[in] resource A PP_Resource containing a resource. 41 * @param[in] instance A <code>PP_Instance</code> identifying one instance of
42 * a module.
45 * 43 *
46 * @return A PP_BOOL containing containing PP_TRUE if the given resource is 44 * @return A <code>PP_Resource</code> corresponding to an audio input resource
47 * an audio input resource, otherwise PP_FALSE. 45 * if successful, 0 if failed.
46 */
47 [version=0.2]
48 PP_Resource Create(
49 [in] PP_Instance instance);
50
51 /**
52 * Determines if the given resource is an audio input resource.
53 *
54 * @param[in] resource A <code>PP_Resource</code> containing a resource.
55 *
56 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the given
57 * resource is an audio input resource, otherwise <code>PP_FALSE</code>.
48 */ 58 */
49 PP_Bool IsAudioInput( 59 PP_Bool IsAudioInput(
50 [in] PP_Resource audio_input); 60 [in] PP_Resource resource);
51 61
52 /** 62 /**
53 * GetCurrrentConfig() returns an audio config resource for the given audio 63 * Enumerates audio input devices.
64 *
65 * Please note that:
66 * - this method ignores the previous value pointed to by <code>devices</code>
67 * (won't release reference even if it is not 0);
68 * - <code>devices</code> must be valid until <code>callback</code> is called,
69 * if the method returns <code>PP_OK_COMPLETIONPENDING</code>;
70 * - the ref count of the returned <code>devices</code> has already been
71 * increased by 1 for the caller.
72 *
73 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio
74 * input resource.
75 * @param[out] devices Once the operation is completed successfully,
76 * <code>devices</code> will be set to a <code>PPB_ResourceArray_Dev</code>
77 * resource, which holds a list of <code>PPB_DeviceRef_Dev</code> resources.
78 * @param[in] callback A <code>PP_CompletionCallback</code> to run on
79 * completion.
80 *
81 * @return An error code from <code>pp_errors.h</code>.
82 */
83 [version=0.2]
84 int32_t EnumerateDevices(
85 [in] PP_Resource audio_input,
86 [out] PP_Resource devices,
87 [in] PP_CompletionCallback callback);
88
89 /**
90 * Opens an audio input device. No sound will be captured until
91 * StartCapture() is called.
92 *
93 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio
94 * input resource.
95 * @param[in] device_ref Identifies an audio input device. It could be one of
96 * the resource in the array returned by EnumerateDevices(), or 0 which means
97 * the default device.
98 * @param[in] config A <code>PPB_AudioConfig</code> audio configuration
54 * resource. 99 * resource.
100 * @param[in] audio_input_callback A <code>PPB_AudioInput_Callback</code>
101 * function that will be called when data is available.
102 * @param[inout] user_data An opaque pointer that will be passed into
103 * <code>audio_input_callback</code>.
104 * @param[in] callback A <code>PP_CompletionCallback</code> to run when this
105 * open operation is completed.
55 * 106 *
56 * @param[in] config A <code>PP_Resource</code> corresponding to an audio 107 * @return An error code from <code>pp_errors.h</code>.
57 * resource. 108 */
109 [version=0.2]
110 int32_t Open(
111 [in] PP_Resource audio_input,
112 [in] PP_Resource device_ref,
113 [in] PP_Resource config,
114 [in] PPB_AudioInput_Callback audio_input_callback,
115 [inout] mem_t user_data,
116 [in] PP_CompletionCallback callback);
117
118 /**
119 * Returns an audio config resource for the given audio input resource.
120 *
121 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio
122 * input resource.
58 * 123 *
59 * @return A <code>PP_Resource</code> containing the audio config resource if 124 * @return A <code>PP_Resource</code> containing the audio config resource if
60 * successful. 125 * successful.
61 */ 126 */
62 PP_Resource GetCurrentConfig( 127 PP_Resource GetCurrentConfig(
63 [in] PP_Resource audio_input); 128 [in] PP_Resource audio_input);
64 129
65 /** 130 /**
66 * StartCapture() starts the capture of the audio input resource and begins 131 * Starts the capture of the audio input resource and begins periodically
67 * periodically calling the callback. 132 * calling the callback.
68 * 133 *
69 * @param[in] config A <code>PP_Resource</code> corresponding to an audio 134 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio
70 * input resource. 135 * input resource.
71 * 136 *
72 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if 137 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if
73 * successful, otherwise <code>PP_FALSE</code>. Also returns 138 * successful, otherwise <code>PP_FALSE</code>.
74 * <code>PP_TRUE</code> (and be a no-op) if called while callback is already 139 * Also returns <code>PP_TRUE</code> (and is a no-op) if called while capture
75 * in progress. 140 * is already started.
76 */ 141 */
77 PP_Bool StartCapture( 142 PP_Bool StartCapture(
78 [in] PP_Resource audio_input); 143 [in] PP_Resource audio_input);
79 144
80 /** 145 /**
81 * StopCapture is a pointer to a function that stops the capture of 146 * Stops the capture of the audio input resource.
82 * the audio input resource.
83 * 147 *
84 * @param[in] config A PP_Resource containing the audio input resource. 148 * @param[in] audio_input A PP_Resource containing the audio input resource.
85 * 149 *
86 * @return A PP_BOOL containing PP_TRUE if successful, otherwise PP_FALSE. 150 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if
87 * Also returns PP_TRUE (and is a no-op) if called while capture is already 151 * successful, otherwise <code>PP_FALSE</code>.
88 * stopped. If a buffer is being captured, StopCapture will block until the 152 * Also returns <code>PP_TRUE</code> (and is a no-op) if called while capture
89 * call completes. 153 * is already stopped. If a buffer is being captured, StopCapture will block
154 * until the call completes.
90 */ 155 */
91 PP_Bool StopCapture( 156 PP_Bool StopCapture(
92 [in] PP_Resource audio_input); 157 [in] PP_Resource audio_input);
158
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 [version=0.2]
169 void Close(
170 [in] PP_Resource audio_input);
93 }; 171 };
94
OLDNEW
« no previous file with comments | « no previous file | ppapi/c/dev/ppb_audio_input_dev.h » ('j') | ppapi/cpp/dev/audio_input_dev.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698