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"
|
||||
|
||||
[dependencies]
|
||||
base64 = "0.10"
|
||||
env_logger = {version = "0.6", default-features = false, features = ["termcolor","humantime","atty"]}
|
||||
base64 = "0.13"
|
||||
env_logger = {version = "0.8", default-features = false, features = ["termcolor","humantime","atty"]}
|
||||
futures = "0.1"
|
||||
getopts = "0.2"
|
||||
hyper = "0.11"
|
||||
log = "0.4"
|
||||
num-bigint = "0.2"
|
||||
num-bigint = "0.3"
|
||||
protobuf = "~2.14.0"
|
||||
rand = "0.7"
|
||||
rpassword = "3.0"
|
||||
rpassword = "5.0"
|
||||
tokio-core = "0.1"
|
||||
tokio-io = "0.1"
|
||||
tokio-process = "0.2"
|
||||
tokio-signal = "0.2"
|
||||
url = "1.7"
|
||||
sha-1 = "0.8"
|
||||
hex = "0.3"
|
||||
hex = "0.4"
|
||||
|
||||
[features]
|
||||
alsa-backend = ["librespot-playback/alsa-backend"]
|
||||
|
|
|
@ -17,7 +17,7 @@ bytes = "0.4"
|
|||
futures = "0.1"
|
||||
lewton = "0.9"
|
||||
log = "0.4"
|
||||
num-bigint = "0.2"
|
||||
num-bigint = "0.3"
|
||||
num-traits = "0.2"
|
||||
tempfile = "3.1"
|
||||
aes-ctr = "0.3"
|
||||
|
|
|
@ -18,11 +18,11 @@ path = "../protocol"
|
|||
version = "0.1.3"
|
||||
|
||||
[dependencies]
|
||||
base64 = "0.10"
|
||||
base64 = "0.13"
|
||||
futures = "0.1"
|
||||
hyper = "0.11"
|
||||
log = "0.4"
|
||||
num-bigint = "0.2"
|
||||
num-bigint = "0.3"
|
||||
protobuf = "~2.14.0"
|
||||
rand = "0.7"
|
||||
serde = "1.0"
|
||||
|
|
|
@ -13,7 +13,7 @@ path = "../protocol"
|
|||
version = "0.1.3"
|
||||
|
||||
[dependencies]
|
||||
base64 = "0.10"
|
||||
base64 = "0.13"
|
||||
byteorder = "1.3"
|
||||
bytes = "0.4"
|
||||
error-chain = { version = "0.12", default_features = false }
|
||||
|
@ -23,7 +23,7 @@ hyper = "0.11"
|
|||
hyper-proxy = { version = "0.4", default_features = false }
|
||||
lazy_static = "1.3"
|
||||
log = "0.4"
|
||||
num-bigint = "0.2"
|
||||
num-bigint = "0.3"
|
||||
num-integer = "0.1"
|
||||
num-traits = "0.2"
|
||||
protobuf = "~2.14.0"
|
||||
|
@ -36,7 +36,7 @@ tokio-codec = "0.1"
|
|||
tokio-core = "0.1"
|
||||
tokio-io = "0.1"
|
||||
url = "1.7"
|
||||
uuid = { version = "0.7", features = ["v4"] }
|
||||
uuid = { version = "0.8", features = ["v4"] }
|
||||
sha-1 = "0.8"
|
||||
hmac = "0.7"
|
||||
pbkdf2 = "0.3"
|
||||
|
|
|
@ -21,21 +21,21 @@ version = "0.1.3"
|
|||
futures = "0.1"
|
||||
log = "0.4"
|
||||
byteorder = "1.3"
|
||||
shell-words = "0.1.0"
|
||||
shell-words = "1.0.0"
|
||||
|
||||
alsa = { version = "0.2", optional = true }
|
||||
portaudio-rs = { version = "0.3", optional = true }
|
||||
libpulse-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 }
|
||||
rodio = { version = "0.13", optional = true, default-features = false }
|
||||
cpal = { version = "0.13", optional = true }
|
||||
sdl2 = { version = "0.32", optional = true }
|
||||
gstreamer = { version = "0.15", optional = true }
|
||||
gstreamer-app = { version = "0.15", optional = true }
|
||||
glib = { version = "0.9", optional = true }
|
||||
zerocopy = { version = "0.2", optional = true }
|
||||
sdl2 = { version = "0.34", optional = true }
|
||||
gstreamer = { version = "0.16", optional = true }
|
||||
gstreamer-app = { version = "0.16", optional = true }
|
||||
glib = { version = "0.10", optional = true }
|
||||
zerocopy = { version = "0.3", optional = true }
|
||||
|
||||
[features]
|
||||
alsa-backend = ["alsa"]
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
use super::{Open, Sink};
|
||||
use jack::prelude::{
|
||||
client_options, AsyncClient, AudioOutPort, AudioOutSpec, Client, JackControl, Port,
|
||||
ProcessHandler, ProcessScope,
|
||||
use jack::{
|
||||
AsyncClient, AudioOut, Client, ClientOptions, Control, Port, ProcessHandler, ProcessScope,
|
||||
};
|
||||
use std::io;
|
||||
use std::sync::mpsc::{sync_channel, Receiver, SyncSender};
|
||||
|
@ -13,8 +12,8 @@ pub struct JackSink {
|
|||
|
||||
pub struct JackData {
|
||||
rec: Receiver<i16>,
|
||||
port_l: Port<AudioOutSpec>,
|
||||
port_r: Port<AudioOutSpec>,
|
||||
port_l: Port<AudioOut>,
|
||||
port_r: Port<AudioOut>,
|
||||
}
|
||||
|
||||
fn pcm_to_f32(sample: i16) -> f32 {
|
||||
|
@ -22,10 +21,10 @@ fn pcm_to_f32(sample: i16) -> f32 {
|
|||
}
|
||||
|
||||
impl ProcessHandler for JackData {
|
||||
fn process(&mut self, _: &Client, ps: &ProcessScope) -> JackControl {
|
||||
fn process(&mut self, _: &Client, ps: &ProcessScope) -> Control {
|
||||
// get output port buffers
|
||||
let mut out_r = AudioOutPort::new(&mut self.port_r, ps);
|
||||
let mut out_l = AudioOutPort::new(&mut self.port_l, ps);
|
||||
let mut out_r = self.port_r.as_mut_slice(ps);
|
||||
let mut out_l = self.port_l.as_mut_slice(ps);
|
||||
let buf_r: &mut [f32] = &mut out_r;
|
||||
let buf_l: &mut [f32] = &mut out_l;
|
||||
// get queue iterator
|
||||
|
@ -36,7 +35,7 @@ impl ProcessHandler for JackData {
|
|||
buf_r[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, _status) =
|
||||
Client::new(&client_name[..], client_options::NO_START_SERVER).unwrap();
|
||||
let ch_r = client
|
||||
.register_port("out_0", AudioOutSpec::default())
|
||||
.unwrap();
|
||||
let ch_l = client
|
||||
.register_port("out_1", AudioOutSpec::default())
|
||||
.unwrap();
|
||||
Client::new(&client_name[..], ClientOptions::NO_START_SERVER).unwrap();
|
||||
let ch_r = client.register_port("out_0", AudioOut::default()).unwrap();
|
||||
let ch_l = client.register_port("out_1", AudioOut::default()).unwrap();
|
||||
// buffer for samples from librespot (~10ms)
|
||||
let (tx, rx) = sync_channel(2 * 1024 * 4);
|
||||
let jack_data = JackData {
|
||||
|
|
Loading…
Reference in a new issue