/*
 * Copyright (c) 2023 Huawei Device Co., Ltd.
 * 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.
 */

/**
 * @file istream_operator.h
 *
 * @brief Declares APIs for stream operations.
 *
 * @since 4.0
 * @version 1.1
 */

package ohos.hdi.camera.v1_1;

import ohos.hdi.camera.v1_0.IStreamOperator;
import ohos.hdi.camera.v1_1.Types;

interface IStreamOperator extends ohos.hdi.camera.v1_0.IStreamOperator {
    /**
     * @brief Checks whether a specific stream can be dynamically created.
     *
     * A stream is a sequence of data elements output from a bottom-layer device, processed by the current module,
     * and then transmitted to an upper-layer service or application.
     * The current module supports preview streams, video streams, photographing streams, and the like.
     * For details, see {@link StreamIntent}.
     *
     * This function is used to check whether a stream or streams can be dynamically created based on the
     * operation mode, configuration information, and existing streams in the current module.
     * If the streams can be created without stopping the existing streams or making the upper-layer service or
     * application unaware of the stopping of the existing streams,
     * <b>type</b> is set to <b>DYNAMIC_SUPPORTED</b> so that the upper-layer service or application
     * can directly add the new stream.
     * If the streams can be created only after the upper-layer service or application stops capturing all streams,
     * <b>type</b> is set to <b>RE_CONFIGURED_REQUIRED</b>.
     * If the streams are not supported, <b>type</b> is set to <b>NOT_SUPPORTED</b>.
     * This function must be called prior to {@link CreateStreams}.
     *
     * @param mode Indicates the operation mode of the streams. For details, see {@link OperationMode_V1_1}.
     * @param modeSetting Indicates the stream configuration parameters, including the frame rate and 3A.
     * 3A stands for automatic focus (AF), automatic exposure (AE), and automatic white-balance (AWB).
     * @param infos Indicates the stream configuration information. For details, see {@link StreamInfo}.
     * @param type Indicates the support type of the dynamically created stream.
     * The supported types are defined in {@link StreamSupportType}.
     *
     * @return Returns <b>NO_ERROR</b> if the operation is successful;
     * returns an error code defined in {@link CamRetCode} otherwise.
     *
     * @since 4.0
     * @version 1.1
     */
    IsStreamsSupported_V1_1([in] enum OperationMode_V1_1 mode, [in] unsigned char[] modeSetting,
        [in] struct StreamInfo_V1_1[] infos, [out] enum StreamSupportType type);

    /**
     * @brief Creates streams.
     *
     * Before calling this function, you must use {@link IsStreamsSupported} to check whether the hardware
     * abstraction layer (HAL) supports the streams to create.
     *
     * @param streamInfos Indicates the list of stream information, which is defined by {@link StreamInfo}.
     * The passed stream information may be changed. Therefore, you can run {@link GetStreamAttributes} to
     * obtain the latest stream attributes after the stream is created.
     *
     * @return Returns <b>NO_ERROR</b> if the operation is successful;
     * returns an error code defined in {@link CamRetCode} otherwise.
     *
     * @since 4.0
     * @version 1.1
     */
    CreateStreams_V1_1([in] struct StreamInfo_V1_1[] streamInfos);

    /**
     * @brief Configures a stream.
     *
     * This function must be called after {@link CreateStreams}.
     *
     * @param mode Indicates the operation mode of the stream. For details, see {@link OperationMode_V1_1}.
     * @param modeSetting Indicates the stream configuration parameters, including the frame rate and zoom information.
     * @return Returns <b>NO_ERROR</b> if the operation is successful;
     * returns an error code defined in {@link CamRetCode} otherwise.
     *
     * @since 4.0
     * @version 1.1
     */
    CommitStreams_V1_1([in] enum OperationMode_V1_1 mode, [in] unsigned char[] modeSetting);
}