Skip to content

Commit

Permalink
add pipe as a backend (#1284)
Browse files Browse the repository at this point in the history
add pipe as a backend, which sends audio to stdout or the file handle
given to --device

Fixes #354
  • Loading branch information
zemar1325 authored Oct 21, 2024
1 parent 94ce64a commit b25538f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,8 @@ env_logger = "0.10"
alsa_backend = ["librespot-playback/alsa-backend", "alsa"]
dbus_keyring = ["keyring"]
dbus_mpris = ["dbus", "dbus-tokio", "dbus-crossroads", "rspotify"]
default = ["alsa_backend"]
pipe_backend = []
default = ["alsa_backend", "pipe_backend"]
portaudio_backend = ["librespot-playback/portaudio-backend"]
pulseaudio_backend = ["librespot-playback/pulseaudio-backend"]
rodio_backend = ["librespot-playback/rodio-backend"]
Expand Down
8 changes: 7 additions & 1 deletion src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ const CONFIG_FILE_NAME: &str = "spotifyd.conf";
feature = "pulseaudio_backend",
feature = "portaudio_backend",
feature = "alsa_backend",
feature = "pipe_backend",
feature = "rodio_backend",
feature = "rodiojack_backend",
)))]
Expand All @@ -38,6 +39,8 @@ static BACKEND_VALUES: &[&str] = &[
"portaudio",
#[cfg(feature = "rodio_backend")]
"rodio",
#[cfg(feature = "pipe_backend")]
"pipe",
#[cfg(feature = "rodiojack_backend")]
"rodiojack",
];
Expand All @@ -50,6 +53,7 @@ pub enum Backend {
PortAudio,
PulseAudio,
Rodio,
Pipe,
RodioJack,
}

Expand All @@ -66,6 +70,7 @@ impl FromStr for Backend {
"portaudio" => Ok(Backend::PortAudio),
"pulseaudio" => Ok(Backend::PulseAudio),
"rodio" => Ok(Backend::Rodio),
"pipe" => Ok(Backend::Pipe),
"rodiojack" => Ok(Backend::RodioJack),
_ => unreachable!(),
}
Expand All @@ -79,6 +84,7 @@ impl fmt::Display for Backend {
Backend::PortAudio => write!(f, "portaudio"),
Backend::PulseAudio => write!(f, "pulseaudio"),
Backend::Rodio => write!(f, "rodio"),
Backend::Pipe => write!(f, "pipe"),
Backend::RodioJack => write!(f, "rodiojack"),
}
}
Expand Down Expand Up @@ -444,7 +450,7 @@ pub struct SharedConfigValues {
#[serde(alias = "volume-control")]
volume_controller: Option<VolumeController>,

/// The audio device
/// The audio device (or file handle if using pipe backend)
#[structopt(long, value_name = "string")]
device: Option<String>,

Expand Down

0 comments on commit b25538f

Please sign in to comment.