mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
DRY up constructors
This commit is contained in:
parent
78bc621ebb
commit
928a673653
7 changed files with 7 additions and 7 deletions
|
@ -71,7 +71,7 @@ fn open_device(dev_name: &str, format: AudioFormat) -> Result<(PCM, Frames), Box
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Open for AlsaSink {
|
impl Open for AlsaSink {
|
||||||
fn open(device: Option<String>, format: AudioFormat) -> AlsaSink {
|
fn open(device: Option<String>, format: AudioFormat) -> Self {
|
||||||
info!("Using Alsa sink with format: {:?}", format);
|
info!("Using Alsa sink with format: {:?}", format);
|
||||||
|
|
||||||
let name = match device.as_ref().map(AsRef::as_ref) {
|
let name = match device.as_ref().map(AsRef::as_ref) {
|
||||||
|
|
|
@ -16,7 +16,7 @@ pub struct GstreamerSink {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Open for GstreamerSink {
|
impl Open for GstreamerSink {
|
||||||
fn open(device: Option<String>, format: AudioFormat) -> GstreamerSink {
|
fn open(device: Option<String>, format: AudioFormat) -> Self {
|
||||||
info!("Using GStreamer sink with format: {:?}", format);
|
info!("Using GStreamer sink with format: {:?}", format);
|
||||||
gst::init().expect("failed to init GStreamer!");
|
gst::init().expect("failed to init GStreamer!");
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ impl ProcessHandler for JackData {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Open for JackSink {
|
impl Open for JackSink {
|
||||||
fn open(client_name: Option<String>, format: AudioFormat) -> JackSink {
|
fn open(client_name: Option<String>, format: AudioFormat) -> Self {
|
||||||
if format != AudioFormat::F32 {
|
if format != AudioFormat::F32 {
|
||||||
warn!("JACK currently does not support {:?} output", format);
|
warn!("JACK currently does not support {:?} output", format);
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,7 +10,7 @@ pub struct StdoutSink {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Open for StdoutSink {
|
impl Open for StdoutSink {
|
||||||
fn open(path: Option<String>, format: AudioFormat) -> StdoutSink {
|
fn open(path: Option<String>, format: AudioFormat) -> Self {
|
||||||
info!("Using pipe sink with format: {:?}", format);
|
info!("Using pipe sink with format: {:?}", format);
|
||||||
|
|
||||||
let output: Box<dyn Write> = match path {
|
let output: Box<dyn Write> = match path {
|
||||||
|
|
|
@ -17,7 +17,7 @@ pub struct PulseAudioSink {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Open for PulseAudioSink {
|
impl Open for PulseAudioSink {
|
||||||
fn open(device: Option<String>, format: AudioFormat) -> PulseAudioSink {
|
fn open(device: Option<String>, format: AudioFormat) -> Self {
|
||||||
info!("Using PulseAudio sink with format: {:?}", format);
|
info!("Using PulseAudio sink with format: {:?}", format);
|
||||||
|
|
||||||
// PulseAudio calls S24 and S24_3 different from the rest of the world
|
// PulseAudio calls S24 and S24_3 different from the rest of the world
|
||||||
|
|
|
@ -12,7 +12,7 @@ pub enum SdlSink {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Open for SdlSink {
|
impl Open for SdlSink {
|
||||||
fn open(device: Option<String>, format: AudioFormat) -> SdlSink {
|
fn open(device: Option<String>, format: AudioFormat) -> Self {
|
||||||
info!("Using SDL sink with format: {:?}", format);
|
info!("Using SDL sink with format: {:?}", format);
|
||||||
|
|
||||||
if device.is_some() {
|
if device.is_some() {
|
||||||
|
|
|
@ -12,7 +12,7 @@ pub struct SubprocessSink {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Open for SubprocessSink {
|
impl Open for SubprocessSink {
|
||||||
fn open(shell_command: Option<String>, format: AudioFormat) -> SubprocessSink {
|
fn open(shell_command: Option<String>, format: AudioFormat) -> Self {
|
||||||
info!("Using subprocess sink with format: {:?}", format);
|
info!("Using subprocess sink with format: {:?}", format);
|
||||||
|
|
||||||
if let Some(shell_command) = shell_command {
|
if let Some(shell_command) = shell_command {
|
||||||
|
|
Loading…
Reference in a new issue