dev-2025-08-18T13:06:13+02:00
This commit is contained in:
parent
c9b07c92dc
commit
4bc439feaf
@ -6,6 +6,7 @@ edition = "2021"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
gettext-rs = { version = "0.7", features = ["gettext-system"] }
|
gettext-rs = { version = "0.7", features = ["gettext-system"] }
|
||||||
gtk = { version = "0.9", package = "gtk4", features = ["gnome_47"] }
|
gtk = { version = "0.9", package = "gtk4", features = ["gnome_47"] }
|
||||||
|
pipewire = "0.8.0"
|
||||||
|
|
||||||
[dependencies.adw]
|
[dependencies.adw]
|
||||||
package = "libadwaita"
|
package = "libadwaita"
|
||||||
|
@ -1,10 +1,11 @@
|
|||||||
{
|
{
|
||||||
"id" : "de.AdaLouBaumann.AudioDeviceManager",
|
"id" : "de.AdaLouBaumann.AudioDeviceManager",
|
||||||
"runtime" : "org.gnome.Platform",
|
"runtime" : "org.gnome.Platform",
|
||||||
"runtime-version" : "master",
|
"runtime-version" : "22.08",
|
||||||
"sdk" : "org.gnome.Sdk",
|
"sdk" : "org.gnome.Sdk",
|
||||||
"sdk-extensions" : [
|
"sdk-extensions" : [
|
||||||
"org.freedesktop.Sdk.Extension.rust-stable"
|
"org.freedesktop.Sdk.Extension.rust-stable",
|
||||||
|
"org.freedesktop.Sdk.Extension.llvm14"
|
||||||
],
|
],
|
||||||
"command" : "audio-device-manager",
|
"command" : "audio-device-manager",
|
||||||
"finish-args" : [
|
"finish-args" : [
|
||||||
@ -21,7 +22,8 @@
|
|||||||
],
|
],
|
||||||
"env" : {
|
"env" : {
|
||||||
"RUST_BACKTRACE" : "1",
|
"RUST_BACKTRACE" : "1",
|
||||||
"RUST_LOG" : "audio-device-manager=debug"
|
"RUST_LOG" : "audio-device-manager=debug",
|
||||||
|
"INCLUDE" : "/lib/clang/14.0.6/include"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"cleanup" : [
|
"cleanup" : [
|
||||||
|
@ -23,6 +23,7 @@ mod application;
|
|||||||
mod config;
|
mod config;
|
||||||
mod window;
|
mod window;
|
||||||
mod components;
|
mod components;
|
||||||
|
mod pipewire;
|
||||||
|
|
||||||
use self::application::AudioDeviceManagerApplication;
|
use self::application::AudioDeviceManagerApplication;
|
||||||
use self::window::AudioDeviceManagerWindow;
|
use self::window::AudioDeviceManagerWindow;
|
||||||
|
57
src/pipewire.rs
Normal file
57
src/pipewire.rs
Normal file
@ -0,0 +1,57 @@
|
|||||||
|
use std::thread;
|
||||||
|
use std::thread::JoinHandle;
|
||||||
|
use gtk::glib::ExitCode;
|
||||||
|
use pipewire::{context::Context, main_loop::MainLoop};
|
||||||
|
use pipewire::types::ObjectType;
|
||||||
|
|
||||||
|
pub fn spawn_pipewire_thread() -> JoinHandle<ExitCode> {
|
||||||
|
let pw_thread = thread::spawn(|| {
|
||||||
|
// Initialize PipeWire and run the main loop
|
||||||
|
// ...
|
||||||
|
let mainloop = MainLoop::new(None).expect("failed to get mail loop");
|
||||||
|
let context = Context::new(&mainloop).expect("failed to get context");
|
||||||
|
let core = context.connect(None).expect("failed to get core");
|
||||||
|
let registry = core.get_registry().expect("failed to get registry");
|
||||||
|
|
||||||
|
let _listener = registry
|
||||||
|
.add_listener_local()
|
||||||
|
.global(|global|
|
||||||
|
{
|
||||||
|
if global.type_ == ObjectType::Port {
|
||||||
|
let props = global.props.as_ref().unwrap();
|
||||||
|
let port_name = props.get("port.name");
|
||||||
|
let port_alias = props.get("port.alias");
|
||||||
|
let object_path = props.get("object.path");
|
||||||
|
let format_dsp = props.get("format.dsp");
|
||||||
|
let audio_channel = props.get("audio.channel");
|
||||||
|
let port_id = props.get("port.id");
|
||||||
|
let port_direction = props.get("port.direction");
|
||||||
|
println!("Port: Name: {:?} Alias: {:?} Id: {:?} Direction: {:?} AudioChannel: {:?} Object Path: {:?} FormatDsp: {:?}",
|
||||||
|
port_name,
|
||||||
|
port_alias,
|
||||||
|
port_id,port_direction,audio_channel,object_path,format_dsp
|
||||||
|
);
|
||||||
|
} else if global.type_ == ObjectType::Device {
|
||||||
|
let props = global.props.as_ref().unwrap();
|
||||||
|
let device_name = props.get("device.name");
|
||||||
|
let device_nick = props.get("device.nick");
|
||||||
|
let device_description = props.get("device.description");
|
||||||
|
let device_api = props.get("device.api");
|
||||||
|
let media_class = props.get("media.class");
|
||||||
|
println!("Device: Name: {:?} Nick: {:?} Desc: {:?} Api: {:?} MediaClass: {:?}",
|
||||||
|
device_name, device_nick, device_description, device_api, media_class);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.register();
|
||||||
|
|
||||||
|
// Calling the `destroy_global` method on the registry will destroy the object with the specified id on the remote.
|
||||||
|
// We don't have a specific object to destroy now, so this is commented out.
|
||||||
|
// registry.destroy_global(313).into_result()?;
|
||||||
|
|
||||||
|
|
||||||
|
mainloop.run();
|
||||||
|
return ExitCode::FAILURE; // not sure
|
||||||
|
});
|
||||||
|
return pw_thread;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user