1/*
2 * Copyright (C) 2022 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@7.1;
18
19import @7.0::Result;
20import @7.0::IStreamOut;
21
22import IStreamOutLatencyModeCallback;
23
24interface IStreamOut extends @7.0::IStreamOut {
25    /**
26     * Indicates the requested latency mode for this output stream.
27     *
28     * The requested mode can be one of the modes returned by
29     * getRecommendedLatencyModes() API.
30     *
31     * Optional method.
32     * Mandated only on specific spatial audio streams indicated by
33     * AUDIO_OUTPUT_FLAG_SPATIALIZER flag if they can be routed to a BT classic sink.
34     *
35     * @return retval operation completion status.
36     */
37    setLatencyMode(LatencyMode mode) generates (Result retval);
38
39    /**
40     * Indicates which latency modes are currently supported on this output stream.
41     * If the transport protocol (e.g Bluetooth A2DP) used by this output stream to reach
42     * the output device supports variable latency modes, the HAL indicates which
43     * modes are currently supported.
44     * The framework can then call setLatencyMode() with one of the supported modes to select
45     * the desired operation mode.
46     *
47     * Optional method.
48     * Mandated only on specific spatial audio streams indicated by
49     * AUDIO_OUTPUT_FLAG_SPATIALIZER flag if they can be routed to a BT classic sink.
50     *
51     * @return retval operation completion status.
52     * @return modes currrently supported latency modes.
53     */
54    getRecommendedLatencyModes() generates (Result retval, vec<LatencyMode> modes);
55
56    /**
57     * Set the callback interface for notifying changes in supported latency modes.
58     *
59     * Calling this method with a null pointer will result in releasing
60     * the callback.
61     *
62     * Optional method.
63     * Mandated only on specific spatial audio streams indicated by
64     * AUDIO_OUTPUT_FLAG_SPATIALIZER flag if they can be routed to a BT classic sink.
65     *
66     * @return retval operation completion status.
67     */
68    setLatencyModeCallback(IStreamOutLatencyModeCallback callback) generates (Result retval);
69};
70