166f3657fSopenharmony_ci/* 266f3657fSopenharmony_ci * Copyright (c) 2022-2024 Huawei Device Co., Ltd. 366f3657fSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 466f3657fSopenharmony_ci * you may not use this file except in compliance with the License. 566f3657fSopenharmony_ci * You may obtain a copy of the License at 666f3657fSopenharmony_ci * 766f3657fSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 866f3657fSopenharmony_ci * 966f3657fSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1066f3657fSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1166f3657fSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1266f3657fSopenharmony_ci * See the License for the specific language governing permissions and 1366f3657fSopenharmony_ci * limitations under the License. 1466f3657fSopenharmony_ci */ 1566f3657fSopenharmony_ci 1666f3657fSopenharmony_ci#ifndef OHOS_DSCREEN_CONSTANTS_H 1766f3657fSopenharmony_ci#define OHOS_DSCREEN_CONSTANTS_H 1866f3657fSopenharmony_ci 1966f3657fSopenharmony_ci#include <cstdint> 2066f3657fSopenharmony_ci#include <string> 2166f3657fSopenharmony_ci#include <unistd.h> 2266f3657fSopenharmony_ci 2366f3657fSopenharmony_cinamespace OHOS { 2466f3657fSopenharmony_cinamespace DistributedHardware { 2566f3657fSopenharmony_cienum RpcEventType { 2666f3657fSopenharmony_ci NOTIFY_SINK_SETUP = 1, 2766f3657fSopenharmony_ci NOTIFY_SOURCE_SETUP_RESULT = 2, 2866f3657fSopenharmony_ci}; 2966f3657fSopenharmony_ci 3066f3657fSopenharmony_cienum DScreenState { 3166f3657fSopenharmony_ci DISABLED, 3266f3657fSopenharmony_ci ENABLED, 3366f3657fSopenharmony_ci DISABLING, 3466f3657fSopenharmony_ci ENABLING, 3566f3657fSopenharmony_ci CONNECTING, 3666f3657fSopenharmony_ci CONNECTED, 3766f3657fSopenharmony_ci DISCONNECTING, 3866f3657fSopenharmony_ci}; 3966f3657fSopenharmony_ci 4066f3657fSopenharmony_cienum TaskType { 4166f3657fSopenharmony_ci TASK_ENABLE, 4266f3657fSopenharmony_ci TASK_DISABLE, 4366f3657fSopenharmony_ci TASK_CONNECT, 4466f3657fSopenharmony_ci TASK_DISCONNECT, 4566f3657fSopenharmony_ci}; 4666f3657fSopenharmony_ci 4766f3657fSopenharmony_cienum CodecType : uint8_t { 4866f3657fSopenharmony_ci VIDEO_CODEC_TYPE_VIDEO_H264 = 0, 4966f3657fSopenharmony_ci VIDEO_CODEC_TYPE_VIDEO_H265 = 1, 5066f3657fSopenharmony_ci VIDEO_CODEC_TYPE_VIDEO_MPEG4 = 2, 5166f3657fSopenharmony_ci}; 5266f3657fSopenharmony_ci 5366f3657fSopenharmony_cienum VideoFormat : uint8_t { 5466f3657fSopenharmony_ci VIDEO_DATA_FORMAT_YUVI420 = 0, 5566f3657fSopenharmony_ci VIDEO_DATA_FORMAT_NV12 = 1, 5666f3657fSopenharmony_ci VIDEO_DATA_FORMAT_NV21 = 2, 5766f3657fSopenharmony_ci VIDEO_DATA_FORMAT_RGBA8888 = 3, 5866f3657fSopenharmony_ci}; 5966f3657fSopenharmony_ci 6066f3657fSopenharmony_cienum DataType : uint8_t { 6166f3657fSopenharmony_ci VIDEO_FULL_SCREEN_DATA = 0, 6266f3657fSopenharmony_ci VIDEO_PART_SCREEN_DATA = 1, 6366f3657fSopenharmony_ci}; 6466f3657fSopenharmony_ci 6566f3657fSopenharmony_cienum DScreenMsgType : uint32_t { 6666f3657fSopenharmony_ci START_MIRROR = 0, 6766f3657fSopenharmony_ci START_MIRROR_SUCCESS = 1, 6866f3657fSopenharmony_ci START_MIRROR_FAIL = 2, 6966f3657fSopenharmony_ci STOP_MIRROR = 3, 7066f3657fSopenharmony_ci}; 7166f3657fSopenharmony_ci 7266f3657fSopenharmony_cienum DScreenEventType : uint32_t { 7366f3657fSopenharmony_ci ENGINE_ERROR = 0, 7466f3657fSopenharmony_ci TRANS_CHANNEL_CLOSED = 1, 7566f3657fSopenharmony_ci}; 7666f3657fSopenharmony_ci 7766f3657fSopenharmony_cistruct VideoData { 7866f3657fSopenharmony_ci uint8_t *data; 7966f3657fSopenharmony_ci size_t size; 8066f3657fSopenharmony_ci uint32_t width; 8166f3657fSopenharmony_ci uint32_t height; 8266f3657fSopenharmony_ci int64_t timestamp; 8366f3657fSopenharmony_ci std::string format; 8466f3657fSopenharmony_ci}; 8566f3657fSopenharmony_ci 8666f3657fSopenharmony_ci/* Screen package name */ 8766f3657fSopenharmony_ciconst std::string PKG_NAME = "ohos.dhardware.dscreen"; 8866f3657fSopenharmony_ci 8966f3657fSopenharmony_ci/* Screen data session name */ 9066f3657fSopenharmony_ciconst std::string DATA_SESSION_NAME = "ohos.dhardware.dscreen.data"; 9166f3657fSopenharmony_ciconst std::string JPEG_SESSION_NAME = "ohos.dhardware.dscreen.jpeg"; 9266f3657fSopenharmony_ci 9366f3657fSopenharmony_ci/* Screen dump data file path name */ 9466f3657fSopenharmony_ciconst std::string DUMP_FILE_PATH = "/data/data/dscreen"; 9566f3657fSopenharmony_ci 9666f3657fSopenharmony_ci/* YUV */ 9766f3657fSopenharmony_ciconstexpr int32_t YR_PARAM = 66; 9866f3657fSopenharmony_ciconstexpr int32_t YG_PARAM = 129; 9966f3657fSopenharmony_ciconstexpr int32_t YB_PARAM = 25; 10066f3657fSopenharmony_ciconstexpr int32_t UR_PARAM = 38; 10166f3657fSopenharmony_ciconstexpr int32_t UG_PARAM = 74; 10266f3657fSopenharmony_ciconstexpr int32_t UB_PARAM = 112; 10366f3657fSopenharmony_ciconstexpr int32_t VG_PARAM = 94; 10466f3657fSopenharmony_ciconstexpr int32_t VB_PARAM = 18; 10566f3657fSopenharmony_ciconstexpr int32_t YA_PARAM = 16; 10666f3657fSopenharmony_ciconstexpr int32_t UA_PARAM = 128; 10766f3657fSopenharmony_ciconstexpr int32_t YUV_PARAM = 255; 10866f3657fSopenharmony_ciconstexpr int32_t MOVEBITS = 8; 10966f3657fSopenharmony_ci 11066f3657fSopenharmony_ci/* RGBA */ 11166f3657fSopenharmony_ciconstexpr uint32_t RGBA_CHROMA = 4; 11266f3657fSopenharmony_ciconstexpr uint32_t RGB_CHROMA = 3; 11366f3657fSopenharmony_ciconstexpr uint32_t ONE = 1; 11466f3657fSopenharmony_ciconstexpr uint32_t TWO = 2; 11566f3657fSopenharmony_ciconstexpr uint32_t THREE = 3; 11666f3657fSopenharmony_ciconstexpr uint32_t ZERO = 0; 11766f3657fSopenharmony_ciconstexpr uint32_t ALIGNEDBITS = 32; 11866f3657fSopenharmony_ci 11966f3657fSopenharmony_ci/* Screen byte alignment size*/ 12066f3657fSopenharmony_ciconstexpr uint32_t BYTE_ALIGNMENT = 32; 12166f3657fSopenharmony_ciconstexpr uint32_t BYTE_ALIGNMENT_CALCULATION = 31; 12266f3657fSopenharmony_ci 12366f3657fSopenharmony_ci/* Screen session name max len */ 12466f3657fSopenharmony_ciconstexpr uint32_t DSCREEN_MAX_SESSION_NAME_LEN = 50; 12566f3657fSopenharmony_ci 12666f3657fSopenharmony_ciconstexpr uint32_t DSCREEN_MAX_DEVICE_ID_LEN = 100; 12766f3657fSopenharmony_ci 12866f3657fSopenharmony_ci/* Screen data received max length */ 12966f3657fSopenharmony_ciconstexpr uint32_t DSCREEN_MAX_RECV_DATA_LEN = 104857600; 13066f3657fSopenharmony_ci 13166f3657fSopenharmony_ci/* Screen max video data width */ 13266f3657fSopenharmony_ciconstexpr uint32_t DSCREEN_MAX_VIDEO_DATA_WIDTH = 2560; 13366f3657fSopenharmony_ci 13466f3657fSopenharmony_ci/* Screen max video data height */ 13566f3657fSopenharmony_ciconstexpr uint32_t DSCREEN_MAX_VIDEO_DATA_HEIGHT = 2772; 13666f3657fSopenharmony_ci 13766f3657fSopenharmony_ci/* Screen max screen data width */ 13866f3657fSopenharmony_ciconstexpr uint32_t DSCREEN_MAX_SCREEN_DATA_WIDTH = 2560; 13966f3657fSopenharmony_ci 14066f3657fSopenharmony_ci/* Screen max screen data height */ 14166f3657fSopenharmony_ciconstexpr uint32_t DSCREEN_MAX_SCREEN_DATA_HEIGHT = 2772; 14266f3657fSopenharmony_ci 14366f3657fSopenharmony_ci/* Screen max display data width */ 14466f3657fSopenharmony_ciconstexpr uint32_t DSCREEN_MAX_DISPLAY_DATA_WIDTH = 2560; 14566f3657fSopenharmony_ci 14666f3657fSopenharmony_ci/* Screen max display data height */ 14766f3657fSopenharmony_ciconstexpr uint32_t DSCREEN_MAX_DISPLAY_DATA_HEIGHT = 2772; 14866f3657fSopenharmony_ci 14966f3657fSopenharmony_ci/* Screen dump data max file size */ 15066f3657fSopenharmony_ciconstexpr uint32_t DUMP_FILE_MAX_SIZE = 295 * 1024 * 1024; 15166f3657fSopenharmony_ci 15266f3657fSopenharmony_ci/* YUV420 buffer size max size */ 15366f3657fSopenharmony_ciconstexpr int64_t MAX_YUV420_BUFFER_SIZE = 2560 * 1600 * (3 / 2) * 2; 15466f3657fSopenharmony_ciconstexpr int32_t DSCREEN_MAX_LEN = 4096; 15566f3657fSopenharmony_ci 15666f3657fSopenharmony_ciconstexpr int32_t INVALID_WINDOW_ID = -1; 15766f3657fSopenharmony_ciconstexpr int32_t STRIDE_ALIGNMENT = 0x8; 15866f3657fSopenharmony_ciconstexpr int32_t SURFACE_SYNC_FENCE_TIMEOUT = 100; 15966f3657fSopenharmony_ci 16066f3657fSopenharmony_ciconst std::string DSCREEN_LOG_TITLE_TAG = "DSCREEN"; 16166f3657fSopenharmony_ciconst std::string DSCREEN_PREFIX = "DISTRIBUTED_SCREEN"; 16266f3657fSopenharmony_ciconst std::string SCREEN_PREFIX = "SCREEN"; 16366f3657fSopenharmony_ciconst std::string DSCREEN_VERSION = "1.0"; 16466f3657fSopenharmony_ciconst std::string DSCREEN_PROCESS_NAME = "dscreen"; 16566f3657fSopenharmony_ciconst std::string SEPERATOR = "#"; 16666f3657fSopenharmony_ciconst std::string KEY_VERSION = "screenVersion"; 16766f3657fSopenharmony_ciconst std::string KEY_DISPLAY_ID = "displayId"; 16866f3657fSopenharmony_ciconst std::string KEY_SCREEN_ID = "screenId"; 16966f3657fSopenharmony_ciconst std::string KEY_DISPLAY_RECT = "displayRect"; 17066f3657fSopenharmony_ciconst std::string KEY_SCREEN_RECT = "screenRect"; 17166f3657fSopenharmony_ciconst std::string KEY_POINT_START_X = "startX"; 17266f3657fSopenharmony_ciconst std::string KEY_POINT_START_Y = "startY"; 17366f3657fSopenharmony_ciconst std::string KEY_POINT_DIRTY_X = "dirtyX"; 17466f3657fSopenharmony_ciconst std::string KEY_POINT_DIRTY_Y = "dirtyY"; 17566f3657fSopenharmony_ciconst std::string KEY_POINT_DIRTY_W = "dirtyW"; 17666f3657fSopenharmony_ciconst std::string KEY_POINT_DIRTY_H = "dirtyH"; 17766f3657fSopenharmony_ciconst std::string KEY_POINT_DIRTY_SIZE = "dirtySize"; 17866f3657fSopenharmony_ciconst std::string KEY_WIDTH = "width"; 17966f3657fSopenharmony_ciconst std::string KEY_HEIGHT = "height"; 18066f3657fSopenharmony_ciconst std::string KEY_SCREEN_WIDTH = "screenWidth"; 18166f3657fSopenharmony_ciconst std::string KEY_SCREEN_HEIGHT = "screenHeight"; 18266f3657fSopenharmony_ciconst std::string KEY_VIDEO_WIDTH = "videoWidth"; 18366f3657fSopenharmony_ciconst std::string KEY_VIDEO_HEIGHT = "videoHeight"; 18466f3657fSopenharmony_ciconst std::string KEY_COLOR_FORMAT = "colorFormat"; 18566f3657fSopenharmony_ciconst std::string KEY_FPS = "fps"; 18666f3657fSopenharmony_ciconst std::string KEY_CODECTYPE = "codecType"; 18766f3657fSopenharmony_ciconst std::string SCREEN_CLIENT_WINDOW = "screenClientWindow"; 18866f3657fSopenharmony_ciconst std::string KEY_DEV_ID = "devId"; 18966f3657fSopenharmony_ciconst std::string KEY_DH_ID = "dhId"; 19066f3657fSopenharmony_ciconst std::string KEY_ERR_CODE = "errCode"; 19166f3657fSopenharmony_ciconst std::string KEY_ERR_CONTENT = "errContent"; 19266f3657fSopenharmony_ciconst std::string KEY_VIDEO_PARAM = "videoParam"; 19366f3657fSopenharmony_ciconst std::string KEY_MAPRELATION = "mapRelation"; 19466f3657fSopenharmony_ciconst std::string KEY_PARTIALREFRESH = "PartialRefresh"; 19566f3657fSopenharmony_ciconst std::string CODEC_NAME_H264 = "OMX_hisi_video_encoder_avc"; 19666f3657fSopenharmony_ciconst std::string CODEC_NAME_H265 = "OMX_hisi_video_encoder_hevc"; 19766f3657fSopenharmony_ciconst std::string CODEC_NAME_MPEG4 = "avenc_mpeg4"; 19866f3657fSopenharmony_ci// Publish massage 19966f3657fSopenharmony_ciconst std::string SOURCE_WIN_ID = "sourceWinId"; 20066f3657fSopenharmony_ciconst std::string SOURCE_DEV_ID = "sourceDevId"; 20166f3657fSopenharmony_ciconst std::string SINK_DEV_ID = "sinkDevId"; 20266f3657fSopenharmony_ciconst std::string SOURCE_WIN_WIDTH = "sourceWinWidth"; 20366f3657fSopenharmony_ciconst std::string SOURCE_WIN_HEIGHT = "sourceWinHeight"; 20466f3657fSopenharmony_ciconst std::string SINK_SHOW_WIN_ID = "sinkShowWinId"; 20566f3657fSopenharmony_ciconst std::string SINK_PROJ_SHOW_WIDTH = "sinkProjShowWidth"; 20666f3657fSopenharmony_ciconst std::string SINK_PROJ_SHOW_HEIGHT = "sinkProjShowHeight"; 20766f3657fSopenharmony_ciconst std::string SINK_WIN_SHOW_X = "sinkWinShowX"; 20866f3657fSopenharmony_ciconst std::string SINK_WIN_SHOW_Y = "sinkWinShowY"; 20966f3657fSopenharmony_ciconstexpr const char* PARTIAL_REFRESH_PARAM = "persist.distributedhardware.dscreen.partial.refresh.enable"; 21066f3657fSopenharmony_ci 21166f3657fSopenharmony_ciconstexpr int32_t DSCREEN_MIN_VERSION = 1; 21266f3657fSopenharmony_ciconstexpr int32_t AV_TRANS_SUPPORTED_VERSION = 3; 21366f3657fSopenharmony_ciconstexpr int32_t PARTIAL_REFRESH_ENABLED_VALUE = 1; 21466f3657fSopenharmony_ciconstexpr uint32_t MAX_MESSAGES_LEN = 40 * 1024 * 1024; 21566f3657fSopenharmony_ciconstexpr float DEFAULT_DENSITY = 2.0; 21666f3657fSopenharmony_ciconstexpr int32_t DEFAULT_SCREEN_FLAGS = 0; 21766f3657fSopenharmony_ciconstexpr double DEFAULT_FPS = 60.0; 21866f3657fSopenharmony_ciconstexpr uint32_t DIRTY_MAX_SIZE = 10; 21966f3657fSopenharmony_ciconstexpr uint32_t DIRTY_MAX_BUF_SIZE = 1560000; 22066f3657fSopenharmony_ciconstexpr uint32_t DIRTY_MAX_IMAGE_DATA_SIZE = 780000; 22166f3657fSopenharmony_ciconstexpr uint8_t DEFAULT_CODECTYPE = VIDEO_CODEC_TYPE_VIDEO_H264; 22266f3657fSopenharmony_ciconstexpr uint8_t DEFAULT_VIDEO_FORMAT = VIDEO_DATA_FORMAT_NV12; 22366f3657fSopenharmony_ciconstexpr int32_t DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID = 4807; 22466f3657fSopenharmony_ciconstexpr int32_t DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID = 4808; 22566f3657fSopenharmony_ciconstexpr uint64_t SCREEN_ID_INVALID = -1ULL; 22666f3657fSopenharmony_ciconstexpr uint64_t SCREEN_ID_DEFAULT = 0; 22766f3657fSopenharmony_ciconstexpr int32_t SCREEN_LOADSA_TIMEOUT_MS = 10000; 22866f3657fSopenharmony_ciconstexpr size_t DID_MAX_SIZE = 256; 22966f3657fSopenharmony_ciconstexpr size_t PARAM_MAX_SIZE = 50 * 1024 * 1024; 23066f3657fSopenharmony_ciconstexpr uint8_t SESSION_WAIT_SECONDS = 5; 23166f3657fSopenharmony_ciconstexpr uint8_t DATA_WAIT_SECONDS = 1; 23266f3657fSopenharmony_ciconstexpr size_t DATA_QUEUE_MAX_SIZE = 1000; 23366f3657fSopenharmony_ciconstexpr uint32_t DECODE_WAIT_MILLISECONDS = 5000; 23466f3657fSopenharmony_ciconstexpr size_t DATA_BUFFER_MAX_SIZE = 10 * 1024 * 1024; 23566f3657fSopenharmony_ciconstexpr uint8_t TASK_WAIT_SECONDS = 1; 23666f3657fSopenharmony_ciconstexpr int32_t JPEG_QUALITY = 80; 23766f3657fSopenharmony_ciconstexpr uint32_t BIT_RATE = 12000000; 23866f3657fSopenharmony_ciconstexpr int32_t WAIT_TIMEOUT_MS = 5000; 23966f3657fSopenharmony_ciconstexpr uint32_t SYSTEM_PARAM_VALUE_SIZE = 50; 24066f3657fSopenharmony_ciconstexpr uint64_t WATCHDOG_INTERVAL_TIME_MS = 20 * 1000; 24166f3657fSopenharmony_ciconstexpr uint64_t WATCHDOG_DELAY_TIME_MS = 5 * 1000; 24266f3657fSopenharmony_ciconstexpr int32_t INVALID_SESSION_ID = -1; 24366f3657fSopenharmony_ci} // namespace DistributedHardware 24466f3657fSopenharmony_ci} // namespace OHOS 24566f3657fSopenharmony_ci#endif