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.
7 * Defines the <code>PPB_AudioBuffer</code> interface.
13 [channel
=dev
] M34
= 0.1,
18 * PP_AudioBuffer_SampleRate is an enumeration of the different audio sample
21 enum PP_AudioBuffer_SampleRate
{
22 PP_AUDIOBUFFER_SAMPLERATE_UNKNOWN
= 0,
23 PP_AUDIOBUFFER_SAMPLERATE_8000
= 8000,
24 PP_AUDIOBUFFER_SAMPLERATE_16000
= 16000,
25 PP_AUDIOBUFFER_SAMPLERATE_22050
= 22050,
26 PP_AUDIOBUFFER_SAMPLERATE_32000
= 32000,
27 PP_AUDIOBUFFER_SAMPLERATE_44100
= 44100,
28 PP_AUDIOBUFFER_SAMPLERATE_48000
= 48000,
29 PP_AUDIOBUFFER_SAMPLERATE_96000
= 96000,
30 PP_AUDIOBUFFER_SAMPLERATE_192000
= 192000
34 * PP_AudioBuffer_SampleSize is an enumeration of the different audio sample
37 enum PP_AudioBuffer_SampleSize
{
38 PP_AUDIOBUFFER_SAMPLESIZE_UNKNOWN
= 0,
39 PP_AUDIOBUFFER_SAMPLESIZE_16_BITS
= 2
43 interface PPB_AudioBuffer
{
45 * Determines if a resource is an AudioBuffer resource.
47 * @param[in] resource The <code>PP_Resource</code> to test.
49 * @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
50 * resource is an AudioBuffer resource or <code>PP_FALSE</code> otherwise.
52 PP_Bool IsAudioBuffer
([in] PP_Resource resource
);
55 * Gets the timestamp of the audio buffer.
57 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
60 * @return A <code>PP_TimeDelta</code> containing the timestamp of the audio
61 * buffer. Given in seconds since the start of the containing audio stream.
64 PP_TimeDelta GetTimestamp
([in] PP_Resource buffer
);
67 * Sets the timestamp of the audio buffer.
69 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
71 * @param[in] timestamp A <code>PP_TimeDelta</code> containing the timestamp
72 * of the audio buffer. Given in seconds since the start of the containing
75 void SetTimestamp
([in] PP_Resource buffer
, [in] PP_TimeDelta timestamp
);
78 * Gets the sample rate of the audio buffer.
80 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
83 * @return The sample rate of the audio buffer.
85 [on_failure
=PP_AUDIOBUFFER_SAMPLERATE_UNKNOWN
]
86 PP_AudioBuffer_SampleRate GetSampleRate
([in] PP_Resource buffer
);
89 * Gets the sample size of the audio buffer.
91 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
94 * @return The sample size of the audio buffer.
96 [on_failure
=PP_AUDIOBUFFER_SAMPLESIZE_UNKNOWN
]
97 PP_AudioBuffer_SampleSize GetSampleSize
([in] PP_Resource buffer
);
100 * Gets the number of channels in the audio buffer.
102 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
105 * @return The number of channels in the audio buffer.
107 uint32_t GetNumberOfChannels
([in] PP_Resource buffer
);
110 * Gets the number of samples in the audio buffer.
112 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
115 * @return The number of samples in the audio buffer.
116 * For example, at a sampling rate of 44,100 Hz in stereo audio, a buffer
117 * containing 4410 * 2 samples would have a duration of 100 milliseconds.
119 uint32_t GetNumberOfSamples
([in] PP_Resource buffer
);
122 * Gets the data buffer containing the audio samples.
124 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
127 * @return A pointer to the beginning of the data buffer.
129 mem_t GetDataBuffer
([in] PP_Resource buffer
);
132 * Gets the size of the data buffer in bytes.
134 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
137 * @return The size of the data buffer in bytes.
139 uint32_t GetDataBufferSize
([in] PP_Resource buffer
);