OLD | NEW |
(Empty) | |
| 1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. |
| 4 */ |
| 5 |
| 6 /** |
| 7 * This file defines the <code>PPB_AudioInput_Dev</code> interface, which |
| 8 * provides realtime audio input capture. |
| 9 */ |
| 10 |
| 11 label Chrome { |
| 12 M17 = 0.1 |
| 13 }; |
| 14 |
| 15 /** |
| 16 * <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 * called on a separate thread to the creation thread. |
| 19 */ |
| 20 typedef void PPB_AudioInput_Callback([out] mem_t sample_buffer, |
| 21 [in] uint32_t buffer_size_in_bytes, |
| 22 [inout] mem_t user_data); |
| 23 |
| 24 /** |
| 25 * The <code>PPB_AudioInput_Dev</code> interface contains pointers to several |
| 26 * functions for handling audio input resources. |
| 27 */ |
| 28 [version=0.1, macro="PPB_AUDIO_INPUT_DEV_INTERFACE"] |
| 29 interface PPB_AudioInput_Dev { |
| 30 /** |
| 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( |
| 35 [in] PP_Instance instance, |
| 36 [in] PP_Resource config, |
| 37 [in] PPB_AudioInput_Callback audio_input_callback, |
| 38 [inout] mem_t user_data); |
| 39 |
| 40 /** |
| 41 * IsAudioInput is a pointer to a function that determines if the given |
| 42 * resource is an audio input resource. |
| 43 * |
| 44 * @param[in] resource A PP_Resource containing a resource. |
| 45 * |
| 46 * @return A PP_BOOL containing containing PP_TRUE if the given resource is |
| 47 * an audio input resource, otherwise PP_FALSE. |
| 48 */ |
| 49 PP_Bool IsAudioInput( |
| 50 [in] PP_Resource audio_input); |
| 51 |
| 52 /** |
| 53 * GetCurrrentConfig() returns an audio config resource for the given audio |
| 54 * resource. |
| 55 * |
| 56 * @param[in] config A <code>PP_Resource</code> corresponding to an audio |
| 57 * resource. |
| 58 * |
| 59 * @return A <code>PP_Resource</code> containing the audio config resource if |
| 60 * successful. |
| 61 */ |
| 62 PP_Resource GetCurrentConfig( |
| 63 [in] PP_Resource audio_input); |
| 64 |
| 65 /** |
| 66 * StartCapture() starts the capture of the audio input resource and begins |
| 67 * periodically calling the callback. |
| 68 * |
| 69 * @param[in] config A <code>PP_Resource</code> corresponding to an audio |
| 70 * input resource. |
| 71 * |
| 72 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if |
| 73 * successful, otherwise <code>PP_FALSE</code>. Also returns |
| 74 * <code>PP_TRUE</code> (and be a no-op) if called while callback is already |
| 75 * in progress. |
| 76 */ |
| 77 PP_Bool StartCapture( |
| 78 [in] PP_Resource audio_input); |
| 79 |
| 80 /** |
| 81 * StopCapture is a pointer to a function that stops the capture of |
| 82 * the audio input resource. |
| 83 * |
| 84 * @param[in] config A PP_Resource containing the audio input resource. |
| 85 * |
| 86 * @return A PP_BOOL containing PP_TRUE if successful, otherwise PP_FALSE. |
| 87 * Also returns PP_TRUE (and is a no-op) if called while capture is already |
| 88 * stopped. If a buffer is being captured, StopCapture will block until the |
| 89 * call completes. |
| 90 */ |
| 91 PP_Bool StopCapture( |
| 92 [in] PP_Resource audio_input); |
| 93 }; |
| 94 |
OLD | NEW |