Service Worker: Cleanup on a renderer crash before the dispatcher host is destroyed
[chromium-blink-merge.git] / ppapi / api / ppb_audio_buffer.idl
blob8640f00dd1f0cc2415ac1293a2cb7e6125c2409a
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 /**
7 * Defines the <code>PPB_AudioBuffer</code> interface.
8 */
10 [generate_thunk]
12 label Chrome {
13 [channel=dev] M34 = 0.1,
14 M35 = 0.1
17 /**
18 * PP_AudioBuffer_SampleRate is an enumeration of the different audio sample
19 * rates.
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
33 /**
34 * PP_AudioBuffer_SampleSize is an enumeration of the different audio sample
35 * sizes.
37 enum PP_AudioBuffer_SampleSize {
38 PP_AUDIOBUFFER_SAMPLESIZE_UNKNOWN = 0,
39 PP_AUDIOBUFFER_SAMPLESIZE_16_BITS = 2
42 [version=0.1]
43 interface PPB_AudioBuffer {
44 /**
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);
54 /**
55 * Gets the timestamp of the audio buffer.
57 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
58 * buffer resource.
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.
63 [on_failure=0.0]
64 PP_TimeDelta GetTimestamp([in] PP_Resource buffer);
66 /**
67 * Sets the timestamp of the audio buffer.
69 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
70 * buffer resource.
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
73 * audio stream.
75 void SetTimestamp([in] PP_Resource buffer, [in] PP_TimeDelta timestamp);
77 /**
78 * Gets the sample rate of the audio buffer.
80 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
81 * buffer resource.
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);
88 /**
89 * Gets the sample size of the audio buffer.
91 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
92 * buffer resource.
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);
99 /**
100 * Gets the number of channels in the audio buffer.
102 * @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
103 * buffer resource.
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
113 * buffer resource.
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
125 * buffer resource.
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
135 * buffer resource.
137 * @return The size of the data buffer in bytes.
139 uint32_t GetDataBufferSize([in] PP_Resource buffer);