blob: 6cf74259101864e9e7d93112ea459e2ffa56e908 [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 IStream;
21
22interface IStreamIn extends IStream {
23 typedef android.hardware.audio@2.0::Result Result;
24
25 /*
26 * Returns the source descriptor of the input stream. Calling this method is
27 * equivalent to getting AUDIO_PARAMETER_STREAM_INPUT_SOURCE on the legacy
28 * HAL.
29 *
30 * @return retval operation completion status.
31 * @return source audio source.
32 */
33 getAudioSource() generates (Result retval, AudioSource source);
34
35 /*
36 * Set the input gain for the audio driver.
37 *
38 * @param gain 1.0f is unity, 0.0f is zero.
39 * @result retval operation completion status.
40 */
41 setGain(float gain) generates (Result retval);
42
43 /*
44 * Read audio buffer in from driver. If at least one frame was read prior to
45 * the error, 'read' must return that byte count and then return an error
46 * in the subsequent call.
47 *
48 * @param size maximum amount of bytes to read.
49 * @return retval operation completion status.
50 * @return data audio data.
51 */
52 // TODO(mnaganov): Replace with FMQ version.
53 read(uint64_t size) generates (Result retval, vec<uint8_t> data);
54
55 /*
56 * Return the amount of input frames lost in the audio driver since the last
57 * call of this function.
58 *
59 * Audio driver is expected to reset the value to 0 and restart counting
60 * upon returning the current value by this function call. Such loss
61 * typically occurs when the user space process is blocked longer than the
62 * capacity of audio driver buffers.
63 *
Mikhail Naganov96b30be2016-10-05 11:21:12 -070064 * @return framesLost the number of input audio frames lost.
65 */
Mikhail Naganov10548292016-10-31 10:39:47 -070066 getInputFramesLost() generates (uint32_t framesLost);
Mikhail Naganov96b30be2016-10-05 11:21:12 -070067
68 /**
69 * Return a recent count of the number of audio frames received and the
70 * clock time associated with that frame count.
71 *
72 * @return retval INVALID_STATE if the device is not ready/available,
73 * NOT_SUPPORTED if the command is not supported,
74 * OK otherwise.
75 * @return frames the total frame count received. This must be as early in
76 * the capture pipeline as possible. In general, frames
77 * must be non-negative and must not go "backwards".
78 * @return time is the clock monotonic time when frames was measured. In
79 * general, time must be a positive quantity and must not
80 * go "backwards".
81 */
82 getCapturePosition()
83 generates (Result retval, uint64_t frames, uint64_t time);
84};