• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_VDI_CAMERA_V1_0_TYPES_H
17 #define OHOS_VDI_CAMERA_V1_0_TYPES_H
18 
19 #include <cstdbool>
20 #include <cstdint>
21 #include <vector>
22 #include "buffer_producer_sequenceable.h"
23 
24 namespace OHOS {
25 class MessageParcel;
26 }
27 
28 namespace OHOS {
29 namespace VDI {
30 namespace Camera {
31 namespace V1_0 {
32 
33 using namespace OHOS;
34 using namespace HDI::Camera::V1_0;
35 using namespace OHOS::HDI::Camera::V1_0;
36 
37 enum VdiCamRetCode : int32_t {
38     NO_ERROR = 0,
39     CAMERA_BUSY = -1,
40     INSUFFICIENT_RESOURCES = -2,
41     INVALID_ARGUMENT = -3,
42     METHOD_NOT_SUPPORTED = -4,
43     CAMERA_CLOSED = -5,
44     DEVICE_ERROR = -6,
45     NO_PERMISSION = -7,
46 };
47 
48 enum VdiResultCallbackMode : int32_t {
49     PER_FRAME = 0,
50     ON_CHANGED = 1,
51 };
52 
53 enum VdiOperationMode : int32_t {
54     NORMAL = 0,
55 };
56 
57 enum VdiStreamIntent : int32_t {
58     PREVIEW = 0,
59     VIDEO = 1,
60     STILL_CAPTURE = 2,
61     POST_VIEW = 3,
62     ANALYZE = 4,
63     CUSTOM = 5,
64 };
65 
66 enum VdiEncodeType : int32_t {
67     ENCODE_TYPE_NULL = 0,
68     ENCODE_TYPE_H264 = 1,
69     ENCODE_TYPE_H265 = 2,
70     ENCODE_TYPE_JPEG = 3,
71 };
72 
73 enum VdiStreamSupportType : int32_t {
74     DYNAMIC_SUPPORTED = 0,
75     RE_CONFIGURED_REQUIRED = 1,
76     NOT_SUPPORTED = 2,
77 };
78 
79 enum VdiCameraStatus : int32_t {
80     UN_AVAILABLE = 0,
81     AVAILABLE = 1,
82 };
83 
84 enum VdiFlashlightStatus : int32_t {
85     FLASHLIGHT_OFF = 0,
86     FLASHLIGHT_ON = 1,
87     FLASHLIGHT_UNAVAILABLE = 2,
88 };
89 
90 enum VdiCameraEvent : int32_t {
91     CAMERA_EVENT_DEVICE_ADD = 0,
92     CAMERA_EVENT_DEVICE_RMV = 1,
93 };
94 
95 enum VdiErrorType : int32_t {
96     FATAL_ERROR = 0,
97     REQUEST_TIMEOUT = 1,
98     DRIVER_ERROR = 2,
99     DEVICE_PREEMPT = 3,
100     DEVICE_DISCONNECT = 4,
101     DCAMERA_ERROR_BEGIN = 1024,
102     DCAMERA_ERROR_DEVICE_IN_USE,
103     DCAMERA_ERROR_NO_PERMISSION,
104 };
105 
106 enum VdiStreamError : int32_t {
107     UNKNOWN_ERROR = 0,
108     BUFFER_LOST = 1,
109 };
110 
111 struct VdiStreamInfo {
112     int32_t streamId_;
113     int32_t width_;
114     int32_t height_;
115     int32_t format_;
116     int32_t dataspace_;
117     VdiStreamIntent intent_;
118     bool tunneledMode_;
119     sptr<BufferProducerSequenceable> bufferQueue_;
120     int32_t minFrameDuration_;
121     VdiEncodeType encodeType_;
122 };
123 
124 struct VdiStreamAttribute {
125     int32_t streamId_;
126     int32_t width_;
127     int32_t height_;
128     int32_t overrideFormat_;
129     int32_t overrideDataspace_;
130     int32_t producerUsage_;
131     int32_t producerBufferCount_;
132     int32_t maxBatchCaptureCount_;
133     int32_t maxCaptureCount_;
134 } __attribute__ ((aligned(8)));
135 
136 struct VdiCaptureInfo {
137     std::vector<int32_t> streamIds_;
138     std::vector<uint8_t> captureSetting_;
139     bool enableShutterCallback_;
140 };
141 
142 struct VdiCaptureEndedInfo {
143     int32_t streamId_;
144     int32_t frameCount_;
145 } __attribute__ ((aligned(8)));
146 
147 struct VdiCaptureErrorInfo {
148     int32_t streamId_;
149     VdiStreamError error_;
150 } __attribute__ ((aligned(8)));
151 
152 } // V1_0
153 } // Camera
154 } // VDI
155 } // OHOS
156 #endif // OHOS_VDI_CAMERA_V1_0_TYPES_H
157