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