1 /* 2 * Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development 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_SHARING_WFD_SESSION_DEF_H 17 #define OHOS_SHARING_WFD_SESSION_DEF_H 18 19 #include "common/event_comm.h" 20 21 namespace OHOS { 22 namespace Sharing { 23 24 constexpr uint16_t MAX_RTSP_TIMEOUT_COUNTS = 3; 25 26 constexpr uint32_t WFD_SEC_TO_MSEC = 1000; 27 constexpr uint32_t P2P_CONNECT_TIMEOUT = 180; 28 constexpr uint32_t RTSP_SESSION_TIMEOUT = 30; 29 constexpr uint32_t RTSP_INTERACTION_TIMEOUT = 10; 30 constexpr uint32_t MINIMAL_VIDEO_FORMAT_SIZE = 54; 31 32 const std::string RTSP_METHOD_WFD = "org.wfa.wfd1.0"; 33 const std::string WFD_PARAM_3D_FORMATS = "wfd_3d_formats"; 34 const std::string WFD_PARAM_TRIGGER = "wfd_trigger_method"; 35 const std::string WFD_PARAM_IDR_REQUEST = "wfd_idr_request"; 36 const std::string WFD_PARAM_DISPLAY_EDID = "wfd_display_edid"; 37 const std::string WFD_PARAM_COUPLED_SINK = "wfd_coupled_sink"; 38 const std::string WFD_PARAM_AUDIO_CODECS = "wfd_audio_codecs"; 39 const std::string WFD_PARAM_RTP_PORTS = "wfd_client_rtp_ports"; 40 const std::string WFD_PARAM_VIDEO_FORMATS = "wfd_video_formats"; 41 const std::string WFD_PARAM_TRIGGER_METHOD = "wfd_trigger_method"; 42 const std::string WFD_RTSP_URL_DEFAULT = "rtsp://localhost/wfd1.0"; 43 const std::string WFD_PARAM_UIBC_CAPABILITY = "wfd_uibc_capability"; 44 const std::string WFD_PARAM_PRESENTATION_URL = "wfd_presentation_URL"; 45 const std::string WFD_PARAM_CONTENT_PROTECTION = "wfd_content_protection"; 46 const std::string WFD_PARAM_STANDBY_RESUME = "wfd_standby_resume_capability"; 47 48 struct WfdSceneEventMsg : public InteractionEventMsg { 49 using Ptr = std::shared_ptr<WfdSceneEventMsg>; 50 51 std::string mac; 52 }; 53 54 struct WfdSinkSessionEventMsg : public SessionEventMsg { 55 using Ptr = std::shared_ptr<WfdSinkSessionEventMsg>; 56 57 uint16_t localPort = 0; 58 uint16_t remotePort = 0; 59 60 std::string ip; 61 std::string mac; 62 63 AudioFormat audioFormat = AUDIO_48000_16_2; 64 VideoFormat videoFormat = VIDEO_1920X1080_30; 65 }; 66 67 struct WfdSourceSessionEventMsg : public SessionEventMsg { 68 using Ptr = std::shared_ptr<WfdSourceSessionEventMsg>; 69 70 uint16_t localPort = 0; 71 uint16_t remotePort = 0; 72 73 std::string ip; 74 std::string mac; 75 76 AudioFormat audioFormat = AUDIO_48000_16_2; 77 VideoFormat videoFormat = VIDEO_1920X1080_30; 78 }; 79 80 // Table 34. Supported CEA Resolution/Refresh Rates 81 enum WfdCeaResolution { 82 CEA_640_480_P60 = 0, 83 CEA_720_480_P60, 84 CEA_720_480_I60, 85 CEA_720_576_P50, 86 CEA_720_576_I50, 87 CEA_1280_720_P30 = 5, 88 CEA_1280_720_P60, 89 CEA_1920_1080_P30 = 7, 90 CEA_1920_1080_P60, 91 CEA_1920_1080_I60, 92 CEA_1280_720_P25 = 10, 93 CEA_1280_720_P50, 94 CEA_1920_1080_P25 = 12, 95 CEA_1920_1080_P50, 96 CEA_1920_1080_I50, 97 CEA_1280_720_P24 = 15, 98 CEA_1920_1080_P24 = 16 99 }; 100 101 // Table 35. Supported VESA Resolution/Refresh Rates 102 enum WfdVesaResolution { 103 VESA_800_600_P30 = 0, 104 VESA_800_600_P60, 105 VESA_1366_768_P30 = 12, 106 VESA_1366_768_P60, 107 VESA_1280_1024_P30, 108 VESA_1280_1024_P60 = 15, 109 VESA_1920_1200_P30 = 28 110 }; 111 112 // Table 36. Supported HH Resolutions/Refresh Rates 113 enum WfdHhResolution { 114 HH_800_480_P30 = 0, 115 HH_800_480_P60 = 1, 116 HH_960_540_P30 = 8, 117 HH_960_540_P60, 118 HH_848_480_P60 = 11 119 }; 120 121 // Table 37. Display Native Resolution Refresh Rate 122 enum class WfdResolutionType : uint8_t { 123 RESOLUTION_CEA, // 0b000 124 RESOLUTION_VESA, // 0b001 125 RESOLUTION_HH // 0b010 126 }; 127 128 // Table 38. Profiles Bitmap 129 enum class WfdH264Profile { 130 PROFILE_CBP = 0, // 0 0b0: CBP not supported; 0b1: CBP supported; 131 PROFILE_CHP // 1 0b0: CHP not supported; 0b1: CHP supported; 132 }; 133 134 // Table 39. Maximum H.264 Level Supported 135 enum class WfdH264Level { 136 LEVEL_31 = 0, 137 LEVEL_32, 138 LEVEL_40, 139 LEVEL_41, 140 LEVEL_42, 141 }; 142 143 } // namespace Sharing 144 } // namespace OHOS 145 #endif 146