// Copyright 2025 System76 // SPDX-License-Identifier: MPL-2.0 use pipewire::device::DeviceInfoRef; /// Device information #[must_use] #[derive(Clone, Debug)] pub struct Device { pub id: u32, pub name: String, } impl Device { /// Attains process info from a pipewire info node. #[must_use] pub fn from_device(info: &DeviceInfoRef) -> Option { let props = info.props()?; let device = Device { id: props.get("object.id")?.parse::().ok()?, name: props.get("device.description")?.to_owned(), }; Some(device) } }