Upgrade to new stable pipewire-rs

This commit is contained in:
Ivan Molodetskikh
2025-11-24 07:56:39 +03:00
parent c558516d4c
commit 642277f881
3 changed files with 36 additions and 55 deletions
Generated
+17 -40
View File
@@ -808,9 +808,6 @@ name = "cookie-factory"
version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9885fa71e26b8ab7855e2ec7cae6e9b380edff76cd052e07c683a0319d51b3a2"
dependencies = [
"futures",
]
[[package]]
name = "core-foundation"
@@ -954,7 +951,7 @@ dependencies = [
"libc",
"option-ext",
"redox_users",
"windows-sys 0.60.2",
"windows-sys 0.61.1",
]
[[package]]
@@ -1093,7 +1090,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
dependencies = [
"libc",
"windows-sys 0.60.2",
"windows-sys 0.61.1",
]
[[package]]
@@ -1206,21 +1203,6 @@ dependencies = [
"percent-encoding",
]
[[package]]
name = "futures"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876"
dependencies = [
"futures-channel",
"futures-core",
"futures-executor",
"futures-io",
"futures-sink",
"futures-task",
"futures-util",
]
[[package]]
name = "futures-channel"
version = "0.3.31"
@@ -1228,7 +1210,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10"
dependencies = [
"futures-core",
"futures-sink",
]
[[package]]
@@ -1278,12 +1259,6 @@ dependencies = [
"syn 2.0.106",
]
[[package]]
name = "futures-sink"
version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7"
[[package]]
name = "futures-task"
version = "0.3.31"
@@ -1296,11 +1271,9 @@ version = "0.3.31"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81"
dependencies = [
"futures-channel",
"futures-core",
"futures-io",
"futures-macro",
"futures-sink",
"futures-task",
"memchr",
"pin-project-lite",
@@ -2170,8 +2143,9 @@ dependencies = [
[[package]]
name = "libspa"
version = "0.8.0"
source = "git+https://gitlab.freedesktop.org/pipewire/pipewire-rs.git#93138d01b23628521b29b5604bbebe991cba4c65"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b6b8cfa2a7656627b4c92c6b9ef929433acd673d5ab3708cda1b18478ac00df4"
dependencies = [
"bitflags 2.9.4",
"cc",
@@ -2186,8 +2160,9 @@ dependencies = [
[[package]]
name = "libspa-sys"
version = "0.8.0"
source = "git+https://gitlab.freedesktop.org/pipewire/pipewire-rs.git#93138d01b23628521b29b5604bbebe991cba4c65"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "901049455d2eb6decf9058235d745237952f4804bc584c5fcb41412e6adcc6e0"
dependencies = [
"bindgen",
"cc",
@@ -2948,8 +2923,9 @@ dependencies = [
[[package]]
name = "pipewire"
version = "0.8.0"
source = "git+https://gitlab.freedesktop.org/pipewire/pipewire-rs.git#93138d01b23628521b29b5604bbebe991cba4c65"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9688b89abf11d756499f7c6190711d6dbe5a3acdb30c8fbf001d6596d06a8d44"
dependencies = [
"anyhow",
"bitflags 2.9.4",
@@ -2964,8 +2940,9 @@ dependencies = [
[[package]]
name = "pipewire-sys"
version = "0.8.0"
source = "git+https://gitlab.freedesktop.org/pipewire/pipewire-rs.git#93138d01b23628521b29b5604bbebe991cba4c65"
version = "0.9.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cb028afee0d6ca17020b090e3b8fa2d7de23305aef975c7e5192a5050246ea36"
dependencies = [
"bindgen",
"libspa-sys",
@@ -3391,7 +3368,7 @@ dependencies = [
"errno",
"libc",
"linux-raw-sys 0.11.0",
"windows-sys 0.60.2",
"windows-sys 0.61.1",
]
[[package]]
@@ -3818,7 +3795,7 @@ dependencies = [
"getrandom 0.3.3",
"once_cell",
"rustix 1.1.2",
"windows-sys 0.60.2",
"windows-sys 0.61.1",
]
[[package]]
@@ -4458,7 +4435,7 @@ version = "0.1.11"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
dependencies = [
"windows-sys 0.60.2",
"windows-sys 0.61.1",
]
[[package]]
+1 -1
View File
@@ -82,7 +82,7 @@ niri-ipc = { version = "25.8.0", path = "niri-ipc", features = ["clap"] }
ordered-float = "5.1.0"
pango = { version = "0.20.12", features = ["v1_44"] }
pangocairo = "0.20.10"
pipewire = { git = "https://gitlab.freedesktop.org/pipewire/pipewire-rs.git", optional = true, features = ["v0_3_33"] }
pipewire = { version = "0.9.2", optional = true, features = ["v0_3_33"] }
png = "0.18.0"
portable-atomic = { version = "1.11.1", default-features = false, features = ["float"] }
profiling = "1.0.17"
+18 -14
View File
@@ -11,10 +11,10 @@ use std::time::Duration;
use anyhow::Context as _;
use calloop::timer::{TimeoutAction, Timer};
use calloop::RegistrationToken;
use pipewire::context::Context;
use pipewire::core::{Core, PW_ID_CORE};
use pipewire::main_loop::MainLoop;
use pipewire::properties::Properties;
use pipewire::context::ContextRc;
use pipewire::core::{CoreRc, PW_ID_CORE};
use pipewire::main_loop::MainLoopRc;
use pipewire::properties::PropertiesBox;
use pipewire::spa::buffer::DataType;
use pipewire::spa::param::format::{FormatProperties, MediaSubtype, MediaType};
use pipewire::spa::param::format_utils::parse_format;
@@ -28,7 +28,7 @@ use pipewire::spa::utils::{
Choice, ChoiceEnum, ChoiceFlags, Direction, Fraction, Rectangle, SpaTypes,
};
use pipewire::spa::{self};
use pipewire::stream::{Stream, StreamFlags, StreamListener, StreamState};
use pipewire::stream::{Stream, StreamFlags, StreamListener, StreamRc, StreamState};
use pipewire::sys::{pw_buffer, pw_stream_queue_buffer};
use smithay::backend::allocator::dmabuf::{AsDmabuf, Dmabuf};
use smithay::backend::allocator::format::FormatSet;
@@ -55,8 +55,8 @@ use crate::utils::get_monotonic_time;
const CAST_DELAY_ALLOWANCE: Duration = Duration::from_micros(100);
pub struct PipeWire {
_context: Context,
pub core: Core,
_context: ContextRc,
pub core: CoreRc,
pub token: RegistrationToken,
event_loop: LoopHandle<'static, State>,
to_niri: calloop::channel::Sender<PwToNiri>,
@@ -72,7 +72,7 @@ pub struct Cast {
event_loop: LoopHandle<'static, State>,
pub session_id: usize,
pub stream_id: usize,
pub stream: Stream,
pub stream: StreamRc,
_listener: StreamListener<()>,
pub target: CastTarget,
pub dynamic_target: bool,
@@ -158,9 +158,9 @@ impl PipeWire {
event_loop: LoopHandle<'static, State>,
to_niri: calloop::channel::Sender<PwToNiri>,
) -> anyhow::Result<Self> {
let main_loop = MainLoop::new(None).context("error creating MainLoop")?;
let context = Context::new(&main_loop).context("error creating Context")?;
let core = context.connect(None).context("error creating Core")?;
let main_loop = MainLoopRc::new(None).context("error creating MainLoop")?;
let context = ContextRc::new(&main_loop, None).context("error creating Context")?;
let core = context.connect_rc(None).context("error creating Core")?;
let to_niri_ = to_niri.clone();
let listener = core
@@ -178,7 +178,7 @@ impl PipeWire {
.register();
mem::forget(listener);
struct AsFdWrapper(MainLoop);
struct AsFdWrapper(MainLoopRc);
impl AsFd for AsFdWrapper {
fn as_fd(&self) -> BorrowedFd<'_> {
self.0.loop_().fd()
@@ -233,8 +233,12 @@ impl PipeWire {
};
let redraw_ = redraw.clone();
let stream = Stream::new(&self.core, "niri-screen-cast-src", Properties::new())
.context("error creating Stream")?;
let stream = StreamRc::new(
self.core.clone(),
"niri-screen-cast-src",
PropertiesBox::new(),
)
.context("error creating Stream")?;
let pending_size = Size::from((size.w as u32, size.h as u32));