Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(270)

Side by Side Diff: ppapi/c/ppb_audio_config.h

Issue 9129007: Work on improving PpbAudioConfig:RecommendSampleFrameCount (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 Wed Oct 5 14:06:02 2011. */ 6 /* From ppb_audio_config.idl modified Wed Jan 11 13:41:09 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
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 stereo * 16bit output. 66 * This interface only supports stereo * 16bit 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_frame_count</code> should be the result of calling
75 * <code>RecommendSampleFrameCount</code>. If the sample frame count or bit 76 * <code>RecommendSampleFrameCount</code>. If the sample frame count or bit
76 * rate isn't supported, this function will fail and return a null resource. 77 * rate isn't supported, this function will fail and return a null resource.
77 * 78 *
78 * A single sample frame on a stereo device means one value for the left 79 * A single sample frame on a stereo device means one value for the left
79 * channel and one value for the right channel. 80 * channel and one value for the right channel.
80 * 81 *
81 * Buffer layout for a stereo int16 configuration: 82 * Buffer layout for a stereo int16 configuration:
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 * smaller frame counts will yield lower latency, but higher CPU utilization. 114 * smaller frame counts will yield lower latency, but higher CPU utilization.
114 * 115 *
115 * Supported sample frame counts will vary by hardware and system (consider 116 * 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 117 * that the local system might be anywhere from a cell phone or a high-end
117 * audio workstation). Sample counts less than 118 * audio workstation). Sample counts less than
118 * <code>PP_AUDIOMINSAMPLEFRAMECOUNT</code> and greater than 119 * <code>PP_AUDIOMINSAMPLEFRAMECOUNT</code> and greater than
119 * <code>PP_AUDIOMAXSAMPLEFRAMECOUNT</code> are never supported on any 120 * <code>PP_AUDIOMAXSAMPLEFRAMECOUNT</code> are never supported on any
120 * system, but values in between aren't necessarily valid. This function 121 * system, but values in between aren't necessarily valid. This function
121 * will return a supported count closest to the requested value. 122 * will return a supported count closest to the requested value.
122 * 123 *
124 * @param[in] instance
123 * @param[in] sample_rate A <code>PP_AudioSampleRate</code> which is either 125 * @param[in] sample_rate A <code>PP_AudioSampleRate</code> which is either
124 * <code>PP_AUDIOSAMPLERATE_44100</code> or 126 * <code>PP_AUDIOSAMPLERATE_44100</code> or
125 * <code>PP_AUDIOSAMPLERATE_48000.</code> 127 * <code>PP_AUDIOSAMPLERATE_48000.</code>
126 * @param[in] requested_sample_frame_count A <code>uint_32t</code> requested 128 * @param[in] requested_sample_frame_count A <code>uint_32t</code> requested
127 * frame count. 129 * frame count.
128 * 130 *
129 * @return A <code>uint32_t</code> containing the recommended sample frame 131 * @return A <code>uint32_t</code> containing the recommended sample frame
130 * count if successful. 132 * count if successful.
131 */ 133 */
132 uint32_t (*RecommendSampleFrameCount)( 134 uint32_t (*RecommendSampleFrameCount)(
135 PP_Instance instance,
133 PP_AudioSampleRate sample_rate, 136 PP_AudioSampleRate sample_rate,
134 uint32_t requested_sample_frame_count); 137 uint32_t requested_sample_frame_count);
135 /** 138 /**
136 * IsAudioConfig() determines if the given resource is a 139 * IsAudioConfig() determines if the given resource is a
137 * <code>PPB_Audio_Config</code>. 140 * <code>PPB_Audio_Config</code>.
138 * 141 *
139 * @param[in] resource A <code>PP_Resource</code> corresponding to an audio 142 * @param[in] resource A <code>PP_Resource</code> corresponding to an audio
140 * config resource. 143 * config resource.
141 * 144 *
142 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the given 145 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the given
(...skipping 17 matching lines...) Expand all
160 * <code>PPB_Audio_Config</code>. 163 * <code>PPB_Audio_Config</code>.
161 * 164 *
162 * @param[in] config A <code>PP_Resource</code> corresponding to an audio 165 * @param[in] config A <code>PP_Resource</code> corresponding to an audio
163 * config resource. 166 * config resource.
164 * 167 *
165 * @return A <code>uint32_t</code> containing sample frame count or 168 * @return A <code>uint32_t</code> containing sample frame count or
166 * 0 if the resource is invalid. Refer to 169 * 0 if the resource is invalid. Refer to
167 * RecommendSampleFrameCount() for more on sample frame counts. 170 * RecommendSampleFrameCount() for more on sample frame counts.
168 */ 171 */
169 uint32_t (*GetSampleFrameCount)(PP_Resource config); 172 uint32_t (*GetSampleFrameCount)(PP_Resource config);
173 /**
174 * RecommendSampleRate() returns the native sample rate that the browser
175 * is using in the backend. Applications that use the recommended sample
176 * rate will have potentially better latency and fidelity.
177 *
178 * @param[in] instance
179 *
180 * @return A <code>uint32_t</code> containing the recommended sample frame
181 * count if successful.
182 */
183 PP_AudioSampleRate (*RecommendSampleRate)(PP_Instance instance);
170 }; 184 };
171 185
172 typedef struct PPB_AudioConfig_1_0 PPB_AudioConfig; 186 typedef struct PPB_AudioConfig_1_1 PPB_AudioConfig;
187
188 struct PPB_AudioConfig_1_0 {
189 PP_Resource (*CreateStereo16Bit)(PP_Instance instance,
190 PP_AudioSampleRate sample_rate,
191 uint32_t sample_frame_count);
192 uint32_t (*RecommendSampleFrameCount)(
193 PP_AudioSampleRate sample_rate,
194 uint32_t requested_sample_frame_count);
195 PP_Bool (*IsAudioConfig)(PP_Resource resource);
196 PP_AudioSampleRate (*GetSampleRate)(PP_Resource config);
197 uint32_t (*GetSampleFrameCount)(PP_Resource config);
198 };
173 /** 199 /**
174 * @} 200 * @}
175 */ 201 */
176 202
177 #endif /* PPAPI_C_PPB_AUDIO_CONFIG_H_ */ 203 #endif /* PPAPI_C_PPB_AUDIO_CONFIG_H_ */
178 204
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698