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 /* From ppb_audio_config.idl modified Fri Jan 20 13:12:44 2012. */ | 6 /* From ppb_audio_config.idl modified Thu Feb 16 16:23:46 2012. */ |
7 | 7 |
8 #ifndef PPAPI_C_PPB_AUDIO_CONFIG_H_ | 8 #ifndef PPAPI_C_PPB_AUDIO_CONFIG_H_ |
9 #define PPAPI_C_PPB_AUDIO_CONFIG_H_ | 9 #define PPAPI_C_PPB_AUDIO_CONFIG_H_ |
10 | 10 |
11 #include "ppapi/c/pp_bool.h" | 11 #include "ppapi/c/pp_bool.h" |
12 #include "ppapi/c/pp_instance.h" | 12 #include "ppapi/c/pp_instance.h" |
13 #include "ppapi/c/pp_macros.h" | 13 #include "ppapi/c/pp_macros.h" |
14 #include "ppapi/c/pp_resource.h" | 14 #include "ppapi/c/pp_resource.h" |
15 #include "ppapi/c/pp_stdint.h" | 15 #include "ppapi/c/pp_stdint.h" |
16 | 16 |
17 #define PPB_AUDIO_CONFIG_INTERFACE_1_0 "PPB_AudioConfig;1.0" | 17 #define PPB_AUDIO_CONFIG_INTERFACE_1_0 "PPB_AudioConfig;1.0" |
18 #define PPB_AUDIO_CONFIG_INTERFACE PPB_AUDIO_CONFIG_INTERFACE_1_0 | 18 #define PPB_AUDIO_CONFIG_INTERFACE_1_1 "PPB_AudioConfig;1.1" |
| 19 #define PPB_AUDIO_CONFIG_INTERFACE PPB_AUDIO_CONFIG_INTERFACE_1_1 |
19 | 20 |
20 /** | 21 /** |
21 * @file | 22 * @file |
22 * This file defines the PPB_AudioConfig interface for establishing an | 23 * This file defines the PPB_AudioConfig interface for establishing an |
23 * audio configuration resource within the browser. | 24 * audio configuration resource within the browser. |
24 */ | 25 */ |
25 | 26 |
26 | 27 |
27 /** | 28 /** |
28 * @addtogroup Enums | 29 * @addtogroup Enums |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 */ | 62 */ |
62 /** | 63 /** |
63 * The <code>PPB_AudioConfig</code> interface contains pointers to several | 64 * The <code>PPB_AudioConfig</code> interface contains pointers to several |
64 * functions for establishing your audio configuration within the browser. | 65 * functions for establishing your audio configuration within the browser. |
65 * This interface only supports 16-bit stereo output. | 66 * This interface only supports 16-bit stereo output. |
66 * | 67 * |
67 * Refer to the | 68 * Refer to the |
68 * <a href="/chrome/nativeclient/docs/audio.html">Pepper | 69 * <a href="/chrome/nativeclient/docs/audio.html">Pepper |
69 * Audio API</a> for information on using this interface. | 70 * Audio API</a> for information on using this interface. |
70 */ | 71 */ |
71 struct PPB_AudioConfig_1_0 { | 72 struct PPB_AudioConfig_1_1 { |
72 /** | 73 /** |
73 * CreateStereo16bit() creates a 16 bit audio configuration resource. The | 74 * CreateStereo16bit() creates a 16 bit audio configuration resource. The |
74 * <code>sample_frame_count</code> should be the result of calling | 75 * <code>sample_rate</code> should be the result of calling |
75 * <code>RecommendSampleFrameCount</code>. If the sample frame count or bit | 76 * <code>RecommendSampleRate</code> and <code>sample_frame_count</code> should |
76 * rate isn't supported, this function will fail and return a null resource. | 77 * be the result of calling <code>RecommendSampleFrameCount</code>. If the |
| 78 * sample frame count or bit rate isn't supported, this function will fail and |
| 79 * return a null resource. |
77 * | 80 * |
78 * A single sample frame on a stereo device means one value for the left | 81 * A single sample frame on a stereo device means one value for the left |
79 * channel and one value for the right channel. | 82 * channel and one value for the right channel. |
80 * | 83 * |
81 * Buffer layout for a stereo int16 configuration: | 84 * Buffer layout for a stereo int16 configuration: |
82 * <code>int16_t *buffer16;</code> | 85 * <code>int16_t *buffer16;</code> |
83 * <code>buffer16[0]</code> is the first left channel sample. | 86 * <code>buffer16[0]</code> is the first left channel sample. |
84 * <code>buffer16[1]</code> is the first right channel sample. | 87 * <code>buffer16[1]</code> is the first right channel sample. |
85 * <code>buffer16[2]</code> is the second left channel sample. | 88 * <code>buffer16[2]</code> is the second left channel sample. |
86 * <code>buffer16[3]</code> is the second right channel sample. | 89 * <code>buffer16[3]</code> is the second right channel sample. |
(...skipping 26 matching lines...) Expand all Loading... |
113 * smaller frame counts will yield lower latency, but higher CPU utilization. | 116 * smaller frame counts will yield lower latency, but higher CPU utilization. |
114 * | 117 * |
115 * Supported sample frame counts will vary by hardware and system (consider | 118 * Supported sample frame counts will vary by hardware and system (consider |
116 * that the local system might be anywhere from a cell phone or a high-end | 119 * that the local system might be anywhere from a cell phone or a high-end |
117 * audio workstation). Sample counts less than | 120 * audio workstation). Sample counts less than |
118 * <code>PP_AUDIOMINSAMPLEFRAMECOUNT</code> and greater than | 121 * <code>PP_AUDIOMINSAMPLEFRAMECOUNT</code> and greater than |
119 * <code>PP_AUDIOMAXSAMPLEFRAMECOUNT</code> are never supported on any | 122 * <code>PP_AUDIOMAXSAMPLEFRAMECOUNT</code> are never supported on any |
120 * system, but values in between aren't necessarily valid. This function | 123 * system, but values in between aren't necessarily valid. This function |
121 * will return a supported count closest to the requested value. | 124 * will return a supported count closest to the requested value. |
122 * | 125 * |
| 126 * RecommendSampleFrameCount() result is intended for audio output devices. |
| 127 * |
| 128 * @param[in] instance |
123 * @param[in] sample_rate A <code>PP_AudioSampleRate</code> which is either | 129 * @param[in] sample_rate A <code>PP_AudioSampleRate</code> which is either |
124 * <code>PP_AUDIOSAMPLERATE_44100</code> or | 130 * <code>PP_AUDIOSAMPLERATE_44100</code> or |
125 * <code>PP_AUDIOSAMPLERATE_48000.</code> | 131 * <code>PP_AUDIOSAMPLERATE_48000.</code> |
126 * @param[in] requested_sample_frame_count A <code>uint_32t</code> requested | 132 * @param[in] requested_sample_frame_count A <code>uint_32t</code> requested |
127 * frame count. | 133 * frame count. |
128 * | 134 * |
129 * @return A <code>uint32_t</code> containing the recommended sample frame | 135 * @return A <code>uint32_t</code> containing the recommended sample frame |
130 * count if successful. | 136 * count if successful. |
131 */ | 137 */ |
132 uint32_t (*RecommendSampleFrameCount)( | 138 uint32_t (*RecommendSampleFrameCount)( |
| 139 PP_Instance instance, |
133 PP_AudioSampleRate sample_rate, | 140 PP_AudioSampleRate sample_rate, |
134 uint32_t requested_sample_frame_count); | 141 uint32_t requested_sample_frame_count); |
135 /** | 142 /** |
136 * IsAudioConfig() determines if the given resource is a | 143 * IsAudioConfig() determines if the given resource is a |
137 * <code>PPB_Audio_Config</code>. | 144 * <code>PPB_Audio_Config</code>. |
138 * | 145 * |
139 * @param[in] resource A <code>PP_Resource</code> corresponding to an audio | 146 * @param[in] resource A <code>PP_Resource</code> corresponding to an audio |
140 * config resource. | 147 * config resource. |
141 * | 148 * |
142 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the given | 149 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the given |
(...skipping 17 matching lines...) Expand all Loading... |
160 * <code>PPB_Audio_Config</code>. | 167 * <code>PPB_Audio_Config</code>. |
161 * | 168 * |
162 * @param[in] config A <code>PP_Resource</code> corresponding to an audio | 169 * @param[in] config A <code>PP_Resource</code> corresponding to an audio |
163 * config resource. | 170 * config resource. |
164 * | 171 * |
165 * @return A <code>uint32_t</code> containing sample frame count or | 172 * @return A <code>uint32_t</code> containing sample frame count or |
166 * 0 if the resource is invalid. Refer to | 173 * 0 if the resource is invalid. Refer to |
167 * RecommendSampleFrameCount() for more on sample frame counts. | 174 * RecommendSampleFrameCount() for more on sample frame counts. |
168 */ | 175 */ |
169 uint32_t (*GetSampleFrameCount)(PP_Resource config); | 176 uint32_t (*GetSampleFrameCount)(PP_Resource config); |
| 177 /** |
| 178 * RecommendSampleRate() returns the native sample rate that the browser |
| 179 * is using in the backend. Applications that use the recommended sample |
| 180 * rate will have potentially better latency and fidelity. The return value |
| 181 * is indended for audio output devices. |
| 182 * |
| 183 * @param[in] instance |
| 184 * |
| 185 * @return A <code>uint32_t</code> containing the recommended sample frame |
| 186 * count if successful. |
| 187 */ |
| 188 PP_AudioSampleRate (*RecommendSampleRate)(PP_Instance instance); |
170 }; | 189 }; |
171 | 190 |
172 typedef struct PPB_AudioConfig_1_0 PPB_AudioConfig; | 191 typedef struct PPB_AudioConfig_1_1 PPB_AudioConfig; |
| 192 |
| 193 struct PPB_AudioConfig_1_0 { |
| 194 PP_Resource (*CreateStereo16Bit)(PP_Instance instance, |
| 195 PP_AudioSampleRate sample_rate, |
| 196 uint32_t sample_frame_count); |
| 197 uint32_t (*RecommendSampleFrameCount)( |
| 198 PP_AudioSampleRate sample_rate, |
| 199 uint32_t requested_sample_frame_count); |
| 200 PP_Bool (*IsAudioConfig)(PP_Resource resource); |
| 201 PP_AudioSampleRate (*GetSampleRate)(PP_Resource config); |
| 202 uint32_t (*GetSampleFrameCount)(PP_Resource config); |
| 203 }; |
173 /** | 204 /** |
174 * @} | 205 * @} |
175 */ | 206 */ |
176 | 207 |
177 #endif /* PPAPI_C_PPB_AUDIO_CONFIG_H_ */ | 208 #endif /* PPAPI_C_PPB_AUDIO_CONFIG_H_ */ |
178 | 209 |
OLD | NEW |