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 dev/ppb_audio_input_dev.idl modified Mon Nov 14 17:58:16 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 #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 | |
20 /** | |
21 * @file | |
22 * This file defines the <code>PPB_AudioInput_Dev</code> interface, which | |
23 * provides realtime audio input capture. | |
24 */ | |
25 | |
26 | |
27 /** | |
28 * @addtogroup Typedefs | |
29 * @{ | |
30 */ | |
31 /** | |
32 * <code>PPB_AudioInput_Callback</code> defines the type of an audio callback | |
33 * function used to provide the audio buffer with data. This callback will be | |
34 * called on a separate thread to the creation thread. | |
35 */ | |
36 typedef void (*PPB_AudioInput_Callback)(void* sample_buffer, | |
37 uint32_t buffer_size_in_bytes, | |
38 void* user_data); | |
39 /** | |
40 * @} | |
41 */ | |
42 | |
43 /** | |
44 * @addtogroup Interfaces | |
45 * @{ | |
46 */ | |
47 /** | |
48 * The <code>PPB_AudioInput_Dev</code> interface contains pointers to several | |
49 * functions for handling audio input resources. | |
50 */ | |
51 struct PPB_AudioInput_Dev { | |
52 /** | |
53 * Create is a pointer to a function that creates an audio input resource. | |
54 * No sound will be captured until StartCapture() is called. | |
55 */ | |
56 PP_Resource (*Create)(PP_Instance instance, | |
57 PP_Resource config, | |
58 PPB_AudioInput_Callback audio_input_callback, | |
59 void* user_data); | |
60 /** | |
61 * IsAudioInput is a pointer to a function that determines if the given | |
62 * resource is an audio input resource. | |
63 * | |
64 * @param[in] resource A PP_Resource containing a resource. | |
65 * | |
66 * @return A PP_BOOL containing containing PP_TRUE if the given resource is | |
67 * an audio input resource, otherwise PP_FALSE. | |
68 */ | |
69 PP_Bool (*IsAudioInput)(PP_Resource audio_input); | |
70 /** | |
71 * GetCurrrentConfig() returns an audio config resource for the given audio | |
72 * resource. | |
73 * | |
74 * @param[in] config A <code>PP_Resource</code> corresponding to an audio | |
75 * resource. | |
76 * | |
77 * @return A <code>PP_Resource</code> containing the audio config resource if | |
78 * successful. | |
79 */ | |
80 PP_Resource (*GetCurrentConfig)(PP_Resource audio_input); | |
81 /** | |
82 * StartCapture() starts the capture of the audio input resource and begins | |
83 * periodically calling the callback. | |
84 * | |
85 * @param[in] config A <code>PP_Resource</code> corresponding to an audio | |
86 * input resource. | |
87 * | |
88 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if | |
89 * successful, otherwise <code>PP_FALSE</code>. Also returns | |
90 * <code>PP_TRUE</code> (and be a no-op) if called while callback is already | |
91 * in progress. | |
92 */ | |
93 PP_Bool (*StartCapture)(PP_Resource audio_input); | |
94 /** | |
95 * StopCapture is a pointer to a function that stops the capture of | |
96 * the audio input resource. | |
97 * | |
98 * @param[in] config A PP_Resource containing the audio input resource. | |
99 * | |
100 * @return A PP_BOOL containing PP_TRUE if successful, otherwise PP_FALSE. | |
101 * Also returns PP_TRUE (and is a no-op) if called while capture is already | |
102 * stopped. If a buffer is being captured, StopCapture will block until the | |
103 * call completes. | |
104 */ | |
105 PP_Bool (*StopCapture)(PP_Resource audio_input); | |
106 }; | |
107 /** | |
108 * @} | |
109 */ | |
110 | |
111 #endif /* PPAPI_C_DEV_PPB_AUDIO_INPUT_DEV_H_ */ | |
112 | |
OLD | NEW |