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#ifndef OHOS_HDI_CAMERA_V1_1_TYPES_H
17#define OHOS_HDI_CAMERA_V1_1_TYPES_H
18
19#include <cstdbool>
20#include <cstdint>
21#include <string>
22#include <vector>
23#include "buffer_producer_sequenceable.h"
24#include "camera/v1_0/types.h"
25
26#ifndef HDI_BUFF_MAX_SIZE
27#define HDI_BUFF_MAX_SIZE (1024 * 200)
28#endif
29
30#ifndef HDI_CHECK_VALUE_RETURN
31#define HDI_CHECK_VALUE_RETURN(lv, compare, rv, ret) do { \
32    if ((lv) compare (rv)) { \
33        return ret; \
34    } \
35} while (false)
36#endif
37
38#ifndef HDI_CHECK_VALUE_RET_GOTO
39#define HDI_CHECK_VALUE_RET_GOTO(lv, compare, rv, ret, value, table) do { \
40    if ((lv) compare (rv)) { \
41        ret = value; \
42        goto table; \
43    } \
44} while (false)
45#endif
46
47namespace OHOS {
48class MessageParcel;
49}
50
51namespace OHOS {
52namespace HDI {
53namespace Camera {
54namespace V1_1 {
55
56using namespace OHOS;
57using namespace OHOS::HDI::Camera::V1_0;
58
59enum ExtendedStreamInfoType : int32_t {
60    EXTENDED_STREAM_INFO_QUICK_THUMBNAIL = 0,
61};
62
63struct ExtendedStreamInfo {
64    OHOS::HDI::Camera::V1_1::ExtendedStreamInfoType type;
65    int32_t width;
66    int32_t height;
67    int32_t format;
68    int32_t dataspace;
69    sptr<OHOS::HDI::Camera::V1_0::BufferProducerSequenceable> bufferQueue;
70};
71
72struct StreamInfo_V1_1 {
73    OHOS::HDI::Camera::V1_0::StreamInfo v1_0;
74    std::vector<OHOS::HDI::Camera::V1_1::ExtendedStreamInfo> extendedStreamInfos;
75};
76
77struct PrelaunchConfig {
78    std::string cameraId;
79    std::vector<OHOS::HDI::Camera::V1_1::StreamInfo_V1_1> streamInfos_V1_1;
80    std::vector<uint8_t> setting;
81};
82
83enum OperationMode_V1_1 : int32_t {
84    NORMAL = 0,
85    CAPTURE = 1,
86    VIDEO = 2,
87    PORTRAIT = 3,
88    NIGHT = 4,
89    PROFESSIONAL = 5,
90    SLOW_MOTION = 6,
91};
92
93bool ExtendedStreamInfoBlockMarshalling(OHOS::MessageParcel &data, const OHOS::HDI::Camera::V1_1::ExtendedStreamInfo& dataBlock);
94
95bool ExtendedStreamInfoBlockUnmarshalling(OHOS::MessageParcel &data, OHOS::HDI::Camera::V1_1::ExtendedStreamInfo& dataBlock);
96
97bool StreamInfo_V1_1BlockMarshalling(OHOS::MessageParcel &data, const OHOS::HDI::Camera::V1_1::StreamInfo_V1_1& dataBlock);
98
99bool StreamInfo_V1_1BlockUnmarshalling(OHOS::MessageParcel &data, OHOS::HDI::Camera::V1_1::StreamInfo_V1_1& dataBlock);
100
101bool PrelaunchConfigBlockMarshalling(OHOS::MessageParcel &data, const OHOS::HDI::Camera::V1_1::PrelaunchConfig& dataBlock);
102
103bool PrelaunchConfigBlockUnmarshalling(OHOS::MessageParcel &data, OHOS::HDI::Camera::V1_1::PrelaunchConfig& dataBlock);
104
105
106} // V1_1
107} // Camera
108} // HDI
109} // OHOS
110
111#endif // OHOS_HDI_CAMERA_V1_1_TYPES_H
112
113