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"; 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 = 1600; 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 = 1600; 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 SEPERATOR = "#"; 96 const std::string KEY_VERSION = "screenVersion"; 97 const std::string KEY_DISPLAY_ID = "displayId"; 98 const std::string KEY_SCREEN_ID = "screenId"; 99 const std::string KEY_DISPLAY_RECT = "displayRect"; 100 const std::string KEY_SCREEN_RECT = "screenRect"; 101 const std::string KEY_POINT_START_X = "startX"; 102 const std::string KEY_POINT_START_Y = "startY"; 103 const std::string KEY_WIDTH = "width"; 104 const std::string KEY_HEIGHT = "height"; 105 const std::string KEY_SCREEN_WIDTH = "screenWidth"; 106 const std::string KEY_SCREEN_HEIGHT = "screenHeight"; 107 const std::string KEY_VIDEO_WIDTH = "videoWidth"; 108 const std::string KEY_VIDEO_HEIGHT = "videoHeight"; 109 const std::string KEY_FPS = "fps"; 110 const std::string KEY_CODECTYPE = "codecType"; 111 const std::string SCREEN_CLIENT_WINDOW = "screenClientWindow"; 112 const std::string KEY_DH_ID = "dhId"; 113 const std::string KEY_ERR_CODE = "errCode"; 114 const std::string KEY_ERR_CONTENT = "errContent"; 115 const std::string KEY_VIDEO_PARAM = "videoParam"; 116 const std::string KEY_MAPRELATION = "mapRelation"; 117 const std::string CODEC_NAME_H264 = "OMX_hisi_video_encoder_avc"; 118 const std::string CODEC_NAME_MPEG4 = "avenc_mpeg4"; 119 constexpr float DEFAULT_DENSITY = 2.0; 120 constexpr int32_t DEFAULT_SCREEN_FLAGS = 0; 121 constexpr uint32_t DEFAULT_FPS = 30; 122 constexpr uint8_t DEFAULT_CODECTYPE = VIDEO_CODEC_TYPE_VIDEO_H264; 123 constexpr uint8_t DEFAULT_VIDEO_FORMAT = VIDEO_DATA_FORMAT_NV21; 124 constexpr int32_t DISTRIBUTED_HARDWARE_SCREEN_SOURCE_SA_ID = 4807; 125 constexpr int32_t DISTRIBUTED_HARDWARE_SCREEN_SINK_SA_ID = 4808; 126 constexpr uint64_t SCREEN_ID_INVALID = -1ULL; 127 constexpr uint64_t SCREEN_ID_DEFAULT = 0; 128 } // namespace DistributedHardware 129 } // namespace OHOS 130 #endif