Skip to content

Commit

Permalink
feat(pipewire): link objects return type
Browse files Browse the repository at this point in the history
  • Loading branch information
arcnmx committed Oct 30, 2023
1 parent f8df6d0 commit da46e73
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
3 changes: 3 additions & 0 deletions Gir.toml
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,9 @@ status = "generate"
[[object.function]]
name = "get_state"
manual = true
[[object.function]]
name = "get_linked_object_ids"
visibility = "crate"

# enums

Expand Down
2 changes: 1 addition & 1 deletion src/auto/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl Link {

#[doc(alias = "wp_link_get_linked_object_ids")]
#[doc(alias = "get_linked_object_ids")]
pub fn linked_object_ids(&self) -> (u32, u32, u32, u32) {
#[allow(dead_code)] pub(crate) fn linked_object_ids(&self) -> (u32, u32, u32, u32) {
unsafe {
let mut output_node = mem::MaybeUninit::uninit();
let mut output_port = mem::MaybeUninit::uninit();
Expand Down
20 changes: 20 additions & 0 deletions src/pw/link.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,18 @@ impl Link {
}
}
}

#[doc(alias = "wp_link_get_linked_object_ids")]
#[doc(alias = "get_linked_object_ids")]
pub fn linked_objects(&self) -> LinkObjects {
let (output_node, output_port, input_node, input_port) = self.linked_object_ids();
LinkObjects {
output_node,
output_port,
input_node,
input_port,
}
}
}

pub trait LinkTarget {
Expand Down Expand Up @@ -111,3 +123,11 @@ impl<E> From<Result<LinkState, E>> for LinkState {
}
}
}

#[derive(Debug, Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Hash)]
pub struct LinkObjects {
pub output_node: u32,
pub output_port: u32,
pub input_node: u32,
pub input_port: u32,
}
2 changes: 1 addition & 1 deletion src/pw/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub use crate::auto::PropertiesItem;
pub use {
self::{
keys::*,
link::LinkTarget,
link::{LinkObjects, LinkTarget},
proxy::{PipewireObjectExt2, ProxyExt2},
},
crate::auto::{
Expand Down

0 comments on commit da46e73

Please sign in to comment.