mirror of
https://github.com/rustdesk/qemu-display.git
synced 2026-10-26 14:10:31 +00:00
qdl: start an Introspect helper
This commit is contained in:
1 parent
0f653ea6d5
commit
75a0fd7bc7
8 files changed
+101
-34
No files matched your search
@@ -10,13 +10,7 @@ pub struct Handler {
|
||||
}
|
||||
|
||||
impl Handler {
|
||||
pub async fn new(conn: &zbus::azync::Connection) -> Result<Self, Box<dyn Error>> {
|
||||
if !Audio::available(conn).await {
|
||||
log::debug!("No qemu audio provided on the bus");
|
||||
return Ok(Self::default());
|
||||
}
|
||||
|
||||
let audio = Audio::new(conn).await?;
|
||||
pub async fn new(audio: Audio) -> Result<Self, Box<dyn Error>> {
|
||||
let rx = audio.listen_out().await?;
|
||||
let mut gst = rdw::GstAudio::new()?;
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ use gio::ApplicationFlags;
|
||||
use glib::{clone, MainContext};
|
||||
use gtk::{gio, glib, prelude::*};
|
||||
use once_cell::sync::OnceCell;
|
||||
use qemu_display_listener::{Chardev, Console};
|
||||
use qemu_display_listener::{Chardev, Console, Introspect};
|
||||
use std::os::unix::io::AsRawFd;
|
||||
use std::os::unix::net::UnixStream;
|
||||
use zbus::Connection;
|
||||
@@ -33,13 +33,17 @@ fn main() {
|
||||
let audio_clone = audio.clone();
|
||||
let clipboard_clone = clipboard.clone();
|
||||
MainContext::default().spawn_local(clone!(@strong window => async move {
|
||||
let intro = Introspect::new(&conn).await.unwrap();
|
||||
|
||||
let console = Console::new(&conn, 0).await.expect("Failed to get the QEMU console");
|
||||
let display = display_qemu::DisplayQemu::new(console);
|
||||
window.set_child(Some(&display));
|
||||
|
||||
match audio::Handler::new(&conn).await {
|
||||
Ok(handler) => audio_clone.set(handler).unwrap(),
|
||||
Err(e) => log::warn!("Failed to setup audio: {}", e),
|
||||
if let Ok(Some(audio)) = intro.audio().await {
|
||||
match audio::Handler::new(audio).await {
|
||||
Ok(handler) => audio_clone.set(handler).unwrap(),
|
||||
Err(e) => log::warn!("Failed to setup audio: {}", e),
|
||||
}
|
||||
}
|
||||
|
||||
match clipboard::Handler::new(&conn).await {
|
||||
|
||||
Reference in new issue
Block a user