1 /* 2 * Copyright (c) 2022-2025 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_AVSESSION_DESCRIPTOR_H 17 #define OHOS_AVSESSION_DESCRIPTOR_H 18 19 #include "parcel.h" 20 #include "element_name.h" 21 #include "av_audio_stream_info.h" 22 23 namespace OHOS::AVSession { 24 struct AudioCapabilities { 25 bool WriteToParcel(Parcel& out) const; 26 bool ReadFromParcel(Parcel& in); 27 28 std::vector<AudioStreamInfo> streamInfos_; 29 }; 30 31 class DeviceInfo : public Parcelable { 32 public: 33 DeviceInfo() = default; DeviceInfo(int32_t castCategory,std::string deviceId,std::string deviceName)34 DeviceInfo(int32_t castCategory, std::string deviceId, std::string deviceName) 35 : castCategory_(castCategory), deviceId_(deviceId), deviceName_(deviceName) {} 36 bool Marshalling(Parcel& out) const override; 37 bool ReadFromParcel(Parcel& in); 38 static DeviceInfo* Unmarshalling(Parcel& in); 39 40 int32_t castCategory_ {}; 41 std::string deviceId_; 42 std::string deviceName_; 43 std::string networkId_; 44 std::string ipAddress_; 45 std::string manufacturer_; 46 std::string modelName_; 47 int32_t deviceType_ {}; 48 int32_t providerId_ {}; 49 int32_t supportedProtocols_ {}; 50 int32_t authenticationStatus_ {}; 51 std::vector<std::string> supportedDrmCapabilities_; 52 std::vector<uint32_t> supportedPullClients_; 53 bool isLegacy_ = false; 54 int32_t mediumTypes_ = 2; 55 AudioCapabilities audioCapabilities_; 56 }; 57 58 class OutputDeviceInfo : public Parcelable { 59 public: 60 bool Marshalling(Parcel& out) const override; 61 bool ReadFromParcel(Parcel& in); 62 static OutputDeviceInfo* Unmarshalling(Parcel& in); 63 64 std::vector<DeviceInfo> deviceInfos_; 65 }; 66 67 class AVHistoryDescriptor : public Parcelable { 68 bool Marshalling(Parcel& out) const override; 69 bool ReadFromParcel(Parcel& in); 70 static AVHistoryDescriptor* Unmarshalling(Parcel& in); 71 72 std::string sessionId_; 73 std::string bundleName_; 74 std::string abilityName_; 75 }; 76 77 class AVSessionDescriptor : public Parcelable { 78 public: 79 bool Marshalling(Parcel& out) const override; 80 bool CheckBeforReadFromParcel(Parcel& in); 81 bool CheckBeforReadFromParcel(Parcel& in, DeviceInfo& deviceInfo); 82 bool ReadFromParcel(Parcel& in); 83 static AVSessionDescriptor* Unmarshalling(Parcel& in); 84 85 std::string sessionId_; 86 int32_t sessionType_ {}; 87 std::string sessionTag_; 88 AppExecFwk::ElementName elementName_; 89 pid_t pid_ {}; 90 pid_t uid_ {}; 91 bool isActive_ {}; 92 bool isTopSession_ {}; 93 bool isThirdPartyApp_ {}; 94 int32_t index_ {}; 95 OutputDeviceInfo outputDeviceInfo_; 96 97 int32_t userId_ {}; 98 }; 99 100 struct AVSessionBasicInfo { 101 std::string deviceName_; 102 std::string networkId_; 103 std::string vendorId_; 104 std::string deviceType_; 105 std::string systemVersion_; 106 int32_t sessionVersion_ {}; 107 std::vector<int32_t> reserve_; 108 std::vector<int32_t> feature_; 109 std::vector<int32_t> metaDataCap_; 110 std::vector<int32_t> playBackStateCap_; 111 std::vector<int32_t> controlCommandCap_; 112 std::vector<int32_t> extendCapability_; 113 int32_t systemTime_ {}; 114 std::vector<int32_t> extend_; 115 }; 116 117 enum CastDisplayState { 118 STATE_OFF = 1, 119 STATE_ON, 120 }; 121 122 enum DeviceLogEventCode { 123 DEVICE_LOG_FULL = 1, 124 DEVICE_LOG_EXCEPTION = 2, 125 DEVICE_LOG_MAX = 3, 126 }; 127 128 struct CastDisplayInfo: public Parcelable { 129 bool Marshalling(Parcel& out) const override; 130 bool ReadFromParcel(Parcel& in); 131 static CastDisplayInfo* Unmarshalling(Parcel& in); 132 133 CastDisplayState displayState; 134 uint64_t displayId {}; 135 std::string name; 136 int32_t width {}; 137 int32_t height {}; 138 }; 139 } // namespace OHOS::AVSession 140 #endif // OHOS_AVSESSION_DESCRIPTOR_H