mirror of
https://gitlab.com/marcandre.lureau/qemu-display.git
synced 2024-12-22 05:35:20 +00:00
qemu-display: take optional destination for proxy
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
This commit is contained in:
parent
948f792593
commit
0df514135c
@ -1,14 +1,15 @@
|
||||
#[cfg(windows)]
|
||||
use crate::win32::Fd;
|
||||
use std::convert::TryInto;
|
||||
#[cfg(unix)]
|
||||
use std::os::unix::net::UnixStream;
|
||||
#[cfg(windows)]
|
||||
use uds_windows::UnixStream;
|
||||
#[cfg(unix)]
|
||||
use zbus::zvariant::Fd;
|
||||
use zbus::Connection;
|
||||
use zbus::{names::BusName, Connection};
|
||||
|
||||
use crate::{util, Result};
|
||||
use crate::{util, Error, Result};
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct PCMInfo {
|
||||
@ -234,8 +235,23 @@ impl<H: AudioInHandler> AudioInListener<H> {
|
||||
}
|
||||
|
||||
impl Audio {
|
||||
pub async fn new(conn: &zbus::Connection, #[cfg(windows)] peer_pid: u32) -> Result<Self> {
|
||||
let proxy = AudioProxy::new(conn).await?;
|
||||
pub async fn new<D>(
|
||||
conn: &zbus::Connection,
|
||||
dest: Option<D>,
|
||||
#[cfg(windows)] peer_pid: u32,
|
||||
) -> Result<Self>
|
||||
where
|
||||
D: TryInto<BusName<'static>>,
|
||||
D::Error: Into<Error>,
|
||||
{
|
||||
let builder = AudioProxy::builder(conn);
|
||||
let builder = if let Some(dest) = dest {
|
||||
let dest = dest.try_into().map_err(Into::into)?;
|
||||
builder.destination(dest)?
|
||||
} else {
|
||||
builder
|
||||
};
|
||||
let proxy = builder.build().await?;
|
||||
Ok(Self {
|
||||
proxy,
|
||||
in_listener: None,
|
||||
|
@ -216,6 +216,7 @@ impl<'d> Display<'d> {
|
||||
Ok(Some(
|
||||
Audio::new(
|
||||
&self.inner.conn,
|
||||
Some(self.inner.proxy.inner().destination().to_owned()),
|
||||
#[cfg(windows)]
|
||||
self.peer_pid(),
|
||||
)
|
||||
|
Loading…
Reference in New Issue
Block a user