/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package android.hardware.audio@7.1;

import @7.0::Result;
import @7.0::IStreamOut;

import IStreamOutLatencyModeCallback;

interface IStreamOut extends @7.0::IStreamOut {
    /**
     * Indicates the requested latency mode for this output stream.
     *
     * The requested mode can be one of the modes returned by
     * getRecommendedLatencyModes() API.
     *
     * Optional method.
     * Mandated only on specific spatial audio streams indicated by
     * AUDIO_OUTPUT_FLAG_SPATIALIZER flag if they can be routed to a BT classic sink.
     *
     * @return retval operation completion status.
     */
    setLatencyMode(LatencyMode mode) generates (Result retval);

    /**
     * Indicates which latency modes are currently supported on this output stream.
     * If the transport protocol (e.g Bluetooth A2DP) used by this output stream to reach
     * the output device supports variable latency modes, the HAL indicates which
     * modes are currently supported.
     * The framework can then call setLatencyMode() with one of the supported modes to select
     * the desired operation mode.
     *
     * Optional method.
     * Mandated only on specific spatial audio streams indicated by
     * AUDIO_OUTPUT_FLAG_SPATIALIZER flag if they can be routed to a BT classic sink.
     *
     * @return retval operation completion status.
     * @return modes currrently supported latency modes.
     */
    getRecommendedLatencyModes() generates (Result retval, vec<LatencyMode> modes);

    /**
     * Set the callback interface for notifying changes in supported latency modes.
     *
     * Calling this method with a null pointer will result in releasing
     * the callback.
     *
     * Optional method.
     * Mandated only on specific spatial audio streams indicated by
     * AUDIO_OUTPUT_FLAG_SPATIALIZER flag if they can be routed to a BT classic sink.
     *
     * @return retval operation completion status.
     */
    setLatencyModeCallback(IStreamOutLatencyModeCallback callback) generates (Result retval);
};
