1 /* 2 * Copyright 2022 The WebRTC project authors. All Rights Reserved. 3 * 4 * Use of this source code is governed by a BSD-style license 5 * that can be found in the LICENSE file in the root of the source 6 * tree. An additional intellectual property rights grant can be found 7 * in the file PATENTS. All contributing project authors may 8 * be found in the AUTHORS file in the root of the source tree. 9 */ 10 11 #ifndef MODULES_DESKTOP_CAPTURE_LINUX_WAYLAND_SCREENCAST_STREAM_UTILS_H_ 12 #define MODULES_DESKTOP_CAPTURE_LINUX_WAYLAND_SCREENCAST_STREAM_UTILS_H_ 13 14 #include <stdint.h> 15 16 #include <string> 17 #include <vector> 18 19 #include "rtc_base/string_encode.h" 20 21 struct spa_pod; 22 struct spa_pod_builder; 23 struct spa_rectangle; 24 25 namespace webrtc { 26 27 struct PipeWireVersion { 28 static PipeWireVersion Parse(const absl::string_view& version); 29 30 // Returns whether current version is newer or same as required version 31 bool operator>=(const PipeWireVersion& other); 32 // Returns whether current version is older or same as required version 33 bool operator<=(const PipeWireVersion& other); 34 35 int major = 0; 36 int minor = 0; 37 int micro = 0; 38 }; 39 40 // Returns a spa_pod used to build PipeWire stream format using given 41 // arguments. Modifiers are optional value and when present they will be 42 // used with SPA_POD_PROP_FLAG_MANDATORY and SPA_POD_PROP_FLAG_DONT_FIXATE 43 // flags. 44 spa_pod* BuildFormat(spa_pod_builder* builder, 45 uint32_t format, 46 const std::vector<uint64_t>& modifiers, 47 const struct spa_rectangle* resolution); 48 49 } // namespace webrtc 50 51 #endif // MODULES_DESKTOP_CAPTURE_LINUX_WAYLAND_SCREENCAST_STREAM_UTILS_H_ 52