mirror of
https://github.com/librespot-org/librespot.git
synced 2025-10-06 03:50:06 +02:00
Format according to rustfmt
This commit is contained in:
parent
c3745a958a
commit
237ef1e4f9
22 changed files with 502 additions and 360 deletions
|
@ -1,11 +1,11 @@
|
|||
use super::{Open, Sink};
|
||||
use alsa::{Access, Format, Mode, Stream, PCM};
|
||||
use std::io;
|
||||
use alsa::{PCM, Stream, Mode, Format, Access};
|
||||
|
||||
pub struct AlsaSink(Option<PCM>, String);
|
||||
|
||||
impl Open for AlsaSink {
|
||||
fn open(device: Option<String>) -> AlsaSink {
|
||||
fn open(device: Option<String>) -> AlsaSink {
|
||||
info!("Using alsa sink");
|
||||
|
||||
let name = device.unwrap_or("default".to_string());
|
||||
|
@ -17,14 +17,22 @@ impl Open for AlsaSink {
|
|||
impl Sink for AlsaSink {
|
||||
fn start(&mut self) -> io::Result<()> {
|
||||
if self.0.is_none() {
|
||||
match PCM::open(&*self.1,
|
||||
Stream::Playback, Mode::Blocking,
|
||||
Format::Signed16, Access::Interleaved,
|
||||
2, 44100) {
|
||||
match PCM::open(
|
||||
&*self.1,
|
||||
Stream::Playback,
|
||||
Mode::Blocking,
|
||||
Format::Signed16,
|
||||
Access::Interleaved,
|
||||
2,
|
||||
44100,
|
||||
) {
|
||||
Ok(f) => self.0 = Some(f),
|
||||
Err(e) => {
|
||||
error!("Alsa error PCM open {}", e);
|
||||
return Err(io::Error::new(io::ErrorKind::Other, "Alsa error: PCM open failed"));
|
||||
error!("Alsa error PCM open {}", e);
|
||||
return Err(io::Error::new(
|
||||
io::ErrorKind::Other,
|
||||
"Alsa error: PCM open failed",
|
||||
));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue