blob: dc43346ed2f354e4eecfb15efa1336657877a22f [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 *
Mikhail Naganov10548292016-10-31 10:39:47 -0700137 * @param effectId effect ID (obtained from IEffectsFactory.createEffect) of
138 * the effect to apply.
Mikhail Naganov96b30be2016-10-05 11:21:12 -0700139 * @return retval operation completion status.
140 */
Mikhail Naganov10548292016-10-31 10:39:47 -0700141 addEffect(uint64_t effectId) generates (Result retval);
Mikhail Naganov96b30be2016-10-05 11:21:12 -0700142
143 /*
144 * Stops application of the effect to the stream.
145 *
Mikhail Naganov10548292016-10-31 10:39:47 -0700146 * @param effectId effect ID (obtained from IEffectsFactory.createEffect) of
147 * the effect to remove.
Mikhail Naganov96b30be2016-10-05 11:21:12 -0700148 * @return retval operation completion status.
149 */
Mikhail Naganov10548292016-10-31 10:39:47 -0700150 removeEffect(uint64_t effectId) generates (Result retval);
Mikhail Naganov96b30be2016-10-05 11:21:12 -0700151
152 /*
153 * Put the audio hardware input/output into standby mode.
154 * Driver must exit from standby mode at the next I/O operation.
155 *
156 * @return retval operation completion status.
157 */
158 standby() generates (Result retval);
159
160 /*
161 * Return the set of device(s) which this stream is connected to.
162 *
Mikhail Naganov96b30be2016-10-05 11:21:12 -0700163 * @return device set of device(s) which this stream is connected to.
164 */
Mikhail Naganov10548292016-10-31 10:39:47 -0700165 getDevice() generates (AudioDevice device);
Mikhail Naganov96b30be2016-10-05 11:21:12 -0700166
167 /*
168 * Connects the stream to the device.
169 *
170 * This method must only be used for HALs that do not support
171 * 'IDevice.createAudioPatch' method. Calling this method is
172 * equivalent to setting AUDIO_PARAMETER_STREAM_ROUTING in the legacy HAL
173 * interface.
174 *
175 * @param address device to connect the stream to.
176 * @return retval operation completion status.
177 */
178 setDevice(DeviceAddress address) generates (Result retval);
179
180 /*
181 * Notifies the stream about device connection state. Calling this method is
182 * equivalent to setting AUDIO_PARAMETER_DEVICE_[DIS]CONNECT on the legacy
183 * HAL.
184 *
185 * @param address audio device specification.
186 * @param connected whether the device is connected.
187 * @return retval operation completion status.
188 */
189 setConnectedState(DeviceAddress address, bool connected)
190 generates (Result retval);
191
192 /*
193 * Sets the HW synchronization source. Calling this method is equivalent to
194 * setting AUDIO_PARAMETER_STREAM_HW_AV_SYNC on the legacy HAL.
195 *
196 * @param hwAvSync HW synchronization source
197 * @return retval operation completion status.
198 */
199 setHwAvSync(AudioHwSync hwAvSync) generates (Result retval);
200
201 /*
202 * Generic method for retrieving vendor-specific parameter values.
203 * The framework does not interpret the parameters, they are passed
204 * in an opaque manner between a vendor application and HAL.
205 *
206 * @param keys parameter keys.
207 * @return retval operation completion status.
208 * @return parameters parameter key value pairs.
209 */
210 getParameters(vec<string> keys)
211 generates (Result retval, vec<ParameterValue> parameters);
212
213 /*
214 * Generic method for setting vendor-specific parameter values.
215 * The framework does not interpret the parameters, they are passed
216 * in an opaque manner between a vendor application and HAL.
217 *
218 * @param parameters parameter key value pairs.
219 * @return retval operation completion status.
220 */
221 setParameters(vec<ParameterValue> parameters) generates (Result retval);
222
223 /*
224 * Dumps information about the stream into the provided file descriptor.
225 * This is used for the dumpsys facility.
226 *
227 * @param fd dump file descriptor.
228 */
229 debugDump(handle fd);
230};