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

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

Issue 6279003: Move ppapi audio interface out of dev, but... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 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
« no previous file with comments | « no previous file | 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')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 * found in the LICENSE file.
4 */
5 #ifndef PPAPI_C_PPB_AUDIO_H_
6 #define PPAPI_C_PPB_AUDIO_H_
7
8 #include "ppapi/c/pp_bool.h"
9 #include "ppapi/c/pp_instance.h"
10 #include "ppapi/c/pp_module.h"
11 #include "ppapi/c/pp_resource.h"
12 #include "ppapi/c/pp_stdint.h"
13
14 #define PPB_AUDIO_INTERFACE "PPB_Audio;1.0"
15
16 // Callback function type for SetCallback.
17 typedef void (*PPB_Audio_Callback)(void* sample_buffer,
18 size_t buffer_size_in_bytes,
19 void* user_data);
20
21 // Callback-based audio interface. User of audio must set the callback that will
22 // be called each time that the buffer needs to be filled.
23 //
24 // A C++ example:
25 //
26 // void audio_callback(void* sample_buffer,
27 // size_t buffer_size_in_bytes,
28 // void* user_data) {
29 // ... fill in the buffer with samples ...
30 // }
31 //
32 // uint32_t obtained;
33 // AudioConfig config(PP_AUDIOSAMPLERATE_44100, 4096, &obtained);
34 // Audio audio(config, audio_callback, NULL);
35 // audio.StartPlayback();
36 //
37 struct PPB_Audio {
38 // Creates a paused audio interface. No sound will be heard until
39 // StartPlayback() is called. The callback is called with the buffer address
40 // and given user data whenever the buffer needs to be filled. From within the
41 // callback, you should not call PPB_Audio functions. The callback will be
42 // called on a different thread than the one which created the interface. For
43 // performance-critical applications (i.e. low-latency audio), the callback
44 // should avoid blocking or calling functions that can obtain locks, such as
45 // malloc. The layout and the size of the buffer passed to the audio callback
46 // will be determined by the device configuration and is specified in the
47 // AudioConfig documentation. If the configuration cannot be honored, or the
48 // callback is null, the function returns 0.
49 PP_Resource (*Create)(PP_Instance instance, PP_Resource config,
50 PPB_Audio_Callback audio_callback, void* user_data);
51
52 /**
53 * Returns PP_TRUE if the given resource is an Audio resource, PP_FALSE
54 * otherwise.
55 */
56 PP_Bool (*IsAudio)(PP_Resource resource);
57
58 // Get the current configuration.
59 PP_Resource (*GetCurrentConfig)(PP_Resource audio);
60
61 // Start the playback. Begin periodically calling the callback. If called
62 // while playback is already in progress, will return PP_TRUE and be a no-op.
63 // On error, return PP_FALSE.
64 PP_Bool (*StartPlayback)(PP_Resource audio);
65
66 // Stop the playback. If playback is already stopped, this is a no-op and
67 // returns PP_TRUE. On error, returns PP_FALSE. If a callback is in progress,
68 // StopPlayback will block until callback completes.
69 PP_Bool (*StopPlayback)(PP_Resource audio);
70 };
71
72 #endif /* PPAPI_C_PPB_DEVICE_CONTEXT_AUDIO_H_ */
73
OLDNEW
« no previous file with comments | « no previous file | ppapi/c/ppb_audio_config.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698