blob: 049df75b8df572c9ffe62cbb3fc03063c83f6e0e [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 *
64 * @return retval operation completion status.
65 * @return framesLost the number of input audio frames lost.
66 */
67 getInputFramesLost() generates (Result retval, uint32_t framesLost);
68
69 /**
70 * Return a recent count of the number of audio frames received and the
71 * clock time associated with that frame count.
72 *
73 * @return retval INVALID_STATE if the device is not ready/available,
74 * NOT_SUPPORTED if the command is not supported,
75 * OK otherwise.
76 * @return frames the total frame count received. This must be as early in
77 * the capture pipeline as possible. In general, frames
78 * must be non-negative and must not go "backwards".
79 * @return time is the clock monotonic time when frames was measured. In
80 * general, time must be a positive quantity and must not
81 * go "backwards".
82 */
83 getCapturePosition()
84 generates (Result retval, uint64_t frames, uint64_t time);
85};