| OLD | NEW |
| 1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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 |
| 6 /* From ppb_audio_config.idl modified Sat Jul 16 16:50:26 2011. */ |
| 7 |
| 5 #ifndef PPAPI_C_PPB_AUDIO_CONFIG_H_ | 8 #ifndef PPAPI_C_PPB_AUDIO_CONFIG_H_ |
| 6 #define PPAPI_C_PPB_AUDIO_CONFIG_H_ | 9 #define PPAPI_C_PPB_AUDIO_CONFIG_H_ |
| 7 | 10 |
| 8 #include "ppapi/c/pp_bool.h" | 11 #include "ppapi/c/pp_bool.h" |
| 9 #include "ppapi/c/pp_instance.h" | 12 #include "ppapi/c/pp_instance.h" |
| 10 #include "ppapi/c/pp_macros.h" | 13 #include "ppapi/c/pp_macros.h" |
| 11 #include "ppapi/c/pp_resource.h" | 14 #include "ppapi/c/pp_resource.h" |
| 12 #include "ppapi/c/pp_stdint.h" | 15 #include "ppapi/c/pp_stdint.h" |
| 13 | 16 |
| 14 #define PPB_AUDIO_CONFIG_INTERFACE_0_5 "PPB_AudioConfig;0.5" | |
| 15 #define PPB_AUDIO_CONFIG_INTERFACE_1_0 "PPB_AudioConfig;1.0" | |
| 16 #define PPB_AUDIO_CONFIG_INTERFACE PPB_AUDIO_CONFIG_INTERFACE_1_0 | |
| 17 | |
| 18 /** | 17 /** |
| 19 * @file | 18 * @file |
| 20 * This file defines the PPB_AudioConfig interface for establishing an | 19 * This file defines the PPB_AudioConfig interface for establishing an |
| 21 * audio configuration resource within the browser. | 20 * audio configuration resource within the browser. |
| 22 */ | 21 */ |
| 23 | 22 |
| 23 |
| 24 /** | 24 /** |
| 25 * | |
| 26 * @addtogroup Enums | 25 * @addtogroup Enums |
| 27 * @{ | 26 * @{ |
| 28 */ | 27 */ |
| 29 | |
| 30 /** | 28 /** |
| 31 * This enumeration contains audio frame count constants. | 29 * This enumeration contains audio frame count constants. |
| 32 * <code>PP_AUDIOMINSAMPLEFRAMECOUNT</code> is the minimum possible frame | 30 * <code>PP_AUDIOMINSAMPLEFRAMECOUNT</code> is the minimum possible frame |
| 33 * count. <code>PP_AUDIOMAXSAMPLEFRAMECOUNT</code> is the maximum possible | 31 * count. <code>PP_AUDIOMAXSAMPLEFRAMECOUNT</code> is the maximum possible |
| 34 * frame count. | 32 * frame count. |
| 35 */ | 33 */ |
| 36 enum { | 34 enum { |
| 37 PP_AUDIOMINSAMPLEFRAMECOUNT = 64, | 35 PP_AUDIOMINSAMPLEFRAMECOUNT = 64, |
| 38 PP_AUDIOMAXSAMPLEFRAMECOUNT = 32768 | 36 PP_AUDIOMAXSAMPLEFRAMECOUNT = 32768 |
| 39 }; | 37 }; |
| 40 /** | |
| 41 * @} | |
| 42 */ | |
| 43 | |
| 44 /** | |
| 45 * | |
| 46 * @addtogroup Enums | |
| 47 * @{ | |
| 48 */ | |
| 49 | 38 |
| 50 /** | 39 /** |
| 51 * PP_AudioSampleRate is an enumeration of the different audio sampling rates. | 40 * PP_AudioSampleRate is an enumeration of the different audio sampling rates. |
| 52 * <code>PP_AUDIOSAMPLERATE_44100</code> is the sample rate used on CDs and | 41 * <code>PP_AUDIOSAMPLERATE_44100</code> is the sample rate used on CDs and |
| 53 * <code>PP_AUDIOSAMPLERATE_48000</code> is the sample rate used on DVDs and | 42 * <code>PP_AUDIOSAMPLERATE_48000</code> is the sample rate used on DVDs and |
| 54 * Digital Audio Tapes. | 43 * Digital Audio Tapes. |
| 55 */ | 44 */ |
| 56 typedef enum { | 45 typedef enum { |
| 57 PP_AUDIOSAMPLERATE_NONE = 0, | 46 PP_AUDIOSAMPLERATE_NONE = 0, |
| 58 PP_AUDIOSAMPLERATE_44100 = 44100, | 47 PP_AUDIOSAMPLERATE_44100 = 44100, |
| 59 PP_AUDIOSAMPLERATE_48000 = 48000 | 48 PP_AUDIOSAMPLERATE_48000 = 48000 |
| 60 } PP_AudioSampleRate; | 49 } PP_AudioSampleRate; |
| 61 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_AudioSampleRate, 4); | 50 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_AudioSampleRate, 4); |
| 62 /** | 51 /** |
| 63 * @} | 52 * @} |
| 64 */ | 53 */ |
| 65 | 54 |
| 66 /** | 55 /** |
| 67 * @addtogroup Interfaces | 56 * @addtogroup Interfaces |
| 68 * @{ | 57 * @{ |
| 69 */ | 58 */ |
| 70 | |
| 71 /** | 59 /** |
| 72 * The <code>PPB_AudioConfig</code> interface contains pointers to several | 60 * The <code>PPB_AudioConfig</code> interface contains pointers to several |
| 73 * functions for establishing your audio configuration within the browser. | 61 * functions for establishing your audio configuration within the browser. |
| 74 * This interface only supports stereo * 16bit output. | 62 * This interface only supports stereo * 16bit output. |
| 75 * | 63 * |
| 76 * Refer to the | 64 * Refer to the |
| 77 * <a href="/chrome/nativeclient/docs/audio.html">Pepper | 65 * <a href="/chrome/nativeclient/docs/audio.html">Pepper |
| 78 * Audio API Code Walkthrough</a> for information on using this interface. | 66 * Audio API Code Walkthrough</a> for information on using this interface. |
| 79 */ | 67 */ |
| 68 #define PPB_AUDIO_CONFIG_INTERFACE_0_5 "PPB_AudioConfig;0.5" |
| 69 #define PPB_AUDIO_CONFIG_INTERFACE_1_0 "PPB_AudioConfig;1.0" |
| 70 #define PPB_AUDIO_CONFIG_INTERFACE PPB_AUDIO_CONFIG_INTERFACE_1_0 |
| 71 |
| 80 struct PPB_AudioConfig { | 72 struct PPB_AudioConfig { |
| 81 /** | 73 /** |
| 82 * CreateStereo16bit() creates a 16 bit audio configuration resource. The | 74 * CreateStereo16bit() creates a 16 bit audio configuration resource. The |
| 83 * <code>sample_frame_count</code> should be the result of calling | 75 * <code>sample_frame_count</code> should be the result of calling |
| 84 * <code>RecommendSampleFrameCount</code>. If the sample frame count or bit | 76 * <code>RecommendSampleFrameCount</code>. If the sample frame count or bit |
| 85 * 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. |
| 86 * | 78 * |
| 87 * 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 |
| 88 * channel and one value for the right channel. | 80 * channel and one value for the right channel. |
| 89 * | 81 * |
| (...skipping 10 matching lines...) Expand all Loading... |
| 100 * right channel sample. | 92 * right channel sample. |
| 101 * Data will always be in the native endian format of the platform. | 93 * Data will always be in the native endian format of the platform. |
| 102 * | 94 * |
| 103 * @param[in] instance A <code>PP_Instance indentifying</code> one instance | 95 * @param[in] instance A <code>PP_Instance indentifying</code> one instance |
| 104 * of a module. | 96 * of a module. |
| 105 * @param[in] sample_rate A P<code>P_AudioSampleRate</code> which is either | 97 * @param[in] sample_rate A P<code>P_AudioSampleRate</code> which is either |
| 106 * <code>PP_AUDIOSAMPLERATE_44100</code> or | 98 * <code>PP_AUDIOSAMPLERATE_44100</code> or |
| 107 * <code>PP_AUDIOSAMPLERATE_48000</code>. | 99 * <code>PP_AUDIOSAMPLERATE_48000</code>. |
| 108 * @param[in] sample_frame_count A <code>uint32_t</code> frame count returned | 100 * @param[in] sample_frame_count A <code>uint32_t</code> frame count returned |
| 109 * from the <code>RecommendSampleFrameCount</code> function. | 101 * from the <code>RecommendSampleFrameCount</code> function. |
| 110 * | |
| 111 * @return A <code>PP_Resource</code> containing the | 102 * @return A <code>PP_Resource</code> containing the |
| 112 * <code>PPB_Audio_Config</code> if successful or a null resource if the | 103 * <code>PPB_Audio_Config</code> if successful or a null resource if the |
| 113 * sample frame count or bit rate are not supported. | 104 * sample frame count or bit rate are not supported. |
| 114 */ | 105 */ |
| 115 PP_Resource (*CreateStereo16Bit)(PP_Instance instance, | 106 PP_Resource (*CreateStereo16Bit)(PP_Instance instance, |
| 116 PP_AudioSampleRate sample_rate, | 107 PP_AudioSampleRate sample_rate, |
| 117 uint32_t sample_frame_count); | 108 uint32_t sample_frame_count); |
| 118 | |
| 119 /** | 109 /** |
| 120 * RecommendSampleFrameCount() returns the supported sample frame count | 110 * RecommendSampleFrameCount() returns the supported sample frame count |
| 121 * closest to the requested count. The sample frame count determines the | 111 * closest to the requested count. The sample frame count determines the |
| 122 * overall latency of audio. Since one "frame" is always buffered in advance, | 112 * overall latency of audio. Since one "frame" is always buffered in advance, |
| 123 * smaller frame counts will yield lower latency, but higher CPU utilization. | 113 * smaller frame counts will yield lower latency, but higher CPU utilization. |
| 124 * | 114 * |
| 125 * Supported sample frame counts will vary by hardware and system (consider | 115 * Supported sample frame counts will vary by hardware and system (consider |
| 126 * that the local system might be anywhere from a cell phone or a high-end | 116 * that the local system might be anywhere from a cell phone or a high-end |
| 127 * audio workstation). Sample counts less than | 117 * audio workstation). Sample counts less than |
| 128 * <code>PP_AUDIOMINSAMPLEFRAMECOUNT</code> and greater than | 118 * <code>PP_AUDIOMINSAMPLEFRAMECOUNT</code> and greater than |
| 129 * <code>PP_AUDIOMAXSAMPLEFRAMECOUNT</code> are never supported on any | 119 * <code>PP_AUDIOMAXSAMPLEFRAMECOUNT</code> are never supported on any |
| 130 * system, but values in between aren't necessarily valid. This function | 120 * system, but values in between aren't necessarily valid. This function |
| 131 * will return a supported count closest to the requested value. | 121 * will return a supported count closest to the requested value. |
| 132 * | 122 * |
| 133 * @param[in] sample_rate A <code>PP_AudioSampleRate which is either | 123 * @param[in] sample_rate A <code>PP_AudioSampleRate which is either |
| 134 * <code>PP_AUDIOSAMPLERATE_44100</code> or | 124 * <code>PP_AUDIOSAMPLERATE_44100</code> or |
| 135 * <code>PP_AUDIOSAMPLERATE_48000.</code> | 125 * <code>PP_AUDIOSAMPLERATE_48000.</code> |
| 136 * @param[in] requested_sample_frame_count A <code>uint_32t</code> requested | 126 * @param[in] requested_sample_frame_count A <code>uint_32t</code> requested |
| 137 * frame count. | 127 * frame count. |
| 138 * | |
| 139 * @return A <code>uint32_t</code> containing the recommended sample frame | 128 * @return A <code>uint32_t</code> containing the recommended sample frame |
| 140 * count if successful. | 129 * count if successful. |
| 141 */ | 130 */ |
| 142 uint32_t (*RecommendSampleFrameCount)(PP_AudioSampleRate sample_rate, | 131 uint32_t (*RecommendSampleFrameCount)( |
| 143 uint32_t requested_sample_frame_count); | 132 PP_AudioSampleRate sample_rate, |
| 144 | 133 uint32_t requested_sample_frame_count); |
| 145 /** | 134 /** |
| 146 * IsAudioConfig() determines if the given resource is a | 135 * IsAudioConfig() determines if the given resource is a |
| 147 * <code>PPB_Audio_Config</code>. | 136 * <code>PPB_Audio_Config</code>. |
| 148 * | 137 * |
| 149 * @param[in] resource A <code>PP_Resource</code> containing the audio config | 138 * @param[in] resource A <code>PP_Resource</code> containing the audio config |
| 150 * resource. | 139 * resource. |
| 151 * | |
| 152 * @return A <code>PP_BOOL</code> containing <code>PP_TRUE</code> if the given | 140 * @return A <code>PP_BOOL</code> containing <code>PP_TRUE</code> if the given |
| 153 * resource is an <code>AudioConfig</code> resource, otherwise | 141 * resource is an <code>AudioConfig</code> resource, otherwise |
| 154 * <code>PP_FALSE</code>. | 142 * <code>PP_FALSE</code>. |
| 155 */ | 143 */ |
| 156 PP_Bool (*IsAudioConfig)(PP_Resource resource); | 144 PP_Bool (*IsAudioConfig)(PP_Resource resource); |
| 157 | |
| 158 /** | 145 /** |
| 159 * GetSampleRate() returns the sample rate for the given | 146 * GetSampleRate() returns the sample rate for the given |
| 160 * <code>PPB_Audio_Config</code>. | 147 * <code>PPB_Audio_Config</code>. |
| 161 * | 148 * |
| 162 * @param[in] config A <code>PP_Resource</code> containing the | 149 * @param[in] config A <code>PP_Resource</code> containing the |
| 163 * <code>PPB_Audio_Config</code>. | 150 * <code>PPB_Audio_Config</code>. |
| 164 * | |
| 165 * @return A <code>PP_AudioSampleRate</code> containing sample rate or | 151 * @return A <code>PP_AudioSampleRate</code> containing sample rate or |
| 166 * <code>PP_AUDIOSAMPLERATE_NONE</code> if the resource is invalid. | 152 * <code>PP_AUDIOSAMPLERATE_NONE</code> if the resource is invalid. |
| 167 */ | 153 */ |
| 168 PP_AudioSampleRate (*GetSampleRate)(PP_Resource config); | 154 PP_AudioSampleRate (*GetSampleRate)(PP_Resource config); |
| 169 | |
| 170 /** | 155 /** |
| 171 * GetSampleFrameCount() returns the sample frame count for the given | 156 * GetSampleFrameCount() returns the sample frame count for the given |
| 172 * <code>PPB_Audio_Config</code>. | 157 * <code>PPB_Audio_Config</code>. |
| 173 * | 158 * |
| 174 * @param[in] config A <code>PP_Resource</code> containing the audio config | 159 * @param[in] config A <code>PP_Resource</code> containing the audio config |
| 175 * resource. | 160 * resource. |
| 176 * | |
| 177 * @return A <code>uint32_t</code> containing sample frame count or | 161 * @return A <code>uint32_t</code> containing sample frame count or |
| 178 * 0 if the resource is invalid. See <code>RecommendSampleFrameCount</code> | 162 * 0 if the resource is invalid. See <code>RecommendSampleFrameCount</code> |
| 179 * for more on sample frame counts. | 163 * for more on sample frame counts. |
| 180 */ | 164 */ |
| 181 uint32_t (*GetSampleFrameCount)(PP_Resource config); | 165 uint32_t (*GetSampleFrameCount)(PP_Resource config); |
| 182 }; | 166 }; |
| 183 /** | 167 /** |
| 184 * @} | 168 * @} |
| 185 */ | 169 */ |
| 186 | 170 |
| 187 #endif /* PPAPI_C_PPB_AUDIO_CONFIG_H_ */ | 171 #endif /* PPAPI_C_PPB_AUDIO_CONFIG_H_ */ |
| 188 | 172 |
| OLD | NEW |