mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
commit
5d5f7846ec
7 changed files with 268 additions and 327 deletions
532
Cargo.lock
generated
532
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
10
Cargo.toml
10
Cargo.toml
|
@ -40,23 +40,23 @@ path = "protocol"
|
||||||
version = "0.1.3"
|
version = "0.1.3"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
base64 = "0.10"
|
base64 = "0.13"
|
||||||
env_logger = {version = "0.6", default-features = false, features = ["termcolor","humantime","atty"]}
|
env_logger = {version = "0.8", default-features = false, features = ["termcolor","humantime","atty"]}
|
||||||
futures = "0.1"
|
futures = "0.1"
|
||||||
getopts = "0.2"
|
getopts = "0.2"
|
||||||
hyper = "0.11"
|
hyper = "0.11"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
num-bigint = "0.2"
|
num-bigint = "0.3"
|
||||||
protobuf = "~2.14.0"
|
protobuf = "~2.14.0"
|
||||||
rand = "0.7"
|
rand = "0.7"
|
||||||
rpassword = "3.0"
|
rpassword = "5.0"
|
||||||
tokio-core = "0.1"
|
tokio-core = "0.1"
|
||||||
tokio-io = "0.1"
|
tokio-io = "0.1"
|
||||||
tokio-process = "0.2"
|
tokio-process = "0.2"
|
||||||
tokio-signal = "0.2"
|
tokio-signal = "0.2"
|
||||||
url = "1.7"
|
url = "1.7"
|
||||||
sha-1 = "0.8"
|
sha-1 = "0.8"
|
||||||
hex = "0.3"
|
hex = "0.4"
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
alsa-backend = ["librespot-playback/alsa-backend"]
|
alsa-backend = ["librespot-playback/alsa-backend"]
|
||||||
|
|
|
@ -17,7 +17,7 @@ bytes = "0.4"
|
||||||
futures = "0.1"
|
futures = "0.1"
|
||||||
lewton = "0.9"
|
lewton = "0.9"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
num-bigint = "0.2"
|
num-bigint = "0.3"
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
tempfile = "3.1"
|
tempfile = "3.1"
|
||||||
aes-ctr = "0.3"
|
aes-ctr = "0.3"
|
||||||
|
|
|
@ -18,11 +18,11 @@ path = "../protocol"
|
||||||
version = "0.1.3"
|
version = "0.1.3"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
base64 = "0.10"
|
base64 = "0.13"
|
||||||
futures = "0.1"
|
futures = "0.1"
|
||||||
hyper = "0.11"
|
hyper = "0.11"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
num-bigint = "0.2"
|
num-bigint = "0.3"
|
||||||
protobuf = "~2.14.0"
|
protobuf = "~2.14.0"
|
||||||
rand = "0.7"
|
rand = "0.7"
|
||||||
serde = "1.0"
|
serde = "1.0"
|
||||||
|
|
|
@ -13,7 +13,7 @@ path = "../protocol"
|
||||||
version = "0.1.3"
|
version = "0.1.3"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
base64 = "0.10"
|
base64 = "0.13"
|
||||||
byteorder = "1.3"
|
byteorder = "1.3"
|
||||||
bytes = "0.4"
|
bytes = "0.4"
|
||||||
error-chain = { version = "0.12", default_features = false }
|
error-chain = { version = "0.12", default_features = false }
|
||||||
|
@ -23,7 +23,7 @@ hyper = "0.11"
|
||||||
hyper-proxy = { version = "0.4", default_features = false }
|
hyper-proxy = { version = "0.4", default_features = false }
|
||||||
lazy_static = "1.3"
|
lazy_static = "1.3"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
num-bigint = "0.2"
|
num-bigint = "0.3"
|
||||||
num-integer = "0.1"
|
num-integer = "0.1"
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
protobuf = "~2.14.0"
|
protobuf = "~2.14.0"
|
||||||
|
@ -36,7 +36,7 @@ tokio-codec = "0.1"
|
||||||
tokio-core = "0.1"
|
tokio-core = "0.1"
|
||||||
tokio-io = "0.1"
|
tokio-io = "0.1"
|
||||||
url = "1.7"
|
url = "1.7"
|
||||||
uuid = { version = "0.7", features = ["v4"] }
|
uuid = { version = "0.8", features = ["v4"] }
|
||||||
sha-1 = "0.8"
|
sha-1 = "0.8"
|
||||||
hmac = "0.7"
|
hmac = "0.7"
|
||||||
pbkdf2 = "0.3"
|
pbkdf2 = "0.3"
|
||||||
|
|
|
@ -21,21 +21,21 @@ version = "0.1.3"
|
||||||
futures = "0.1"
|
futures = "0.1"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
byteorder = "1.3"
|
byteorder = "1.3"
|
||||||
shell-words = "0.1.0"
|
shell-words = "1.0.0"
|
||||||
|
|
||||||
alsa = { version = "0.2", optional = true }
|
alsa = { version = "0.2", optional = true }
|
||||||
portaudio-rs = { version = "0.3", optional = true }
|
portaudio-rs = { version = "0.3", optional = true }
|
||||||
libpulse-binding = { version = "2.13", optional = true, default-features = false }
|
libpulse-binding = { version = "2.13", optional = true, default-features = false }
|
||||||
libpulse-simple-binding = { version = "2.13", optional = true, default-features = false }
|
libpulse-simple-binding = { version = "2.13", optional = true, default-features = false }
|
||||||
jack = { version = "0.5", optional = true }
|
jack = { version = "0.6", optional = true }
|
||||||
libc = { version = "0.2", optional = true }
|
libc = { version = "0.2", optional = true }
|
||||||
rodio = { version = "0.13", optional = true, default-features = false }
|
rodio = { version = "0.13", optional = true, default-features = false }
|
||||||
cpal = { version = "0.13", optional = true }
|
cpal = { version = "0.13", optional = true }
|
||||||
sdl2 = { version = "0.32", optional = true }
|
sdl2 = { version = "0.34", optional = true }
|
||||||
gstreamer = { version = "0.15", optional = true }
|
gstreamer = { version = "0.16", optional = true }
|
||||||
gstreamer-app = { version = "0.15", optional = true }
|
gstreamer-app = { version = "0.16", optional = true }
|
||||||
glib = { version = "0.9", optional = true }
|
glib = { version = "0.10", optional = true }
|
||||||
zerocopy = { version = "0.2", optional = true }
|
zerocopy = { version = "0.3", optional = true }
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
alsa-backend = ["alsa"]
|
alsa-backend = ["alsa"]
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
use super::{Open, Sink};
|
use super::{Open, Sink};
|
||||||
use jack::prelude::{
|
use jack::{
|
||||||
client_options, AsyncClient, AudioOutPort, AudioOutSpec, Client, JackControl, Port,
|
AsyncClient, AudioOut, Client, ClientOptions, Control, Port, ProcessHandler, ProcessScope,
|
||||||
ProcessHandler, ProcessScope,
|
|
||||||
};
|
};
|
||||||
use std::io;
|
use std::io;
|
||||||
use std::sync::mpsc::{sync_channel, Receiver, SyncSender};
|
use std::sync::mpsc::{sync_channel, Receiver, SyncSender};
|
||||||
|
@ -13,8 +12,8 @@ pub struct JackSink {
|
||||||
|
|
||||||
pub struct JackData {
|
pub struct JackData {
|
||||||
rec: Receiver<i16>,
|
rec: Receiver<i16>,
|
||||||
port_l: Port<AudioOutSpec>,
|
port_l: Port<AudioOut>,
|
||||||
port_r: Port<AudioOutSpec>,
|
port_r: Port<AudioOut>,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn pcm_to_f32(sample: i16) -> f32 {
|
fn pcm_to_f32(sample: i16) -> f32 {
|
||||||
|
@ -22,10 +21,10 @@ fn pcm_to_f32(sample: i16) -> f32 {
|
||||||
}
|
}
|
||||||
|
|
||||||
impl ProcessHandler for JackData {
|
impl ProcessHandler for JackData {
|
||||||
fn process(&mut self, _: &Client, ps: &ProcessScope) -> JackControl {
|
fn process(&mut self, _: &Client, ps: &ProcessScope) -> Control {
|
||||||
// get output port buffers
|
// get output port buffers
|
||||||
let mut out_r = AudioOutPort::new(&mut self.port_r, ps);
|
let mut out_r = self.port_r.as_mut_slice(ps);
|
||||||
let mut out_l = AudioOutPort::new(&mut self.port_l, ps);
|
let mut out_l = self.port_l.as_mut_slice(ps);
|
||||||
let buf_r: &mut [f32] = &mut out_r;
|
let buf_r: &mut [f32] = &mut out_r;
|
||||||
let buf_l: &mut [f32] = &mut out_l;
|
let buf_l: &mut [f32] = &mut out_l;
|
||||||
// get queue iterator
|
// get queue iterator
|
||||||
|
@ -36,7 +35,7 @@ impl ProcessHandler for JackData {
|
||||||
buf_r[i] = pcm_to_f32(queue_iter.next().unwrap_or(0));
|
buf_r[i] = pcm_to_f32(queue_iter.next().unwrap_or(0));
|
||||||
buf_l[i] = pcm_to_f32(queue_iter.next().unwrap_or(0));
|
buf_l[i] = pcm_to_f32(queue_iter.next().unwrap_or(0));
|
||||||
}
|
}
|
||||||
JackControl::Continue
|
Control::Continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,13 +45,9 @@ impl Open for JackSink {
|
||||||
|
|
||||||
let client_name = client_name.unwrap_or("librespot".to_string());
|
let client_name = client_name.unwrap_or("librespot".to_string());
|
||||||
let (client, _status) =
|
let (client, _status) =
|
||||||
Client::new(&client_name[..], client_options::NO_START_SERVER).unwrap();
|
Client::new(&client_name[..], ClientOptions::NO_START_SERVER).unwrap();
|
||||||
let ch_r = client
|
let ch_r = client.register_port("out_0", AudioOut::default()).unwrap();
|
||||||
.register_port("out_0", AudioOutSpec::default())
|
let ch_l = client.register_port("out_1", AudioOut::default()).unwrap();
|
||||||
.unwrap();
|
|
||||||
let ch_l = client
|
|
||||||
.register_port("out_1", AudioOutSpec::default())
|
|
||||||
.unwrap();
|
|
||||||
// buffer for samples from librespot (~10ms)
|
// buffer for samples from librespot (~10ms)
|
||||||
let (tx, rx) = sync_channel(2 * 1024 * 4);
|
let (tx, rx) = sync_channel(2 * 1024 * 4);
|
||||||
let jack_data = JackData {
|
let jack_data = JackData {
|
||||||
|
|
Loading…
Reference in a new issue