| 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 #ifndef PPAPI_C_PPB_AUDIO_H_ | 5 #ifndef PPAPI_C_PPB_AUDIO_H_ |
| 6 #define PPAPI_C_PPB_AUDIO_H_ | 6 #define PPAPI_C_PPB_AUDIO_H_ |
| 7 | 7 |
| 8 #include "ppapi/c/pp_bool.h" | 8 #include "ppapi/c/pp_bool.h" |
| 9 #include "ppapi/c/pp_instance.h" | 9 #include "ppapi/c/pp_instance.h" |
| 10 #include "ppapi/c/pp_module.h" | 10 #include "ppapi/c/pp_module.h" |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 * applications (i.e. low-latency audio), the callback should avoid blocking | 82 * applications (i.e. low-latency audio), the callback should avoid blocking |
| 83 * or calling functions that can obtain locks, such as malloc. The layout and | 83 * or calling functions that can obtain locks, such as malloc. The layout and |
| 84 * the size of the buffer passed to the audio callback will be determined by | 84 * the size of the buffer passed to the audio callback will be determined by |
| 85 * the device configuration and is specified in the AudioConfig documentation. | 85 * the device configuration and is specified in the AudioConfig documentation. |
| 86 * | 86 * |
| 87 * @param[in] instance A PP_Instance indentifying one instance of a module. | 87 * @param[in] instance A PP_Instance indentifying one instance of a module. |
| 88 * @param[in] config A PP_Resource containing the audio config resource. | 88 * @param[in] config A PP_Resource containing the audio config resource. |
| 89 * @param[in] audio_callback A PPB_Audio_Callback callback function that the | 89 * @param[in] audio_callback A PPB_Audio_Callback callback function that the |
| 90 * browser calls when it needs more samples to play. | 90 * browser calls when it needs more samples to play. |
| 91 * @param[in] user_data A pointer to user data used in the callback function. | 91 * @param[in] user_data A pointer to user data used in the callback function. |
| 92 * |
| 92 * @return A PP_Resource containing the audio resource if successful or | 93 * @return A PP_Resource containing the audio resource if successful or |
| 93 * 0 if the configuration cannot be honored or the callback is null. | 94 * 0 if the configuration cannot be honored or the callback is null. |
| 94 */ | 95 */ |
| 95 PP_Resource (*Create)(PP_Instance instance, PP_Resource config, | 96 PP_Resource (*Create)(PP_Instance instance, PP_Resource config, |
| 96 PPB_Audio_Callback audio_callback, void* user_data); | 97 PPB_Audio_Callback audio_callback, void* user_data); |
| 97 /** | 98 /** |
| 98 * IsAudio is a pointer to a function that determines if the given | 99 * IsAudio is a pointer to a function that determines if the given |
| 99 * resource is an audio resource. | 100 * resource is an audio resource. |
| 100 * | 101 * |
| 101 * @param[in] resource A PP_Resource containing a resource. | 102 * @param[in] resource A PP_Resource containing a resource. |
| 103 * |
| 102 * @return A PP_BOOL containing containing PP_TRUE if the given resource is | 104 * @return A PP_BOOL containing containing PP_TRUE if the given resource is |
| 103 * an Audio resource, otherwise PP_FALSE. | 105 * an Audio resource, otherwise PP_FALSE. |
| 104 */ | 106 */ |
| 105 PP_Bool (*IsAudio)(PP_Resource resource); | 107 PP_Bool (*IsAudio)(PP_Resource resource); |
| 106 | 108 |
| 107 /** | 109 /** |
| 108 * GetCurrrentConfig is a pointer to a function that returns an audio config | 110 * GetCurrrentConfig is a pointer to a function that returns an audio config |
| 109 * resource for the given audio resource. | 111 * resource for the given audio resource. |
| 110 * | 112 * |
| 111 * @param[in] config A PP_Resource containing the audio resource. | 113 * @param[in] config A PP_Resource containing the audio resource. |
| 114 * |
| 112 * @return A PP_Resource containing the audio config resource if successful. | 115 * @return A PP_Resource containing the audio config resource if successful. |
| 113 */ | 116 */ |
| 114 PP_Resource (*GetCurrentConfig)(PP_Resource audio); | 117 PP_Resource (*GetCurrentConfig)(PP_Resource audio); |
| 115 | 118 |
| 116 /** | 119 /** |
| 117 * StartPlayback is a pointer to a function that starts the playback of | 120 * StartPlayback is a pointer to a function that starts the playback of |
| 118 * the audio resource and begins periodically calling the callback. | 121 * the audio resource and begins periodically calling the callback. |
| 119 * | 122 * |
| 120 * @param[in] config A PP_Resource containing the audio resource. | 123 * @param[in] config A PP_Resource containing the audio resource. |
| 124 * |
| 121 * @return A PP_BOOL containing PP_TRUE if successful, otherwise PP_FALSE. | 125 * @return A PP_BOOL containing PP_TRUE if successful, otherwise PP_FALSE. |
| 122 * Also returns PP_TRUE (and be a no-op) if called while playback is already | 126 * Also returns PP_TRUE (and be a no-op) if called while playback is already |
| 123 * in progress. | 127 * in progress. |
| 124 */ | 128 */ |
| 125 PP_Bool (*StartPlayback)(PP_Resource audio); | 129 PP_Bool (*StartPlayback)(PP_Resource audio); |
| 126 | 130 |
| 127 /** | 131 /** |
| 128 * StopPlayback is a pointer to a function that stops the playback of | 132 * StopPlayback is a pointer to a function that stops the playback of |
| 129 * the audio resource. | 133 * the audio resource. |
| 130 * | 134 * |
| 131 * @param[in] config A PP_Resource containing the audio resource. | 135 * @param[in] config A PP_Resource containing the audio resource. |
| 136 * |
| 132 * @return A PP_BOOL containing PP_TRUE if successful, otherwise PP_FALSE. | 137 * @return A PP_BOOL containing PP_TRUE if successful, otherwise PP_FALSE. |
| 133 * Also returns PP_TRUE (and is a no-op) if called while playback is already | 138 * Also returns PP_TRUE (and is a no-op) if called while playback is already |
| 134 * stopped. If a callback is in progress, StopPlayback will block until the | 139 * stopped. If a callback is in progress, StopPlayback will block until the |
| 135 * callback completes. | 140 * callback completes. |
| 136 */ | 141 */ |
| 137 PP_Bool (*StopPlayback)(PP_Resource audio); | 142 PP_Bool (*StopPlayback)(PP_Resource audio); |
| 138 }; | 143 }; |
| 139 /** | 144 /** |
| 140 * @} | 145 * @} |
| 141 */ | 146 */ |
| 142 | 147 |
| 143 #endif /* PPAPI_C_PPB_DEVICE_CONTEXT_AUDIO_H_ */ | 148 #endif /* PPAPI_C_PPB_DEVICE_CONTEXT_AUDIO_H_ */ |
| 144 | 149 |
| OLD | NEW |