1 /* 2 * Copyright (c) 2022 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_DSCREEN_CONSTANTS_H 17 #define OHOS_DSCREEN_CONSTANTS_H 18 19 #include <cstdint> 20 #include <string> 21 #include <unistd.h> 22 23 namespace OHOS { 24 namespace DistributedHardware { 25 enum RpcEventType { 26 NOTIFY_SINK_SETUP = 1, 27 NOTIFY_SOURCE_SETUP_RESULT = 2, 28 }; 29 30 enum DScreenState { 31 DISABLED, 32 ENABLED, 33 DISABLING, 34 ENABLING, 35 CONNECTING, 36 CONNECTED, 37 DISCONNECTING, 38 }; 39 40 enum TaskType { 41 TASK_ENABLE, 42 TASK_DISABLE, 43 TASK_CONNECT, 44 TASK_DISCONNECT, 45 }; 46 47 enum CodecType : uint8_t { 48 VIDEO_CODEC_TYPE_VIDEO_H264 = 0, 49 VIDEO_CODEC_TYPE_VIDEO_H265 = 1, 50 VIDEO_CODEC_TYPE_VIDEO_MPEG4 = 2, 51 }; 52 53 enum VideoFormat : uint8_t { 54 VIDEO_DATA_FORMAT_YUVI420 = 0, 55 VIDEO_DATA_FORMAT_NV12 = 1, 56 VIDEO_DATA_FORMAT_NV21 = 2, 57 VIDEO_DATA_FORMAT_RGBA8888 = 3, 58 }; 59 60 /* Screen package name */ 61 const std::string PKG_NAME = "ohos.dhardware.dscreen"; 62 63 /* Screen data session name */ 64 const std::string DATA_SESSION_NAME = "ohos.dhardware.dscreen.data"; 65 66 /* Screen session name max len */ 67 constexpr uint32_t DSCREEN_MAX_SESSION_NAME_LEN = 50; 68 69 constexpr uint32_t DSCREEN_MAX_DEVICE_ID_LEN = 100; 70 /* Screen data received max length */ 71 constexpr uint32_t DSCREEN_MAX_RECV_DATA_LEN = 104857600; 72 73 /* Screen max video data width */ 74 constexpr uint32_t DSCREEN_MAX_VIDEO_DATA_WIDTH = 2560; 75 76 /* Screen max video data height */ 77 constexpr uint32_t DSCREEN_MAX_VIDEO_DATA_HEIGHT = 2772; 78 79 /* Screen max screen data width */ 80 constexpr uint32_t DSCREEN_MAX_SCREEN_DATA_WIDTH = 2560; 81 82 /* Screen max screen data height */ 83 constexpr uint32_t DSCREEN_MAX_SCREEN_DATA_HEIGHT = 2772; 84 85 /* YUV420 buffer size max size */ 86 constexpr int64_t MAX_YUV420_BUFFER_SIZE = 2560 * 1600 * (3 / 2) * 2; 87 constexpr int32_t LOG_MAX_LEN = 4096; 88 89 constexpr int32_t INVALID_WINDOW_ID = -1; 90 91 const std::string DSCREEN_LOG_TITLE_TAG = "DSCREEN"; 92 const std::string DSCREEN_PREFIX = "DISTRIBUTED_SCREEN"; 93 const std::string SCREEN_PREFIX = "SCREEN"; 94 const std::string DSCREEN_VERSION = "1.0"; 95 const std::string DSCREEN_PROCESS_NAME = "dscreen"; 96 const std::string SEPERATOR = "#"; 97 const std::string KEY_VERSION = "screenVersion"; 98 const std::string KEY_DISPLAY_ID = "displayId"; 99 const std::string KEY_SCREEN_ID = "screenId"; 100 const std::string KEY_DISPLAY_RECT = "displayRect"; 101 const std::string KEY_SCREEN_RECT = "screenRect"; 102 const std::string KEY_POINT_START_X = "startX"; 103 const std::string KEY_POINT_START_Y = "startY"; 104 const std::string KEY_WIDTH = "width"; 105 const std::string KEY_HEIGHT = "height"; 106 const std::string KEY_SCREEN_WIDTH = "screenWidth"; 107 const std::string KEY_SCREEN_HEIGHT = "screenHeight"; 108 const std::string KEY_VIDEO_WIDTH = "videoWidth"; 109 const std::string KEY_VIDEO_HEIGHT = "videoHeight"; 110 const std::string KEY_COLOR_FORMAT = "colorFormat"; 111 const std::string KEY_FPS = "fps"; 112 const std::string KEY_CODECTYPE = "codecType"; 113 const std::string SCREEN_CLIENT_WINDOW = "screenClientWindow"; 114 const std::string KEY_DH_ID = "dhId"; 115 const std::string KEY_ERR_CODE = "errCode"; 116 const std::string KEY_ERR_CONTENT = "errContent"; 117 const std::string KEY_VIDEO_PARAM = "videoParam"; 118 const std::string KEY_MAPRELATION = "mapRelation"; 119 const std::string CODEC_NAME_H264 = "OMX_hisi_video_encoder_avc"; 120 const std::string CODEC_NAME_MPEG4 = "avenc_mpeg4"; 121 // Publish massage 122 const std::string SOURCE_WIN_ID = "sourceWinId"; 123 const std::string SOURCE_DEV_ID = "sourceDevId"; 124 const std::string SINK_DEV_ID = "sinkDevId"; 125 const std::string SOURCE_WIN_WIDTH = "sourceWinWidth"; 126 const std::string SOURCE_WIN_HEIGHT = "sourceWinHeight"; 127 const std::string SINK_SHOW_WIN_ID = "sinkShowWinId"; 128 const std::string SINK_PROJ_SHOW_WIDTH = "sinkProjShowWidth"; 129 const std::string SINK_PROJ_SHOW_HEIGHT = "sinkProjShowHeight"; 130 const std::string SINK_WIN_SHOW_X = "sinkWinShowX"; 131 const std::string SINK_WIN_SHOW_Y = "sinkWinShowY"; 132 133 constexpr uint32_t MAX_MESSAGE_LEN = 40 * 1024 * 1024; 134 constexpr float DEFAULT_DENSITY = 2.0; 135 constexpr int32_t DEFAULT_SCREEN_FLAGS = 0; 136 constexpr uint32_t DEFAULT_FPS = 30; 137 constexpr uint8_t DEFAULT_CODECTYPE = VIDEO_CODEC_TYPE_VIDEO_H264; 138 constexpr uint8_t DEFAULT_VIDEO_FORMAT = VIDEO_DATA_FORMAT_NV12; 139 constexpr int32_t DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID = 4807; 140 constexpr int32_t DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID = 4808; 141 constexpr uint64_t SCREEN_ID_INVALID = -1ULL; 142 constexpr uint64_t SCREEN_ID_DEFAULT = 0; 143 constexpr int32_t SCREEN_LOADSA_TIMEOUT_MS = 10000; 144 } // namespace DistributedHardware 145 } // namespace OHOS 146 #endif