mirror of
https://gitlab.freedesktop.org/pipewire/helvum
synced 2026-03-15 11:36:11 +08:00
Update dependencies
This updates all crates to their newest release. For pipewire-rs, this includes bumping the version to 0.3, which means this comment has to fix a few breaking changes, but nothing big. 0.3 also lets us create and delete remote objects, which will be needed for link creation and deletion.
This commit is contained in:
@@ -33,7 +33,9 @@ impl PipewireConnection {
|
||||
.connect(None)
|
||||
.map_err(|_| "Failed to connect to pipewire core")?,
|
||||
);
|
||||
let registry = core.get_registry();
|
||||
let registry = core
|
||||
.get_registry()
|
||||
.map_err(|_| "Failed to get pipewire registry")?;
|
||||
|
||||
let state = Rc::new(RefCell::new(state));
|
||||
|
||||
@@ -61,7 +63,10 @@ impl PipewireConnection {
|
||||
/// Receive all events from the pipewire server, sending them to the `pipewire_state` struct for processing.
|
||||
pub fn roundtrip(&self) {
|
||||
let done = Rc::new(Cell::new(false));
|
||||
let pending = self.core.sync(0);
|
||||
let pending = self
|
||||
.core
|
||||
.sync(0)
|
||||
.expect("Failed to trigger core sync event");
|
||||
|
||||
let done_clone = done.clone();
|
||||
let loop_clone = self.mainloop.clone();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use crate::{view, PipewireLink};
|
||||
|
||||
use gtk::WidgetExt;
|
||||
use libspa::dict::ReadableDict;
|
||||
use libspa::{dict::ReadableDict, ForeignDict};
|
||||
use log::warn;
|
||||
use pipewire::{port::Direction, registry::GlobalObject, types::ObjectType};
|
||||
|
||||
@@ -44,7 +44,7 @@ impl PipewireState {
|
||||
}
|
||||
|
||||
/// This function is called from the `PipewireConnection` struct responsible for updating this struct.
|
||||
pub fn global(&mut self, global: GlobalObject) {
|
||||
pub fn global(&mut self, global: &GlobalObject<ForeignDict>) {
|
||||
match global.type_ {
|
||||
ObjectType::Node => {
|
||||
self.add_node(global);
|
||||
@@ -59,7 +59,7 @@ impl PipewireState {
|
||||
}
|
||||
}
|
||||
|
||||
fn add_node(&mut self, node: GlobalObject) {
|
||||
fn add_node(&mut self, node: &GlobalObject<ForeignDict>) {
|
||||
// Update graph to contain the new node.
|
||||
let node_widget = crate::view::Node::new(
|
||||
&node
|
||||
@@ -79,6 +79,7 @@ impl PipewireState {
|
||||
// FIXME: This relies on the node being passed to us by the pipwire server before its port.
|
||||
let media_type = node
|
||||
.props
|
||||
.as_ref()
|
||||
.map(|props| {
|
||||
props.get("media.class").map(|class| {
|
||||
if class.contains("Audio") {
|
||||
@@ -109,9 +110,12 @@ impl PipewireState {
|
||||
);
|
||||
}
|
||||
|
||||
fn add_port(&mut self, port: GlobalObject) {
|
||||
fn add_port(&mut self, port: &GlobalObject<ForeignDict>) {
|
||||
// Update graph to contain the new port.
|
||||
let props = port.props.expect("Port object is missing properties");
|
||||
let props = port
|
||||
.props
|
||||
.as_ref()
|
||||
.expect("Port object is missing properties");
|
||||
let port_label = props.get("port.name").unwrap_or_default().to_string();
|
||||
let node_id: u32 = props
|
||||
.get("node.id")
|
||||
@@ -148,12 +152,15 @@ impl PipewireState {
|
||||
self.items.insert(port.id, Item::Port { node_id });
|
||||
}
|
||||
|
||||
fn add_link(&mut self, link: GlobalObject) {
|
||||
fn add_link(&mut self, link: &GlobalObject<ForeignDict>) {
|
||||
// FIXME: Links should be colored depending on the data they carry (video, audio, midi) like ports are.
|
||||
self.items.insert(link.id, Item::Link);
|
||||
|
||||
// Update graph to contain the new link.
|
||||
let props = link.props.expect("Link object is missing properties");
|
||||
let props = link
|
||||
.props
|
||||
.as_ref()
|
||||
.expect("Link object is missing properties");
|
||||
let input_node: u32 = props
|
||||
.get("link.input.node")
|
||||
.expect("Link has no link.input.node property")
|
||||
|
||||
Reference in New Issue
Block a user