forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathppb_audio_buffer.idl
140 lines (126 loc) · 4.1 KB
/
ppb_audio_buffer.idl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
/* Copyright 2014 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/**
* Defines the <code>PPB_AudioBuffer</code> interface.
*/
[generate_thunk]
label Chrome {
[channel=dev] M34 = 0.1,
M35 = 0.1
};
/**
* PP_AudioBuffer_SampleRate is an enumeration of the different audio sample
* rates.
*/
enum PP_AudioBuffer_SampleRate {
PP_AUDIOBUFFER_SAMPLERATE_UNKNOWN = 0,
PP_AUDIOBUFFER_SAMPLERATE_8000 = 8000,
PP_AUDIOBUFFER_SAMPLERATE_16000 = 16000,
PP_AUDIOBUFFER_SAMPLERATE_22050 = 22050,
PP_AUDIOBUFFER_SAMPLERATE_32000 = 32000,
PP_AUDIOBUFFER_SAMPLERATE_44100 = 44100,
PP_AUDIOBUFFER_SAMPLERATE_48000 = 48000,
PP_AUDIOBUFFER_SAMPLERATE_96000 = 96000,
PP_AUDIOBUFFER_SAMPLERATE_192000 = 192000
};
/**
* PP_AudioBuffer_SampleSize is an enumeration of the different audio sample
* sizes.
*/
enum PP_AudioBuffer_SampleSize {
PP_AUDIOBUFFER_SAMPLESIZE_UNKNOWN = 0,
PP_AUDIOBUFFER_SAMPLESIZE_16_BITS = 2
};
[version=0.1]
interface PPB_AudioBuffer {
/**
* Determines if a resource is an AudioBuffer resource.
*
* @param[in] resource The <code>PP_Resource</code> to test.
*
* @return A <code>PP_Bool</code> with <code>PP_TRUE</code> if the given
* resource is an AudioBuffer resource or <code>PP_FALSE</code> otherwise.
*/
PP_Bool IsAudioBuffer([in] PP_Resource resource);
/**
* Gets the timestamp of the audio buffer.
*
* @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
* buffer resource.
*
* @return A <code>PP_TimeDelta</code> containing the timestamp of the audio
* buffer. Given in seconds since the start of the containing audio stream.
*/
[on_failure=0.0]
PP_TimeDelta GetTimestamp([in] PP_Resource buffer);
/**
* Sets the timestamp of the audio buffer.
*
* @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
* buffer resource.
* @param[in] timestamp A <code>PP_TimeDelta</code> containing the timestamp
* of the audio buffer. Given in seconds since the start of the containing
* audio stream.
*/
void SetTimestamp([in] PP_Resource buffer, [in] PP_TimeDelta timestamp);
/**
* Gets the sample rate of the audio buffer.
*
* @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
* buffer resource.
*
* @return The sample rate of the audio buffer.
*/
[on_failure=PP_AUDIOBUFFER_SAMPLERATE_UNKNOWN]
PP_AudioBuffer_SampleRate GetSampleRate([in] PP_Resource buffer);
/**
* Gets the sample size of the audio buffer.
*
* @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
* buffer resource.
*
* @return The sample size of the audio buffer.
*/
[on_failure=PP_AUDIOBUFFER_SAMPLESIZE_UNKNOWN]
PP_AudioBuffer_SampleSize GetSampleSize([in] PP_Resource buffer);
/**
* Gets the number of channels in the audio buffer.
*
* @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
* buffer resource.
*
* @return The number of channels in the audio buffer.
*/
uint32_t GetNumberOfChannels([in] PP_Resource buffer);
/**
* Gets the number of samples in the audio buffer.
*
* @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
* buffer resource.
*
* @return The number of samples in the audio buffer.
* For example, at a sampling rate of 44,100 Hz in stereo audio, a buffer
* containing 4410 * 2 samples would have a duration of 100 milliseconds.
*/
uint32_t GetNumberOfSamples([in] PP_Resource buffer);
/**
* Gets the data buffer containing the audio samples.
*
* @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
* buffer resource.
*
* @return A pointer to the beginning of the data buffer.
*/
mem_t GetDataBuffer([in] PP_Resource buffer);
/**
* Gets the size of the data buffer in bytes.
*
* @param[in] buffer A <code>PP_Resource</code> corresponding to an audio
* buffer resource.
*
* @return The size of the data buffer in bytes.
*/
uint32_t GetDataBufferSize([in] PP_Resource buffer);
};