skia/ext: Early out from analysis when we have more than 1 draw op.
[chromium-blink-merge.git] / ppapi / c / ppb_audio_buffer.h
blobfe728a3158563e653b1a42d51d727a0c80979227
1 /* Copyright 2014 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 */
6 /* From ppb_audio_buffer.idl modified Tue Mar 25 18:29:27 2014. */
8 #ifndef PPAPI_C_PPB_AUDIO_BUFFER_H_
9 #define PPAPI_C_PPB_AUDIO_BUFFER_H_
11 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_macros.h"
13 #include "ppapi/c/pp_resource.h"
14 #include "ppapi/c/pp_stdint.h"
15 #include "ppapi/c/pp_time.h"
17 #define PPB_AUDIOBUFFER_INTERFACE_0_1 "PPB_AudioBuffer;0.1"
18 #define PPB_AUDIOBUFFER_INTERFACE PPB_AUDIOBUFFER_INTERFACE_0_1
20 /**
21 * @file
22 * Defines the <code>PPB_AudioBuffer</code> interface.
26 /**
27 * @addtogroup Enums
28 * @{
30 /**
31 * PP_AudioBuffer_SampleRate is an enumeration of the different audio sample
32 * rates.
34 typedef enum {
35 PP_AUDIOBUFFER_SAMPLERATE_UNKNOWN = 0,
36 PP_AUDIOBUFFER_SAMPLERATE_8000 = 8000,
37 PP_AUDIOBUFFER_SAMPLERATE_16000 = 16000,
38 PP_AUDIOBUFFER_SAMPLERATE_22050 = 22050,
39 PP_AUDIOBUFFER_SAMPLERATE_32000 = 32000,
40 PP_AUDIOBUFFER_SAMPLERATE_44100 = 44100,
41 PP_AUDIOBUFFER_SAMPLERATE_48000 = 48000,
42 PP_AUDIOBUFFER_SAMPLERATE_96000 = 96000,
43 PP_AUDIOBUFFER_SAMPLERATE_192000 = 192000
44 } PP_AudioBuffer_SampleRate;
46 /**
47 * PP_AudioBuffer_SampleSize is an enumeration of the different audio sample
48 * sizes.
50 typedef enum {
51 PP_AUDIOBUFFER_SAMPLESIZE_UNKNOWN = 0,
52 PP_AUDIOBUFFER_SAMPLESIZE_16_BITS = 2
53 } PP_AudioBuffer_SampleSize;
54 /**
55 * @}
58 /**
59 * @addtogroup Interfaces
60 * @{
62 struct PPB_AudioBuffer_0_1 {
63 /**
64 * Determines if a resource is an AudioBuffer resource.
66 * @param[in] resource The <code>PP_Resource</code> to test.
68 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
69 * resource is an AudioBuffer resource or <code>PP_FALSE</code> otherwise.
71 PP_Bool (*IsAudioBuffer)(PP_Resource resource);
72 /**
73 * Gets the timestamp of the audio buffer.
75 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
76 * buffer resource.
78 * @return A <code>PP_TimeDelta</code> containing the timestamp of the audio
79 * buffer. Given in seconds since the start of the containing audio stream.
81 PP_TimeDelta (*GetTimestamp)(PP_Resource buffer);
82 /**
83 * Sets the timestamp of the audio buffer.
85 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
86 * buffer resource.
87 * @param[in] timestamp A <code>PP_TimeDelta</code> containing the timestamp
88 * of the audio buffer. Given in seconds since the start of the containing
89 * audio stream.
91 void (*SetTimestamp)(PP_Resource buffer, PP_TimeDelta timestamp);
92 /**
93 * Gets the sample rate of the audio buffer.
95 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
96 * buffer resource.
98 * @return The sample rate of the audio buffer.
100 PP_AudioBuffer_SampleRate (*GetSampleRate)(PP_Resource buffer);
102 * Gets the sample size of the audio buffer.
104 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
105 * buffer resource.
107 * @return The sample size of the audio buffer.
109 PP_AudioBuffer_SampleSize (*GetSampleSize)(PP_Resource buffer);
111 * Gets the number of channels in the audio buffer.
113 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
114 * buffer resource.
116 * @return The number of channels in the audio buffer.
118 uint32_t (*GetNumberOfChannels)(PP_Resource buffer);
120 * Gets the number of samples in the audio buffer.
122 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
123 * buffer resource.
125 * @return The number of samples in the audio buffer.
126 * For example, at a sampling rate of 44,100 Hz in stereo audio, a buffer
127 * containing 4410 * 2 samples would have a duration of 100 milliseconds.
129 uint32_t (*GetNumberOfSamples)(PP_Resource buffer);
131 * Gets the data buffer containing the audio samples.
133 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
134 * buffer resource.
136 * @return A pointer to the beginning of the data buffer.
138 void* (*GetDataBuffer)(PP_Resource buffer);
140 * Gets the size of the data buffer in bytes.
142 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
143 * buffer resource.
145 * @return The size of the data buffer in bytes.
147 uint32_t (*GetDataBufferSize)(PP_Resource buffer);
150 typedef struct PPB_AudioBuffer_0_1 PPB_AudioBuffer;
152 * @}
155 #endif /* PPAPI_C_PPB_AUDIO_BUFFER_H_ */