Amend conditional compilation to fail on unsupported systems

This commit is contained in:
Sasha Hilton 2021-02-10 01:44:05 +00:00
parent aad4dba8a8
commit 59f87dcb37
2 changed files with 22 additions and 4 deletions

View file

@ -34,7 +34,16 @@ mod jackaudio;
#[cfg(feature = "jackaudio-backend")] #[cfg(feature = "jackaudio-backend")]
use self::jackaudio::JackSink; use self::jackaudio::JackSink;
#[cfg(feature = "rodiojack-backend")] #[cfg(all(
feature = "rodiojack-backend",
not(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd"))
))]
compile_error!("Rodio JACK backend is currently only supported on linux.");
#[cfg(all(
feature = "rodiojack-backend",
any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd")
))]
use self::rodio::JackRodioSink; use self::rodio::JackRodioSink;
#[cfg(feature = "gstreamer-backend")] #[cfg(feature = "gstreamer-backend")]

View file

@ -12,7 +12,10 @@ pub struct RodioSink {
stream: rodio::OutputStream, stream: rodio::OutputStream,
} }
#[cfg(feature = "rodiojack-backend")] #[cfg(all(
feature = "rodiojack-backend",
any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd")
))]
pub struct JackRodioSink { pub struct JackRodioSink {
jackrodio_sink: rodio::Sink, jackrodio_sink: rodio::Sink,
// We have to keep hold of this object, or the Sink can't play... // We have to keep hold of this object, or the Sink can't play...
@ -117,7 +120,10 @@ impl Open for RodioSink {
} }
} }
#[cfg(feature = "rodiojack-backend")] #[cfg(all(
feature = "rodiojack-backend",
any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd")
))]
impl Open for JackRodioSink { impl Open for JackRodioSink {
fn open(device: Option<String>) -> JackRodioSink { fn open(device: Option<String>) -> JackRodioSink {
let host = cpal::host_from_id( let host = cpal::host_from_id(
@ -173,7 +179,10 @@ impl Sink for RodioSink {
} }
} }
#[cfg(feature = "rodiojack-backend")] #[cfg(all(
feature = "rodiojack-backend",
any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd")
))]
impl Sink for JackRodioSink { impl Sink for JackRodioSink {
fn start(&mut self) -> io::Result<()> { fn start(&mut self) -> io::Result<()> {
// More similar to an "unpause" than "play". Doesn't undo "stop". // More similar to an "unpause" than "play". Doesn't undo "stop".