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

Side by Side Diff: ppapi/c/ppb_audio_config.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 | « ppapi/c/ppb_audio.h ('k') | ppapi/c/trusted/ppb_audio_trusted.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_CONFIG_H_
6 #define PPAPI_C_PPB_AUDIO_CONFIG_H_
7
8 #include "ppapi/c/pp_bool.h"
9 #include "ppapi/c/pp_instance.h"
10 #include "ppapi/c/pp_macros.h"
11 #include "ppapi/c/pp_resource.h"
12 #include "ppapi/c/pp_stdint.h"
13
14 #define PPB_AUDIO_CONFIG_INTERFACE "PPB_AudioConfig;1.0"
15
16 enum {
17 PP_AUDIOMINSAMPLEFRAMECOUNT = 64,
18 PP_AUDIOMAXSAMPLEFRAMECOUNT = 32768
19 };
20
21 typedef enum {
22 PP_AUDIOSAMPLERATE_NONE = 0,
23 PP_AUDIOSAMPLERATE_44100 = 44100,
24 PP_AUDIOSAMPLERATE_48000 = 48000
25 } PP_AudioSampleRate;
26 PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_AudioSampleRate, 4);
27
28 /**
29 * Audio configuration. This base configuration interface supports only stereo
30 * 16bit output. This class is not mutable, therefore it is okay to access
31 * instances from different threads.
32 */
33 struct PPB_AudioConfig {
34 /**
35 * Create a 16 bit stereo config with the given sample rate. We guarantee
36 * that PP_AUDIOSAMPLERATE_44100 and PP_AUDIOSAMPLERATE_48000 sample rates
37 * are supported. The |sample_frame_count| should be the result of calling
38 * RecommendSampleFrameCount. If the sample frame count or bit rate aren't
39 * supported, this function will fail and return a null resource.
40 *
41 * A single sample frame on a stereo device means one value for the left
42 * channel and one value for the right channel.
43 *
44 * Buffer layout for a stereo int16 configuration:
45 * int16_t *buffer16;
46 * buffer16[0] is the first left channel sample
47 * buffer16[1] is the first right channel sample
48 * buffer16[2] is the second left channel sample
49 * buffer16[3] is the second right channel sample
50 * ...
51 * buffer16[2 * (sample_frame_count - 1)] is the last left channel sample
52 * buffer16[2 * (sample_frame_count - 1) + 1] is the last right channel sample
53 * Data will always be in the native endian format of the platform.
54 */
55 PP_Resource (*CreateStereo16Bit)(PP_Instance instance,
56 PP_AudioSampleRate sample_rate,
57 uint32_t sample_frame_count);
58
59 /*
60 * Returns a supported sample frame count closest to the given requested
61 * count. The sample frame count determines the overall latency of audio.
62 * Since one "frame" is always buffered in advance, smaller frame counts
63 * will yield lower latency, but higher CPU utilization.
64 *
65 * Supported sample frame counts will vary by hardware and system (consider
66 * that the local system might be anywhere from a cell phone or a high-end
67 * audio workstation). Sample counts less than PP_AUDIOMINSAMPLEFRAMECOUNT
68 * and greater than PP_AUDIOMAXSAMPLEFRAMECOUNT are never supported on any
69 * system, but values in between aren't necessarily valid. This function
70 * will return a supported count closest to the requested value.
71 *
72 * If you pass 0 as the requested sample count, the recommended sample for
73 * the local system is returned.
74 */
75 uint32_t (*RecommendSampleFrameCount)(PP_AudioSampleRate sample_rate,
76 uint32_t requested_sample_frame_count);
77
78 /**
79 * Returns true if the given resource is an AudioConfig object.
80 */
81 PP_Bool (*IsAudioConfig)(PP_Resource resource);
82
83 /**
84 * Returns the sample rate for the given AudioConfig resource. If the
85 * resource is invalid, this will return PP_AUDIOSAMPLERATE_NONE.
86 */
87 PP_AudioSampleRate (*GetSampleRate)(PP_Resource config);
88
89 /**
90 * Returns the sample frame count for the given AudioConfig resource. If the
91 * resource is invalid, this will return 0. See RecommendSampleFrameCount for
92 * more on sample frame counts.
93 */
94 uint32_t (*GetSampleFrameCount)(PP_Resource config);
95 };
96
97 #endif /* PPAPI_C_PPB_AUDIO_CONFIG_H_ */
98
OLDNEW
« no previous file with comments | « ppapi/c/ppb_audio.h ('k') | ppapi/c/trusted/ppb_audio_trusted.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698