1094332d3Sopenharmony_ci/* 2094332d3Sopenharmony_ci * Copyright (c) 2021-2024 Huawei Device Co., Ltd. 3094332d3Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4094332d3Sopenharmony_ci * you may not use this file except in compliance with the License. 5094332d3Sopenharmony_ci * You may obtain a copy of the License at 6094332d3Sopenharmony_ci * 7094332d3Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8094332d3Sopenharmony_ci * 9094332d3Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10094332d3Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11094332d3Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12094332d3Sopenharmony_ci * See the License for the specific language governing permissions and 13094332d3Sopenharmony_ci * limitations under the License. 14094332d3Sopenharmony_ci */ 15094332d3Sopenharmony_ci 16094332d3Sopenharmony_ci#ifndef DISTRIBUTED_CONSTANTS_H 17094332d3Sopenharmony_ci#define DISTRIBUTED_CONSTANTS_H 18094332d3Sopenharmony_ci 19094332d3Sopenharmony_ci#include <string> 20094332d3Sopenharmony_ci#include <vector> 21094332d3Sopenharmony_ci 22094332d3Sopenharmony_cinamespace OHOS { 23094332d3Sopenharmony_cinamespace DistributedHardware { 24094332d3Sopenharmony_ciconst uint32_t YUV_WIDTH_RATIO = 3; 25094332d3Sopenharmony_ciconst uint32_t YUV_HEIGHT_RATIO = 2; 26094332d3Sopenharmony_ci 27094332d3Sopenharmony_ciconst uint32_t DEVID_MAX_LENGTH = 256; 28094332d3Sopenharmony_ciconst uint32_t DHID_MAX_LENGTH = 256; 29094332d3Sopenharmony_ciconst uint32_t CONTAINER_CAPACITY_MAX_SIZE = 50 * 1024 * 1024; 30094332d3Sopenharmony_ciconst uint32_t METADATA_CAPACITY_MAX_SIZE = 50 * 1024 * 1024; 31094332d3Sopenharmony_ciconst int32_t STREAM_HEIGHT_MAX_SIZE = 10000; 32094332d3Sopenharmony_ciconst int32_t STREAM_WIDTH_MAX_SIZE = 10000; 33094332d3Sopenharmony_ciconst int32_t JPEG_MAX_SIZE = 24 * 1024 * 1024; 34094332d3Sopenharmony_ci 35094332d3Sopenharmony_ciconstexpr size_t DEFAULT_ENTRY_CAPACITY = 100; 36094332d3Sopenharmony_ciconstexpr size_t DEFAULT_DATA_CAPACITY = 2000; 37094332d3Sopenharmony_ci 38094332d3Sopenharmony_ciconst uint32_t SIZE_FMT_LEN = 2; 39094332d3Sopenharmony_ciconst uint32_t MAX_SUPPORT_PREVIEW_WIDTH = 1920; 40094332d3Sopenharmony_ciconst uint32_t MAX_SUPPORT_PREVIEW_HEIGHT = 1080; 41094332d3Sopenharmony_ciconst uint32_t MAX_SUPPORT_PHOTO_WIDTH = 4096; 42094332d3Sopenharmony_ciconst uint32_t MAX_SUPPORT_PHOTO_HEIGHT = 3072; 43094332d3Sopenharmony_ciconst std::string STAR_SEPARATOR = "*"; 44094332d3Sopenharmony_ci 45094332d3Sopenharmony_ciconst uint32_t MIN_SUPPORT_DEFAULT_FPS = 15; 46094332d3Sopenharmony_ciconst uint32_t MAX_SUPPORT_DEFAULT_FPS = 30; 47094332d3Sopenharmony_ci 48094332d3Sopenharmony_ciconst int64_t MAX_FRAME_DURATION = 1000000000LL / 10; 49094332d3Sopenharmony_ci 50094332d3Sopenharmony_ciconst uint32_t BUFFER_QUEUE_SIZE = 8; 51094332d3Sopenharmony_ci 52094332d3Sopenharmony_ciconst uint32_t DEGREE_180 = 180; 53094332d3Sopenharmony_ciconst uint32_t DEGREE_240 = 240; 54094332d3Sopenharmony_ci 55094332d3Sopenharmony_ciconst uint32_t INGNORE_STR_LEN = 2; 56094332d3Sopenharmony_ci 57094332d3Sopenharmony_ciconst uint32_t WAIT_OPEN_TIMEOUT_SEC = 5; 58094332d3Sopenharmony_ciconst uint32_t BUFFER_SYNC_FENCE_TIMEOUT = 100; 59094332d3Sopenharmony_ciconst int32_t GET_FULL_WAIT_SECONDS = 10; 60094332d3Sopenharmony_ci 61094332d3Sopenharmony_ciconst std::string ENCODE_TYPE_STR_H264 = "video/avc"; 62094332d3Sopenharmony_ciconst std::string ENCODE_TYPE_STR_H265 = "video/hevc"; 63094332d3Sopenharmony_ciconst std::string ENCODE_TYPE_STR_JPEG = "jpeg"; 64094332d3Sopenharmony_ciconst std::string ENCODE_TYPE_STR_MPEG4_ES = "video/mp4v-es"; 65094332d3Sopenharmony_ciconst std::string DC_LOG_TITLE_TAG = "DCAMERA"; 66094332d3Sopenharmony_ciconst std::string FULL_DATA_KEY = "ProtocolVer"; 67094332d3Sopenharmony_ciconst std::string META_DATA_KEY = "MetaData"; 68094332d3Sopenharmony_ciconst std::string CAMERA_SUPPORT_MODE = "Mode"; 69094332d3Sopenharmony_ciconstexpr int32_t LOG_MAX_LEN = 4096; 70094332d3Sopenharmony_ciconstexpr uint64_t SEC_TO_NSEC_TIMES = 1000000000; 71094332d3Sopenharmony_ci 72094332d3Sopenharmony_citypedef enum { 73094332d3Sopenharmony_ci OHOS_CAMERA_FORMAT_INVALID = 0, 74094332d3Sopenharmony_ci OHOS_CAMERA_FORMAT_RGBA_8888, 75094332d3Sopenharmony_ci OHOS_CAMERA_FORMAT_YCBCR_420_888, 76094332d3Sopenharmony_ci OHOS_CAMERA_FORMAT_YCRCB_420_SP, 77094332d3Sopenharmony_ci OHOS_CAMERA_FORMAT_JPEG, 78094332d3Sopenharmony_ci} DCameraFormat; 79094332d3Sopenharmony_ci 80094332d3Sopenharmony_citypedef enum { 81094332d3Sopenharmony_ci DCAMERA_MESSAGE = 0, 82094332d3Sopenharmony_ci DCAMERA_OPERATION = 1, 83094332d3Sopenharmony_ci DCAMERA_SINK_STOP = 2, 84094332d3Sopenharmony_ci DCAMERE_GETFULLCAP = 3, 85094332d3Sopenharmony_ci} DCameraEventType; 86094332d3Sopenharmony_ci 87094332d3Sopenharmony_citypedef enum { 88094332d3Sopenharmony_ci DCAMERA_EVENT_CHANNEL_DISCONNECTED = 0, 89094332d3Sopenharmony_ci DCAMERA_EVENT_CHANNEL_CONNECTED = 1, 90094332d3Sopenharmony_ci DCAMERA_EVENT_CAMERA_SUCCESS = 2, 91094332d3Sopenharmony_ci 92094332d3Sopenharmony_ci DCAMERA_EVENT_CAMERA_ERROR = -1, 93094332d3Sopenharmony_ci DCAMERA_EVENT_OPEN_CHANNEL_ERROR = -2, 94094332d3Sopenharmony_ci DCAMERA_EVENT_CLOSE_CHANNEL_ERROR = -3, 95094332d3Sopenharmony_ci DCAMERA_EVENT_CONFIG_STREAMS_ERROR = -4, 96094332d3Sopenharmony_ci DCAMERA_EVENT_RELEASE_STREAMS_ERROR = -5, 97094332d3Sopenharmony_ci DCAMERA_EVENT_START_CAPTURE_ERROR = -6, 98094332d3Sopenharmony_ci DCAMERA_EVENT_STOP_CAPTURE_ERROR = -7, 99094332d3Sopenharmony_ci DCAMERA_EVENT_UPDATE_SETTINGS_ERROR = -8, 100094332d3Sopenharmony_ci DCAMERA_EVENT_DEVICE_ERROR = -9, 101094332d3Sopenharmony_ci DCAMERA_EVENT_DEVICE_PREEMPT = -10, 102094332d3Sopenharmony_ci DCAMERA_EVENT_DEVICE_IN_USE = -11, 103094332d3Sopenharmony_ci DCAMERA_EVENT_NO_PERMISSION = -12, 104094332d3Sopenharmony_ci} DCameraEventResult; 105094332d3Sopenharmony_ci 106094332d3Sopenharmony_cienum DCameraBufferUsage : uint64_t { 107094332d3Sopenharmony_ci CAMERA_USAGE_SW_READ_OFTEN = (1 << 0), 108094332d3Sopenharmony_ci CAMERA_USAGE_SW_WRITE_OFTEN = (1 << 1), 109094332d3Sopenharmony_ci CAMERA_USAGE_MEM_DMA = (1 << 2), 110094332d3Sopenharmony_ci}; 111094332d3Sopenharmony_ci 112094332d3Sopenharmony_ciusing DCSceneType = enum _DCSceneType : int32_t { 113094332d3Sopenharmony_ci PREVIEW = 0, 114094332d3Sopenharmony_ci VIDEO = 1, 115094332d3Sopenharmony_ci PHOTO = 2 116094332d3Sopenharmony_ci}; 117094332d3Sopenharmony_ci 118094332d3Sopenharmony_ciusing RetCode = uint32_t; 119094332d3Sopenharmony_cienum Ret : uint32_t { 120094332d3Sopenharmony_ci RC_OK = 0, 121094332d3Sopenharmony_ci RC_ERROR, 122094332d3Sopenharmony_ci}; 123094332d3Sopenharmony_ci 124094332d3Sopenharmony_cistruct DCResolution { 125094332d3Sopenharmony_ci int32_t width_; 126094332d3Sopenharmony_ci int32_t height_; 127094332d3Sopenharmony_ci 128094332d3Sopenharmony_ci DCResolution() : width_(0), height_(0) {} 129094332d3Sopenharmony_ci 130094332d3Sopenharmony_ci DCResolution(int32_t width, int32_t height) : width_(width), height_(height) {} 131094332d3Sopenharmony_ci 132094332d3Sopenharmony_ci bool operator ==(const DCResolution others) const 133094332d3Sopenharmony_ci { 134094332d3Sopenharmony_ci return (this->width_ == others.width_) && (this->height_ == others.height_); 135094332d3Sopenharmony_ci } 136094332d3Sopenharmony_ci 137094332d3Sopenharmony_ci bool operator <(const DCResolution others) const 138094332d3Sopenharmony_ci { 139094332d3Sopenharmony_ci return this->width_ < others.width_ || 140094332d3Sopenharmony_ci (this->width_ == others.width_ && this->height_ < others.height_); 141094332d3Sopenharmony_ci } 142094332d3Sopenharmony_ci}; 143094332d3Sopenharmony_ci} // namespace DistributedHardware 144094332d3Sopenharmony_ci} // namespace OHOS 145094332d3Sopenharmony_ci#endif // DISTRIBUTED_CONSTANTS_H 146