blob: 09ba42a5571086c7c8d1f4ceb08900e031293422 [file] [log] [blame]
Mikhail Naganov96b30be2016-10-05 11:21:12 -07001/*
2 * Copyright (C) 2016 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.hardware.audio@2.0;
18
19import android.hardware.audio.common@2.0;
20import android.hardware.audio.effect@2.0::IEffect;
21
22interface IStream {
23 typedef android.hardware.audio@2.0::Result Result;
24
25 /*
26 * Return the frame size (number of bytes per sample).
27 *
28 * @return frameSize frame size in bytes.
29 */
30 getFrameSize() generates (uint64_t frameSize);
31
32 /*
33 * Return the frame count of the buffer. Calling this method is equivalent
34 * to getting AUDIO_PARAMETER_STREAM_FRAME_COUNT on the legacy HAL.
35 *
36 * @return count frame count.
37 */
38 getFrameCount() generates (uint64_t count);
39
40 /*
41 * Return the size of input/output buffer in bytes for this stream.
42 * It must be a multiple of the frame size.
43 *
44 * @return buffer buffer size in bytes.
45 */
46 getBufferSize() generates (uint64_t bufferSize);
47
48 /*
49 * Return the sampling rate in Hz.
50 *
51 * @return sampleRateHz sample rate in Hz.
52 */
53 getSampleRate() generates (uint32_t sampleRateHz);
54
55 /*
56 * Return supported sampling rates of the stream. Calling this method is
57 * equivalent to getting AUDIO_PARAMETER_STREAM_SUP_SAMPLING_RATES on the
58 * legacy HAL.
59 *
60 * @return sampleRateHz supported sample rates.
61 */
62 getSupportedSampleRates() generates (vec<uint32_t> sampleRates);
63
64 /*
65 * Sets the sampling rate of the stream. Calling this method is equivalent
66 * to setting AUDIO_PARAMETER_STREAM_SAMPLING_RATE on the legacy HAL.
67 *
68 * @param sampleRateHz sample rate in Hz.
69 * @return retval operation completion status.
70 */
71 setSampleRate(uint32_t sampleRateHz) generates (Result retval);
72
73 /*
74 * Return the channel mask of the stream.
75 *
76 * @return mask channel mask.
77 */
78 getChannelMask() generates (AudioChannelMask mask);
79
80 /*
81 * Return supported channel masks of the stream. Calling this method is
82 * equivalent to getting AUDIO_PARAMETER_STREAM_SUP_CHANNELS on the legacy
83 * HAL.
84 *
85 * @return masks supported audio masks.
86 */
87 getSupportedChannelMasks() generates (vec<AudioChannelMask> masks);
88
89 /*
90 * Sets the channel mask of the stream. Calling this method is equivalent to
91 * setting AUDIO_PARAMETER_STREAM_CHANNELS on the legacy HAL.
92 *
93 * @param format audio format.
94 * @return retval operation completion status.
95 */
96 setChannelMask(AudioChannelMask mask) generates (Result retval);
97
98 /*
99 * Return the audio format of the stream.
100 *
101 * @return format audio format.
102 */
103 getFormat() generates (AudioFormat format);
104
105 /*
106 * Return supported audio formats of the stream. Calling this method is
107 * equivalent to getting AUDIO_PARAMETER_STREAM_SUP_FORMATS on the legacy
108 * HAL.
109 *
110 * @return formats supported audio formats.
111 */
112 getSupportedFormats() generates (vec<AudioFormat> formats);
113
114 /*
115 * Sets the audio format of the stream. Calling this method is equivalent to
116 * setting AUDIO_PARAMETER_STREAM_FORMAT on the legacy HAL.
117 *
118 * @param format audio format.
119 * @return retval operation completion status.
120 */
121 setFormat(AudioFormat format) generates (Result retval);
122
123 /*
124 * Convenience method for retrieving several stream parameters in
125 * one transaction.
126 *
127 * @return sampleRateHz sample rate in Hz.
128 * @return mask channel mask.
129 * @return format audio format.
130 */
131 getAudioProperties() generates (
132 uint32_t sampleRateHz, AudioChannelMask mask, AudioFormat format);
133
134 /*
135 * Applies audio effect to the stream.
136 *
137 * @param effect the effect to apply.
138 * @return retval operation completion status.
139 */
140 addEffect(IEffect effect) generates (Result retval);
141
142 /*
143 * Stops application of the effect to the stream.
144 *
145 * @param effect the effect to apply.
146 * @return retval operation completion status.
147 */
148 removeEffect(IEffect effect) generates (Result retval);
149
150 /*
151 * Put the audio hardware input/output into standby mode.
152 * Driver must exit from standby mode at the next I/O operation.
153 *
154 * @return retval operation completion status.
155 */
156 standby() generates (Result retval);
157
158 /*
159 * Return the set of device(s) which this stream is connected to.
160 *
161 * @return retval operation completion status.
162 * @return device set of device(s) which this stream is connected to.
163 */
164 getDevice() generates (Result retval, AudioDevice device);
165
166 /*
167 * Connects the stream to the device.
168 *
169 * This method must only be used for HALs that do not support
170 * 'IDevice.createAudioPatch' method. Calling this method is
171 * equivalent to setting AUDIO_PARAMETER_STREAM_ROUTING in the legacy HAL
172 * interface.
173 *
174 * @param address device to connect the stream to.
175 * @return retval operation completion status.
176 */
177 setDevice(DeviceAddress address) generates (Result retval);
178
179 /*
180 * Notifies the stream about device connection state. Calling this method is
181 * equivalent to setting AUDIO_PARAMETER_DEVICE_[DIS]CONNECT on the legacy
182 * HAL.
183 *
184 * @param address audio device specification.
185 * @param connected whether the device is connected.
186 * @return retval operation completion status.
187 */
188 setConnectedState(DeviceAddress address, bool connected)
189 generates (Result retval);
190
191 /*
192 * Sets the HW synchronization source. Calling this method is equivalent to
193 * setting AUDIO_PARAMETER_STREAM_HW_AV_SYNC on the legacy HAL.
194 *
195 * @param hwAvSync HW synchronization source
196 * @return retval operation completion status.
197 */
198 setHwAvSync(AudioHwSync hwAvSync) generates (Result retval);
199
200 /*
201 * Generic method for retrieving vendor-specific parameter values.
202 * The framework does not interpret the parameters, they are passed
203 * in an opaque manner between a vendor application and HAL.
204 *
205 * @param keys parameter keys.
206 * @return retval operation completion status.
207 * @return parameters parameter key value pairs.
208 */
209 getParameters(vec<string> keys)
210 generates (Result retval, vec<ParameterValue> parameters);
211
212 /*
213 * Generic method for setting vendor-specific parameter values.
214 * The framework does not interpret the parameters, they are passed
215 * in an opaque manner between a vendor application and HAL.
216 *
217 * @param parameters parameter key value pairs.
218 * @return retval operation completion status.
219 */
220 setParameters(vec<ParameterValue> parameters) generates (Result retval);
221
222 /*
223 * Dumps information about the stream into the provided file descriptor.
224 * This is used for the dumpsys facility.
225 *
226 * @param fd dump file descriptor.
227 */
228 debugDump(handle fd);
229};