1/*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file istream_operator.h
18 *
19 * @brief Declares APIs for stream operations.
20 *
21 * @since 4.0
22 * @version 1.1
23 */
24
25package ohos.hdi.camera.v1_1;
26
27import ohos.hdi.camera.v1_0.IStreamOperator;
28import ohos.hdi.camera.v1_1.Types;
29
30interface IStreamOperator extends ohos.hdi.camera.v1_0.IStreamOperator {
31    /**
32     * @brief Checks whether a specific stream can be dynamically created.
33     *
34     * A stream is a sequence of data elements output from a bottom-layer device, processed by the current module,
35     * and then transmitted to an upper-layer service or application.
36     * The current module supports preview streams, video streams, photographing streams, and the like.
37     * For details, see {@link StreamIntent}.
38     *
39     * This function is used to check whether a stream or streams can be dynamically created based on the
40     * operation mode, configuration information, and existing streams in the current module.
41     * If the streams can be created without stopping the existing streams or making the upper-layer service or
42     * application unaware of the stopping of the existing streams,
43     * <b>type</b> is set to <b>DYNAMIC_SUPPORTED</b> so that the upper-layer service or application
44     * can directly add the new stream.
45     * If the streams can be created only after the upper-layer service or application stops capturing all streams,
46     * <b>type</b> is set to <b>RE_CONFIGURED_REQUIRED</b>.
47     * If the streams are not supported, <b>type</b> is set to <b>NOT_SUPPORTED</b>.
48     * This function must be called prior to {@link CreateStreams}.
49     *
50     * @param mode Indicates the operation mode of the streams. For details, see {@link OperationMode_V1_1}.
51     * @param modeSetting Indicates the stream configuration parameters, including the frame rate and 3A.
52     * 3A stands for automatic focus (AF), automatic exposure (AE), and automatic white-balance (AWB).
53     * @param infos Indicates the stream configuration information. For details, see {@link StreamInfo}.
54     * @param type Indicates the support type of the dynamically created stream.
55     * The supported types are defined in {@link StreamSupportType}.
56     *
57     * @return Returns <b>NO_ERROR</b> if the operation is successful;
58     * returns an error code defined in {@link CamRetCode} otherwise.
59     *
60     * @since 4.0
61     * @version 1.1
62     */
63    IsStreamsSupported_V1_1([in] enum OperationMode_V1_1 mode, [in] unsigned char[] modeSetting,
64        [in] struct StreamInfo_V1_1[] infos, [out] enum StreamSupportType type);
65
66    /**
67     * @brief Creates streams.
68     *
69     * Before calling this function, you must use {@link IsStreamsSupported} to check whether the hardware
70     * abstraction layer (HAL) supports the streams to create.
71     *
72     * @param streamInfos Indicates the list of stream information, which is defined by {@link StreamInfo}.
73     * The passed stream information may be changed. Therefore, you can run {@link GetStreamAttributes} to
74     * obtain the latest stream attributes after the stream is created.
75     *
76     * @return Returns <b>NO_ERROR</b> if the operation is successful;
77     * returns an error code defined in {@link CamRetCode} otherwise.
78     *
79     * @since 4.0
80     * @version 1.1
81     */
82    CreateStreams_V1_1([in] struct StreamInfo_V1_1[] streamInfos);
83
84    /**
85     * @brief Configures a stream.
86     *
87     * This function must be called after {@link CreateStreams}.
88     *
89     * @param mode Indicates the operation mode of the stream. For details, see {@link OperationMode_V1_1}.
90     * @param modeSetting Indicates the stream configuration parameters, including the frame rate and zoom information.
91     * @return Returns <b>NO_ERROR</b> if the operation is successful;
92     * returns an error code defined in {@link CamRetCode} otherwise.
93     *
94     * @since 4.0
95     * @version 1.1
96     */
97    CommitStreams_V1_1([in] enum OperationMode_V1_1 mode, [in] unsigned char[] modeSetting);
98}
99