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 /* From ppb_audio_input.idl modified Weds Aug 17 2011. */ |
| 7 |
| 8 #ifndef PPAPI_C_DEV_PPB_AUDIO_INPUT_DEV_H_ |
| 9 #define PPAPI_C_DEV_PPB_AUDIO_INPUT_DEV_H_ |
| 10 |
| 11 #include "ppapi/c/pp_bool.h" |
| 12 #include "ppapi/c/pp_instance.h" |
| 13 #include "ppapi/c/pp_macros.h" |
| 14 #include "ppapi/c/pp_resource.h" |
| 15 #include "ppapi/c/pp_stdint.h" |
| 16 |
| 17 /** |
| 18 * @file |
| 19 * This file defines the <code>PPB_Audio_Input</code> interface, which provides |
| 20 * realtime audio input capture. |
| 21 */ |
| 22 |
| 23 /** |
| 24 * @addtogroup Typedefs |
| 25 * @{ |
| 26 */ |
| 27 /** |
| 28 * <code>PPB_Audio_Input_Callback</code> defines the type of an audio callback |
| 29 * function used to provide the audio buffer with data. This callback will be |
| 30 * called on a separate thread to the creation thread. |
| 31 */ |
| 32 typedef void (*PPB_AudioInput_Callback)(void* sample_buffer, |
| 33 uint32_t buffer_size_in_bytes, |
| 34 void* user_data); |
| 35 |
| 36 /** |
| 37 * @addtogroup Interfaces |
| 38 * @{ |
| 39 */ |
| 40 /** |
| 41 * The <code>PPB_AudioInput_Dev</code> interface contains pointers to several fu
nctions |
| 42 * for handling audio input resources. |
| 43 */ |
| 44 |
| 45 #define PPB_AUDIO_INPUT_DEV_INTERFACE_0_1 "PPB_AudioInput(Dev);0.1" |
| 46 #define PPB_AUDIO_INPUT_DEV_INTERFACE PPB_AUDIO_INPUT_DEV_INTERFACE_0_1 |
| 47 |
| 48 struct PPB_AudioInput_Dev { |
| 49 /** |
| 50 * Create is a pointer to a function that creates an audio input resource. |
| 51 * No sound will be captured until StartCapture() is called. |
| 52 */ |
| 53 PP_Resource (*Create)(PP_Instance instance, |
| 54 PPB_AudioInput_Callback audio_input_callback, |
| 55 void* user_data); |
| 56 |
| 57 /** |
| 58 * IsAudioInput is a pointer to a function that determines if the given |
| 59 * resource is an audio input resource. |
| 60 * |
| 61 * @param[in] resource A PP_Resource containing a resource. |
| 62 * |
| 63 * @return A PP_BOOL containing containing PP_TRUE if the given resource is |
| 64 * an audio input resource, otherwise PP_FALSE. |
| 65 */ |
| 66 PP_Bool (*IsAudioInput)(PP_Resource audio_input); |
| 67 |
| 68 |
| 69 PP_Bool (*StartCapture)(PP_Resource audio_input); |
| 70 /** |
| 71 * StopCapture is a pointer to a function that stops the capture of |
| 72 * the audio input resource. |
| 73 * |
| 74 * @param[in] config A PP_Resource containing the audio input resource. |
| 75 * |
| 76 * @return A PP_BOOL containing PP_TRUE if successful, otherwise PP_FALSE. |
| 77 * Also returns PP_TRUE (and is a no-op) if called while capture is already |
| 78 * stopped. If a buffer is being captured, StopCapture will block until the |
| 79 * call completes. |
| 80 */ |
| 81 PP_Bool (*StopCapture)(PP_Resource audio_input); |
| 82 }; |
| 83 /** |
| 84 * @} |
| 85 */ |
| 86 |
| 87 #endif /* PPAPI_C_PPB_AUDIO_INPUT_DEV_H_ */ |
| 88 |
OLD | NEW |