| 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 | 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, | |
| 13 M19 = 0.2 | 12 M19 = 0.2 |
| 14 }; | 13 }; |
| 15 | 14 |
| 16 /** | 15 /** |
| 17 * <code>PPB_AudioInput_Callback</code> defines the type of an audio callback | 16 * <code>PPB_AudioInput_Callback</code> defines the type of an audio callback |
| 18 * function used to provide the audio buffer with data. This callback will be | 17 * function used to provide the audio buffer with data. This callback will be |
| 19 * called on a separate thread from the creation thread. | 18 * called on a separate thread from the creation thread. |
| 20 */ | 19 */ |
| 21 typedef void PPB_AudioInput_Callback([in] mem_t sample_buffer, | 20 typedef void PPB_AudioInput_Callback([in] mem_t sample_buffer, |
| 22 [in] uint32_t buffer_size_in_bytes, | 21 [in] uint32_t buffer_size_in_bytes, |
| 23 [inout] mem_t user_data); | 22 [inout] mem_t user_data); |
| 24 | 23 |
| 25 /** | 24 /** |
| 26 * The <code>PPB_AudioInput_Dev</code> interface contains pointers to several | 25 * The <code>PPB_AudioInput_Dev</code> interface contains pointers to several |
| 27 * functions for handling audio input resources. | 26 * functions for handling audio input resources. |
| 28 */ | 27 */ |
| 29 [macro="PPB_AUDIO_INPUT_DEV_INTERFACE"] | 28 [macro="PPB_AUDIO_INPUT_DEV_INTERFACE"] |
| 30 interface PPB_AudioInput_Dev { | 29 interface PPB_AudioInput_Dev { |
| 31 [deprecate=0.2] | |
| 32 PP_Resource Create( | |
| 33 [in] PP_Instance instance, | |
| 34 [in] PP_Resource config, | |
| 35 [in] PPB_AudioInput_Callback audio_input_callback, | |
| 36 [inout] mem_t user_data); | |
| 37 | |
| 38 /** | 30 /** |
| 39 * Creates an audio input resource. | 31 * Creates an audio input resource. |
| 40 * | 32 * |
| 41 * @param[in] instance A <code>PP_Instance</code> identifying one instance of | 33 * @param[in] instance A <code>PP_Instance</code> identifying one instance of |
| 42 * a module. | 34 * a module. |
| 43 * | 35 * |
| 44 * @return A <code>PP_Resource</code> corresponding to an audio input resource | 36 * @return A <code>PP_Resource</code> corresponding to an audio input resource |
| 45 * if successful, 0 if failed. | 37 * if successful, 0 if failed. |
| 46 */ | 38 */ |
| 47 [version=0.2] | |
| 48 PP_Resource Create( | 39 PP_Resource Create( |
| 49 [in] PP_Instance instance); | 40 [in] PP_Instance instance); |
| 50 | 41 |
| 51 /** | 42 /** |
| 52 * Determines if the given resource is an audio input resource. | 43 * Determines if the given resource is an audio input resource. |
| 53 * | 44 * |
| 54 * @param[in] resource A <code>PP_Resource</code> containing a resource. | 45 * @param[in] resource A <code>PP_Resource</code> containing a resource. |
| 55 * | 46 * |
| 56 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the given | 47 * @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 * resource is an audio input resource, otherwise <code>PP_FALSE</code>. |
| (...skipping 15 matching lines...) Expand all Loading... |
| 73 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio | 64 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio |
| 74 * input resource. | 65 * input resource. |
| 75 * @param[out] devices Once the operation is completed successfully, | 66 * @param[out] devices Once the operation is completed successfully, |
| 76 * <code>devices</code> will be set to a <code>PPB_ResourceArray_Dev</code> | 67 * <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. | 68 * resource, which holds a list of <code>PPB_DeviceRef_Dev</code> resources. |
| 78 * @param[in] callback A <code>PP_CompletionCallback</code> to run on | 69 * @param[in] callback A <code>PP_CompletionCallback</code> to run on |
| 79 * completion. | 70 * completion. |
| 80 * | 71 * |
| 81 * @return An error code from <code>pp_errors.h</code>. | 72 * @return An error code from <code>pp_errors.h</code>. |
| 82 */ | 73 */ |
| 83 [version=0.2] | |
| 84 int32_t EnumerateDevices( | 74 int32_t EnumerateDevices( |
| 85 [in] PP_Resource audio_input, | 75 [in] PP_Resource audio_input, |
| 86 [out] PP_Resource devices, | 76 [out] PP_Resource devices, |
| 87 [in] PP_CompletionCallback callback); | 77 [in] PP_CompletionCallback callback); |
| 88 | 78 |
| 89 /** | 79 /** |
| 90 * Opens an audio input device. No sound will be captured until | 80 * Opens an audio input device. No sound will be captured until |
| 91 * StartCapture() is called. | 81 * StartCapture() is called. |
| 92 * | 82 * |
| 93 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio | 83 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio |
| 94 * input resource. | 84 * input resource. |
| 95 * @param[in] device_ref Identifies an audio input device. It could be one of | 85 * @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 | 86 * the resource in the array returned by EnumerateDevices(), or 0 which means |
| 97 * the default device. | 87 * the default device. |
| 98 * @param[in] config A <code>PPB_AudioConfig</code> audio configuration | 88 * @param[in] config A <code>PPB_AudioConfig</code> audio configuration |
| 99 * resource. | 89 * resource. |
| 100 * @param[in] audio_input_callback A <code>PPB_AudioInput_Callback</code> | 90 * @param[in] audio_input_callback A <code>PPB_AudioInput_Callback</code> |
| 101 * function that will be called when data is available. | 91 * function that will be called when data is available. |
| 102 * @param[inout] user_data An opaque pointer that will be passed into | 92 * @param[inout] user_data An opaque pointer that will be passed into |
| 103 * <code>audio_input_callback</code>. | 93 * <code>audio_input_callback</code>. |
| 104 * @param[in] callback A <code>PP_CompletionCallback</code> to run when this | 94 * @param[in] callback A <code>PP_CompletionCallback</code> to run when this |
| 105 * open operation is completed. | 95 * open operation is completed. |
| 106 * | 96 * |
| 107 * @return An error code from <code>pp_errors.h</code>. | 97 * @return An error code from <code>pp_errors.h</code>. |
| 108 */ | 98 */ |
| 109 [version=0.2] | |
| 110 int32_t Open( | 99 int32_t Open( |
| 111 [in] PP_Resource audio_input, | 100 [in] PP_Resource audio_input, |
| 112 [in] PP_Resource device_ref, | 101 [in] PP_Resource device_ref, |
| 113 [in] PP_Resource config, | 102 [in] PP_Resource config, |
| 114 [in] PPB_AudioInput_Callback audio_input_callback, | 103 [in] PPB_AudioInput_Callback audio_input_callback, |
| 115 [inout] mem_t user_data, | 104 [inout] mem_t user_data, |
| 116 [in] PP_CompletionCallback callback); | 105 [in] PP_CompletionCallback callback); |
| 117 | 106 |
| 118 /** | 107 /** |
| 119 * Returns an audio config resource for the given audio input resource. | 108 * Returns an audio config resource for the given audio input resource. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 | 147 |
| 159 /** | 148 /** |
| 160 * Closes the audio input device, and stops capturing if necessary. It is | 149 * 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. | 150 * 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 | 151 * 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. | 152 * it will be implicitly closed, so you are not required to call this method. |
| 164 * | 153 * |
| 165 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio | 154 * @param[in] audio_input A <code>PP_Resource</code> corresponding to an audio |
| 166 * input resource. | 155 * input resource. |
| 167 */ | 156 */ |
| 168 [version=0.2] | |
| 169 void Close( | 157 void Close( |
| 170 [in] PP_Resource audio_input); | 158 [in] PP_Resource audio_input); |
| 171 }; | 159 }; |
| OLD | NEW |