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.
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
22 * Defines the <code>PPB_AudioBuffer</code> interface.
31 * PP_AudioBuffer_SampleRate is an enumeration of the different audio sample
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
;
47 * PP_AudioBuffer_SampleSize is an enumeration of the different audio sample
51 PP_AUDIOBUFFER_SAMPLESIZE_UNKNOWN
= 0,
52 PP_AUDIOBUFFER_SAMPLESIZE_16_BITS
= 2
53 } PP_AudioBuffer_SampleSize
;
59 * @addtogroup Interfaces
62 struct PPB_AudioBuffer_0_1
{
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
);
73 * Gets the timestamp of the audio buffer.
75 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
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
);
83 * Sets the timestamp of the audio buffer.
85 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
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
91 void (*SetTimestamp
)(PP_Resource buffer
, PP_TimeDelta timestamp
);
93 * Gets the sample rate of the audio buffer.
95 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
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
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
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
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
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
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
;
155 #endif /* PPAPI_C_PPB_AUDIO_BUFFER_H_ */