• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 HOS_CAMERA_TEMP_H
17 #define HOS_CAMERA_TEMP_H
18 
19 #include <cstdint>
20 #include <functional>
21 #include <iostream>
22 #include <memory>
23 #include <stdint.h>
24 #include <stdio.h>
25 #include <stdlib.h>
26 
27 namespace OHOS::Camera {
28 enum CameraBufferStatus {
29     CAMERA_BUFFER_STATUS_OK = 0,
30     CAMERA_BUFFER_STATUS_DROP,
31     CAMERA_BUFFER_STATUS_INVALID,
32 };
33 
34 class IBuffer {
35 public:
IBuffer()36     IBuffer() {}
~IBuffer()37     ~IBuffer() {}
38 
GetIndex()39     int32_t GetIndex()
40     {
41         return index_;
42     }
GetSize()43     uint32_t GetSize()
44     {
45         return size_;
46     }
GetVirAddress()47     void* GetVirAddress()
48     {
49         return virAddr_;
50     }
51 
GetUsage()52     uint64_t GetUsage()
53     {
54         return usage_;
55     }
56 
SetIndex(const uint32_t index)57     void SetIndex(const uint32_t index)
58     {
59         index_ = index;
60         return;
61     }
62 
SetSize(const uint32_t size)63     void SetSize(const uint32_t size)
64     {
65         size_ = size;
66         return;
67     }
68 
SetVirAddress(void * addr)69     void SetVirAddress(void* addr)
70     {
71         virAddr_ = addr;
72         return;
73     }
74 
SetUsage(const uint64_t usage)75     void SetUsage(const uint64_t usage)
76     {
77         usage_ = usage;
78         return;
79     }
80 
GetFileDescriptor()81     int32_t GetFileDescriptor()
82     {
83         return fileDesc_;
84     }
85 
SetFileDescriptor(const int32_t fd)86     void SetFileDescriptor(const int32_t fd)
87     {
88         fileDesc_ = fd;
89     }
90 
GetWidth()91     uint32_t GetWidth()
92     {
93         return 0;
94     }
95 
GetHeight()96     uint32_t GetHeight()
97     {
98         return 0;
99     }
100 
GetFormat()101     int32_t GetFormat()
102     {
103         return 0;
104     }
105 
GetEncodeType()106     int32_t GetEncodeType()
107     {
108         return 0;
109     }
110 
SetBufferStatus(const CameraBufferStatus flag)111     void SetBufferStatus(const CameraBufferStatus flag)
112     {
113     }
114 
115 private:
116     int32_t index_ = -1;
117     uint32_t size_ = 0;
118     void* virAddr_ = nullptr;
119     uint64_t usage_ = 0;
120     int32_t fileDesc_ = -1;
121 };
122 
123 struct FrameSpec {
124     int64_t bufferPoolId_;
125     std::shared_ptr<IBuffer> buffer_;
126 };
127 
128 using FrameSpec = struct FrameSpec;
129 
130 enum AdapterCmd : uint32_t {
131     CMD_AE_EXPO,
132     CMD_AWB_MODE,
133     CMD_AE_EXPOTIME,
134     CMD_EXPOSURE_MODE,
135     CMD_EXPOSURE_COMPENSATION,
136     CMD_EXPOSURE_STATE,
137     CMD_AWB_COLORGAINS,
138     CMD_FOCUS_MODE,
139     CMD_FOCUS_REGION,
140     CMD_METER_MODE,
141     CMD_METER_POINT,
142     CMD_FLASH_MODE,
143     CMD_FPS_RANGE
144 };
145 
146 #ifdef DISABLE_LOGD
147 #define CAMERA_LOGD(...)
148 #else
149 #define CAMERA_LOGD(fmt, ...)                    \
150     do {                                         \
151         printf("INFO:" fmt "\n", ##__VA_ARGS__); \
152     } while (0)
153 #endif
154 
155 #define CAMERA_LOGE(fmt, ...)                     \
156     do {                                          \
157         printf("ERROR:" fmt "\n", ##__VA_ARGS__); \
158     } while (0)
159 
160 enum RetCode {
161     RC_OK = 0,
162     RC_ERROR,
163 };
164 } // namespace OHOS::Camera
165 #endif // HOS_CAMERA_TEMP_H
166