mirror of
https://gitlab.com/marcandre.lureau/qemu-display.git
synced 2025-01-18 09:45:15 +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)]
|
#[cfg(windows)]
|
||||||
use crate::win32::Fd;
|
use crate::win32::Fd;
|
||||||
|
use std::convert::TryInto;
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use std::os::unix::net::UnixStream;
|
use std::os::unix::net::UnixStream;
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
use uds_windows::UnixStream;
|
use uds_windows::UnixStream;
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use zbus::zvariant::Fd;
|
use zbus::zvariant::Fd;
|
||||||
use zbus::Connection;
|
use zbus::{names::BusName, Connection};
|
||||||
|
|
||||||
use crate::{util, Result};
|
use crate::{util, Error, Result};
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
pub struct PCMInfo {
|
pub struct PCMInfo {
|
||||||
@ -234,8 +235,23 @@ impl<H: AudioInHandler> AudioInListener<H> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Audio {
|
impl Audio {
|
||||||
pub async fn new(conn: &zbus::Connection, #[cfg(windows)] peer_pid: u32) -> Result<Self> {
|
pub async fn new<D>(
|
||||||
let proxy = AudioProxy::new(conn).await?;
|
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 {
|
Ok(Self {
|
||||||
proxy,
|
proxy,
|
||||||
in_listener: None,
|
in_listener: None,
|
||||||
|
@ -216,6 +216,7 @@ impl<'d> Display<'d> {
|
|||||||
Ok(Some(
|
Ok(Some(
|
||||||
Audio::new(
|
Audio::new(
|
||||||
&self.inner.conn,
|
&self.inner.conn,
|
||||||
|
Some(self.inner.proxy.inner().destination().to_owned()),
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
self.peer_pid(),
|
self.peer_pid(),
|
||||||
)
|
)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user