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

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

Issue 7715005: Changed all @code to <code> and @endcode to </code> as per dmichael (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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
« no previous file with comments | « ppapi/api/ppp_messaging.idl ('k') | ppapi/c/ppb_audio_config.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 5
6 /* From ppb_audio.idl modified Wed Aug 24 20:46:25 2011. */ 6 /* From ppb_audio.idl modified Mon Aug 29 10:11:34 2011. */
7 7
8 #ifndef PPAPI_C_PPB_AUDIO_H_ 8 #ifndef PPAPI_C_PPB_AUDIO_H_
9 #define PPAPI_C_PPB_AUDIO_H_ 9 #define PPAPI_C_PPB_AUDIO_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_INTERFACE_1_0 "PPB_Audio;1.0" 17 #define PPB_AUDIO_INTERFACE_1_0 "PPB_Audio;1.0"
18 #define PPB_AUDIO_INTERFACE PPB_AUDIO_INTERFACE_1_0 18 #define PPB_AUDIO_INTERFACE PPB_AUDIO_INTERFACE_1_0
19 19
20 /** 20 /**
21 * @file 21 * @file
22 * This file defines the <code>PPB_Audio</code> interface, which provides 22 * This file defines the <code>PPB_Audio</code> interface, which provides
23 * realtime stereo audio streaming capabilities. 23 * realtime stereo audio streaming capabilities.
24 */ 24 */
25 25
26 26
27 /** 27 /**
28 * @addtogroup Typedefs 28 * @addtogroup Typedefs
29 * @{ 29 * @{
30 */ 30 */
31 /** 31 /**
32 * <code>PPB_Audio_Callback</code> defines the type of an audio callback 32 * <code>PPB_Audio_Callback</code> defines the type of an audio callback
33 * function used to fill the audio buffer with data. Please see the 33 * function used to fill the audio buffer with data. Please see the
34 * <code>Create()</code> function in the <code>PPB_Audio</code> interface for 34 * Create() function in the <code>PPB_Audio</code> interface for
35 * more details on this callback. 35 * more details on this callback.
36 */ 36 */
37 typedef void (*PPB_Audio_Callback)(void* sample_buffer, 37 typedef void (*PPB_Audio_Callback)(void* sample_buffer,
38 uint32_t buffer_size_in_bytes, 38 uint32_t buffer_size_in_bytes,
39 void* user_data); 39 void* user_data);
40 /** 40 /**
41 * @} 41 * @}
42 */ 42 */
43 43
44 /** 44 /**
45 * @addtogroup Interfaces 45 * @addtogroup Interfaces
46 * @{ 46 * @{
47 */ 47 */
48 /** 48 /**
49 * The <code>PPB_Audio</code> interface contains pointers to several functions 49 * The <code>PPB_Audio</code> interface contains pointers to several functions
50 * for handling audio resources. Please refer to the 50 * for handling audio resources. Please refer to the
51 * <a href="/chrome/nativeclient/docs/audio.html">Pepper 51 * <a href="/chrome/nativeclient/docs/audio.html">Pepper
52 * Audio API</a> for information on using this interface. 52 * Audio API</a> for information on using this interface.
53 * Please see descriptions for each <code>PPB_Audio</code> and 53 * Please see descriptions for each <code>PPB_Audio</code> and
54 * <code>PPB_AudioConfig</code> function for more details. 54 * <code>PPB_AudioConfig</code> function for more details. A C example using
55 * <code>PPB_Audio</code> and <code>PPB_AudioConfig</code> follows.
55 * 56 *
56 * A C example using PPB_Audio and PPB_AudioConfig: 57 * <strong>Example: </strong>
57 * @code 58 *
59 * <code>
58 * void audio_callback(void* sample_buffer, 60 * void audio_callback(void* sample_buffer,
59 * uint32_t buffer_size_in_bytes, 61 * uint32_t buffer_size_in_bytes,
60 * void* user_data) { 62 * void* user_data) {
61 * ... quickly fill in the buffer with samples and return to caller ... 63 * ... quickly fill in the buffer with samples and return to caller ...
62 * } 64 * }
63 * 65 *
64 * ...Assume the application has cached the audio configuration interface in 66 * ...Assume the application has cached the audio configuration interface in
65 * |audio_config_interface| and the audio interface in |audio_interface|... 67 * <code>audio_config_interface</code> and the audio interface in
68 * <code>audio_interface</code>...
66 * 69 *
67 * uint32_t count = audio_config_interface->RecommendSampleFrameCount( 70 * uint32_t count = audio_config_interface->RecommendSampleFrameCount(
68 * PP_AUDIOSAMPLERATE_44100, 4096); 71 * PP_AUDIOSAMPLERATE_44100, 4096);
69 * PP_Resource pp_audio_config = audio_config_interface->CreateStereo16Bit( 72 * PP_Resource pp_audio_config = audio_config_interface->CreateStereo16Bit(
70 * pp_instance, PP_AUDIOSAMPLERATE_44100, count); 73 * pp_instance, PP_AUDIOSAMPLERATE_44100, count);
71 * PP_Resource pp_audio = audio_interface->Create(pp_instance, pp_audio_config, 74 * PP_Resource pp_audio = audio_interface->Create(pp_instance, pp_audio_config,
72 * audio_callback, NULL); 75 * audio_callback, NULL);
73 * audio_interface->StartPlayback(pp_audio); 76 * audio_interface->StartPlayback(pp_audio);
74 * 77 *
75 * ...audio_callback() will now be periodically invoked on a seperate thread... 78 * ...audio_callback() will now be periodically invoked on a separate thread...
76 * @endcode 79 * </code>
77 */ 80 */
78 struct PPB_Audio { 81 struct PPB_Audio {
79 /** 82 /**
80 * Create is a pointer to a function that creates an audio resource. 83 * Create() creates an audio resource. No sound will be heard until
81 * No sound will be heard until StartPlayback() is called. The callback 84 * StartPlayback() is called. The callback is called with the buffer address
82 * is called with the buffer address and given user data whenever the 85 * and given user data whenever the buffer needs to be filled. From within the
83 * buffer needs to be filled. From within the callback, you should not 86 * callback, you should not call <code>PPB_Audio</code> functions. The
84 * call PPB_Audio functions. The callback will be called on a different 87 * callback will be called on a different thread than the one which created
85 * thread than the one which created the interface. For performance-critical 88 * the interface. For performance-critical applications (i.e. low-latency
86 * applications (i.e. low-latency audio), the callback should avoid blocking 89 * audio), the callback should avoid blocking or calling functions that can
87 * or calling functions that can obtain locks, such as malloc. The layout and 90 * obtain locks, such as malloc. The layout and the size of the buffer passed
88 * the size of the buffer passed to the audio callback will be determined by 91 * to the audio callback will be determined by the device configuration and is
89 * the device configuration and is specified in the AudioConfig documentation. 92 * specified in the <code>AudioConfig</code> documentation.
90 * 93 *
91 * @param[in] instance A PP_Instance indentifying one instance of a module. 94 * @param[in] instance A <code>PP_Instance</code> identifying one instance
92 * @param[in] config A PP_Resource containing the audio config resource. 95 * of a module.
93 * @param[in] audio_callback A PPB_Audio_Callback callback function that the 96 * @param[in] config A <code>PP_Resource</code> corresponding to an audio
94 * browser calls when it needs more samples to play. 97 * config resource.
98 * @param[in] audio_callback A <code>PPB_Audio_Callback</code> callback
99 * function that the browser calls when it needs more samples to play.
95 * @param[in] user_data A pointer to user data used in the callback function. 100 * @param[in] user_data A pointer to user data used in the callback function.
96 * 101 *
97 * @return A PP_Resource containing the audio resource if successful or 102 * @return A <code>PP_Resource</code> containing the audio resource if
98 * 0 if the configuration cannot be honored or the callback is null. 103 * successful or 0 if the configuration cannot be honored or the callback is
104 * null.
99 */ 105 */
100 PP_Resource (*Create)(PP_Instance instance, 106 PP_Resource (*Create)(PP_Instance instance,
101 PP_Resource config, 107 PP_Resource config,
102 PPB_Audio_Callback audio_callback, 108 PPB_Audio_Callback audio_callback,
103 void* user_data); 109 void* user_data);
104 /** 110 /**
105 * IsAudio is a pointer to a function that determines if the given 111 * IsAudio() determines if the provided resource is an audio resource.
106 * resource is an audio resource.
107 * 112 *
108 * @param[in] resource A PP_Resource containing a resource. 113 * @param[in] resource A <code>PP_Resource</code> corresponding to a generic
114 * resource.
109 * 115 *
110 * @return A PP_BOOL containing containing PP_TRUE if the given resource is 116 * @return A <code>PP_Bool</code> containing containing <code>PP_TRUE</code>
111 * an Audio resource, otherwise PP_FALSE. 117 * if the given resource is an Audio resource, otherwise
118 * <code>PP_FALSE</code>.
112 */ 119 */
113 PP_Bool (*IsAudio)(PP_Resource resource); 120 PP_Bool (*IsAudio)(PP_Resource resource);
114 /** 121 /**
115 * GetCurrrentConfig is a pointer to a function that returns an audio config 122 * GetCurrrentConfig() returns an audio config resource for the given audio
116 * resource for the given audio resource. 123 * resource.
117 * 124 *
118 * @param[in] config A PP_Resource containing the audio resource. 125 * @param[in] config A <code>PP_Resource</code> corresponding to an audio
126 * resource.
119 * 127 *
120 * @return A PP_Resource containing the audio config resource if successful. 128 * @return A <code>PP_Resource</code> containing the audio config resource if
129 * successful.
121 */ 130 */
122 PP_Resource (*GetCurrentConfig)(PP_Resource audio); 131 PP_Resource (*GetCurrentConfig)(PP_Resource audio);
123 /** 132 /**
124 * StartPlayback is a pointer to a function that starts the playback of 133 * StartPlayback() starts the playback of the audio resource and begins
125 * the audio resource and begins periodically calling the callback. 134 * periodically calling the callback.
126 * 135 *
127 * @param[in] config A PP_Resource containing the audio resource. 136 * @param[in] config A <code>PP_Resource</code> corresponding to an audio
137 * resource.
128 * 138 *
129 * @return A PP_BOOL containing PP_TRUE if successful, otherwise PP_FALSE. 139 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if
130 * Also returns PP_TRUE (and be a no-op) if called while playback is already 140 * successful, otherwise <code>PP_FALSE</code>. Also returns
141 * <code>PP_TRUE</code> (and be a no-op) if called while playback is already
131 * in progress. 142 * in progress.
132 */ 143 */
133 PP_Bool (*StartPlayback)(PP_Resource audio); 144 PP_Bool (*StartPlayback)(PP_Resource audio);
134 /** 145 /**
135 * StopPlayback is a pointer to a function that stops the playback of 146 * StopPlayback() stops the playback of the audio resource.
136 * the audio resource.
137 * 147 *
138 * @param[in] config A PP_Resource containing the audio resource. 148 * @param[in] config A <code>PP_Resource</code> corresponding to an audio
149 * resource.
139 * 150 *
140 * @return A PP_BOOL containing PP_TRUE if successful, otherwise PP_FALSE. 151 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if
141 * Also returns PP_TRUE (and is a no-op) if called while playback is already 152 * successful, otherwise <code>PP_FALSE</code>. Also returns
142 * stopped. If a callback is in progress, StopPlayback will block until the 153 * <code>PP_TRUE</code> (and is a no-op) if called while playback is already
154 * stopped. If a callback is in progress, StopPlayback() will block until the
143 * callback completes. 155 * callback completes.
144 */ 156 */
145 PP_Bool (*StopPlayback)(PP_Resource audio); 157 PP_Bool (*StopPlayback)(PP_Resource audio);
146 }; 158 };
147 /** 159 /**
148 * @} 160 * @}
149 */ 161 */
150 162
151 #endif /* PPAPI_C_PPB_AUDIO_H_ */ 163 #endif /* PPAPI_C_PPB_AUDIO_H_ */
152 164
OLDNEW
« no previous file with comments | « ppapi/api/ppp_messaging.idl ('k') | ppapi/c/ppb_audio_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698