From 52438b1cc2ee48c2e3571eba3f158285bd53d170 Mon Sep 17 00:00:00 2001 From: Lcchy <52164716+Lcchy@users.noreply.github.com> Date: Fri, 5 Feb 2021 13:59:21 +0100 Subject: [PATCH 01/35] Use rodio for jackaudio backend --- .travis.yml | 3 +- COMPILING.md | 1 + Cargo.lock | 826 ++++++++++++++++------------ Cargo.toml | 1 + README.md | 1 + playback/Cargo.toml | 1 + playback/src/audio_backend/mod.rs | 11 +- playback/src/audio_backend/rodio.rs | 108 +++- 8 files changed, 592 insertions(+), 360 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6887d9f85..4de5ac673 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,6 +1,6 @@ language: rust rust: - - 1.40.0 + - 1.42.0 - stable - beta - nightly @@ -58,6 +58,7 @@ script: - cargo build --locked --no-default-features --features "portaudio-backend" - cargo build --locked --no-default-features --features "pulseaudio-backend" - cargo build --locked --no-default-features --features "jackaudio-backend" + - cargo build --locked --no-default-features --features "rodiojack-backend" - cargo build --locked --no-default-features --features "rodio-backend" - cargo build --locked --no-default-features --features "sdl-backend" - cargo build --locked --no-default-features --features "gstreamer-backend" diff --git a/COMPILING.md b/COMPILING.md index 7b3467eea..40eefb395 100644 --- a/COMPILING.md +++ b/COMPILING.md @@ -46,6 +46,7 @@ Depending on the chosen backend, specific development libraries are required. |PortAudio | `portaudio19-dev` | `portaudio-devel` | `portaudio` | |PulseAudio | `libpulse-dev` | `pulseaudio-libs-devel` | | |JACK | `libjack-dev` | `jack-audio-connection-kit-devel` | | +|JACK over Rodio | `libjack-dev` | `jack-audio-connection-kit-devel` | - | |SDL | `libsdl2-dev` | `SDL2-devel` | | |Pipe | - | - | - | diff --git a/Cargo.lock b/Cargo.lock index e325f2605..68c3440a0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,9 +2,9 @@ # It is not intended for manual editing. [[package]] name = "addr2line" -version = "0.14.0" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c0929d69e78dd9bf5408269919fcbcaeb2e35e5d43e5815517cdc6a8e11a423" +checksum = "a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7" dependencies = [ "gimli", ] @@ -80,9 +80,9 @@ dependencies = [ [[package]] name = "alsa-sys" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5a0559bcd3f7a482690d98be41c08a43e92f669b179433e95ddf5e8b8fd36a3" +checksum = "db8fee663d06c4e303404ef5f40488a53e062f89ba8bfed81f42325aafad1527" dependencies = [ "libc", "pkg-config", @@ -90,15 +90,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.35" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c0df63cb2955042487fad3aefd2c6e3ae7389ac5dc1beb28921de0b69f779d4" - -[[package]] -name = "arc-swap" -version = "0.4.7" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" +checksum = "afddf7f520a80dbf76e6f50a35bca42a2331ef227a28b3b6dc5c2e2338d114b1" [[package]] name = "ascii" @@ -119,15 +113,15 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" +checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" [[package]] name = "backtrace" -version = "0.3.55" +version = "0.3.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef5140344c85b01f9bbb4d4b7288a8aa4b3287ccef913a14bcc78a1063623598" +checksum = "9d117600f438b1707d4e4ae15d3595657288f8235a0eb593e80ecc98ab34e1bc" dependencies = [ "addr2line", "cfg-if 1.0.0", @@ -138,30 +132,21 @@ dependencies = [ ] [[package]] -name = "base64" -version = "0.9.3" +name = "base-x" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" -dependencies = [ - "byteorder", - "safemem", -] +checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" [[package]] name = "base64" -version = "0.10.1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" +checksum = "489d6c0ed21b11d038c31b6ceccca973e65d73ba3bd8ecb9a2babf5546164643" dependencies = [ "byteorder", + "safemem", ] -[[package]] -name = "base64" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" - [[package]] name = "base64" version = "0.13.0" @@ -170,13 +155,12 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "bindgen" -version = "0.53.3" +version = "0.56.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c72a978d268b1d70b0e963217e60fdabd9523a941457a6c42a7315d15c7e89e5" +checksum = "2da379dbebc0b76ef63ca68d8fc6e71c0f13e59432e0987e508c1820e6ab5239" dependencies = [ "bitflags", "cexpr", - "cfg-if 0.1.10", "clang-sys", "lazy_static", "lazycell", @@ -199,9 +183,9 @@ dependencies = [ [[package]] name = "bit-vec" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f0dc55f2d8a1a85650ac47858bb001b4c0dd73d79e3c455a842925e68d29cd3" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" [[package]] name = "bitflags" @@ -251,9 +235,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.4.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" +checksum = "099e596ef14349721d9016f6b80dd3419ea1bf289ab9b44df8e4dfd3a005d5d9" [[package]] name = "byte-tools" @@ -263,9 +247,9 @@ checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" [[package]] name = "byteorder" -version = "1.3.4" +version = "1.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" +checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b" [[package]] name = "bytes" @@ -279,15 +263,15 @@ dependencies = [ [[package]] name = "bytes" -version = "0.5.6" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" +checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" [[package]] name = "cc" -version = "1.0.65" +version = "1.0.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95752358c8f7552394baf48cd82695b345628ad3f170d607de3ca03b8dacca15" +checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48" [[package]] name = "cesu8" @@ -318,30 +302,32 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.13" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c74d84029116787153e02106bf53e66828452a4b325cc8652b788b5967c0a0b6" +checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" dependencies = [ + "libc", "num-integer", "num-traits", - "time", + "time 0.1.43", + "winapi 0.3.9", ] [[package]] name = "chunked_transfer" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7477065d45a8fe57167bf3cf8bcd3729b54cfcb81cca49bda2d038ea89ae82ca" +checksum = "fff857943da45f546682664a79488be82e69e43c1a7a2307679ab9afb3a66d2e" [[package]] name = "clang-sys" -version = "0.29.3" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe6837df1d5cba2397b835c8530f51723267e16abbf83892e9e5af4f0e5dd10a" +checksum = "0659001ab56b791be01d4b729c44376edc6718cf389a502e579b77b758f3296c" dependencies = [ "glob", "libc", - "libloading 0.5.2", + "libloading", ] [[package]] @@ -353,15 +339,6 @@ dependencies = [ "bitflags", ] -[[package]] -name = "cloudabi" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" -dependencies = [ - "bitflags", -] - [[package]] name = "combine" version = "3.8.1" @@ -377,23 +354,45 @@ dependencies = [ [[package]] name = "combine" -version = "4.4.0" +version = "4.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9417a0c314565e2abffaece67e95a8cb51f9238cd39f3764d9dfdf09e72b20c" +checksum = "cc4369b5e4c0cddf64ad8981c0111e7df4f7078f4d6ba98fb31f2e17c4c57b7e" dependencies = [ - "bytes 0.5.6", + "bytes 1.0.1", "memchr", - "pin-project-lite", ] +[[package]] +name = "const_fn" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28b9d6de7f49e22cf97ad17fc4036ece69300032f45f78f30b4a4482cdc3f4a6" + [[package]] name = "cookie" +version = "0.14.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "784ad0fbab4f3e9cef09f20e0aea6000ae08d2cb98ac4c0abc53df18803d702f" +dependencies = [ + "percent-encoding 2.1.0", + "time 0.2.25", + "version_check", +] + +[[package]] +name = "cookie_store" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "888604f00b3db336d2af898ec3c1d5d0ddf5e6d462220f2ededc33a87ac4bbd5" +checksum = "3818dfca4b0cb5211a659bbcbb94225b7127407b2b135e650d717bfb78ab10d3" dependencies = [ - "time", - "url 1.7.2", + "cookie", + "idna 0.2.1", + "log 0.4.14", + "publicsuffix", + "serde", + "serde_json", + "time 0.2.25", + "url 2.2.0", ] [[package]] @@ -414,9 +413,9 @@ dependencies = [ [[package]] name = "coreaudio-sys" -version = "0.2.5" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6570ee6e089131e928d5ec9236db9e818aa3cf850f48b0eec6ef700571271d4" +checksum = "2b7e3347be6a09b46aba228d6608386739fb70beff4f61e07422da87b0bb31fa" dependencies = [ "bindgen", ] @@ -430,6 +429,7 @@ dependencies = [ "alsa", "core-foundation-sys", "coreaudio-rs", + "jack", "jni 0.17.0", "js-sys", "lazy_static", @@ -440,7 +440,7 @@ dependencies = [ "nix", "oboe", "parking_lot 0.11.1", - "stdweb", + "stdweb 0.1.3", "thiserror", "web-sys", "winapi 0.3.9", @@ -579,9 +579,9 @@ dependencies = [ [[package]] name = "derivative" -version = "2.1.1" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb582b60359da160a9477ee80f15c8d784c477e69c217ef2cdd4169c24ea380f" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" dependencies = [ "proc-macro2", "quote", @@ -597,6 +597,12 @@ dependencies = [ "generic-array", ] +[[package]] +name = "discard" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" + [[package]] name = "dns-sd" version = "0.1.3" @@ -621,15 +627,15 @@ checksum = "f26ecb66b4bdca6c1409b40fb255eefc2bd4f6d135dab3c3124f80ffa2a9661e" dependencies = [ "atty", "humantime", - "log 0.4.11", + "log 0.4.14", "termcolor", ] [[package]] name = "error-chain" -version = "0.12.2" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d371106cc88ffdfb1eabd7111e432da544f16f3e2d7bf1dfe8bf575f1df045cd" +checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" dependencies = [ "backtrace", "version_check", @@ -643,9 +649,9 @@ checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "fetch_unroll" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5c55005e95bbe15f5f72a73b6597d0dc82ddc97ffe2ca097a99dcd591fefbca" +checksum = "c8d44807d562d137f063cbfe209da1c3f9f2fa8375e11166ef495daab7b847f9" dependencies = [ "libflate", "tar", @@ -654,13 +660,13 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.13" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c122a393ea57648015bf06fbd3d372378992e86b9ff5a7a497b076a28c79efe" +checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall", + "redox_syscall 0.2.4", "winapi 0.3.9", ] @@ -704,24 +710,24 @@ checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" [[package]] name = "futures" -version = "0.1.29" +version = "0.1.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef" +checksum = "4c7e4c2612746b0df8fed4ce0c69156021b704c9aefa360311c04e6e9e002eed" [[package]] name = "futures-channel" -version = "0.3.5" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5" +checksum = "f2d31b7ec7efab6eefc7c57233bb10b847986139d88cc2f5a02a1ae6871a1846" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.5" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399" +checksum = "79e5145dde8da7d1b3892dad07a9c98fc04bc39892b1ecc9692cf53e2b780a65" [[package]] name = "futures-cpupool" @@ -735,9 +741,9 @@ dependencies = [ [[package]] name = "futures-executor" -version = "0.3.5" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10d6bb888be1153d3abeb9006b11b02cf5e9b209fda28693c31ae1e4e012e314" +checksum = "e9e59fdc009a4b3096bf94f740a0f2424c082521f20a9b08c5c07c48d90fd9b9" dependencies = [ "futures-core", "futures-task", @@ -746,9 +752,9 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.5" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39" +checksum = "c287d25add322d9f9abdcdc5927ca398917996600182178774032e9f8258fedd" dependencies = [ "proc-macro-hack", "proc-macro2", @@ -758,29 +764,29 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.5" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc" +checksum = "caf5c69029bda2e743fddd0582d1083951d65cc9539aebf8812f36c3491342d6" [[package]] name = "futures-task" -version = "0.3.5" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626" +checksum = "13de07eb8ea81ae445aca7b69f5f7bf15d7bf4912d8ca37d6645c77ae8a58d86" dependencies = [ "once_cell", ] [[package]] name = "futures-util" -version = "0.3.5" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" +checksum = "632a8cd0f2a4b3fdea1657f08bde063848c3bd00f9bbf6e256b8be78802e624b" dependencies = [ "futures-core", "futures-macro", "futures-task", - "pin-project", + "pin-project-lite", "pin-utils", "proc-macro-hack", "proc-macro-nested", @@ -813,13 +819,24 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.1.14" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" +checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "libc", - "wasi", + "wasi 0.9.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" +dependencies = [ + "cfg-if 1.0.0", + "libc", + "wasi 0.10.2+wasi-snapshot-preview1", ] [[package]] @@ -990,18 +1007,18 @@ dependencies = [ [[package]] name = "heck" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" +checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac" dependencies = [ "unicode-segmentation", ] [[package]] name = "hermit-abi" -version = "0.1.15" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9" +checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" dependencies = [ "libc", ] @@ -1035,15 +1052,15 @@ dependencies = [ [[package]] name = "httparse" -version = "1.3.4" +version = "1.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" +checksum = "615caabe2c3160b313d52ccc905335f4ed5f10881dd63dc5699d47e90be85691" [[package]] name = "humantime" -version = "2.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c1ad908cc71012b7bea4d0c53ba96a8cba9962f048fa68d143376143d863b7a" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" @@ -1058,12 +1075,12 @@ dependencies = [ "httparse", "iovec", "language-tags", - "log 0.4.11", + "log 0.4.14", "mime", "net2", "percent-encoding 1.0.1", "relay", - "time", + "time 0.1.43", "tokio-core", "tokio-io", "tokio-proto", @@ -1104,9 +1121,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" +checksum = "de910d521f7cc3135c4de8db1cb910e0b5ed1dc6f57c381cd07e8e661ce10094" dependencies = [ "matches", "unicode-bidi", @@ -1115,9 +1132,9 @@ dependencies = [ [[package]] name = "if-addrs" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f12906406f12abf5569643c46b29aec78313dc1537b17dd5c5250169790c4db9" +checksum = "28538916eb3f3976311f5dfbe67b5362d0add1293d0a9cad17debf86f8e3aa48" dependencies = [ "if-addrs-sys", "libc", @@ -1126,9 +1143,9 @@ dependencies = [ [[package]] name = "if-addrs-sys" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e2556f16544202bcfe0aa5d20a01a6b815f736b136b3ad76dc547ee6b5bb1df" +checksum = "de74b9dd780476e837e5eb5ab7c88b49ed304126e412030a0adba99c8efe79ea" dependencies = [ "cc", "libc", @@ -1163,9 +1180,9 @@ dependencies = [ [[package]] name = "itoa" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" +checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" [[package]] name = "jack" @@ -1181,13 +1198,13 @@ dependencies = [ [[package]] name = "jack-sys" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0d4ca501477fd3cd93a36df581046e5d6338ed826cf7e9b8d302603521e6cc3" +checksum = "8e1d6ab7ada402b6a27912a2b86504be62a48c58313c886fe72a059127acb4d7" dependencies = [ "lazy_static", "libc", - "libloading 0.4.3", + "libloading", ] [[package]] @@ -1200,7 +1217,7 @@ dependencies = [ "combine 3.8.1", "error-chain", "jni-sys", - "log 0.4.11", + "log 0.4.14", "walkdir", ] @@ -1211,10 +1228,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36bcc950632e48b86da402c5c077590583da5ac0d480103611d5374e7c967a3c" dependencies = [ "cesu8", - "combine 4.4.0", + "combine 4.5.2", "error-chain", "jni-sys", - "log 0.4.11", + "log 0.4.14", "walkdir", ] @@ -1226,9 +1243,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "js-sys" -version = "0.3.46" +version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf3d7383929f7c9c7c2d0fa596f325832df98c3704f2c60553080f7127a58175" +checksum = "5cfb73131c35423a367daf8cbd24100af0d077668c8c2943f0e7dd775fef0f65" dependencies = [ "wasm-bindgen", ] @@ -1257,9 +1274,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "lazycell" -version = "1.2.1" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" +checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "lewton" @@ -1269,45 +1286,40 @@ checksum = "777b48df9aaab155475a83a7df3070395ea1ac6902f5cd062b8f2b028075c030" dependencies = [ "byteorder", "ogg", - "tinyvec 1.1.1", + "tinyvec", ] [[package]] name = "libc" -version = "0.2.73" +version = "0.2.85" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd7d4bd64732af4bf3a67f367c27df8520ad7e230c5817b8ff485864d80242b9" +checksum = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" [[package]] name = "libflate" -version = "0.1.27" +version = "1.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9135df43b1f5d0e333385cb6e7897ecd1a43d7d11b91ac003f4d2c2d2401fdd" +checksum = "389de7875e06476365974da3e7ff85d55f1972188ccd9f6020dd7c8156e17914" dependencies = [ "adler32", "crc32fast", + "libflate_lz77", "rle-decode-fast", - "take_mut", ] [[package]] -name = "libloading" -version = "0.4.3" +name = "libflate_lz77" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd38073de8f7965d0c17d30546d4bb6da311ab428d1c7a3fc71dff7f9d4979b9" -dependencies = [ - "kernel32-sys", - "lazy_static", - "winapi 0.2.8", -] +checksum = "3286f09f7d4926fc486334f28d8d2e6ebe4f7f9994494b6dab27ddfad2c9b11b" [[package]] name = "libloading" -version = "0.5.2" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" +checksum = "351a32417a12d5f7e82c368a66781e307834dae04c6ce0cd4456d52989229883" dependencies = [ - "cc", + "cfg-if 1.0.0", "winapi 0.3.9", ] @@ -1321,7 +1333,7 @@ dependencies = [ "futures", "hostname", "if-addrs", - "log 0.4.11", + "log 0.4.14", "multimap", "net2", "quick-error", @@ -1331,10 +1343,11 @@ dependencies = [ [[package]] name = "libpulse-binding" -version = "2.19.0" +version = "2.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e8f85a42300c868de4849bb72eda5a65cea08c3ca61396b72c2d7c28a87f055" +checksum = "b2405f806801527dfb3d2b6d48a282cdebe9a1b41b0652e0d7b5bad81dbc700e" dependencies = [ + "bitflags", "libc", "libpulse-sys", "num-derive", @@ -1344,9 +1357,9 @@ dependencies = [ [[package]] name = "libpulse-simple-binding" -version = "2.18.1" +version = "2.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a047f4502997eed57b3e9d8e71f2b860da91a20bb7e15c65d1f183a7b4fb1226" +checksum = "a574975292db859087c3957b9182f7d53278553f06bddaa2099c90e4ac3a0ee0" dependencies = [ "libpulse-binding", "libpulse-simple-sys", @@ -1355,9 +1368,9 @@ dependencies = [ [[package]] name = "libpulse-simple-sys" -version = "1.15.1" +version = "1.16.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b72cb239bc4de6858fa0bbad27419e72cd4466f079ca56f21d94b0a712ab02e" +checksum = "468cf582b7b022c0d1b266fefc7fc8fa7b1ddcb61214224f2f105c95a9c2d5c1" dependencies = [ "libpulse-sys", "pkg-config", @@ -1365,9 +1378,9 @@ dependencies = [ [[package]] name = "libpulse-sys" -version = "1.15.3" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "706e95c4b87ebb81c1e7763c74bf7d5ba897208f1a8aa5fc7bea8298dee8f2ca" +checksum = "cf17e9832643c4f320c42b7d78b2c0510f45aa5e823af094413b94e45076ba82" dependencies = [ "libc", "num-derive", @@ -1392,7 +1405,7 @@ dependencies = [ "librespot-metadata", "librespot-playback", "librespot-protocol", - "log 0.4.11", + "log 0.4.14", "num-bigint", "protobuf", "rand 0.7.3", @@ -1417,7 +1430,7 @@ dependencies = [ "lewton", "librespot-core", "librespot-tremor", - "log 0.4.11", + "log 0.4.14", "num-bigint", "num-traits", "tempfile", @@ -1439,7 +1452,7 @@ dependencies = [ "librespot-core", "librespot-playback", "librespot-protocol", - "log 0.4.11", + "log 0.4.14", "num-bigint", "protobuf", "rand 0.7.3", @@ -1467,7 +1480,7 @@ dependencies = [ "hyper-proxy", "lazy_static", "librespot-protocol", - "log 0.4.11", + "log 0.4.14", "num-bigint", "num-integer", "num-traits", @@ -1496,7 +1509,7 @@ dependencies = [ "librespot-core", "librespot-protocol", "linear-map", - "log 0.4.11", + "log 0.4.14", "protobuf", ] @@ -1518,7 +1531,7 @@ dependencies = [ "librespot-audio", "librespot-core", "librespot-metadata", - "log 0.4.11", + "log 0.4.14", "portaudio-rs", "rodio", "sdl2", @@ -1578,16 +1591,16 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" dependencies = [ - "log 0.4.11", + "log 0.4.14", ] [[package]] name = "log" -version = "0.4.11" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" +checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", ] [[package]] @@ -1619,15 +1632,15 @@ checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "memchr" -version = "2.3.3" +version = "2.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" +checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" [[package]] name = "memoffset" -version = "0.5.5" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c198b026e1bbf08a937e94c6c60f9ec4a2267f5b0d2eec9c1b21b061ce2be55f" +checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" dependencies = [ "autocfg", ] @@ -1650,9 +1663,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.6.22" +version = "0.6.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" +checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" dependencies = [ "cfg-if 0.1.10", "fuchsia-zircon", @@ -1660,8 +1673,8 @@ dependencies = [ "iovec", "kernel32-sys", "libc", - "log 0.4.11", - "miow 0.2.1", + "log 0.4.14", + "miow 0.2.2", "net2", "slab 0.4.2", "winapi 0.2.8", @@ -1673,9 +1686,9 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" dependencies = [ - "log 0.4.11", + "log 0.4.14", "mio", - "miow 0.3.5", + "miow 0.3.6", "winapi 0.3.9", ] @@ -1692,9 +1705,9 @@ dependencies = [ [[package]] name = "miow" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" +checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" dependencies = [ "kernel32-sys", "net2", @@ -1704,9 +1717,9 @@ dependencies = [ [[package]] name = "miow" -version = "0.3.5" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e" +checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897" dependencies = [ "socket2", "winapi 0.3.9", @@ -1720,9 +1733,9 @@ checksum = "0419348c027fa7be448d2ae7ea0e4e04c2334c31dc4e74ab29f00a2a7ca69204" [[package]] name = "multimap" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8883adfde9756c1d30b0f519c9b8c502a94b41ac62f696453c37c7fc0a958ce" +checksum = "1255076139a83bb467426e7f8d0134968a8118844faa755985e077cf31850333" dependencies = [ "serde", ] @@ -1747,7 +1760,7 @@ checksum = "bdf399b8b7a39c6fb153c4ec32c72fd5fe789df24a647f229c239aa7adb15241" dependencies = [ "lazy_static", "libc", - "log 0.4.11", + "log 0.4.14", "ndk", "ndk-macro", "ndk-sys", @@ -1774,9 +1787,9 @@ checksum = "c44922cb3dbb1c70b5e5f443d63b64363a898564d739ba5198e3a9138442868d" [[package]] name = "net2" -version = "0.2.34" +version = "0.2.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" +checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" dependencies = [ "cfg-if 0.1.10", "libc", @@ -1830,9 +1843,9 @@ dependencies = [ [[package]] name = "num-integer" -version = "0.1.43" +version = "0.1.44" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" +checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" dependencies = [ "autocfg", "num-traits", @@ -1851,9 +1864,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.12" +version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" +checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" dependencies = [ "autocfg", ] @@ -1892,9 +1905,9 @@ dependencies = [ [[package]] name = "object" -version = "0.22.0" +version = "0.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8d3b63360ec3cb337817c2dbd47ab4a0f170d285d8e5a2064600f3def1402397" +checksum = "a9a7ab5d64814df0fe4a4b5ead45ed6c5f181ee3ff04ba344313a6c80446c5d4" [[package]] name = "oboe" @@ -1970,7 +1983,7 @@ checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" dependencies = [ "instant", "lock_api 0.4.2", - "parking_lot_core 0.8.0", + "parking_lot_core 0.8.2", ] [[package]] @@ -1980,26 +1993,25 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" dependencies = [ "cfg-if 0.1.10", - "cloudabi 0.0.3", + "cloudabi", "libc", - "redox_syscall", + "redox_syscall 0.1.57", "rustc_version", - "smallvec 0.6.13", + "smallvec 0.6.14", "winapi 0.3.9", ] [[package]] name = "parking_lot_core" -version = "0.8.0" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" +checksum = "9ccb628cad4f84851442432c60ad8e1f607e29752d0bf072cbd0baf28aa34272" dependencies = [ - "cfg-if 0.1.10", - "cloudabi 0.1.0", + "cfg-if 1.0.0", "instant", "libc", - "redox_syscall", - "smallvec 1.5.0", + "redox_syscall 0.1.57", + "smallvec 1.6.1", "winapi 0.3.9", ] @@ -2042,31 +2054,11 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" -[[package]] -name = "pin-project" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12e3a6cdbfe94a5e4572812a0201f8c0ed98c1c452c7b8563ce2276988ef9c17" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "0.4.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a0ffd45cf79d88737d7cc85bfd5d2894bee1139b356e616fe85dc389c61aaf7" -dependencies = [ - "proc-macro2", - "quote", - "syn", -] - [[package]] name = "pin-project-lite" -version = "0.1.11" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c917123afa01924fc84bb20c4c03f004d9c38e5127e3c039bbf7f4b9c76a2f6b" +checksum = "439697af366c49a6d0a010c56a0d97685bc140ce0d377b13a2ea2aa42d64a827" [[package]] name = "pin-utils" @@ -2076,9 +2068,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33" +checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" [[package]] name = "portaudio-rs" @@ -2103,9 +2095,9 @@ dependencies = [ [[package]] name = "ppv-lite86" -version = "0.2.8" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea" +checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" [[package]] name = "pretty-hex" @@ -2148,21 +2140,21 @@ dependencies = [ [[package]] name = "proc-macro-hack" -version = "0.5.16" +version = "0.5.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4" +checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro-nested" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" +checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" [[package]] name = "proc-macro2" -version = "1.0.19" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12" +checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" dependencies = [ "unicode-xid", ] @@ -2192,6 +2184,19 @@ dependencies = [ "protobuf-codegen", ] +[[package]] +name = "publicsuffix" +version = "1.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bbaa49075179162b49acac1c6aa45fb4dafb5f13cf6794276d77bc7fd95757b" +dependencies = [ + "error-chain", + "idna 0.2.1", + "lazy_static", + "regex", + "url 2.2.0", +] + [[package]] name = "qstring" version = "0.7.2" @@ -2209,9 +2214,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" +checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" dependencies = [ "proc-macro2", ] @@ -2245,7 +2250,7 @@ version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" dependencies = [ - "cloudabi 0.0.3", + "cloudabi", "fuchsia-cprng", "libc", "rand_core 0.3.1", @@ -2258,11 +2263,23 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom", + "getrandom 0.1.16", "libc", - "rand_chacha", + "rand_chacha 0.2.2", "rand_core 0.5.1", - "rand_hc", + "rand_hc 0.2.0", +] + +[[package]] +name = "rand" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" +dependencies = [ + "libc", + "rand_chacha 0.3.0", + "rand_core 0.6.1", + "rand_hc 0.3.0", ] [[package]] @@ -2275,6 +2292,16 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rand_chacha" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.1", +] + [[package]] name = "rand_core" version = "0.3.1" @@ -2296,7 +2323,16 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom", + "getrandom 0.1.16", +] + +[[package]] +name = "rand_core" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c026d7df8b298d90ccbbc5190bd04d85e159eaf5576caeacf8741da93ccbd2e5" +dependencies = [ + "getrandom 0.2.2", ] [[package]] @@ -2308,6 +2344,15 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rand_hc" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" +dependencies = [ + "rand_core 0.6.1", +] + [[package]] name = "rdrand" version = "0.4.0" @@ -2323,20 +2368,29 @@ version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" +[[package]] +name = "redox_syscall" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05ec8ca9416c5ea37062b502703cd7fcb207736bc294f6e0cf367ac6fc234570" +dependencies = [ + "bitflags", +] + [[package]] name = "regex" -version = "1.3.9" +version = "1.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" +checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" dependencies = [ "regex-syntax", ] [[package]] name = "regex-syntax" -version = "0.6.18" +version = "0.6.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" +checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" [[package]] name = "relay" @@ -2358,9 +2412,9 @@ dependencies = [ [[package]] name = "ring" -version = "0.16.18" +version = "0.16.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70017ed5c555d79ee3538fc63ca09c70ad8f317dcadc1adc2c496b60c22bb24f" +checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" dependencies = [ "cc", "libc", @@ -2388,9 +2442,9 @@ dependencies = [ [[package]] name = "rpassword" -version = "5.0.0" +version = "5.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d755237fc0f99d98641540e66abac8bc46a0652f19148ac9e21de2da06b326c9" +checksum = "ffc936cf8a7ea60c58f030fd36a612a48f440610214dc54bc36431f9ea0c3efb" dependencies = [ "libc", "winapi 0.3.9", @@ -2419,12 +2473,12 @@ dependencies = [ [[package]] name = "rustls" -version = "0.16.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b25a18b1bf7387f0145e7f8324e700805aade3842dd3db2e74e4cdeb4677c09e" +checksum = "064fd21ff87c6e87ed4506e68beb42459caa4a0e2eb144932e6776768556980b" dependencies = [ - "base64 0.10.1", - "log 0.4.11", + "base64 0.13.0", + "log 0.4.14", "ring", "sct", "webpki", @@ -2513,15 +2567,18 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.114" +version = "1.0.123" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3" +checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae" +dependencies = [ + "serde_derive", +] [[package]] name = "serde_derive" -version = "1.0.114" +version = "1.0.123" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e" +checksum = "9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31" dependencies = [ "proc-macro2", "quote", @@ -2530,9 +2587,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.56" +version = "1.0.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3433e879a558dde8b5e8feb2a04899cf34fdde1fafb894687e52105fc1162ac3" +checksum = "4fceb2595057b6891a4ee808f70054bd2d12f0e97f1cbb78689b59f676df325a" dependencies = [ "itoa", "ryu", @@ -2551,6 +2608,12 @@ dependencies = [ "opaque-debug", ] +[[package]] +name = "sha1" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" + [[package]] name = "sha2" version = "0.8.2" @@ -2586,11 +2649,10 @@ checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" [[package]] name = "signal-hook-registry" -version = "1.2.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41" +checksum = "16f1d0fef1604ba8f7a073c7e701f213e056707210e9020af4528e0101ce11a6" dependencies = [ - "arc-swap", "libc", ] @@ -2614,28 +2676,27 @@ checksum = "4c8cbcd6df1e117c2210e13ab5109635ad68a929fcbb8964dc965b76cb5ee013" [[package]] name = "smallvec" -version = "0.6.13" +version = "0.6.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" +checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" dependencies = [ "maybe-uninit", ] [[package]] name = "smallvec" -version = "1.5.0" +version = "1.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7acad6f34eb9e8a259d3283d1e8c1d34d7415943d4895f65cc73813c7396fc85" +checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" [[package]] name = "socket2" -version = "0.3.12" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918" +checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "libc", - "redox_syscall", "winapi 0.3.9", ] @@ -2645,12 +2706,70 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" +[[package]] +name = "standback" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2beb4d1860a61f571530b3f855a1b538d0200f7871c63331ecd6f17b1f014f8" +dependencies = [ + "version_check", +] + [[package]] name = "stdweb" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef5430c8e36b713e13b48a9f709cc21e046723fe44ce34587b73a830203b533e" +[[package]] +name = "stdweb" +version = "0.4.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" +dependencies = [ + "discard", + "rustc_version", + "stdweb-derive", + "stdweb-internal-macros", + "stdweb-internal-runtime", + "wasm-bindgen", +] + +[[package]] +name = "stdweb-derive" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "serde_derive", + "syn", +] + +[[package]] +name = "stdweb-internal-macros" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" +dependencies = [ + "base-x", + "proc-macro2", + "quote", + "serde", + "serde_derive", + "serde_json", + "sha1", + "syn", +] + +[[package]] +name = "stdweb-internal-runtime" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" + [[package]] name = "stream-cipher" version = "0.3.2" @@ -2692,9 +2811,9 @@ checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" [[package]] name = "syn" -version = "1.0.35" +version = "1.0.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb7f4c519df8c117855e19dd8cc851e89eb746fe7a73f0157e0d95fdec5369b0" +checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" dependencies = [ "proc-macro2", "quote", @@ -2734,61 +2853,54 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b157868d8ac1f56b64604539990685fa7611d8fa9e5476cf0c02cf34d32917c5" -[[package]] -name = "take_mut" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" - [[package]] name = "tar" -version = "0.4.30" +version = "0.4.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "489997b7557e9a43e192c527face4feacc78bfbe6eed67fd55c4c9e381cba290" +checksum = "0313546c01d59e29be4f09687bcb4fb6690cec931cc3607b6aec7a0e417f4cc6" dependencies = [ "filetime", "libc", - "redox_syscall", "xattr", ] [[package]] name = "tempfile" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" +checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "libc", - "rand 0.7.3", - "redox_syscall", + "rand 0.8.3", + "redox_syscall 0.2.4", "remove_dir_all", "winapi 0.3.9", ] [[package]] name = "termcolor" -version = "1.1.0" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f" +checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" dependencies = [ "winapi-util", ] [[package]] name = "thiserror" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "318234ffa22e0920fe9a40d7b8369b5f649d490980cf7aadcf1eb91594869b42" +checksum = "76cc616c6abf8c8928e2fdcc0dbfab37175edd8fb49a4641066ad1364fdab146" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.21" +version = "1.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cae2447b6282786c3493999f40a9be2a6ad20cb8bd268b0a0dbf5a065535c0ab" +checksum = "9be73a2caec27583d0046ef3796c3794f868a5bc813db689eed00c7631275cd1" dependencies = [ "proc-macro2", "quote", @@ -2806,10 +2918,42 @@ dependencies = [ ] [[package]] -name = "tinyvec" -version = "0.3.3" +name = "time" +version = "0.2.25" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53953d2d3a5ad81d9f844a32f14ebb121f50b650cd59d0ee2a07cf13c617efed" +checksum = "1195b046942c221454c2539395f85413b33383a067449d78aab2b7b052a142f7" +dependencies = [ + "const_fn", + "libc", + "standback", + "stdweb 0.4.20", + "time-macros", + "version_check", + "winapi 0.3.9", +] + +[[package]] +name = "time-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" +dependencies = [ + "proc-macro-hack", + "time-macros-impl", +] + +[[package]] +name = "time-macros-impl" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa" +dependencies = [ + "proc-macro-hack", + "proc-macro2", + "quote", + "standback", + "syn", +] [[package]] name = "tinyvec" @@ -2863,14 +3007,14 @@ dependencies = [ [[package]] name = "tokio-core" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeeffbbb94209023feaef3c196a41cbcdafa06b4a6f893f68779bb5e53796f71" +checksum = "87b1395334443abca552f63d4f61d0486f12377c2ba8b368e523f89e828cffd4" dependencies = [ "bytes 0.4.12", "futures", "iovec", - "log 0.4.11", + "log 0.4.14", "mio", "scoped-tls", "tokio", @@ -2919,7 +3063,7 @@ checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" dependencies = [ "bytes 0.4.12", "futures", - "log 0.4.11", + "log 0.4.14", ] [[package]] @@ -2932,7 +3076,7 @@ dependencies = [ "futures", "lazy_static", "libc", - "log 0.4.11", + "log 0.4.14", "mio", "mio-named-pipes", "tokio-io", @@ -2968,7 +3112,7 @@ dependencies = [ "crossbeam-utils 0.7.2", "futures", "lazy_static", - "log 0.4.11", + "log 0.4.14", "mio", "num_cpus", "parking_lot 0.9.0", @@ -3039,7 +3183,7 @@ dependencies = [ "crossbeam-utils 0.7.2", "futures", "lazy_static", - "log 0.4.11", + "log 0.4.14", "num_cpus", "slab 0.4.2", "tokio-executor", @@ -3065,7 +3209,7 @@ checksum = "e2a0b10e610b39c38b031a2fcab08e4b82f16ece36504988dcbd81dbba650d82" dependencies = [ "bytes 0.4.12", "futures", - "log 0.4.11", + "log 0.4.14", "mio", "tokio-codec", "tokio-io", @@ -3082,7 +3226,7 @@ dependencies = [ "futures", "iovec", "libc", - "log 0.4.11", + "log 0.4.14", "mio", "mio-uds", "tokio-codec", @@ -3092,9 +3236,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.7" +version = "0.5.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75cf45bb0bef80604d001caaec0d09da99611b3c0fd39d3080468875cdb65645" +checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" dependencies = [ "serde", ] @@ -3131,11 +3275,11 @@ dependencies = [ [[package]] name = "unicode-normalization" -version = "0.1.13" +version = "0.1.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb19cf769fa8c6a80a162df694621ebeb4dafb606470b2b2fce0be40a98a977" +checksum = "a13e63ab62dbe32aeee58d1c5408d35c36c392bba5d9d3142287219721afe606" dependencies = [ - "tinyvec 0.3.3", + "tinyvec", ] [[package]] @@ -3173,14 +3317,16 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "ureq" -version = "0.11.4" +version = "1.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "801125e6d1ba6864cf3a5a92cfb2f0b0a3ee73e40602a0cd206ad2f3c040aa96" +checksum = "294b85ef5dbc3670a72e82a89971608a1fcc4ed5c7c5a2895230d31a95f0569b" dependencies = [ - "base64 0.11.0", + "base64 0.13.0", "chunked_transfer", "cookie", - "lazy_static", + "cookie_store", + "log 0.4.14", + "once_cell", "qstring", "rustls", "url 2.2.0", @@ -3206,18 +3352,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5909f2b0817350449ed73e8bcd81c8c3c8d9a7a5d8acba4b27db277f1868976e" dependencies = [ "form_urlencoded", - "idna 0.2.0", + "idna 0.2.1", "matches", "percent-encoding 2.1.0", ] [[package]] name = "uuid" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fde2f6a4bea1d6e007c4ad38c6839fa71cbb63b6dbf5b595aa38dc9b1093c11" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" dependencies = [ - "rand 0.7.3", + "getrandom 0.2.2", ] [[package]] @@ -3262,11 +3408,11 @@ dependencies = [ [[package]] name = "vorbis-sys" -version = "0.1.0" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a0a8d7034313748da1d84b0adfa501f83f9ec83250f37fbacfa92a3580327c4" +checksum = "bd9ed6ef5361a85e68ccc005961d995c2d44e31f0816f142025f2ca2383dfbfd" dependencies = [ - "gcc", + "cc", "libc", "ogg-sys", "pkg-config", @@ -3303,7 +3449,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a05d9d966753fa4b5c8db73fcab5eed4549cfe0e1e4e66911e5564a0085c35d1" dependencies = [ "futures", - "log 0.4.11", + "log 0.4.14", "try-lock", ] @@ -3313,11 +3459,17 @@ version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" +[[package]] +name = "wasi" +version = "0.10.2+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" + [[package]] name = "wasm-bindgen" -version = "0.2.69" +version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cd364751395ca0f68cafb17666eee36b63077fb5ecd972bbcd74c90c4bf736e" +checksum = "55c0f7123de74f0dab9b7d00fd614e7b19349cd1e2f5252bbe9b1754b59433be" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -3325,13 +3477,13 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.69" +version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1114f89ab1f4106e5b55e688b828c0ab0ea593a1ea7c094b141b14cbaaec2d62" +checksum = "7bc45447f0d4573f3d65720f636bbcc3dd6ce920ed704670118650bcd47764c7" dependencies = [ "bumpalo", "lazy_static", - "log 0.4.11", + "log 0.4.14", "proc-macro2", "quote", "syn", @@ -3340,9 +3492,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.69" +version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6ac8995ead1f084a8dea1e65f194d0973800c7f571f6edd70adf06ecf77084" +checksum = "3b8853882eef39593ad4174dd26fc9865a64e84026d223f63bb2c42affcbba2c" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3350,9 +3502,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.69" +version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5a48c72f299d80557c7c62e37e7225369ecc0c963964059509fbafe917c7549" +checksum = "4133b5e7f2a531fa413b3a1695e925038a05a71cf67e87dafa295cb645a01385" dependencies = [ "proc-macro2", "quote", @@ -3363,15 +3515,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.69" +version = "0.2.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e7811dd7f9398f14cc76efd356f98f03aa30419dea46aa810d71e819fc97158" +checksum = "dd4945e4943ae02d15c13962b38a5b1e81eadd4b71214eee75af64a4d6a4fd64" [[package]] name = "web-sys" -version = "0.3.46" +version = "0.3.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222b1ef9334f92a21d3fb53dc3fd80f30836959a90f9274a626d7e06315ba3c3" +checksum = "c40dc691fc48003eba817c38da7113c15698142da971298003cac3ef175680b3" dependencies = [ "js-sys", "wasm-bindgen", @@ -3379,9 +3531,9 @@ dependencies = [ [[package]] name = "webpki" -version = "0.21.3" +version = "0.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab146130f5f790d45f82aeeb09e55a256573373ec64409fc19a6fb82fb1032ae" +checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" dependencies = [ "ring", "untrusted", @@ -3389,9 +3541,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.18.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91cd5736df7f12a964a5067a12c62fa38e1bd8080aff1f80bc29be7c80d19ab4" +checksum = "82015b7e0b8bad8185994674a13a93306bea76cf5a16c5a181382fd3a5ec2376" dependencies = [ "webpki", ] diff --git a/Cargo.toml b/Cargo.toml index 6405ca89b..884721c35 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,6 +63,7 @@ alsa-backend = ["librespot-playback/alsa-backend"] portaudio-backend = ["librespot-playback/portaudio-backend"] pulseaudio-backend = ["librespot-playback/pulseaudio-backend"] jackaudio-backend = ["librespot-playback/jackaudio-backend"] +rodiojack-backend = ["librespot-playback/rodiojack-backend"] rodio-backend = ["librespot-playback/rodio-backend"] sdl-backend = ["librespot-playback/sdl-backend"] gstreamer-backend = ["librespot-playback/gstreamer-backend"] diff --git a/README.md b/README.md index 1d4e820d0..81b03f0e8 100644 --- a/README.md +++ b/README.md @@ -55,6 +55,7 @@ ALSA PortAudio PulseAudio JACK +JACK over Rodio SDL Pipe ``` diff --git a/playback/Cargo.toml b/playback/Cargo.toml index 115785d20..2ae931234 100644 --- a/playback/Cargo.toml +++ b/playback/Cargo.toml @@ -42,6 +42,7 @@ alsa-backend = ["alsa"] portaudio-backend = ["portaudio-rs"] pulseaudio-backend = ["libpulse-binding", "libpulse-simple-binding"] jackaudio-backend = ["jack"] +rodiojack-backend = ["rodio", "cpal/jack"] rodio-backend = ["rodio", "cpal"] sdl-backend = ["sdl2"] gstreamer-backend = ["gstreamer", "gstreamer-app", "glib", "zerocopy"] diff --git a/playback/src/audio_backend/mod.rs b/playback/src/audio_backend/mod.rs index a9840d42f..a656bcd28 100644 --- a/playback/src/audio_backend/mod.rs +++ b/playback/src/audio_backend/mod.rs @@ -34,15 +34,19 @@ mod jackaudio; #[cfg(feature = "jackaudio-backend")] use self::jackaudio::JackSink; +#[cfg(feature = "rodiojack-backend")] +use self::rodio::JackRodioSink; + #[cfg(feature = "gstreamer-backend")] mod gstreamer; #[cfg(feature = "gstreamer-backend")] use self::gstreamer::GstreamerSink; -#[cfg(feature = "rodio-backend")] +#[cfg(any(feature = "rodio-backend", feature = "rodiojack-backend"))] mod rodio; #[cfg(feature = "rodio-backend")] use self::rodio::RodioSink; + #[cfg(feature = "sdl-backend")] mod sdl; #[cfg(feature = "sdl-backend")] @@ -63,6 +67,11 @@ pub const BACKENDS: &'static [(&'static str, fn(Option) -> Box ("pulseaudio", mk_sink::), #[cfg(feature = "jackaudio-backend")] ("jackaudio", mk_sink::), + #[cfg(all( + feature = "rodiojack-backend", + any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd") + ))] + ("rodiojack", mk_sink::), #[cfg(feature = "gstreamer-backend")] ("gstreamer", mk_sink::), #[cfg(feature = "rodio-backend")] diff --git a/playback/src/audio_backend/rodio.rs b/playback/src/audio_backend/rodio.rs index bc1017867..660992e2d 100644 --- a/playback/src/audio_backend/rodio.rs +++ b/playback/src/audio_backend/rodio.rs @@ -12,6 +12,14 @@ pub struct RodioSink { stream: rodio::OutputStream, } +#[cfg(feature = "rodiojack-backend")] +pub struct JackRodioSink { + jackrodio_sink: rodio::Sink, + // We have to keep hold of this object, or the Sink can't play... + #[allow(dead_code)] + stream: rodio::OutputStream, +} + fn list_formats(ref device: &rodio::Device) { let default_fmt = match device.default_output_config() { Ok(fmt) => cpal::SupportedStreamConfig::from(fmt), @@ -39,17 +47,19 @@ fn list_formats(ref device: &rodio::Device) { } } -fn list_outputs() { - let default_device = get_default_device(); +fn list_outputs(ref host: &cpal::Host) { + let default_device = get_default_device(host); let default_device_name = default_device.name().expect("cannot get output name"); println!("Default Audio Device:\n {}", default_device_name); list_formats(&default_device); println!("Other Available Audio Devices:"); - for device in cpal::default_host() - .output_devices() - .expect("cannot get list of output devices") - { + + let found_devices = host.output_devices().expect(&format!( + "Cannot get list of output devices of Host: {:?}", + host.id() + )); + for device in found_devices { let device_name = device.name().expect("cannot get output name"); if device_name != default_device_name { println!(" {}", device_name); @@ -58,23 +68,24 @@ fn list_outputs() { } } -fn get_default_device() -> rodio::Device { - cpal::default_host() - .default_output_device() +fn get_default_device(ref host: &cpal::Host) -> rodio::Device { + host.default_output_device() .expect("no default output device available") } -fn match_device(device: Option) -> rodio::Device { +fn match_device(ref host: &cpal::Host, device: Option) -> rodio::Device { match device { Some(device_name) => { if device_name == "?".to_string() { - list_outputs(); + list_outputs(host); exit(0) } - for d in cpal::default_host() - .output_devices() - .expect("cannot get list of output devices") - { + + let found_devices = host.output_devices().expect(&format!( + "Cannot get list of output devices of Host: {:?}", + host.id() + )); + for d in found_devices { if d.name().expect("cannot get output name") == device_name { return d; } @@ -82,18 +93,16 @@ fn match_device(device: Option) -> rodio::Device { println!("No output sink matching '{}' found.", device_name); exit(0) } - None => return get_default_device(), + None => return get_default_device(host), } } impl Open for RodioSink { fn open(device: Option) -> RodioSink { - debug!( - "Using rodio sink with cpal host: {:?}", - cpal::default_host().id() - ); + let host = cpal::default_host(); + debug!("Using rodio sink with cpal host: {:?}", host.id()); - let rodio_device = match_device(device); + let rodio_device = match_device(&host, device); debug!("Using cpal device"); let stream = rodio::OutputStream::try_from_device(&rodio_device) .expect("Couldn't open output stream."); @@ -108,6 +117,33 @@ impl Open for RodioSink { } } +#[cfg(feature = "rodiojack-backend")] +impl Open for JackRodioSink { + fn open(device: Option) -> JackRodioSink { + let host = cpal::host_from_id( + cpal::available_hosts() + .into_iter() + .find(|id| *id == cpal::HostId::Jack) + .expect("Jack Host not found"), + ) + .expect("Jack Host not found"); + debug!("Using jack rodio sink with cpal Jack host"); + + let rodio_device = match_device(&host, device); + debug!("Using cpal device"); + let stream = rodio::OutputStream::try_from_device(&rodio_device) + .expect("Couldn't open output stream."); + debug!("Using jack rodio stream"); + let sink = rodio::Sink::try_new(&stream.1).expect("Couldn't create output sink."); + debug!("Using jack rodio sink"); + + JackRodioSink { + jackrodio_sink: sink, + stream: stream.0, + } + } +} + impl Sink for RodioSink { fn start(&mut self) -> io::Result<()> { // More similar to an "unpause" than "play". Doesn't undo "stop". @@ -136,3 +172,33 @@ impl Sink for RodioSink { Ok(()) } } + +#[cfg(feature = "rodiojack-backend")] +impl Sink for JackRodioSink { + fn start(&mut self) -> io::Result<()> { + // More similar to an "unpause" than "play". Doesn't undo "stop". + // self.rodio_sink.play(); + Ok(()) + } + + fn stop(&mut self) -> io::Result<()> { + // This will immediately stop playback, but the sink is then unusable. + // We just have to let the current buffer play till the end. + // self.rodio_sink.stop(); + Ok(()) + } + + fn write(&mut self, data: &[i16]) -> io::Result<()> { + let source = rodio::buffer::SamplesBuffer::new(2, 44100, data); + self.jackrodio_sink.append(source); + + // Chunk sizes seem to be about 256 to 3000 ish items long. + // Assuming they're on average 1628 then a half second buffer is: + // 44100 elements --> about 27 chunks + while self.jackrodio_sink.len() > 26 { + // sleep and wait for rodio to drain a bit + thread::sleep(time::Duration::from_millis(10)); + } + Ok(()) + } +} From aad4dba8a8c8621e9dd81a11aaf1d8f720787620 Mon Sep 17 00:00:00 2001 From: Sasha Hilton Date: Wed, 10 Feb 2021 01:07:02 +0000 Subject: [PATCH 02/35] Merge branch 'dev' into rodiojack-backend --- .github/workflows/test.yml | 2 +- .travis.yml | 74 -------------------------------------- README.md | 8 ++--- audio/src/fetch.rs | 7 ++++ connect/src/discovery.rs | 5 ++- core/src/authentication.rs | 35 ++++++++++++++++++ core/src/cache.rs | 13 +++++++ core/src/config.rs | 28 +++++++++++++++ core/src/connection/mod.rs | 10 +++--- core/src/session.rs | 14 +++++--- playback/src/player.rs | 48 ++++++++++++++++++------- src/main.rs | 6 ++-- 12 files changed, 143 insertions(+), 107 deletions(-) delete mode 100644 .travis.yml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 09281ba3e..4ad4b406a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -41,7 +41,7 @@ jobs: matrix: os: [ubuntu-latest] toolchain: - - 1.40.0 # MSRV (Minimum supported rust version) + - 1.42.0 # MSRV (Minimum supported rust version) - stable - beta experimental: [false] diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4de5ac673..000000000 --- a/.travis.yml +++ /dev/null @@ -1,74 +0,0 @@ -language: rust -rust: - - 1.42.0 - - stable - - beta - - nightly - -# Need to cache the whole `.cargo` directory to keep .crates.toml for -# cargo-update to work -cache: - directories: - - /home/travis/.cargo - -# But don't cache the cargo registry -before_cache: - - rm -rf /home/travis/.cargo/registry - -matrix: - # Performance tweak - fast_finish: true - # Ignore failures in nightly, not ideal, but necessary - allow_failures: - - rust: nightly - - # Only run the formatting check for stable - include: - - name: 'Rust: format check' - rust: stable - install: - - rustup component add rustfmt - script: - - cargo fmt --verbose --all -- --check - -addons: - apt: - packages: - - gcc-arm-linux-gnueabihf - - libc6-dev-armhf-cross - - libpulse-dev - - portaudio19-dev - - libasound2-dev - - libsdl2-dev - - gstreamer1.0-dev - - libgstreamer-plugins-base1.0-dev - -before_script: - - mkdir -p ~/.cargo - - echo '[target.armv7-unknown-linux-gnueabihf]' > ~/.cargo/config - - echo 'linker = "arm-linux-gnueabihf-gcc"' >> ~/.cargo/config - - rustup target add armv7-unknown-linux-gnueabihf - -script: - - cargo build --locked --no-default-features - - cargo build --locked --examples - - cargo build --locked --no-default-features --features "with-tremor" - - cargo build --locked --no-default-features --features "with-vorbis" - - cargo build --locked --no-default-features --features "alsa-backend" - - cargo build --locked --no-default-features --features "portaudio-backend" - - cargo build --locked --no-default-features --features "pulseaudio-backend" - - cargo build --locked --no-default-features --features "jackaudio-backend" - - cargo build --locked --no-default-features --features "rodiojack-backend" - - cargo build --locked --no-default-features --features "rodio-backend" - - cargo build --locked --no-default-features --features "sdl-backend" - - cargo build --locked --no-default-features --features "gstreamer-backend" - - cargo build --locked --no-default-features --target armv7-unknown-linux-gnueabihf - -notifications: - email: false - webhooks: - urls: - - https://webhooks.gitter.im/e/780b178b15811059752e - on_success: change # options: [always|never|change] default: always - on_failure: always # options: [always|never|change] default: always - on_start: never # options: [always|never|change] default: always diff --git a/README.md b/README.md index 81b03f0e8..9639e7690 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,4 @@ -[![Build Status](https://img.shields.io/github/workflow/status/librespot-org/librespot/test/dev)](https://github.com/librespot-org/librespot/actions) -[![Build Status](https://travis-ci.org/librespot-org/librespot.svg?branch=dev)](https://travis-ci.org/librespot-org/librespot) +[![Build Status](https://github.com/librespot-org/librespot/workflows/test/badge.svg)](https://github.com/librespot-org/librespot/actions) [![Gitter chat](https://badges.gitter.im/librespot-org/librespot.png)](https://gitter.im/librespot-org/spotify-connect-resources) [![Crates.io](https://img.shields.io/crates/v/librespot.svg)](https://crates.io/crates/librespot) @@ -21,7 +20,7 @@ As the origin by [plietar](https://github.com/plietar/) is no longer actively ma # Documentation Documentation is currently a work in progress, contributions are welcome! -There is some brief documentation on how the protocol works in the [docs](https://github.com/librespot-org/librespot/tree/master/docs) folder, +There is some brief documentation on how the protocol works in the [docs](https://github.com/librespot-org/librespot/tree/master/docs) folder, [COMPILING.md](https://github.com/librespot-org/librespot/blob/master/COMPILING.md) contains detailed instructions on setting up a development environment, and compiling librespot. More general usage and compilation information is available on the [wiki](https://github.com/librespot-org/librespot/wiki). [CONTRIBUTING.md](https://github.com/librespot-org/librespot/blob/master/CONTRIBUTING.md) also contains our contributing guidelines. @@ -32,7 +31,7 @@ If you wish to learn more about how librespot works overall, the best way is to If you run into a bug when using librespot, please search the existing issues before opening a new one. Chances are, we've encountered it before, and have provided a resolution. If not, please open a new one, and where possible, include the backtrace librespot generates on crashing, along with anything we can use to reproduce the issue, eg. the Spotify URI of the song that caused the crash. # Building -A quick walk through of the build process is outlined here, while a detailed compilation guide can be found [here](https://github.com/librespot-org/librespot/blob/master/COMPILING.md). +A quick walk through of the build process is outlined here, while a detailed compilation guide can be found [here](https://github.com/librespot-org/librespot/blob/master/COMPILING.md). ## Additional Dependencies We recently switched to using [Rodio](https://github.com/tomaka/rodio) for audio playback by default, hence for macOS and Windows, you should just be able to clone and build librespot (with the command below). @@ -112,4 +111,3 @@ functionality. - [librespot-java](https://github.com/devgianlu/librespot-java) - A Java port of librespot. - [ncspot](https://github.com/hrkfdn/ncspot) - Cross-platform ncurses Spotify client. - [ansible-role-librespot](https://github.com/xMordax/ansible-role-librespot/tree/master) - Ansible role that will build, install and configure Librespot. - diff --git a/audio/src/fetch.rs b/audio/src/fetch.rs index bae694192..11745a259 100644 --- a/audio/src/fetch.rs +++ b/audio/src/fetch.rs @@ -459,6 +459,13 @@ impl AudioFile { } } } + + pub fn is_cached(&self) -> bool { + match self { + AudioFile::Cached { .. } => true, + _ => false, + } + } } fn request_range(session: &Session, file: FileId, offset: usize, length: usize) -> Channel { diff --git a/connect/src/discovery.rs b/connect/src/discovery.rs index 9779e6f86..b53070d73 100644 --- a/connect/src/discovery.rs +++ b/connect/src/discovery.rs @@ -75,7 +75,7 @@ impl Discovery { "status": 101, "statusString": "ERROR-OK", "spotifyError": 0, - "version": "2.1.0", + "version": "2.7.1", "deviceID": (self.0.device_id), "remoteName": (self.0.config.name), "activeUser": "", @@ -85,6 +85,9 @@ impl Discovery { "accountReq": "PREMIUM", "brandDisplayName": "librespot", "modelDisplayName": "librespot", + "resolverVersion": "0", + "groupStatus": "NONE", + "voiceSupport": "NO", }); let body = result.to_string(); diff --git a/core/src/authentication.rs b/core/src/authentication.rs index 9109c7fb4..b2b4f5444 100644 --- a/core/src/authentication.rs +++ b/core/src/authentication.rs @@ -7,6 +7,7 @@ use sha1::{Digest, Sha1}; use std::io::{self, Read}; use crate::protocol::authentication::AuthenticationType; +use crate::protocol::keyexchange::{APLoginFailed, ErrorCode}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Credentials { @@ -164,3 +165,37 @@ pub fn get_credentials String>( (None, _, None) => None, } } + +error_chain! { + types { + AuthenticationError, AuthenticationErrorKind, AuthenticationResultExt, AuthenticationResult; + } + + foreign_links { + Io(::std::io::Error); + } + + errors { + BadCredentials { + description("Bad credentials") + display("Authentication failed with error: Bad credentials") + } + PremiumAccountRequired { + description("Premium account required") + display("Authentication failed with error: Premium account required") + } + } +} + +impl From for AuthenticationError { + fn from(login_failure: APLoginFailed) -> Self { + let error_code = login_failure.get_error_code(); + match error_code { + ErrorCode::BadCredentials => Self::from_kind(AuthenticationErrorKind::BadCredentials), + ErrorCode::PremiumAccountRequired => { + Self::from_kind(AuthenticationErrorKind::PremiumAccountRequired) + } + _ => format!("Authentication failed with error: {:?}", error_code).into(), + } + } +} diff --git a/core/src/cache.rs b/core/src/cache.rs index 00f0f4071..55c9ab01c 100644 --- a/core/src/cache.rs +++ b/core/src/cache.rs @@ -162,4 +162,17 @@ impl Cache { warn!("Cannot save file to cache: {}", e) } } + + pub fn remove_file(&self, file: FileId) -> bool { + if let Some(path) = self.file_path(file) { + if let Err(err) = fs::remove_file(path) { + warn!("Unable to remove file from cache: {}", err); + false + } else { + true + } + } else { + false + } + } } diff --git a/core/src/config.rs b/core/src/config.rs index 12c1b2ed8..60cb66e0d 100644 --- a/core/src/config.rs +++ b/core/src/config.rs @@ -36,6 +36,16 @@ pub enum DeviceType { AVR = 6, STB = 7, AudioDongle = 8, + GameConsole = 9, + CastAudio = 10, + CastVideo = 11, + Automobile = 12, + Smartwatch = 13, + Chromebook = 14, + UnknownSpotify = 100, + CarThing = 101, + Observer = 102, + HomeThing = 103, } impl FromStr for DeviceType { @@ -51,6 +61,14 @@ impl FromStr for DeviceType { "avr" => Ok(AVR), "stb" => Ok(STB), "audiodongle" => Ok(AudioDongle), + "gameconsole" => Ok(GameConsole), + "castaudio" => Ok(CastAudio), + "castvideo" => Ok(CastVideo), + "automobile" => Ok(Automobile), + "smartwatch" => Ok(Smartwatch), + "chromebook" => Ok(Chromebook), + "carthing" => Ok(CarThing), + "homething" => Ok(HomeThing), _ => Err(()), } } @@ -69,6 +87,16 @@ impl fmt::Display for DeviceType { AVR => f.write_str("AVR"), STB => f.write_str("STB"), AudioDongle => f.write_str("AudioDongle"), + GameConsole => f.write_str("GameConsole"), + CastAudio => f.write_str("CastAudio"), + CastVideo => f.write_str("CastVideo"), + Automobile => f.write_str("Automobile"), + Smartwatch => f.write_str("Smartwatch"), + Chromebook => f.write_str("Chromebook"), + UnknownSpotify => f.write_str("UnknownSpotify"), + CarThing => f.write_str("CarThing"), + Observer => f.write_str("Observer"), + HomeThing => f.write_str("HomeThing"), } } } diff --git a/core/src/connection/mod.rs b/core/src/connection/mod.rs index 72497795e..ffc6d0f44 100644 --- a/core/src/connection/mod.rs +++ b/core/src/connection/mod.rs @@ -13,7 +13,7 @@ use tokio_core::net::TcpStream; use tokio_core::reactor::Handle; use url::Url; -use crate::authentication::Credentials; +use crate::authentication::{AuthenticationError, Credentials}; use crate::version; use crate::proxytunnel; @@ -66,7 +66,7 @@ pub fn authenticate( transport: Transport, credentials: Credentials, device_id: String, -) -> Box> { +) -> Box> { use crate::protocol::authentication::{APWelcome, ClientResponseEncrypted, CpuFamily, Os}; use crate::protocol::keyexchange::APLoginFailed; @@ -101,6 +101,7 @@ pub fn authenticate( transport .send((cmd, data)) .and_then(|transport| transport.into_future().map_err(|(err, _stream)| err)) + .map_err(|io_err| io_err.into()) .and_then(|(packet, transport)| match packet { Some((0xac, data)) => { let welcome_data: APWelcome = @@ -118,10 +119,7 @@ pub fn authenticate( Some((0xad, data)) => { let error_data: APLoginFailed = protobuf::parse_from_bytes(data.as_ref()).unwrap(); - panic!( - "Authentication failed with reason: {:?}", - error_data.get_error_code() - ) + Err(error_data.into()) } Some((cmd, _)) => panic!("Unexpected packet {:?}", cmd), diff --git a/core/src/session.rs b/core/src/session.rs index 4d86a02b7..3754a000a 100644 --- a/core/src/session.rs +++ b/core/src/session.rs @@ -19,6 +19,8 @@ use crate::config::SessionConfig; use crate::connection; use crate::mercury::MercuryManager; +pub use crate::authentication::{AuthenticationError, AuthenticationErrorKind}; + struct SessionData { country: String, time_delta: i64, @@ -53,16 +55,18 @@ impl Session { credentials: Credentials, cache: Option, handle: Handle, - ) -> Box> { + ) -> Box> { let access_point = apresolve_or_fallback::(&handle, &config.proxy, &config.ap_port); let handle_ = handle.clone(); let proxy = config.proxy.clone(); - let connection = access_point.and_then(move |addr| { - info!("Connecting to AP \"{}\"", addr); - connection::connect(addr, &handle_, &proxy) - }); + let connection = access_point + .and_then(move |addr| { + info!("Connecting to AP \"{}\"", addr); + connection::connect(addr, &handle_, &proxy) + }) + .map_err(|io_err| io_err.into()); let device_id = config.device_id.clone(); let authentication = connection.and_then(move |connection| { diff --git a/playback/src/player.rs b/playback/src/player.rs index d8350bb60..a72b438f3 100644 --- a/playback/src/player.rs +++ b/playback/src/player.rs @@ -654,20 +654,24 @@ impl PlayerTrackLoader { FileFormat::OGG_VORBIS_96, ], }; - let format = formats - .iter() - .find(|format| audio.files.contains_key(format)) - .unwrap(); - let file_id = match audio.files.get(&format) { - Some(&file_id) => file_id, + let entry = formats.iter().find_map(|format| { + if let Some(&file_id) = audio.files.get(format) { + Some((*format, file_id)) + } else { + None + } + }); + + let (format, file_id) = match entry { + Some(t) => t, None => { - warn!("<{}> in not available in format {:?}", audio.name, format); + warn!("<{}> is not available in any supported format", audio.name); return None; } }; - let bytes_per_second = self.stream_data_rate(*format); + let bytes_per_second = self.stream_data_rate(format); let play_from_beginning = position_ms == 0; let key = self.session.audio_key().request(spotify_id, file_id); @@ -685,6 +689,7 @@ impl PlayerTrackLoader { return None; } }; + let is_cached = encrypted_file.is_cached(); let mut stream_loader_controller = encrypted_file.get_stream_loader_controller(); @@ -718,12 +723,31 @@ impl PlayerTrackLoader { let audio_file = Subfile::new(decrypted_file, 0xa7); - let mut decoder = VorbisDecoder::new(audio_file).unwrap(); + let mut decoder = match VorbisDecoder::new(audio_file) { + Ok(decoder) => decoder, + Err(e) if is_cached => { + warn!( + "Unable to read cached audio file: {}. Trying to download it.", + e + ); + + // unwrap safety: The file is cached, so session must have a cache + if !self.session.cache().unwrap().remove_file(file_id) { + return None; + } + + // Just try it again + return self.load_track(spotify_id, position_ms); + } + Err(e) => { + error!("Unable to read audio file: {}", e); + return None; + } + }; if position_ms != 0 { - match decoder.seek(position_ms as i64) { - Ok(_) => (), - Err(err) => error!("Vorbis error: {:?}", err), + if let Err(err) = decoder.seek(position_ms as i64) { + error!("Vorbis error: {}", err); } stream_loader_controller.set_stream_mode(); } diff --git a/src/main.rs b/src/main.rs index 8444803eb..4c57808f4 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,7 +3,7 @@ use futures::{Async, Future, Poll, Stream}; use log::{error, info, trace, warn}; use sha1::{Digest, Sha1}; use std::env; -use std::io::{self, stderr, Write}; +use std::io::{stderr, Write}; use std::mem; use std::path::Path; use std::process::exit; @@ -16,7 +16,7 @@ use url::Url; use librespot::core::authentication::{get_credentials, Credentials}; use librespot::core::cache::Cache; use librespot::core::config::{ConnectConfig, DeviceType, SessionConfig, VolumeCtrl}; -use librespot::core::session::Session; +use librespot::core::session::{AuthenticationError, Session}; use librespot::core::version; use librespot::connect::discovery::{discovery, DiscoveryStream}; @@ -436,7 +436,7 @@ struct Main { spirc: Option, spirc_task: Option, - connect: Box>, + connect: Box>, shutdown: bool, last_credentials: Option, From 59f87dcb375b8bb8054cd06396dcf6a1f7018674 Mon Sep 17 00:00:00 2001 From: Sasha Hilton Date: Wed, 10 Feb 2021 01:44:05 +0000 Subject: [PATCH 03/35] Amend conditional compilation to fail on unsupported systems --- playback/src/audio_backend/mod.rs | 11 ++++++++++- playback/src/audio_backend/rodio.rs | 15 ++++++++++++--- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/playback/src/audio_backend/mod.rs b/playback/src/audio_backend/mod.rs index a656bcd28..b9db29fce 100644 --- a/playback/src/audio_backend/mod.rs +++ b/playback/src/audio_backend/mod.rs @@ -34,7 +34,16 @@ mod jackaudio; #[cfg(feature = "jackaudio-backend")] use self::jackaudio::JackSink; -#[cfg(feature = "rodiojack-backend")] +#[cfg(all( + feature = "rodiojack-backend", + not(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd")) +))] +compile_error!("Rodio JACK backend is currently only supported on linux."); + +#[cfg(all( + feature = "rodiojack-backend", + any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd") +))] use self::rodio::JackRodioSink; #[cfg(feature = "gstreamer-backend")] diff --git a/playback/src/audio_backend/rodio.rs b/playback/src/audio_backend/rodio.rs index 660992e2d..866e8a8c8 100644 --- a/playback/src/audio_backend/rodio.rs +++ b/playback/src/audio_backend/rodio.rs @@ -12,7 +12,10 @@ pub struct RodioSink { stream: rodio::OutputStream, } -#[cfg(feature = "rodiojack-backend")] +#[cfg(all( + feature = "rodiojack-backend", + any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd") +))] pub struct JackRodioSink { jackrodio_sink: rodio::Sink, // We have to keep hold of this object, or the Sink can't play... @@ -117,7 +120,10 @@ impl Open for RodioSink { } } -#[cfg(feature = "rodiojack-backend")] +#[cfg(all( + feature = "rodiojack-backend", + any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd") +))] impl Open for JackRodioSink { fn open(device: Option) -> JackRodioSink { let host = cpal::host_from_id( @@ -173,7 +179,10 @@ impl Sink for RodioSink { } } -#[cfg(feature = "rodiojack-backend")] +#[cfg(all( + feature = "rodiojack-backend", + any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd") +))] impl Sink for JackRodioSink { fn start(&mut self) -> io::Result<()> { // More similar to an "unpause" than "play". Doesn't undo "stop". From 34733baa75559bcb2d95496a746cc03506130bf4 Mon Sep 17 00:00:00 2001 From: johannesd3 Date: Sat, 13 Feb 2021 19:10:34 +0100 Subject: [PATCH 04/35] Bump crypto crates --- Cargo.lock | 189 +++++++++++++++++-------------- audio/Cargo.toml | 2 +- audio/src/decrypt.rs | 4 +- connect/Cargo.toml | 8 +- connect/src/discovery.rs | 16 +-- core/Cargo.toml | 8 +- core/src/authentication.rs | 6 +- core/src/connection/handshake.rs | 12 +- 8 files changed, 131 insertions(+), 114 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 68c3440a0..327626861 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -23,47 +23,45 @@ checksum = "aae1277d39aeec15cb388266ecc24b11c80469deae6067e17a1a7aa9e5c1f234" [[package]] name = "aes" -version = "0.3.2" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54eb1d8fe354e5fc611daf4f2ea97dd45a765f4f1e4512306ec183ae2e8f20c9" +checksum = "884391ef1066acaa41e766ba8f596341b96e93ce34f9a43e7d24bf0a0eaf0561" dependencies = [ "aes-soft", "aesni", - "block-cipher-trait", + "cipher", ] [[package]] name = "aes-ctr" -version = "0.3.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2e5b0458ea3beae0d1d8c0f3946564f8e10f90646cf78c06b4351052058d1ee" +checksum = "7729c3cde54d67063be556aeac75a81330d802f0259500ca40cb52967f975763" dependencies = [ "aes-soft", "aesni", + "cipher", "ctr", - "stream-cipher", ] [[package]] name = "aes-soft" -version = "0.3.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfd7e7ae3f9a1fb5c03b389fc6bb9a51400d0c13053f0dca698c832bfd893a0d" +checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" dependencies = [ - "block-cipher-trait", - "byteorder", - "opaque-debug", + "cipher", + "opaque-debug 0.3.0", ] [[package]] name = "aesni" -version = "0.6.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f70a6b5f971e473091ab7cfb5ffac6cde81666c4556751d8d5620ead8abf100" +checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" dependencies = [ - "block-cipher-trait", - "opaque-debug", - "stream-cipher", + "cipher", + "opaque-debug 0.3.0", ] [[package]] @@ -199,29 +197,29 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" dependencies = [ - "block-padding", + "block-padding 0.1.5", "byte-tools", "byteorder", - "generic-array", + "generic-array 0.12.3", ] [[package]] -name = "block-cipher-trait" -version = "0.6.2" +name = "block-buffer" +version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c924d49bd09e7c06003acda26cd9742e796e34282ec6c1189404dee0c1f4774" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "generic-array", + "generic-array 0.14.4", ] [[package]] name = "block-modes" -version = "0.3.3" +version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31aa8410095e39fdb732909fb5730a48d5bd7c2e3cd76bd1b07b3dbea130c529" +checksum = "57a0e8073e8baa88212fb5823574c02ebccb395136ba9a164ab89379ec6072f0" dependencies = [ - "block-cipher-trait", - "block-padding", + "block-padding 0.2.1", + "cipher", ] [[package]] @@ -233,6 +231,12 @@ dependencies = [ "byte-tools", ] +[[package]] +name = "block-padding" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" + [[package]] name = "bumpalo" version = "3.6.0" @@ -319,6 +323,15 @@ version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fff857943da45f546682664a79488be82e69e43c1a7a2307679ab9afb3a66d2e" +[[package]] +name = "cipher" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" +dependencies = [ + "generic-array 0.14.4", +] + [[package]] name = "clang-sys" version = "1.0.3" @@ -446,6 +459,12 @@ dependencies = [ "winapi 0.3.9", ] +[[package]] +name = "cpuid-bool" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8aebca1129a03dc6dc2b127edd729435bbc4a37e1d5f4d7513165089ceb02634" + [[package]] name = "crc32fast" version = "1.2.1" @@ -524,22 +543,21 @@ dependencies = [ [[package]] name = "crypto-mac" -version = "0.7.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4434400df11d95d556bac068ddfedd482915eb18fe8bea89bc80b6e4b1c179e5" +checksum = "4857fd85a0c34b3c3297875b747c1e02e06b6a0ea32dd892d8192b9ce0813ea6" dependencies = [ - "generic-array", + "generic-array 0.14.4", "subtle", ] [[package]] name = "ctr" -version = "0.3.2" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "022cd691704491df67d25d006fe8eca083098253c4d43516c2206479c58c6736" +checksum = "fb4a30d54f7443bf3d6191dcd486aca19e67cb3c49fa7a06a319966346707e7f" dependencies = [ - "block-cipher-trait", - "stream-cipher", + "cipher", ] [[package]] @@ -594,7 +612,16 @@ version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" dependencies = [ - "generic-array", + "generic-array 0.12.3", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array 0.14.4", ] [[package]] @@ -808,6 +835,16 @@ dependencies = [ "typenum", ] +[[package]] +name = "generic-array" +version = "0.14.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "501466ecc8a30d1d3b7fc9229b122b2ce8ed6e9d9223f1138d4babb253e51817" +dependencies = [ + "typenum", + "version_check", +] + [[package]] name = "getopts" version = "0.2.21" @@ -1031,12 +1068,12 @@ checksum = "644f9158b2f133fd50f5fb3242878846d9eb792e445c893805ff0e3824006e35" [[package]] name = "hmac" -version = "0.7.1" +version = "0.10.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dcb5e64cda4c23119ab41ba960d1e170a774c8e4b9d9e6a9bc18aabf5e59695" +checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" dependencies = [ "crypto-mac", - "digest", + "digest 0.9.0", ] [[package]] @@ -1410,7 +1447,7 @@ dependencies = [ "protobuf", "rand 0.7.3", "rpassword", - "sha-1", + "sha-1 0.8.2", "tokio-core", "tokio-io", "tokio-process", @@ -1459,7 +1496,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "sha-1", + "sha-1 0.9.3", "tokio-core", "url 1.7.2", ] @@ -1490,7 +1527,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "sha-1", + "sha-1 0.9.3", "shannon", "tokio-codec", "tokio-core", @@ -1964,6 +2001,12 @@ version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" +[[package]] +name = "opaque-debug" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" + [[package]] name = "parking_lot" version = "0.9.0" @@ -2023,17 +2066,12 @@ checksum = "c5d65c4d95931acda4498f675e332fcbdc9a06705cd07086c510e9b6009cd1c1" [[package]] name = "pbkdf2" -version = "0.3.0" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "006c038a43a45995a9670da19e67600114740e8511d4333bf97a56e66a7542d9" +checksum = "309c95c5f738c85920eb7062a2de29f3840d4f96974453fc9ac1ba078da9c627" dependencies = [ - "base64 0.9.3", - "byteorder", "crypto-mac", "hmac", - "rand 0.5.6", - "sha2", - "subtle", ] [[package]] @@ -2244,19 +2282,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "rand" -version = "0.5.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c618c47cd3ebd209790115ab837de41425723956ad3ce2e6a7f09890947cacb9" -dependencies = [ - "cloudabi", - "fuchsia-cprng", - "libc", - "rand_core 0.3.1", - "winapi 0.3.9", -] - [[package]] name = "rand" version = "0.7.3" @@ -2602,29 +2627,30 @@ version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" dependencies = [ - "block-buffer", - "digest", + "block-buffer 0.7.3", + "digest 0.8.1", "fake-simd", - "opaque-debug", + "opaque-debug 0.2.3", ] [[package]] -name = "sha1" -version = "0.6.0" +name = "sha-1" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" +checksum = "f4b312c3731e3fe78a185e6b9b911a7aa715b8e31cce117975219aab2acf285d" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if 1.0.0", + "cpuid-bool", + "digest 0.9.0", + "opaque-debug 0.3.0", +] [[package]] -name = "sha2" -version = "0.8.2" +name = "sha1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a256f46ea78a0c0d9ff00077504903ac881a1dafdc20da66545699e7776b3e69" -dependencies = [ - "block-buffer", - "digest", - "fake-simd", - "opaque-debug", -] +checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" [[package]] name = "shannon" @@ -2770,15 +2796,6 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" -[[package]] -name = "stream-cipher" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8131256a5896cabcf5eb04f4d6dacbe1aefda854b0d9896e09cb58829ec5638c" -dependencies = [ - "generic-array", -] - [[package]] name = "strsim" version = "0.9.3" @@ -2805,9 +2822,9 @@ dependencies = [ [[package]] name = "subtle" -version = "1.0.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d67a5a62ba6e01cb2192ff309324cb4875d0c451d55fe2319433abe7a05a8ee" +checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" [[package]] name = "syn" diff --git a/audio/Cargo.toml b/audio/Cargo.toml index f6d16f611..2dae1a8d9 100644 --- a/audio/Cargo.toml +++ b/audio/Cargo.toml @@ -11,6 +11,7 @@ path = "../core" version = "0.1.3" [dependencies] +aes-ctr = "0.6" bit-set = "0.5" byteorder = "1.3" bytes = "0.4" @@ -20,7 +21,6 @@ log = "0.4" num-bigint = "0.3" num-traits = "0.2" tempfile = "3.1" -aes-ctr = "0.3" librespot-tremor = { version = "0.2.0", optional = true } vorbis = { version ="0.0.14", optional = true } diff --git a/audio/src/decrypt.rs b/audio/src/decrypt.rs index 818eb34e2..616ef4f68 100644 --- a/audio/src/decrypt.rs +++ b/audio/src/decrypt.rs @@ -1,7 +1,7 @@ use std::io; -use aes_ctr::stream_cipher::generic_array::GenericArray; -use aes_ctr::stream_cipher::{NewStreamCipher, SyncStreamCipher, SyncStreamCipherSeek}; +use aes_ctr::cipher::generic_array::GenericArray; +use aes_ctr::cipher::{NewStreamCipher, SyncStreamCipher, SyncStreamCipherSeek}; use aes_ctr::Aes128Ctr; use librespot_core::audio_key::AudioKey; diff --git a/connect/Cargo.toml b/connect/Cargo.toml index 8235870ac..063d9befc 100644 --- a/connect/Cargo.toml +++ b/connect/Cargo.toml @@ -18,8 +18,11 @@ path = "../protocol" version = "0.1.3" [dependencies] +aes-ctr = "0.6" base64 = "0.13" +block-modes = "0.7" futures = "0.1" +hmac = "0.10" hyper = "0.11" log = "0.4" num-bigint = "0.3" @@ -28,12 +31,9 @@ rand = "0.7" serde = "1.0" serde_derive = "1.0" serde_json = "1.0" +sha-1 = "0.9" tokio-core = "0.1" url = "1.7" -sha-1 = "0.8" -hmac = "0.7" -aes-ctr = "0.3" -block-modes = "0.3" dns-sd = { version = "0.1.3", optional = true } libmdns = { version = "0.2.7", optional = true } diff --git a/connect/src/discovery.rs b/connect/src/discovery.rs index b53070d73..d3e3f709f 100644 --- a/connect/src/discovery.rs +++ b/connect/src/discovery.rs @@ -1,10 +1,10 @@ -use aes_ctr::stream_cipher::generic_array::GenericArray; -use aes_ctr::stream_cipher::{NewStreamCipher, SyncStreamCipher}; +use aes_ctr::cipher::generic_array::GenericArray; +use aes_ctr::cipher::{NewStreamCipher, SyncStreamCipher}; use aes_ctr::Aes128Ctr; use base64; use futures::sync::mpsc; use futures::{Future, Poll, Stream}; -use hmac::{Hmac, Mac}; +use hmac::{Hmac, Mac, NewMac}; use hyper::server::{Http, Request, Response, Service}; use hyper::{self, Get, Post, StatusCode}; use sha1::{Digest, Sha1}; @@ -118,18 +118,18 @@ impl Discovery { let checksum_key = { let mut h = HmacSha1::new_varkey(base_key).expect("HMAC can take key of any size"); - h.input(b"checksum"); - h.result().code() + h.update(b"checksum"); + h.finalize().into_bytes() }; let encryption_key = { let mut h = HmacSha1::new_varkey(&base_key).expect("HMAC can take key of any size"); - h.input(b"encryption"); - h.result().code() + h.update(b"encryption"); + h.finalize().into_bytes() }; let mut h = HmacSha1::new_varkey(&checksum_key).expect("HMAC can take key of any size"); - h.input(encrypted); + h.update(encrypted); if let Err(_) = h.verify(cksum) { warn!("Login error for user {:?}: MAC mismatch", username); let result = json!({ diff --git a/core/Cargo.toml b/core/Cargo.toml index 8511878c3..9b9678cff 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -13,11 +13,13 @@ path = "../protocol" version = "0.1.3" [dependencies] +aes = "0.6" base64 = "0.13" byteorder = "1.3" bytes = "0.4" error-chain = { version = "0.12", default_features = false } futures = "0.1" +hmac = "0.10" httparse = "1.3" hyper = "0.11" hyper-proxy = { version = "0.4", default_features = false } @@ -26,21 +28,19 @@ log = "0.4" num-bigint = "0.3" num-integer = "0.1" num-traits = "0.2" +pbkdf2 = { version = "0.7", default_features = false, features = ["hmac"] } protobuf = "~2.14.0" rand = "0.7" serde = "1.0" serde_derive = "1.0" serde_json = "1.0" +sha-1 = "0.9" shannon = "0.2.0" tokio-codec = "0.1" tokio-core = "0.1" tokio-io = "0.1" url = "1.7" uuid = { version = "0.8", features = ["v4"] } -sha-1 = "0.8" -hmac = "0.7" -pbkdf2 = "0.3" -aes = "0.3" [build-dependencies] rand = "0.7" diff --git a/core/src/authentication.rs b/core/src/authentication.rs index b2b4f5444..5394ff351 100644 --- a/core/src/authentication.rs +++ b/core/src/authentication.rs @@ -71,9 +71,9 @@ impl Credentials { // decrypt data using ECB mode without padding let blob = { - use aes::block_cipher_trait::generic_array::typenum::Unsigned; - use aes::block_cipher_trait::generic_array::GenericArray; - use aes::block_cipher_trait::BlockCipher; + use aes::cipher::generic_array::typenum::Unsigned; + use aes::cipher::generic_array::GenericArray; + use aes::cipher::{BlockCipher, NewBlockCipher}; let mut data = base64::decode(encrypted_blob).unwrap(); let cipher = Aes192::new(GenericArray::from_slice(&key)); diff --git a/core/src/connection/handshake.rs b/core/src/connection/handshake.rs index 220ab6e83..abd6a1699 100644 --- a/core/src/connection/handshake.rs +++ b/core/src/connection/handshake.rs @@ -1,6 +1,6 @@ use byteorder::{BigEndian, ByteOrder, WriteBytesExt}; use futures::{Async, Future, Poll}; -use hmac::{Hmac, Mac}; +use hmac::{Hmac, Mac, NewMac}; use protobuf::{self, Message}; use rand::thread_rng; use sha1::Sha1; @@ -195,16 +195,16 @@ fn compute_keys(shared_secret: &[u8], packets: &[u8]) -> (Vec, Vec, Vec< let mut data = Vec::with_capacity(0x64); for i in 1..6 { let mut mac = HmacSha1::new_varkey(&shared_secret).expect("HMAC can take key of any size"); - mac.input(packets); - mac.input(&[i]); - data.extend_from_slice(&mac.result().code()); + mac.update(packets); + mac.update(&[i]); + data.extend_from_slice(&mac.finalize().into_bytes()); } let mut mac = HmacSha1::new_varkey(&data[..0x14]).expect("HMAC can take key of any size"); - mac.input(packets); + mac.update(packets); ( - mac.result().code().to_vec(), + mac.finalize().into_bytes().to_vec(), data[0x14..0x34].to_vec(), data[0x34..0x54].to_vec(), ) From 392a12af9262dbec25c197f7b4cac37162bdd163 Mon Sep 17 00:00:00 2001 From: Zsombor Welker Date: Sat, 20 Feb 2021 14:53:24 +0100 Subject: [PATCH 05/35] Fix toggling in SpircCommand::PlayPause Fix play/pause toggling in handle_play_pause() to correctly call handled_play()/handle_pause() based on the state. --- connect/src/spirc.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connect/src/spirc.rs b/connect/src/spirc.rs index 5e3ba389b..e1e3bb50d 100644 --- a/connect/src/spirc.rs +++ b/connect/src/spirc.rs @@ -828,7 +828,7 @@ impl SpircTask { self.handle_play() } SpircPlayStatus::Playing { .. } | SpircPlayStatus::LoadingPlay { .. } => { - self.handle_play() + self.handle_pause() } _ => (), } From 7662bc50649df89f6369e766ec13f425675bbdb3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89rico=20Nogueira=20Rolim?= <34201958+ericonr@users.noreply.github.com> Date: Thu, 28 Jan 2021 12:07:33 -0300 Subject: [PATCH 06/35] librespot-audio: update librespot-tremor. This picks up a fix for librespot-tremor when building with Rust 1.48. --- audio/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/audio/Cargo.toml b/audio/Cargo.toml index 85de4eb02..7fe15356e 100644 --- a/audio/Cargo.toml +++ b/audio/Cargo.toml @@ -22,7 +22,7 @@ num-traits = "0.2" tempfile = "3.1" aes-ctr = "0.3" -librespot-tremor = { version = "0.1.0", optional = true } +librespot-tremor = { version = "0.2.0", optional = true } vorbis = { version ="0.0.14", optional = true } [features] From a173fa7cc5a90e0f9d42150a89018df1b1c76cd4 Mon Sep 17 00:00:00 2001 From: Sasha Hilton Date: Sun, 31 Jan 2021 01:36:10 +0000 Subject: [PATCH 07/35] Remove depreciated error description method --- audio/src/libvorbis_decoder.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/audio/src/libvorbis_decoder.rs b/audio/src/libvorbis_decoder.rs index c2198251a..48be2b864 100644 --- a/audio/src/libvorbis_decoder.rs +++ b/audio/src/libvorbis_decoder.rs @@ -73,10 +73,6 @@ impl fmt::Display for VorbisError { } impl error::Error for VorbisError { - fn description(&self) -> &str { - error::Error::description(&self.0) - } - fn source(&self) -> Option<&(dyn error::Error + 'static)> { error::Error::source(&self.0) } From 4e0f5e46a556acab2d846116a9806fa955aed731 Mon Sep 17 00:00:00 2001 From: Sasha Hilton Date: Sat, 20 Feb 2021 22:59:35 +0000 Subject: [PATCH 08/35] Add skip-merge and dry-run options to publish script. Update Cargo.lock. --- Cargo.lock | 6 +-- publish.sh | 120 ++++++++++++++++++++++++++++++++++++++++++++++------- 2 files changed, 109 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9c9c2f6fd..01eb3c796 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -970,7 +970,7 @@ dependencies = [ "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "lewton 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)", "librespot-core 0.1.3", - "librespot-tremor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", + "librespot-tremor 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-traits 0.2.12 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1091,7 +1091,7 @@ dependencies = [ [[package]] name = "librespot-tremor" -version = "0.1.0" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "cc 1.0.58 (registry+https://github.com/rust-lang/crates.io-index)", @@ -2627,7 +2627,7 @@ dependencies = [ "checksum libm 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" "checksum libmdns 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "966e0f9cc15be41e9dbfcd74fd9c04cf69d3c0ec43fc56aa28f5e4da4e545c38" "checksum libpulse-sys 0.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9bb11b06faf883500c1b625cf4453e6c7737e9df9c7ba01df3f84b22b083e4ac" -"checksum librespot-tremor 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b155a7dc4e4d272e01c37a1b85c1ee1bee7f04980ad4a7784c1a6e0f2de5929b" +"checksum librespot-tremor 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "97f525bff915d478a76940a7b988e5ea34911ba7280c97bd3a7673f54d68b4fe" "checksum linear-map 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bfae20f6b19ad527b550c223fddc3077a547fc70cda94b9b566575423fd303ee" "checksum lock_api 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75" "checksum log 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)" = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" diff --git a/publish.sh b/publish.sh index c9fe9db8f..3f4964fe8 100755 --- a/publish.sh +++ b/publish.sh @@ -1,16 +1,25 @@ #!/bin/bash +SKIP_MERGE='false' +DRY_RUN='false' + WORKINGDIR="$( cd "$(dirname "$0")" ; pwd -P )" cd $WORKINGDIR crates=( "protocol" "core" "audio" "metadata" "playback" "connect" "librespot" ) function switchBranch { - # You are expected to have committed/stashed your changes before running this. - echo "Switching to master branch and merging development." - git checkout master - git pull - git merge dev + if [ "$SKIP_MERGE" = 'false' ] ; then + # You are expected to have committed/stashed your changes before running this. + echo "Switching to master branch and merging development." + git checkout master + git pull + if [ "$DRY_RUN" = 'true' ] ; then + git merge --no-commit --no-ff dev + else + git merge dev + fi + fi } function updateVersion { @@ -26,15 +35,25 @@ function updateVersion { echo "Path is $crate_path" if [ "$CRATE" = "librespot" ] then - cargo update - git add . && git commit -a -m "Update Cargo.lock" + if [ "$DRY_RUN" = 'true' ] ; then + cargo update --dry-run + git add . && git commit --dry-run -a -m "Update Cargo.lock" + else + cargo update + git add . && git commit -a -m "Update Cargo.lock" + fi fi done } function commitAndTag { - git commit -a -m "Update version numbers to $1" - git tag "v$1" -a -m "Update to version $1" + if [ "$DRY_RUN" = 'true' ] ; then + # Skip tagging on dry run. + git commit --dry-run -a -m "Update version numbers to $1" + else + git commit -a -m "Update version numbers to $1" + git tag "v$1" -a -m "Update to version $1" + fi } function get_crate_name { @@ -73,8 +92,17 @@ function publishCrates { then # Protocol crate needs --no-verify option due to build.rs modification. cargo publish --no-verify + if [ "$DRY_RUN" = 'true' ] ; then + cargo publish --no-verify --dry-run + else + cargo publish --no-verify + fi else - cargo publish + if [ "$DRY_RUN" = 'true' ] ; then + cargo publish --dry-run + else + cargo publish + fi fi echo "Successfully published $crate_name to crates.io" remoteWait 30 $crate_name @@ -83,10 +111,32 @@ function publishCrates { function updateRepo { cd $WORKINGDIR - echo "Pushing to master branch of repo." - git push origin master - echo "Pushing v$1 tag to master branch of repo." - git push origin v$1 + if [ "$DRY_RUN" = 'true' ] ; then + echo "Pushing to master branch of repo. [DRY RUN]" + git push --dry-run origin master + echo "Pushing v$1 tag to master branch of repo. [DRY RUN]" + git push --dry-run origin v$1 + + # Cancels any merges in progress + git merge --abort + + git checkout dev + git merge --no-commit --no-ff master + + # Cancels above merge + git merge --abort + + git push --dry-run + else + echo "Pushing to master branch of repo." + git push origin master + echo "Pushing v$1 tag to master branch of repo." + git push origin v$1 + # Update the dev repo with latest version commit + git checkout dev + git merge master + git push + fi } function run { @@ -98,5 +148,47 @@ function run { echo "Successfully published v$1 to crates.io and uploaded changes to repo." } +#Set Script Name variable +SCRIPT=`basename ${BASH_SOURCE[0]}` + +print_usage () { + local l_MSG=$1 + if [ ! -z "${l_MSG}" ]; then + echo "Usage Error: $l_MSG" + fi + echo "Usage: $SCRIPT " + echo " where specifies the version number in semver format, eg. 1.0.1" + echo "Recognized optional command line arguments" + echo "--dry-run -- Test the script before making live changes" + echo "--skip-merge -- Skip merging dev into master before publishing" + exit 1 +} + +### check number of command line arguments +NUMARGS=$# +if [ $NUMARGS -eq 0 ]; then + print_usage 'No command line arguments specified' +fi + +while test $# -gt 0; do + case "$1" in + -h|--help) + print_usage + exit 0 + ;; + --dry-run) + DRY_RUN='true' + shift + ;; + --skip-merge) + SKIP_MERGE='true' + shift + ;; + *) + break + ;; + esac +done + # First argument is new version number. run $1 From 66566e0b26bbc7ec39f23b5275a5869d3b5e421f Mon Sep 17 00:00:00 2001 From: Sasha Hilton Date: Sat, 20 Feb 2021 23:04:08 +0000 Subject: [PATCH 09/35] remove errant live code in dry-run of publish.sh --- publish.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/publish.sh b/publish.sh index 3f4964fe8..942adf845 100755 --- a/publish.sh +++ b/publish.sh @@ -91,7 +91,6 @@ function publishCrates { if [ "$CRATE" == "protocol" ] then # Protocol crate needs --no-verify option due to build.rs modification. - cargo publish --no-verify if [ "$DRY_RUN" = 'true' ] ; then cargo publish --no-verify --dry-run else From 2c110ca25659816c612d94fe7ff4f2ce52b9c38d Mon Sep 17 00:00:00 2001 From: Sasha Hilton Date: Sat, 20 Feb 2021 23:05:56 +0000 Subject: [PATCH 10/35] Update version numbers to 0.1.5 --- Cargo.toml | 14 +++++++------- audio/Cargo.toml | 4 ++-- connect/Cargo.toml | 8 ++++---- core/Cargo.toml | 4 ++-- metadata/Cargo.toml | 6 +++--- playback/Cargo.toml | 8 ++++---- protocol/Cargo.toml | 2 +- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 085ccb8e3..da66ac192 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "librespot" -version = "0.1.3" +version = "0.1.5" authors = ["Librespot Org"] license = "MIT" description = "An open source client library for Spotify, with support for Spotify Connect" @@ -22,22 +22,22 @@ doc = false [dependencies.librespot-audio] path = "audio" -version = "0.1.3" +version = "0.1.5" [dependencies.librespot-connect] path = "connect" -version = "0.1.3" +version = "0.1.5" [dependencies.librespot-core] path = "core" -version = "0.1.3" +version = "0.1.5" [dependencies.librespot-metadata] path = "metadata" -version = "0.1.3" +version = "0.1.5" [dependencies.librespot-playback] path = "playback" -version = "0.1.3" +version = "0.1.5" [dependencies.librespot-protocol] path = "protocol" -version = "0.1.3" +version = "0.1.5" [dependencies] base64 = "0.10" diff --git a/audio/Cargo.toml b/audio/Cargo.toml index 7fe15356e..6743a324e 100644 --- a/audio/Cargo.toml +++ b/audio/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "librespot-audio" -version = "0.1.3" +version = "0.1.5" authors = ["Paul Lietar "] description="The audio fetching and processing logic for librespot" license="MIT" @@ -8,7 +8,7 @@ edition = "2018" [dependencies.librespot-core] path = "../core" -version = "0.1.3" +version = "0.1.5" [dependencies] bit-set = "0.5" diff --git a/connect/Cargo.toml b/connect/Cargo.toml index 6c2411338..7496a5c18 100644 --- a/connect/Cargo.toml +++ b/connect/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "librespot-connect" -version = "0.1.3" +version = "0.1.5" authors = ["Paul Lietar "] description="The discovery and Spotify Connect logic for librespot" license="MIT" @@ -8,13 +8,13 @@ edition = "2018" [dependencies.librespot-core] path = "../core" -version = "0.1.3" +version = "0.1.5" [dependencies.librespot-playback] path = "../playback" -version = "0.1.3" +version = "0.1.5" [dependencies.librespot-protocol] path = "../protocol" -version = "0.1.3" +version = "0.1.5" [dependencies] base64 = "0.10" diff --git a/core/Cargo.toml b/core/Cargo.toml index fbcd70ae0..12f8227f0 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "librespot-core" -version = "0.1.3" +version = "0.1.5" authors = ["Paul Lietar "] build = "build.rs" description="The core functionality provided by librespot" @@ -9,7 +9,7 @@ edition = "2018" [dependencies.librespot-protocol] path = "../protocol" -version = "0.1.3" +version = "0.1.5" [dependencies] base64 = "0.10" diff --git a/metadata/Cargo.toml b/metadata/Cargo.toml index a4ca25750..5e90b7381 100644 --- a/metadata/Cargo.toml +++ b/metadata/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "librespot-metadata" -version = "0.1.3" +version = "0.1.5" authors = ["Paul Lietar "] description="The metadata logic for librespot" license="MIT" @@ -15,7 +15,7 @@ log = "0.4" [dependencies.librespot-core] path = "../core" -version = "0.1.3" +version = "0.1.5" [dependencies.librespot-protocol] path = "../protocol" -version = "0.1.3" +version = "0.1.5" diff --git a/playback/Cargo.toml b/playback/Cargo.toml index 699a3f531..48e3ce4d0 100644 --- a/playback/Cargo.toml +++ b/playback/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "librespot-playback" -version = "0.1.3" +version = "0.1.5" authors = ["Sasha Hilton "] description="The audio playback logic for librespot" license="MIT" @@ -8,13 +8,13 @@ edition = "2018" [dependencies.librespot-audio] path = "../audio" -version = "0.1.3" +version = "0.1.5" [dependencies.librespot-core] path = "../core" -version = "0.1.3" +version = "0.1.5" [dependencies.librespot-metadata] path = "../metadata" -version = "0.1.3" +version = "0.1.5" [dependencies] futures = "0.1" diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index 4e59d7b35..ead3371bb 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "librespot-protocol" -version = "0.1.3" +version = "0.1.5" authors = ["Paul Liétar "] build = "build.rs" description="The protobuf logic for communicating with Spotify servers" From 91dc14794c2aebb32a7aa8765cc059324e4e26eb Mon Sep 17 00:00:00 2001 From: Sasha Hilton Date: Sat, 20 Feb 2021 23:23:44 +0000 Subject: [PATCH 11/35] Update Cargo.lock --- Cargo.lock | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 01eb3c796..2d844a65b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -932,7 +932,7 @@ dependencies = [ [[package]] name = "librespot" -version = "0.1.3" +version = "0.1.5" dependencies = [ "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -940,12 +940,12 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.11.27 (registry+https://github.com/rust-lang/crates.io-index)", - "librespot-audio 0.1.3", - "librespot-connect 0.1.3", - "librespot-core 0.1.3", - "librespot-metadata 0.1.3", - "librespot-playback 0.1.3", - "librespot-protocol 0.1.3", + "librespot-audio 0.1.5", + "librespot-connect 0.1.5", + "librespot-core 0.1.5", + "librespot-metadata 0.1.5", + "librespot-playback 0.1.5", + "librespot-protocol 0.1.5", "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -961,7 +961,7 @@ dependencies = [ [[package]] name = "librespot-audio" -version = "0.1.3" +version = "0.1.5" dependencies = [ "aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -969,7 +969,7 @@ dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "lewton 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)", - "librespot-core 0.1.3", + "librespot-core 0.1.5", "librespot-tremor 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -980,7 +980,7 @@ dependencies = [ [[package]] name = "librespot-connect" -version = "0.1.3" +version = "0.1.5" dependencies = [ "aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -990,9 +990,9 @@ dependencies = [ "hmac 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.11.27 (registry+https://github.com/rust-lang/crates.io-index)", "libmdns 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", - "librespot-core 0.1.3", - "librespot-playback 0.1.3", - "librespot-protocol 0.1.3", + "librespot-core 0.1.5", + "librespot-playback 0.1.5", + "librespot-protocol 0.1.5", "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1007,7 +1007,7 @@ dependencies = [ [[package]] name = "librespot-core" -version = "0.1.3" +version = "0.1.5" dependencies = [ "aes 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1020,7 +1020,7 @@ dependencies = [ "hyper 0.11.27 (registry+https://github.com/rust-lang/crates.io-index)", "hyper-proxy 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "librespot-protocol 0.1.3", + "librespot-protocol 0.1.5", "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1043,12 +1043,12 @@ dependencies = [ [[package]] name = "librespot-metadata" -version = "0.1.3" +version = "0.1.5" dependencies = [ "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "librespot-core 0.1.3", - "librespot-protocol 0.1.3", + "librespot-core 0.1.5", + "librespot-protocol 0.1.5", "linear-map 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1056,7 +1056,7 @@ dependencies = [ [[package]] name = "librespot-playback" -version = "0.1.3" +version = "0.1.5" dependencies = [ "alsa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1068,9 +1068,9 @@ dependencies = [ "jack 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.73 (registry+https://github.com/rust-lang/crates.io-index)", "libpulse-sys 0.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "librespot-audio 0.1.3", - "librespot-core 0.1.3", - "librespot-metadata 0.1.3", + "librespot-audio 0.1.5", + "librespot-core 0.1.5", + "librespot-metadata 0.1.5", "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "portaudio-rs 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "rodio 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1081,7 +1081,7 @@ dependencies = [ [[package]] name = "librespot-protocol" -version = "0.1.3" +version = "0.1.5" dependencies = [ "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)", From 0b211f923f7bdda3bbeac7ef7f419cbf24f93789 Mon Sep 17 00:00:00 2001 From: Will Stott Date: Sun, 21 Feb 2021 18:54:16 +0000 Subject: [PATCH 12/35] Stabilization of libmdns at 0.2.7 (includes fix for NetBSD) --- connect/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/connect/Cargo.toml b/connect/Cargo.toml index 7496a5c18..5940d00a1 100644 --- a/connect/Cargo.toml +++ b/connect/Cargo.toml @@ -35,7 +35,7 @@ aes-ctr = "0.3" block-modes = "0.3" dns-sd = { version = "0.1.3", optional = true } -libmdns = { version = "0.2.6", optional = true } +libmdns = { version = "0.2.7", optional = true } [features] default = ["libmdns"] From 89ad7a44a69818c4184734e0cfbd0bdc63b60e8b Mon Sep 17 00:00:00 2001 From: Will Stott Date: Sun, 21 Feb 2021 19:01:31 +0000 Subject: [PATCH 13/35] Update Cargo.lock --- Cargo.lock | 57 ++++++++++++++++++++++++------------------------------ 1 file changed, 25 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 2d844a65b..3ce0e09f4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -223,11 +223,6 @@ dependencies = [ "iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "c_linked_list" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" - [[package]] name = "cc" version = "1.0.58" @@ -546,26 +541,6 @@ dependencies = [ "typenum 1.12.0 (registry+https://github.com/rust-lang/crates.io-index)", ] -[[package]] -name = "get_if_addrs" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "c_linked_list 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "get_if_addrs-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.73 (registry+https://github.com/rust-lang/crates.io-index)", - "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", -] - -[[package]] -name = "get_if_addrs-sys" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -dependencies = [ - "gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)", - "libc 0.2.73 (registry+https://github.com/rust-lang/crates.io-index)", -] - [[package]] name = "getopts" version = "0.2.21" @@ -808,6 +783,25 @@ dependencies = [ "unicode-normalization 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", ] +[[package]] +name = "if-addrs" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "if-addrs-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.73 (registry+https://github.com/rust-lang/crates.io-index)", + "winapi 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", +] + +[[package]] +name = "if-addrs-sys" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +dependencies = [ + "cc 1.0.58 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.73 (registry+https://github.com/rust-lang/crates.io-index)", +] + [[package]] name = "iovec" version = "0.1.4" @@ -907,13 +901,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "libmdns" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "get_if_addrs 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)", "hostname 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", + "if-addrs 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "multimap 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", "net2 0.2.34 (registry+https://github.com/rust-lang/crates.io-index)", @@ -989,7 +983,7 @@ dependencies = [ "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "hmac 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.11.27 (registry+https://github.com/rust-lang/crates.io-index)", - "libmdns 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", + "libmdns 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", "librespot-core 0.1.5", "librespot-playback 0.1.5", "librespot-protocol 0.1.5", @@ -2550,7 +2544,6 @@ dependencies = [ "checksum byte-tools 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" "checksum byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)" = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" "checksum bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)" = "206fdffcfa2df7cbe15601ef46c813fce0965eb3286db6b56c583b814b51c81c" -"checksum c_linked_list 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4964518bd3b4a8190e832886cdc0da9794f12e8e6c1613a9e90ff331c4c8724b" "checksum cc 1.0.58 (registry+https://github.com/rust-lang/crates.io-index)" = "f9a06fb2e53271d7c279ec1efea6ab691c35a2ae67ec0d91d7acec0caf13b518" "checksum cexpr 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "f4aedb84272dbe89af497cf81375129abda4fc0a9e7c5d317498c15cc30c0d27" "checksum cfg-if 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822" @@ -2589,8 +2582,6 @@ dependencies = [ "checksum futures-util 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" "checksum gcc 0.3.55 (registry+https://github.com/rust-lang/crates.io-index)" = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" "checksum generic-array 0.12.3 (registry+https://github.com/rust-lang/crates.io-index)" = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" -"checksum get_if_addrs 0.5.3 (registry+https://github.com/rust-lang/crates.io-index)" = "abddb55a898d32925f3148bd281174a68eeb68bbfd9a5938a57b18f506ee4ef7" -"checksum get_if_addrs-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "0d04f9fb746cf36b191c00f3ede8bde9c8e64f9f4b05ae2694a9ccf5e3f5ab48" "checksum getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)" = "14dbbfd5c71d70241ecf9e6f13737f7b5ce823821063188d7e46c41d371eebd5" "checksum getrandom 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)" = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" "checksum glib 0.9.3 (registry+https://github.com/rust-lang/crates.io-index)" = "40fb573a09841b6386ddf15fd4bc6655b4f5b106ca962f57ecaecde32a0061c0" @@ -2612,6 +2603,8 @@ dependencies = [ "checksum hyper 0.11.27 (registry+https://github.com/rust-lang/crates.io-index)" = "34a590ca09d341e94cddf8e5af0bbccde205d5fbc2fa3c09dd67c7f85cea59d7" "checksum hyper-proxy 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)" = "44f0925de2747e481e6e477dd212c25e8f745567f02f6182e04d27b97c3fbece" "checksum idna 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" +"checksum if-addrs 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "28538916eb3f3976311f5dfbe67b5362d0add1293d0a9cad17debf86f8e3aa48" +"checksum if-addrs-sys 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "de74b9dd780476e837e5eb5ab7c88b49ed304126e412030a0adba99c8efe79ea" "checksum iovec 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)" = "b2b3ea6ff95e175473f8ffe6a7eb7c00d054240321b84c57051175fe3c1e075e" "checksum itoa 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)" = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" "checksum jack 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)" = "1e15fc592e2e5a74a105ff507083c04db1aa20ba1b90d425362ba000e57422df" @@ -2625,7 +2618,7 @@ dependencies = [ "checksum libloading 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "fd38073de8f7965d0c17d30546d4bb6da311ab428d1c7a3fc71dff7f9d4979b9" "checksum libloading 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)" = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" "checksum libm 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "c7d73b3f436185384286bd8098d17ec07c9a7d2388a6599f824d8502b529702a" -"checksum libmdns 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)" = "966e0f9cc15be41e9dbfcd74fd9c04cf69d3c0ec43fc56aa28f5e4da4e545c38" +"checksum libmdns 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)" = "5d8582c174736c53633bc482ac709b24527c018356c3dc6d8e25a788b06b394e" "checksum libpulse-sys 0.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9bb11b06faf883500c1b625cf4453e6c7737e9df9c7ba01df3f84b22b083e4ac" "checksum librespot-tremor 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "97f525bff915d478a76940a7b988e5ea34911ba7280c97bd3a7673f54d68b4fe" "checksum linear-map 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bfae20f6b19ad527b550c223fddc3077a547fc70cda94b9b566575423fd303ee" From b7c3609c7bd73936e0b85e95593de452c0f42a1c Mon Sep 17 00:00:00 2001 From: Sasha Hilton Date: Mon, 22 Feb 2021 00:37:28 +0000 Subject: [PATCH 14/35] Update version numbers to 0.1.6 --- Cargo.toml | 14 +++++++------- audio/Cargo.toml | 4 ++-- connect/Cargo.toml | 8 ++++---- core/Cargo.toml | 4 ++-- metadata/Cargo.toml | 6 +++--- playback/Cargo.toml | 8 ++++---- protocol/Cargo.toml | 2 +- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index da66ac192..67372c9b8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "librespot" -version = "0.1.5" +version = "0.1.6" authors = ["Librespot Org"] license = "MIT" description = "An open source client library for Spotify, with support for Spotify Connect" @@ -22,22 +22,22 @@ doc = false [dependencies.librespot-audio] path = "audio" -version = "0.1.5" +version = "0.1.6" [dependencies.librespot-connect] path = "connect" -version = "0.1.5" +version = "0.1.6" [dependencies.librespot-core] path = "core" -version = "0.1.5" +version = "0.1.6" [dependencies.librespot-metadata] path = "metadata" -version = "0.1.5" +version = "0.1.6" [dependencies.librespot-playback] path = "playback" -version = "0.1.5" +version = "0.1.6" [dependencies.librespot-protocol] path = "protocol" -version = "0.1.5" +version = "0.1.6" [dependencies] base64 = "0.10" diff --git a/audio/Cargo.toml b/audio/Cargo.toml index 6743a324e..71a72f9c8 100644 --- a/audio/Cargo.toml +++ b/audio/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "librespot-audio" -version = "0.1.5" +version = "0.1.6" authors = ["Paul Lietar "] description="The audio fetching and processing logic for librespot" license="MIT" @@ -8,7 +8,7 @@ edition = "2018" [dependencies.librespot-core] path = "../core" -version = "0.1.5" +version = "0.1.6" [dependencies] bit-set = "0.5" diff --git a/connect/Cargo.toml b/connect/Cargo.toml index 5940d00a1..fbe6f9e8d 100644 --- a/connect/Cargo.toml +++ b/connect/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "librespot-connect" -version = "0.1.5" +version = "0.1.6" authors = ["Paul Lietar "] description="The discovery and Spotify Connect logic for librespot" license="MIT" @@ -8,13 +8,13 @@ edition = "2018" [dependencies.librespot-core] path = "../core" -version = "0.1.5" +version = "0.1.6" [dependencies.librespot-playback] path = "../playback" -version = "0.1.5" +version = "0.1.6" [dependencies.librespot-protocol] path = "../protocol" -version = "0.1.5" +version = "0.1.6" [dependencies] base64 = "0.10" diff --git a/core/Cargo.toml b/core/Cargo.toml index 12f8227f0..266278689 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "librespot-core" -version = "0.1.5" +version = "0.1.6" authors = ["Paul Lietar "] build = "build.rs" description="The core functionality provided by librespot" @@ -9,7 +9,7 @@ edition = "2018" [dependencies.librespot-protocol] path = "../protocol" -version = "0.1.5" +version = "0.1.6" [dependencies] base64 = "0.10" diff --git a/metadata/Cargo.toml b/metadata/Cargo.toml index 5e90b7381..7df03daeb 100644 --- a/metadata/Cargo.toml +++ b/metadata/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "librespot-metadata" -version = "0.1.5" +version = "0.1.6" authors = ["Paul Lietar "] description="The metadata logic for librespot" license="MIT" @@ -15,7 +15,7 @@ log = "0.4" [dependencies.librespot-core] path = "../core" -version = "0.1.5" +version = "0.1.6" [dependencies.librespot-protocol] path = "../protocol" -version = "0.1.5" +version = "0.1.6" diff --git a/playback/Cargo.toml b/playback/Cargo.toml index 48e3ce4d0..fcf03e082 100644 --- a/playback/Cargo.toml +++ b/playback/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "librespot-playback" -version = "0.1.5" +version = "0.1.6" authors = ["Sasha Hilton "] description="The audio playback logic for librespot" license="MIT" @@ -8,13 +8,13 @@ edition = "2018" [dependencies.librespot-audio] path = "../audio" -version = "0.1.5" +version = "0.1.6" [dependencies.librespot-core] path = "../core" -version = "0.1.5" +version = "0.1.6" [dependencies.librespot-metadata] path = "../metadata" -version = "0.1.5" +version = "0.1.6" [dependencies] futures = "0.1" diff --git a/protocol/Cargo.toml b/protocol/Cargo.toml index ead3371bb..3df4e9ef5 100644 --- a/protocol/Cargo.toml +++ b/protocol/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "librespot-protocol" -version = "0.1.5" +version = "0.1.6" authors = ["Paul Liétar "] build = "build.rs" description="The protobuf logic for communicating with Spotify servers" From d4b36b239847519e94929658971d6dfec0da2eee Mon Sep 17 00:00:00 2001 From: Sasha Hilton Date: Mon, 22 Feb 2021 00:48:14 +0000 Subject: [PATCH 15/35] Bump cargo.lock --- Cargo.lock | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3ce0e09f4..4138fdc71 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -926,7 +926,7 @@ dependencies = [ [[package]] name = "librespot" -version = "0.1.5" +version = "0.1.6" dependencies = [ "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", "env_logger 0.6.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -934,12 +934,12 @@ dependencies = [ "getopts 0.2.21 (registry+https://github.com/rust-lang/crates.io-index)", "hex 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.11.27 (registry+https://github.com/rust-lang/crates.io-index)", - "librespot-audio 0.1.5", - "librespot-connect 0.1.5", - "librespot-core 0.1.5", - "librespot-metadata 0.1.5", - "librespot-playback 0.1.5", - "librespot-protocol 0.1.5", + "librespot-audio 0.1.6", + "librespot-connect 0.1.6", + "librespot-core 0.1.6", + "librespot-metadata 0.1.6", + "librespot-playback 0.1.6", + "librespot-protocol 0.1.6", "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -955,7 +955,7 @@ dependencies = [ [[package]] name = "librespot-audio" -version = "0.1.5" +version = "0.1.6" dependencies = [ "aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "bit-set 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -963,7 +963,7 @@ dependencies = [ "bytes 0.4.12 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", "lewton 0.9.4 (registry+https://github.com/rust-lang/crates.io-index)", - "librespot-core 0.1.5", + "librespot-core 0.1.6", "librespot-tremor 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", @@ -974,7 +974,7 @@ dependencies = [ [[package]] name = "librespot-connect" -version = "0.1.5" +version = "0.1.6" dependencies = [ "aes-ctr 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -984,9 +984,9 @@ dependencies = [ "hmac 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", "hyper 0.11.27 (registry+https://github.com/rust-lang/crates.io-index)", "libmdns 0.2.7 (registry+https://github.com/rust-lang/crates.io-index)", - "librespot-core 0.1.5", - "librespot-playback 0.1.5", - "librespot-protocol 0.1.5", + "librespot-core 0.1.6", + "librespot-playback 0.1.6", + "librespot-protocol 0.1.6", "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1001,7 +1001,7 @@ dependencies = [ [[package]] name = "librespot-core" -version = "0.1.5" +version = "0.1.6" dependencies = [ "aes 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "base64 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1014,7 +1014,7 @@ dependencies = [ "hyper 0.11.27 (registry+https://github.com/rust-lang/crates.io-index)", "hyper-proxy 0.4.1 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "librespot-protocol 0.1.5", + "librespot-protocol 0.1.6", "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "num-bigint 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", "num-integer 0.1.43 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1037,12 +1037,12 @@ dependencies = [ [[package]] name = "librespot-metadata" -version = "0.1.5" +version = "0.1.6" dependencies = [ "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "futures 0.1.29 (registry+https://github.com/rust-lang/crates.io-index)", - "librespot-core 0.1.5", - "librespot-protocol 0.1.5", + "librespot-core 0.1.6", + "librespot-protocol 0.1.6", "linear-map 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1050,7 +1050,7 @@ dependencies = [ [[package]] name = "librespot-playback" -version = "0.1.5" +version = "0.1.6" dependencies = [ "alsa 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1062,9 +1062,9 @@ dependencies = [ "jack 0.5.7 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.73 (registry+https://github.com/rust-lang/crates.io-index)", "libpulse-sys 0.0.0 (registry+https://github.com/rust-lang/crates.io-index)", - "librespot-audio 0.1.5", - "librespot-core 0.1.5", - "librespot-metadata 0.1.5", + "librespot-audio 0.1.6", + "librespot-core 0.1.6", + "librespot-metadata 0.1.6", "log 0.4.11 (registry+https://github.com/rust-lang/crates.io-index)", "portaudio-rs 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "rodio 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", @@ -1075,7 +1075,7 @@ dependencies = [ [[package]] name = "librespot-protocol" -version = "0.1.5" +version = "0.1.6" dependencies = [ "glob 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "protobuf 2.14.0 (registry+https://github.com/rust-lang/crates.io-index)", From 34bc286d9b456c828300ce682ac083d4cfed0741 Mon Sep 17 00:00:00 2001 From: Philippe G Date: Wed, 6 Jan 2021 22:42:38 -0800 Subject: [PATCH 16/35] ogg passthrough rename --- .gitignore | 5 +- Cargo.lock | 1 + audio/Cargo.toml | 1 + audio/src/lewton_decoder.rs | 31 ++-- audio/src/lib.rs | 67 +++++++- audio/src/libvorbis_decoder.rs | 31 ++-- audio/src/passthrough_decoder.rs | 191 +++++++++++++++++++++++ playback/src/audio_backend/alsa.rs | 4 +- playback/src/audio_backend/gstreamer.rs | 5 +- playback/src/audio_backend/jackaudio.rs | 5 +- playback/src/audio_backend/mod.rs | 3 +- playback/src/audio_backend/pipe.rs | 16 +- playback/src/audio_backend/portaudio.rs | 5 +- playback/src/audio_backend/pulseaudio.rs | 11 +- playback/src/audio_backend/rodio.rs | 5 +- playback/src/audio_backend/sdl.rs | 5 +- playback/src/audio_backend/subprocess.rs | 7 +- playback/src/config.rs | 2 + playback/src/player.rs | 101 +++++++----- src/main.rs | 8 + 20 files changed, 405 insertions(+), 99 deletions(-) create mode 100644 audio/src/passthrough_decoder.rs diff --git a/.gitignore b/.gitignore index 1ca8ef720..1fa443273 100644 --- a/.gitignore +++ b/.gitignore @@ -3,4 +3,7 @@ target spotify_appkey.key .vagrant/ .project -.history \ No newline at end of file +.history +*.save + + diff --git a/Cargo.lock b/Cargo.lock index 68c3440a0..9eb306c04 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1433,6 +1433,7 @@ dependencies = [ "log 0.4.14", "num-bigint", "num-traits", + "ogg", "tempfile", "vorbis", ] diff --git a/audio/Cargo.toml b/audio/Cargo.toml index f6d16f611..71746ab08 100644 --- a/audio/Cargo.toml +++ b/audio/Cargo.toml @@ -16,6 +16,7 @@ byteorder = "1.3" bytes = "0.4" futures = "0.1" lewton = "0.10" +ogg = "0.8" log = "0.4" num-bigint = "0.3" num-traits = "0.2" diff --git a/audio/src/lewton_decoder.rs b/audio/src/lewton_decoder.rs index b9f05d4c8..1addaa011 100644 --- a/audio/src/lewton_decoder.rs +++ b/audio/src/lewton_decoder.rs @@ -2,12 +2,12 @@ extern crate lewton; use self::lewton::inside_ogg::OggStreamReader; +use super::{AudioDecoder, AudioError, AudioPacket}; use std::error; use std::fmt; use std::io::{Read, Seek}; pub struct VorbisDecoder(OggStreamReader); -pub struct VorbisPacket(Vec); pub struct VorbisError(lewton::VorbisError); impl VorbisDecoder @@ -17,41 +17,38 @@ where pub fn new(input: R) -> Result, VorbisError> { Ok(VorbisDecoder(OggStreamReader::new(input)?)) } +} - pub fn seek(&mut self, ms: i64) -> Result<(), VorbisError> { +impl AudioDecoder for VorbisDecoder +where + R: Read + Seek, +{ + fn seek(&mut self, ms: i64) -> Result<(), AudioError> { let absgp = ms * 44100 / 1000; - self.0.seek_absgp_pg(absgp as u64)?; - Ok(()) + match self.0.seek_absgp_pg(absgp as u64) { + Ok(_) => return Ok(()), + Err(err) => return Err(AudioError::VorbisError(err.into())), + } } - pub fn next_packet(&mut self) -> Result, VorbisError> { + fn next_packet(&mut self) -> Result, AudioError> { use self::lewton::audio::AudioReadError::AudioIsHeader; use self::lewton::OggReadError::NoCapturePatternFound; use self::lewton::VorbisError::BadAudio; use self::lewton::VorbisError::OggError; loop { match self.0.read_dec_packet_itl() { - Ok(Some(packet)) => return Ok(Some(VorbisPacket(packet))), + Ok(Some(packet)) => return Ok(Some(AudioPacket::Samples(packet))), Ok(None) => return Ok(None), Err(BadAudio(AudioIsHeader)) => (), Err(OggError(NoCapturePatternFound)) => (), - Err(err) => return Err(err.into()), + Err(err) => return Err(AudioError::VorbisError(err.into())), } } } } -impl VorbisPacket { - pub fn data(&self) -> &[i16] { - &self.0 - } - - pub fn data_mut(&mut self) -> &mut [i16] { - &mut self.0 - } -} - impl From for VorbisError { fn from(err: lewton::VorbisError) -> VorbisError { VorbisError(err) diff --git a/audio/src/lib.rs b/audio/src/lib.rs index 3e13c079a..fd7640714 100644 --- a/audio/src/lib.rs +++ b/audio/src/lib.rs @@ -20,6 +20,7 @@ mod fetch; mod lewton_decoder; #[cfg(any(feature = "with-tremor", feature = "with-vorbis"))] mod libvorbis_decoder; +mod passthrough_decoder; mod range_set; @@ -29,8 +30,70 @@ pub use fetch::{ READ_AHEAD_BEFORE_PLAYBACK_ROUNDTRIPS, READ_AHEAD_BEFORE_PLAYBACK_SECONDS, READ_AHEAD_DURING_PLAYBACK_ROUNDTRIPS, READ_AHEAD_DURING_PLAYBACK_SECONDS, }; +use std::fmt; + +pub enum AudioPacket { + Samples(Vec), + OggData(Vec), +} + +impl AudioPacket { + pub fn samples(&self) -> &[i16] { + match self { + AudioPacket::Samples(s) => s, + AudioPacket::OggData(_) => panic!("can't return OggData on samples"), + } + } + + pub fn oggdata(&self) -> &[u8] { + match self { + AudioPacket::Samples(_) => panic!("can't return samples on OggData"), + AudioPacket::OggData(d) => d, + } + } + + pub fn is_empty(&self) -> bool { + match self { + AudioPacket::Samples(s) => s.is_empty(), + AudioPacket::OggData(d) => d.is_empty(), + } + } +} #[cfg(not(any(feature = "with-tremor", feature = "with-vorbis")))] -pub use crate::lewton_decoder::{VorbisDecoder, VorbisError, VorbisPacket}; +pub use crate::lewton_decoder::{VorbisDecoder, VorbisError}; #[cfg(any(feature = "with-tremor", feature = "with-vorbis"))] -pub use libvorbis_decoder::{VorbisDecoder, VorbisError, VorbisPacket}; +pub use libvorbis_decoder::{VorbisDecoder, VorbisError}; +pub use passthrough_decoder::{PassthroughDecoder, PassthroughError}; + +#[derive(Debug)] +pub enum AudioError { + PassthroughError(PassthroughError), + VorbisError(VorbisError), +} + +impl fmt::Display for AudioError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + match self { + AudioError::PassthroughError(err) => write!(f, "PassthroughError({})", err), + AudioError::VorbisError(err) => write!(f, "VorbisError({})", err), + } + } +} + +impl From for AudioError { + fn from(err: VorbisError) -> AudioError { + AudioError::VorbisError(VorbisError::from(err)) + } +} + +impl From for AudioError { + fn from(err: PassthroughError) -> AudioError { + AudioError::PassthroughError(PassthroughError::from(err)) + } +} + +pub trait AudioDecoder { + fn seek(&mut self, ms: i64) -> Result<(), AudioError>; + fn next_packet(&mut self) -> Result, AudioError>; +} diff --git a/audio/src/libvorbis_decoder.rs b/audio/src/libvorbis_decoder.rs index 48be2b864..8aced5562 100644 --- a/audio/src/libvorbis_decoder.rs +++ b/audio/src/libvorbis_decoder.rs @@ -3,12 +3,12 @@ extern crate librespot_tremor as vorbis; #[cfg(not(feature = "with-tremor"))] extern crate vorbis; +use super::{AudioDecoder, AudioError, AudioPacket}; use std::error; use std::fmt; use std::io::{Read, Seek}; pub struct VorbisDecoder(vorbis::Decoder); -pub struct VorbisPacket(vorbis::Packet); pub struct VorbisError(vorbis::VorbisError); impl VorbisDecoder @@ -18,23 +18,28 @@ where pub fn new(input: R) -> Result, VorbisError> { Ok(VorbisDecoder(vorbis::Decoder::new(input)?)) } +} +impl AudioDecoder for VorbisDecoder +where + R: Read + Seek, +{ #[cfg(not(feature = "with-tremor"))] - pub fn seek(&mut self, ms: i64) -> Result<(), VorbisError> { + fn seek(&mut self, ms: i64) -> Result<(), AudioError> { self.0.time_seek(ms as f64 / 1000f64)?; Ok(()) } #[cfg(feature = "with-tremor")] - pub fn seek(&mut self, ms: i64) -> Result<(), VorbisError> { + fn seek(&mut self, ms: i64) -> Result<(), AudioError> { self.0.time_seek(ms)?; Ok(()) } - pub fn next_packet(&mut self) -> Result, VorbisError> { + fn next_packet(&mut self) -> Result, AudioError> { loop { match self.0.packets().next() { - Some(Ok(packet)) => return Ok(Some(VorbisPacket(packet))), + Some(Ok(packet)) => return Ok(Some(AudioPacket::Samples(packet.data))), None => return Ok(None), Some(Err(vorbis::VorbisError::Hole)) => (), @@ -44,16 +49,6 @@ where } } -impl VorbisPacket { - pub fn data(&self) -> &[i16] { - &self.0.data - } - - pub fn data_mut(&mut self) -> &mut [i16] { - &mut self.0.data - } -} - impl From for VorbisError { fn from(err: vorbis::VorbisError) -> VorbisError { VorbisError(err) @@ -77,3 +72,9 @@ impl error::Error for VorbisError { error::Error::source(&self.0) } } + +impl From for AudioError { + fn from(err: vorbis::VorbisError) -> AudioError { + AudioError::VorbisError(VorbisError(err)) + } +} diff --git a/audio/src/passthrough_decoder.rs b/audio/src/passthrough_decoder.rs new file mode 100644 index 000000000..3a011011d --- /dev/null +++ b/audio/src/passthrough_decoder.rs @@ -0,0 +1,191 @@ +// Passthrough decoder for librespot +use super::{AudioDecoder, AudioError, AudioPacket}; +use ogg::{OggReadError, Packet, PacketReader, PacketWriteEndInfo, PacketWriter}; +use std::fmt; +use std::io::{Read, Seek}; +use std::time::{SystemTime, UNIX_EPOCH}; + +fn write_headers( + rdr: &mut PacketReader, + wtr: &mut PacketWriter>, +) -> Result { + let mut stream_serial: u32 = SystemTime::now() + .duration_since(UNIX_EPOCH) + .unwrap() + .as_millis() as u32; + + // search for ident, comment, setup + get_header(1, rdr, wtr, &mut stream_serial, PacketWriteEndInfo::EndPage)?; + get_header( + 3, + rdr, + wtr, + &mut stream_serial, + PacketWriteEndInfo::NormalPacket, + )?; + get_header(5, rdr, wtr, &mut stream_serial, PacketWriteEndInfo::EndPage)?; + + // remove un-needed packets + rdr.delete_unread_packets(); + return Ok(stream_serial); +} + +fn get_header( + code: u8, + rdr: &mut PacketReader, + wtr: &mut PacketWriter>, + stream_serial: &mut u32, + info: PacketWriteEndInfo, +) -> Result +where + T: Read + Seek, +{ + let pck: Packet = rdr.read_packet_expected()?; + + // set a unique serial number + if pck.stream_serial() != 0 { + *stream_serial = pck.stream_serial(); + } + + let pkt_type = pck.data[0]; + debug!("Vorbis header type{}", &pkt_type); + + // all headers are mandatory + if pkt_type != code { + return Err(PassthroughError(OggReadError::InvalidData)); + } + + // headers keep original granule number + let absgp_page = pck.absgp_page(); + wtr.write_packet( + pck.data.into_boxed_slice(), + *stream_serial, + info, + absgp_page, + ) + .unwrap(); + + return Ok(*stream_serial); +} + +pub struct PassthroughDecoder { + rdr: PacketReader, + wtr: PacketWriter>, + lastgp_page: Option, + absgp_page: u64, + stream_serial: u32, +} + +pub struct PassthroughError(ogg::OggReadError); + +impl PassthroughDecoder { + /// Constructs a new Decoder from a given implementation of `Read + Seek`. + pub fn new(rdr: R) -> Result { + let mut rdr = PacketReader::new(rdr); + let mut wtr = PacketWriter::new(Vec::new()); + + let stream_serial = write_headers(&mut rdr, &mut wtr)?; + info!("Starting passthrough track with serial {}", stream_serial); + + return Ok(PassthroughDecoder { + rdr, + wtr, + lastgp_page: Some(0), + absgp_page: 0, + stream_serial, + }); + } +} + +impl AudioDecoder for PassthroughDecoder { + fn seek(&mut self, ms: i64) -> Result<(), AudioError> { + info!("Seeking to {}", ms); + self.lastgp_page = match ms { + 0 => Some(0), + _ => None, + }; + + // hard-coded to 44.1 kHz + match self.rdr.seek_absgp(None, (ms * 44100 / 1000) as u64) { + Ok(_) => return Ok(()), + Err(err) => return Err(AudioError::PassthroughError(err.into())), + } + } + + fn next_packet(&mut self) -> Result, AudioError> { + let mut skip = self.lastgp_page.is_none(); + loop { + let pck = match self.rdr.read_packet() { + Ok(Some(pck)) => pck, + + Ok(None) | Err(OggReadError::NoCapturePatternFound) => { + info!("end of streaming"); + return Ok(None); + } + + Err(err) => return Err(AudioError::PassthroughError(err.into())), + }; + + let pckgp_page = pck.absgp_page(); + let lastgp_page = self.lastgp_page.get_or_insert(pckgp_page); + + // consume packets till next page to get a granule reference + if skip { + if *lastgp_page == pckgp_page { + debug!("skipping packet"); + continue; + } + skip = false; + info!("skipped at {}", pckgp_page); + } + + // now we can calculate absolute granule + self.absgp_page += pckgp_page - *lastgp_page; + self.lastgp_page = Some(pckgp_page); + + // set packet type + let inf = if pck.last_in_stream() { + self.lastgp_page = Some(0); + PacketWriteEndInfo::EndStream + } else if pck.last_in_page() { + PacketWriteEndInfo::EndPage + } else { + PacketWriteEndInfo::NormalPacket + }; + + self.wtr + .write_packet( + pck.data.into_boxed_slice(), + self.stream_serial, + inf, + self.absgp_page, + ) + .unwrap(); + + let data = self.wtr.inner_mut(); + + if data.len() > 0 { + let result = AudioPacket::OggData(std::mem::take(data)); + return Ok(Some(result)); + } + } + } +} + +impl fmt::Debug for PassthroughError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Debug::fmt(&self.0, f) + } +} + +impl From for PassthroughError { + fn from(err: OggReadError) -> PassthroughError { + PassthroughError(err) + } +} + +impl fmt::Display for PassthroughError { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Display::fmt(&self.0, f) + } +} diff --git a/playback/src/audio_backend/alsa.rs b/playback/src/audio_backend/alsa.rs index ae76f0571..bf7b13764 100644 --- a/playback/src/audio_backend/alsa.rs +++ b/playback/src/audio_backend/alsa.rs @@ -1,4 +1,5 @@ use super::{Open, Sink}; +use crate::audio::AudioPacket; use alsa::device_name::HintIter; use alsa::pcm::{Access, Format, Frames, HwParams, PCM}; use alsa::{Direction, Error, ValueOr}; @@ -124,8 +125,9 @@ impl Sink for AlsaSink { Ok(()) } - fn write(&mut self, data: &[i16]) -> io::Result<()> { + fn write(&mut self, packet: &AudioPacket) -> io::Result<()> { let mut processed_data = 0; + let data = packet.samples(); while processed_data < data.len() { let data_to_buffer = min( self.buffer.capacity() - self.buffer.len(), diff --git a/playback/src/audio_backend/gstreamer.rs b/playback/src/audio_backend/gstreamer.rs index d902cd3e3..6be6dd722 100644 --- a/playback/src/audio_backend/gstreamer.rs +++ b/playback/src/audio_backend/gstreamer.rs @@ -1,4 +1,5 @@ use super::{Open, Sink}; +use crate::audio::AudioPacket; use gst::prelude::*; use gst::*; use std::sync::mpsc::{sync_channel, SyncSender}; @@ -104,9 +105,9 @@ impl Sink for GstreamerSink { fn stop(&mut self) -> io::Result<()> { Ok(()) } - fn write(&mut self, data: &[i16]) -> io::Result<()> { + fn write(&mut self, packet: &AudioPacket) -> io::Result<()> { // Copy expensively (in to_vec()) to avoid thread synchronization - let deighta: &[u8] = data.as_bytes(); + let deighta: &[u8] = packet.samples().as_bytes(); self.tx .send(deighta.to_vec()) .expect("tx send failed in write function"); diff --git a/playback/src/audio_backend/jackaudio.rs b/playback/src/audio_backend/jackaudio.rs index 792e7e3bb..4699c1824 100644 --- a/playback/src/audio_backend/jackaudio.rs +++ b/playback/src/audio_backend/jackaudio.rs @@ -1,4 +1,5 @@ use super::{Open, Sink}; +use crate::audio::AudioPacket; use jack::{ AsyncClient, AudioOut, Client, ClientOptions, Control, Port, ProcessHandler, ProcessScope, }; @@ -73,8 +74,8 @@ impl Sink for JackSink { Ok(()) } - fn write(&mut self, data: &[i16]) -> io::Result<()> { - for s in data.iter() { + fn write(&mut self, packet: &AudioPacket) -> io::Result<()> { + for s in packet.samples().iter() { let res = self.send.send(*s); if res.is_err() { error!("jackaudio: cannot write to channel"); diff --git a/playback/src/audio_backend/mod.rs b/playback/src/audio_backend/mod.rs index b9db29fce..3f5dae8d4 100644 --- a/playback/src/audio_backend/mod.rs +++ b/playback/src/audio_backend/mod.rs @@ -1,3 +1,4 @@ +use crate::audio::AudioPacket; use std::io; pub trait Open { @@ -7,7 +8,7 @@ pub trait Open { pub trait Sink { fn start(&mut self) -> io::Result<()>; fn stop(&mut self) -> io::Result<()>; - fn write(&mut self, data: &[i16]) -> io::Result<()>; + fn write(&mut self, packet: &AudioPacket) -> io::Result<()>; } fn mk_sink(device: Option) -> Box { diff --git a/playback/src/audio_backend/pipe.rs b/playback/src/audio_backend/pipe.rs index 2adafe11c..210c0ce9f 100644 --- a/playback/src/audio_backend/pipe.rs +++ b/playback/src/audio_backend/pipe.rs @@ -1,4 +1,5 @@ use super::{Open, Sink}; +use crate::audio::AudioPacket; use std::fs::OpenOptions; use std::io::{self, Write}; use std::mem; @@ -26,12 +27,15 @@ impl Sink for StdoutSink { Ok(()) } - fn write(&mut self, data: &[i16]) -> io::Result<()> { - let data: &[u8] = unsafe { - slice::from_raw_parts( - data.as_ptr() as *const u8, - data.len() * mem::size_of::(), - ) + fn write(&mut self, packet: &AudioPacket) -> io::Result<()> { + let data: &[u8] = match packet { + AudioPacket::Samples(data) => unsafe { + slice::from_raw_parts( + data.as_ptr() as *const u8, + data.len() * mem::size_of::(), + ) + }, + AudioPacket::OggData(data) => data, }; self.0.write_all(data)?; diff --git a/playback/src/audio_backend/portaudio.rs b/playback/src/audio_backend/portaudio.rs index 31397bfb3..0e25021e0 100644 --- a/playback/src/audio_backend/portaudio.rs +++ b/playback/src/audio_backend/portaudio.rs @@ -1,4 +1,5 @@ use super::{Open, Sink}; +use crate::audio::AudioPacket; use portaudio_rs; use portaudio_rs::device::{get_default_output_index, DeviceIndex, DeviceInfo}; use portaudio_rs::stream::*; @@ -95,8 +96,8 @@ impl<'a> Sink for PortAudioSink<'a> { self.0 = None; Ok(()) } - fn write(&mut self, data: &[i16]) -> io::Result<()> { - match self.0.as_mut().unwrap().write(data) { + fn write(&mut self, packet: &AudioPacket) -> io::Result<()> { + match self.0.as_mut().unwrap().write(packet.samples()) { Ok(_) => (), Err(portaudio_rs::PaError::OutputUnderflowed) => error!("PortAudio write underflow"), Err(e) => panic!("PA Error {}", e), diff --git a/playback/src/audio_backend/pulseaudio.rs b/playback/src/audio_backend/pulseaudio.rs index 6c8d72110..11ea026ae 100644 --- a/playback/src/audio_backend/pulseaudio.rs +++ b/playback/src/audio_backend/pulseaudio.rs @@ -1,4 +1,5 @@ use super::{Open, Sink}; +use crate::audio::AudioPacket; use libpulse_binding::{self as pulse, stream::Direction}; use libpulse_simple_binding::Simple; use std::io; @@ -65,13 +66,17 @@ impl Sink for PulseAudioSink { Ok(()) } - fn write(&mut self, data: &[i16]) -> io::Result<()> { + fn write(&mut self, packet: &AudioPacket) -> io::Result<()> { if let Some(s) = &self.s { // SAFETY: An i16 consists of two bytes, so that the given slice can be interpreted // as a byte array of double length. Each byte pointer is validly aligned, and so // is the newly created slice. - let d: &[u8] = - unsafe { std::slice::from_raw_parts(data.as_ptr() as *const u8, data.len() * 2) }; + let d: &[u8] = unsafe { + std::slice::from_raw_parts( + packet.samples().as_ptr() as *const u8, + packet.samples().len() * 2, + ) + }; match s.write(d) { Ok(_) => Ok(()), diff --git a/playback/src/audio_backend/rodio.rs b/playback/src/audio_backend/rodio.rs index 866e8a8c8..3b920c302 100644 --- a/playback/src/audio_backend/rodio.rs +++ b/playback/src/audio_backend/rodio.rs @@ -1,6 +1,7 @@ use super::{Open, Sink}; extern crate cpal; extern crate rodio; +use crate::audio::AudioPacket; use cpal::traits::{DeviceTrait, HostTrait}; use std::process::exit; use std::{io, thread, time}; @@ -164,8 +165,8 @@ impl Sink for RodioSink { Ok(()) } - fn write(&mut self, data: &[i16]) -> io::Result<()> { - let source = rodio::buffer::SamplesBuffer::new(2, 44100, data); + fn write(&mut self, packet: &AudioPacket) -> io::Result<()> { + let source = rodio::buffer::SamplesBuffer::new(2, 44100, packet.samples()); self.rodio_sink.append(source); // Chunk sizes seem to be about 256 to 3000 ish items long. diff --git a/playback/src/audio_backend/sdl.rs b/playback/src/audio_backend/sdl.rs index 71d19e503..27d650f9e 100644 --- a/playback/src/audio_backend/sdl.rs +++ b/playback/src/audio_backend/sdl.rs @@ -1,4 +1,5 @@ use super::{Open, Sink}; +use crate::audio::AudioPacket; use sdl2::audio::{AudioQueue, AudioSpecDesired}; use std::{io, thread, time}; @@ -45,12 +46,12 @@ impl Sink for SdlSink { Ok(()) } - fn write(&mut self, data: &[i16]) -> io::Result<()> { + fn write(&mut self, packet: &AudioPacket) -> io::Result<()> { while self.queue.size() > (2 * 2 * 44_100) { // sleep and wait for sdl thread to drain the queue a bit thread::sleep(time::Duration::from_millis(10)); } - self.queue.queue(data); + self.queue.queue(packet.samples()); Ok(()) } } diff --git a/playback/src/audio_backend/subprocess.rs b/playback/src/audio_backend/subprocess.rs index 2af883605..0dd25638d 100644 --- a/playback/src/audio_backend/subprocess.rs +++ b/playback/src/audio_backend/subprocess.rs @@ -1,4 +1,5 @@ use super::{Open, Sink}; +use crate::audio::AudioPacket; use shell_words::split; use std::io::{self, Write}; use std::mem; @@ -43,11 +44,11 @@ impl Sink for SubprocessSink { Ok(()) } - fn write(&mut self, data: &[i16]) -> io::Result<()> { + fn write(&mut self, packet: &AudioPacket) -> io::Result<()> { let data: &[u8] = unsafe { slice::from_raw_parts( - data.as_ptr() as *const u8, - data.len() * mem::size_of::(), + packet.samples().as_ptr() as *const u8, + packet.samples().len() * mem::size_of::(), ) }; if let Some(child) = &mut self.child { diff --git a/playback/src/config.rs b/playback/src/config.rs index 0a9bb47d9..31f636261 100644 --- a/playback/src/config.rs +++ b/playback/src/config.rs @@ -55,6 +55,7 @@ pub struct PlayerConfig { pub normalisation_type: NormalisationType, pub normalisation_pregain: f32, pub gapless: bool, + pub passthrough: bool, } impl Default for PlayerConfig { @@ -65,6 +66,7 @@ impl Default for PlayerConfig { normalisation_type: NormalisationType::default(), normalisation_pregain: 0.0, gapless: true, + passthrough: false, } } } diff --git a/playback/src/player.rs b/playback/src/player.rs index a72b438f3..9b4eefb95 100644 --- a/playback/src/player.rs +++ b/playback/src/player.rs @@ -15,8 +15,8 @@ use librespot_core::spotify_id::SpotifyId; use librespot_core::util::SeqGenerator; +use crate::audio::{AudioDecoder, AudioError, AudioPacket, PassthroughDecoder, VorbisDecoder}; use crate::audio::{AudioDecrypt, AudioFile, StreamLoaderController}; -use crate::audio::{VorbisDecoder, VorbisPacket}; use crate::audio::{ READ_AHEAD_BEFORE_PLAYBACK_ROUNDTRIPS, READ_AHEAD_BEFORE_PLAYBACK_SECONDS, READ_AHEAD_DURING_PLAYBACK_ROUNDTRIPS, READ_AHEAD_DURING_PLAYBACK_SECONDS, @@ -378,7 +378,7 @@ enum PlayerPreload { }, } -type Decoder = VorbisDecoder>>; +type Decoder = Box; enum PlayerState { Stopped, @@ -723,7 +723,19 @@ impl PlayerTrackLoader { let audio_file = Subfile::new(decrypted_file, 0xa7); - let mut decoder = match VorbisDecoder::new(audio_file) { + let result = if self.config.passthrough { + match PassthroughDecoder::new(audio_file) { + Ok(result) => Ok(Box::new(result) as Decoder), + Err(e) => Err(AudioError::PassthroughError(e)), + } + } else { + match VorbisDecoder::new(audio_file) { + Ok(result) => Ok(Box::new(result) as Decoder), + Err(e) => Err(AudioError::VorbisError(e)), + } + }; + + let mut decoder = match result { Ok(decoder) => decoder, Err(e) if is_cached => { warn!( @@ -873,37 +885,44 @@ impl Future for PlayerInternal { { let packet = decoder.next_packet().expect("Vorbis error"); - if let Some(ref packet) = packet { - *stream_position_pcm = - *stream_position_pcm + (packet.data().len() / 2) as u64; - let stream_position_millis = Self::position_pcm_to_ms(*stream_position_pcm); - - let notify_about_position = match *reported_nominal_start_time { - None => true, - Some(reported_nominal_start_time) => { - // only notify if we're behind. If we're ahead it's probably due to a buffer of the backend and we;re actually in time. - let lag = (Instant::now() - reported_nominal_start_time).as_millis() - as i64 - - stream_position_millis as i64; - if lag > 1000 { - true - } else { - false + if !self.config.passthrough { + if let Some(ref packet) = packet { + *stream_position_pcm = + *stream_position_pcm + (packet.samples().len() / 2) as u64; + let stream_position_millis = + Self::position_pcm_to_ms(*stream_position_pcm); + + let notify_about_position = match *reported_nominal_start_time { + None => true, + Some(reported_nominal_start_time) => { + // only notify if we're behind. If we're ahead it's probably due to a buffer of the backend and we;re actually in time. + let lag = (Instant::now() - reported_nominal_start_time) + .as_millis() + as i64 + - stream_position_millis as i64; + if lag > 1000 { + true + } else { + false + } } + }; + if notify_about_position { + *reported_nominal_start_time = Some( + Instant::now() + - Duration::from_millis(stream_position_millis as u64), + ); + self.send_event(PlayerEvent::Playing { + track_id, + play_request_id, + position_ms: stream_position_millis as u32, + duration_ms, + }); } - }; - if notify_about_position { - *reported_nominal_start_time = Some( - Instant::now() - - Duration::from_millis(stream_position_millis as u64), - ); - self.send_event(PlayerEvent::Playing { - track_id, - play_request_id, - position_ms: stream_position_millis as u32, - duration_ms, - }); } + } else { + // position, even if irrelevant, must be set so that seek() is called + *stream_position_pcm = duration_ms.into(); } self.handle_packet(packet, normalisation_factor); @@ -1085,21 +1104,23 @@ impl PlayerInternal { } } - fn handle_packet(&mut self, packet: Option, normalisation_factor: f32) { + fn handle_packet(&mut self, packet: Option, normalisation_factor: f32) { match packet { Some(mut packet) => { - if packet.data().len() > 0 { - if let Some(ref editor) = self.audio_filter { - editor.modify_stream(&mut packet.data_mut()) - }; + if !packet.is_empty() { + if let AudioPacket::Samples(ref mut data) = packet { + if let Some(ref editor) = self.audio_filter { + editor.modify_stream(data) + } - if self.config.normalisation && normalisation_factor != 1.0 { - for x in packet.data_mut().iter_mut() { - *x = (*x as f32 * normalisation_factor) as i16; + if self.config.normalisation && normalisation_factor != 1.0 { + for x in data.iter_mut() { + *x = (*x as f32 * normalisation_factor) as i16; + } } } - if let Err(err) = self.sink.write(&packet.data()) { + if let Err(err) = self.sink.write(&packet) { error!("Could not write audio: {}", err); self.ensure_sink_stopped(false); } diff --git a/src/main.rs b/src/main.rs index 4c57808f4..6b2acb94f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -204,6 +204,11 @@ fn setup(args: &[String]) -> Setup { "", "disable-gapless", "disable gapless playback.", + ) + .optflag( + "", + "passthrough", + "Pass raw stream to output, only works for \"pipe\"." ); let matches = match opts.parse(&args[1..]) { @@ -354,6 +359,8 @@ fn setup(args: &[String]) -> Setup { } }; + let passthrough = matches.opt_present("passthrough"); + let player_config = { let bitrate = matches .opt_str("b") @@ -376,6 +383,7 @@ fn setup(args: &[String]) -> Setup { .opt_str("normalisation-pregain") .map(|pregain| pregain.parse::().expect("Invalid pregain float value")) .unwrap_or(PlayerConfig::default().normalisation_pregain), + passthrough, } }; From 19e22ef48626221f83a703353c45d9af24a97310 Mon Sep 17 00:00:00 2001 From: Sasha Hilton Date: Tue, 23 Feb 2021 00:13:13 +0000 Subject: [PATCH 17/35] Add note on issues/discussions. --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 9639e7690..33b2b76e2 100644 --- a/README.md +++ b/README.md @@ -27,7 +27,9 @@ There is some brief documentation on how the protocol works in the [docs](https: If you wish to learn more about how librespot works overall, the best way is to simply read the code, and ask any questions you have in our [Gitter Room](https://gitter.im/librespot-org/spotify-connect-resources). -# Issues +# Issues & Discussions +**We have recently started using Github discussions for general questions and feature requests, as they are a more natural medium for such cases, and allow for upvoting to prioritize feature development. Check them out [here](https://github.com/librespot-org/librespot/discussions). Bugs and issues with the underlying library should still be reported as issues.** + If you run into a bug when using librespot, please search the existing issues before opening a new one. Chances are, we've encountered it before, and have provided a resolution. If not, please open a new one, and where possible, include the backtrace librespot generates on crashing, along with anything we can use to reproduce the issue, eg. the Spotify URI of the song that caused the crash. # Building From 1fc5267a71d05f2bc36477041774bfe4d178096a Mon Sep 17 00:00:00 2001 From: johannesd3 Date: Tue, 23 Feb 2021 14:24:03 +0100 Subject: [PATCH 18/35] Revert "Merge pull request #548 from Lcchy/rodiojack-backend" This reverts commit f483075b2cde3e443929873e5abb2f072bac48a3, reversing changes made to ea8ece36d929f3a1e4325139db5a94591ffbf67e. --- COMPILING.md | 1 - Cargo.lock | 824 ++++++++++++---------------- Cargo.toml | 1 - README.md | 1 - playback/Cargo.toml | 1 - playback/src/audio_backend/mod.rs | 20 +- playback/src/audio_backend/rodio.rs | 117 +--- 7 files changed, 358 insertions(+), 607 deletions(-) diff --git a/COMPILING.md b/COMPILING.md index 40eefb395..7b3467eea 100644 --- a/COMPILING.md +++ b/COMPILING.md @@ -46,7 +46,6 @@ Depending on the chosen backend, specific development libraries are required. |PortAudio | `portaudio19-dev` | `portaudio-devel` | `portaudio` | |PulseAudio | `libpulse-dev` | `pulseaudio-libs-devel` | | |JACK | `libjack-dev` | `jack-audio-connection-kit-devel` | | -|JACK over Rodio | `libjack-dev` | `jack-audio-connection-kit-devel` | - | |SDL | `libsdl2-dev` | `SDL2-devel` | | |Pipe | - | - | - | diff --git a/Cargo.lock b/Cargo.lock index efaae37ad..074ecbf84 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,9 +2,9 @@ # It is not intended for manual editing. [[package]] name = "addr2line" -version = "0.14.1" +version = "0.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a55f82cfe485775d02112886f4169bde0c5894d75e79ead7eafe7e40a25e45f7" +checksum = "7c0929d69e78dd9bf5408269919fcbcaeb2e35e5d43e5815517cdc6a8e11a423" dependencies = [ "gimli", ] @@ -78,9 +78,9 @@ dependencies = [ [[package]] name = "alsa-sys" -version = "0.3.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8fee663d06c4e303404ef5f40488a53e062f89ba8bfed81f42325aafad1527" +checksum = "d5a0559bcd3f7a482690d98be41c08a43e92f669b179433e95ddf5e8b8fd36a3" dependencies = [ "libc", "pkg-config", @@ -88,9 +88,15 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.38" +version = "1.0.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c0df63cb2955042487fad3aefd2c6e3ae7389ac5dc1beb28921de0b69f779d4" + +[[package]] +name = "arc-swap" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afddf7f520a80dbf76e6f50a35bca42a2331ef227a28b3b6dc5c2e2338d114b1" +checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034" [[package]] name = "ascii" @@ -111,15 +117,15 @@ dependencies = [ [[package]] name = "autocfg" -version = "1.0.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a" +checksum = "f8aac770f1885fd7e387acedd76065302551364496e46b3dd00860b2f8359b9d" [[package]] name = "backtrace" -version = "0.3.56" +version = "0.3.55" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d117600f438b1707d4e4ae15d3595657288f8235a0eb593e80ecc98ab34e1bc" +checksum = "ef5140344c85b01f9bbb4d4b7288a8aa4b3287ccef913a14bcc78a1063623598" dependencies = [ "addr2line", "cfg-if 1.0.0", @@ -129,12 +135,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "base-x" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4521f3e3d031370679b3b140beb36dfe4801b09ac77e30c61941f97df3ef28b" - [[package]] name = "base64" version = "0.9.3" @@ -145,6 +145,21 @@ dependencies = [ "safemem", ] +[[package]] +name = "base64" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b25d992356d2eb0ed82172f5248873db5560c4721f564b13cb5193bda5e668e" +dependencies = [ + "byteorder", +] + +[[package]] +name = "base64" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b41b7ea54a0c9d92199de89e20e58d49f02f8e699814ef3fdf266f6f748d15c7" + [[package]] name = "base64" version = "0.13.0" @@ -153,12 +168,13 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" [[package]] name = "bindgen" -version = "0.56.0" +version = "0.53.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da379dbebc0b76ef63ca68d8fc6e71c0f13e59432e0987e508c1820e6ab5239" +checksum = "c72a978d268b1d70b0e963217e60fdabd9523a941457a6c42a7315d15c7e89e5" dependencies = [ "bitflags", "cexpr", + "cfg-if 0.1.10", "clang-sys", "lazy_static", "lazycell", @@ -181,9 +197,9 @@ dependencies = [ [[package]] name = "bit-vec" -version = "0.6.3" +version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" +checksum = "5f0dc55f2d8a1a85650ac47858bb001b4c0dd73d79e3c455a842925e68d29cd3" [[package]] name = "bitflags" @@ -239,9 +255,9 @@ checksum = "8d696c370c750c948ada61c69a0ee2cbbb9c50b1019ddb86d9317157a99c2cae" [[package]] name = "bumpalo" -version = "3.6.0" +version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099e596ef14349721d9016f6b80dd3419ea1bf289ab9b44df8e4dfd3a005d5d9" +checksum = "2e8c087f005730276d1096a652e92a8bacee2e2472bcc9715a74d2bec38b5820" [[package]] name = "byte-tools" @@ -251,9 +267,9 @@ checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" [[package]] name = "byteorder" -version = "1.4.2" +version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b" +checksum = "08c48aae112d48ed9f069b33538ea9e3e90aa263cfa3d1c24309612b1f7472de" [[package]] name = "bytes" @@ -267,15 +283,15 @@ dependencies = [ [[package]] name = "bytes" -version = "1.0.1" +version = "0.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" +checksum = "0e4cec68f03f32e44924783795810fa50a7035d8c8ebe78580ad7e6c703fba38" [[package]] name = "cc" -version = "1.0.66" +version = "1.0.65" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c0496836a84f8d0495758516b8621a622beb77c0fed418570e50764093ced48" +checksum = "95752358c8f7552394baf48cd82695b345628ad3f170d607de3ca03b8dacca15" [[package]] name = "cesu8" @@ -306,22 +322,20 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.19" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "670ad68c9088c2a963aaa298cb369688cf3f9465ce5e2d4ca10e6e0098a1ce73" +checksum = "c74d84029116787153e02106bf53e66828452a4b325cc8652b788b5967c0a0b6" dependencies = [ - "libc", "num-integer", "num-traits", - "time 0.1.43", - "winapi 0.3.9", + "time", ] [[package]] name = "chunked_transfer" -version = "1.4.0" +version = "1.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff857943da45f546682664a79488be82e69e43c1a7a2307679ab9afb3a66d2e" +checksum = "7477065d45a8fe57167bf3cf8bcd3729b54cfcb81cca49bda2d038ea89ae82ca" [[package]] name = "cipher" @@ -334,13 +348,13 @@ dependencies = [ [[package]] name = "clang-sys" -version = "1.0.3" +version = "0.29.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0659001ab56b791be01d4b729c44376edc6718cf389a502e579b77b758f3296c" +checksum = "fe6837df1d5cba2397b835c8530f51723267e16abbf83892e9e5af4f0e5dd10a" dependencies = [ "glob", "libc", - "libloading", + "libloading 0.5.2", ] [[package]] @@ -352,6 +366,15 @@ dependencies = [ "bitflags", ] +[[package]] +name = "cloudabi" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467" +dependencies = [ + "bitflags", +] + [[package]] name = "combine" version = "3.8.1" @@ -367,45 +390,23 @@ dependencies = [ [[package]] name = "combine" -version = "4.5.2" +version = "4.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc4369b5e4c0cddf64ad8981c0111e7df4f7078f4d6ba98fb31f2e17c4c57b7e" +checksum = "b9417a0c314565e2abffaece67e95a8cb51f9238cd39f3764d9dfdf09e72b20c" dependencies = [ - "bytes 1.0.1", + "bytes 0.5.6", "memchr", + "pin-project-lite", ] -[[package]] -name = "const_fn" -version = "0.4.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28b9d6de7f49e22cf97ad17fc4036ece69300032f45f78f30b4a4482cdc3f4a6" - [[package]] name = "cookie" -version = "0.14.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "784ad0fbab4f3e9cef09f20e0aea6000ae08d2cb98ac4c0abc53df18803d702f" -dependencies = [ - "percent-encoding 2.1.0", - "time 0.2.25", - "version_check", -] - -[[package]] -name = "cookie_store" version = "0.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3818dfca4b0cb5211a659bbcbb94225b7127407b2b135e650d717bfb78ab10d3" +checksum = "888604f00b3db336d2af898ec3c1d5d0ddf5e6d462220f2ededc33a87ac4bbd5" dependencies = [ - "cookie", - "idna 0.2.1", - "log 0.4.14", - "publicsuffix", - "serde", - "serde_json", - "time 0.2.25", - "url 2.2.0", + "time", + "url 1.7.2", ] [[package]] @@ -426,9 +427,9 @@ dependencies = [ [[package]] name = "coreaudio-sys" -version = "0.2.8" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b7e3347be6a09b46aba228d6608386739fb70beff4f61e07422da87b0bb31fa" +checksum = "d6570ee6e089131e928d5ec9236db9e818aa3cf850f48b0eec6ef700571271d4" dependencies = [ "bindgen", ] @@ -442,7 +443,6 @@ dependencies = [ "alsa", "core-foundation-sys", "coreaudio-rs", - "jack", "jni 0.17.0", "js-sys", "lazy_static", @@ -453,7 +453,7 @@ dependencies = [ "nix", "oboe", "parking_lot 0.11.1", - "stdweb 0.1.3", + "stdweb", "thiserror", "web-sys", "winapi 0.3.9", @@ -597,9 +597,9 @@ dependencies = [ [[package]] name = "derivative" -version = "2.2.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +checksum = "cb582b60359da160a9477ee80f15c8d784c477e69c217ef2cdd4169c24ea380f" dependencies = [ "proc-macro2", "quote", @@ -624,12 +624,6 @@ dependencies = [ "generic-array 0.14.4", ] -[[package]] -name = "discard" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "212d0f5754cb6769937f4501cc0e67f4f4483c8d2c3e1e922ee9edbe4ab4c7c0" - [[package]] name = "dns-sd" version = "0.1.3" @@ -654,15 +648,15 @@ checksum = "f26ecb66b4bdca6c1409b40fb255eefc2bd4f6d135dab3c3124f80ffa2a9661e" dependencies = [ "atty", "humantime", - "log 0.4.14", + "log 0.4.11", "termcolor", ] [[package]] name = "error-chain" -version = "0.12.4" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d2f06b9cac1506ece98fe3231e3cc9c4410ec3d5b1f24ae1c8946f0742cdefc" +checksum = "d371106cc88ffdfb1eabd7111e432da544f16f3e2d7bf1dfe8bf575f1df045cd" dependencies = [ "backtrace", "version_check", @@ -676,9 +670,9 @@ checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" [[package]] name = "fetch_unroll" -version = "0.2.2" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8d44807d562d137f063cbfe209da1c3f9f2fa8375e11166ef495daab7b847f9" +checksum = "b5c55005e95bbe15f5f72a73b6597d0dc82ddc97ffe2ca097a99dcd591fefbca" dependencies = [ "libflate", "tar", @@ -687,13 +681,13 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.14" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d34cfa13a63ae058bfa601fe9e313bbdb3746427c1459185464ce0fcf62e1e8" +checksum = "0c122a393ea57648015bf06fbd3d372378992e86b9ff5a7a497b076a28c79efe" dependencies = [ "cfg-if 1.0.0", "libc", - "redox_syscall 0.2.4", + "redox_syscall", "winapi 0.3.9", ] @@ -737,24 +731,24 @@ checksum = "3dcaa9ae7725d12cdb85b3ad99a434db70b468c09ded17e012d86b5c1010f7a7" [[package]] name = "futures" -version = "0.1.30" +version = "0.1.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c7e4c2612746b0df8fed4ce0c69156021b704c9aefa360311c04e6e9e002eed" +checksum = "1b980f2816d6ee8673b6517b52cb0e808a180efc92e5c19d02cdda79066703ef" [[package]] name = "futures-channel" -version = "0.3.12" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2d31b7ec7efab6eefc7c57233bb10b847986139d88cc2f5a02a1ae6871a1846" +checksum = "f366ad74c28cca6ba456d95e6422883cfb4b252a83bed929c83abfdbbf2967d5" dependencies = [ "futures-core", ] [[package]] name = "futures-core" -version = "0.3.12" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e5145dde8da7d1b3892dad07a9c98fc04bc39892b1ecc9692cf53e2b780a65" +checksum = "59f5fff90fd5d971f936ad674802482ba441b6f09ba5e15fd8b39145582ca399" [[package]] name = "futures-cpupool" @@ -768,9 +762,9 @@ dependencies = [ [[package]] name = "futures-executor" -version = "0.3.12" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e9e59fdc009a4b3096bf94f740a0f2424c082521f20a9b08c5c07c48d90fd9b9" +checksum = "10d6bb888be1153d3abeb9006b11b02cf5e9b209fda28693c31ae1e4e012e314" dependencies = [ "futures-core", "futures-task", @@ -779,9 +773,9 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.12" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c287d25add322d9f9abdcdc5927ca398917996600182178774032e9f8258fedd" +checksum = "d0b5a30a4328ab5473878237c447333c093297bded83a4983d10f4deea240d39" dependencies = [ "proc-macro-hack", "proc-macro2", @@ -791,29 +785,29 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.12" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "caf5c69029bda2e743fddd0582d1083951d65cc9539aebf8812f36c3491342d6" +checksum = "3f2032893cb734c7a05d85ce0cc8b8c4075278e93b24b66f9de99d6eb0fa8acc" [[package]] name = "futures-task" -version = "0.3.12" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "13de07eb8ea81ae445aca7b69f5f7bf15d7bf4912d8ca37d6645c77ae8a58d86" +checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626" dependencies = [ "once_cell", ] [[package]] name = "futures-util" -version = "0.3.12" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "632a8cd0f2a4b3fdea1657f08bde063848c3bd00f9bbf6e256b8be78802e624b" +checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6" dependencies = [ "futures-core", "futures-macro", "futures-task", - "pin-project-lite", + "pin-project", "pin-utils", "proc-macro-hack", "proc-macro-nested", @@ -856,24 +850,13 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.1.16" +version = "0.1.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" +checksum = "7abc8dd8451921606d809ba32e95b6111925cd2906060d2dcc29c070220503eb" dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - -[[package]] -name = "getrandom" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" -dependencies = [ - "cfg-if 1.0.0", + "cfg-if 0.1.10", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi", ] [[package]] @@ -1044,18 +1027,18 @@ dependencies = [ [[package]] name = "heck" -version = "0.3.2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cbf45460356b7deeb5e3415b5563308c0a9b057c85e12b06ad551f98d0a6ac" +checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205" dependencies = [ "unicode-segmentation", ] [[package]] name = "hermit-abi" -version = "0.1.18" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "322f4de77956e22ed0e5032c359a0f1273f1f7f0d79bfa3b8ffbc730d7fbcc5c" +checksum = "3deed196b6e7f9e44a2ae8d94225d80302d81208b1bb673fd21fe634645c85a9" dependencies = [ "libc", ] @@ -1089,15 +1072,15 @@ dependencies = [ [[package]] name = "httparse" -version = "1.3.5" +version = "1.3.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "615caabe2c3160b313d52ccc905335f4ed5f10881dd63dc5699d47e90be85691" +checksum = "cd179ae861f0c2e53da70d892f5f3029f9594be0c41dc5269cd371691b1dc2f9" [[package]] name = "humantime" -version = "2.1.0" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" +checksum = "3c1ad908cc71012b7bea4d0c53ba96a8cba9962f048fa68d143376143d863b7a" [[package]] name = "hyper" @@ -1112,12 +1095,12 @@ dependencies = [ "httparse", "iovec", "language-tags", - "log 0.4.14", + "log 0.4.11", "mime", "net2", "percent-encoding 1.0.1", "relay", - "time 0.1.43", + "time", "tokio-core", "tokio-io", "tokio-proto", @@ -1158,9 +1141,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.2.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de910d521f7cc3135c4de8db1cb910e0b5ed1dc6f57c381cd07e8e661ce10094" +checksum = "02e2673c30ee86b5b96a9cb52ad15718aa1f966f5ab9ad54a8b95d5ca33120a9" dependencies = [ "matches", "unicode-bidi", @@ -1169,9 +1152,9 @@ dependencies = [ [[package]] name = "if-addrs" -version = "0.6.5" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28538916eb3f3976311f5dfbe67b5362d0add1293d0a9cad17debf86f8e3aa48" +checksum = "f12906406f12abf5569643c46b29aec78313dc1537b17dd5c5250169790c4db9" dependencies = [ "if-addrs-sys", "libc", @@ -1180,9 +1163,9 @@ dependencies = [ [[package]] name = "if-addrs-sys" -version = "0.3.2" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de74b9dd780476e837e5eb5ab7c88b49ed304126e412030a0adba99c8efe79ea" +checksum = "9e2556f16544202bcfe0aa5d20a01a6b815f736b136b3ad76dc547ee6b5bb1df" dependencies = [ "cc", "libc", @@ -1217,9 +1200,9 @@ dependencies = [ [[package]] name = "itoa" -version = "0.4.7" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd25036021b0de88a0aff6b850051563c6516d0bf53f8638938edbb9de732736" +checksum = "dc6f3ad7b9d11a0c00842ff8de1b60ee58661048eb8049ed33c73594f359d7e6" [[package]] name = "jack" @@ -1235,13 +1218,13 @@ dependencies = [ [[package]] name = "jack-sys" -version = "0.2.1" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e1d6ab7ada402b6a27912a2b86504be62a48c58313c886fe72a059127acb4d7" +checksum = "c0d4ca501477fd3cd93a36df581046e5d6338ed826cf7e9b8d302603521e6cc3" dependencies = [ "lazy_static", "libc", - "libloading", + "libloading 0.4.3", ] [[package]] @@ -1254,7 +1237,7 @@ dependencies = [ "combine 3.8.1", "error-chain", "jni-sys", - "log 0.4.14", + "log 0.4.11", "walkdir", ] @@ -1265,10 +1248,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "36bcc950632e48b86da402c5c077590583da5ac0d480103611d5374e7c967a3c" dependencies = [ "cesu8", - "combine 4.5.2", + "combine 4.4.0", "error-chain", "jni-sys", - "log 0.4.14", + "log 0.4.11", "walkdir", ] @@ -1280,9 +1263,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "js-sys" -version = "0.3.47" +version = "0.3.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5cfb73131c35423a367daf8cbd24100af0d077668c8c2943f0e7dd775fef0f65" +checksum = "cf3d7383929f7c9c7c2d0fa596f325832df98c3704f2c60553080f7127a58175" dependencies = [ "wasm-bindgen", ] @@ -1311,9 +1294,9 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "lazycell" -version = "1.3.0" +version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" +checksum = "b294d6fa9ee409a054354afc4352b0b9ef7ca222c69b8812cbea9e7d2bf3783f" [[package]] name = "lewton" @@ -1323,40 +1306,45 @@ checksum = "777b48df9aaab155475a83a7df3070395ea1ac6902f5cd062b8f2b028075c030" dependencies = [ "byteorder", "ogg", - "tinyvec", + "tinyvec 1.1.1", ] [[package]] name = "libc" -version = "0.2.85" +version = "0.2.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ccac4b00700875e6a07c6cde370d44d32fa01c5a65cdd2fca6858c479d28bb3" +checksum = "bd7d4bd64732af4bf3a67f367c27df8520ad7e230c5817b8ff485864d80242b9" [[package]] name = "libflate" -version = "1.0.3" +version = "0.1.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "389de7875e06476365974da3e7ff85d55f1972188ccd9f6020dd7c8156e17914" +checksum = "d9135df43b1f5d0e333385cb6e7897ecd1a43d7d11b91ac003f4d2c2d2401fdd" dependencies = [ "adler32", "crc32fast", - "libflate_lz77", "rle-decode-fast", + "take_mut", ] [[package]] -name = "libflate_lz77" -version = "1.0.0" +name = "libloading" +version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3286f09f7d4926fc486334f28d8d2e6ebe4f7f9994494b6dab27ddfad2c9b11b" +checksum = "fd38073de8f7965d0c17d30546d4bb6da311ab428d1c7a3fc71dff7f9d4979b9" +dependencies = [ + "kernel32-sys", + "lazy_static", + "winapi 0.2.8", +] [[package]] name = "libloading" -version = "0.6.7" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "351a32417a12d5f7e82c368a66781e307834dae04c6ce0cd4456d52989229883" +checksum = "f2b111a074963af1d37a139918ac6d49ad1d0d5e47f72fd55388619691a7d753" dependencies = [ - "cfg-if 1.0.0", + "cc", "winapi 0.3.9", ] @@ -1370,7 +1358,7 @@ dependencies = [ "futures", "hostname", "if-addrs", - "log 0.4.14", + "log 0.4.11", "multimap", "net2", "quick-error", @@ -1380,11 +1368,10 @@ dependencies = [ [[package]] name = "libpulse-binding" -version = "2.23.0" +version = "2.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2405f806801527dfb3d2b6d48a282cdebe9a1b41b0652e0d7b5bad81dbc700e" +checksum = "1e8f85a42300c868de4849bb72eda5a65cea08c3ca61396b72c2d7c28a87f055" dependencies = [ - "bitflags", "libc", "libpulse-sys", "num-derive", @@ -1394,9 +1381,9 @@ dependencies = [ [[package]] name = "libpulse-simple-binding" -version = "2.23.0" +version = "2.18.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a574975292db859087c3957b9182f7d53278553f06bddaa2099c90e4ac3a0ee0" +checksum = "a047f4502997eed57b3e9d8e71f2b860da91a20bb7e15c65d1f183a7b4fb1226" dependencies = [ "libpulse-binding", "libpulse-simple-sys", @@ -1405,9 +1392,9 @@ dependencies = [ [[package]] name = "libpulse-simple-sys" -version = "1.16.1" +version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "468cf582b7b022c0d1b266fefc7fc8fa7b1ddcb61214224f2f105c95a9c2d5c1" +checksum = "9b72cb239bc4de6858fa0bbad27419e72cd4466f079ca56f21d94b0a712ab02e" dependencies = [ "libpulse-sys", "pkg-config", @@ -1415,9 +1402,9 @@ dependencies = [ [[package]] name = "libpulse-sys" -version = "1.18.0" +version = "1.15.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf17e9832643c4f320c42b7d78b2c0510f45aa5e823af094413b94e45076ba82" +checksum = "706e95c4b87ebb81c1e7763c74bf7d5ba897208f1a8aa5fc7bea8298dee8f2ca" dependencies = [ "libc", "num-derive", @@ -1442,7 +1429,7 @@ dependencies = [ "librespot-metadata", "librespot-playback", "librespot-protocol", - "log 0.4.14", + "log 0.4.11", "num-bigint", "protobuf", "rand 0.7.3", @@ -1467,7 +1454,7 @@ dependencies = [ "lewton", "librespot-core", "librespot-tremor", - "log 0.4.14", + "log 0.4.11", "num-bigint", "num-traits", "ogg", @@ -1490,7 +1477,7 @@ dependencies = [ "librespot-core", "librespot-playback", "librespot-protocol", - "log 0.4.14", + "log 0.4.11", "num-bigint", "protobuf", "rand 0.7.3", @@ -1518,7 +1505,7 @@ dependencies = [ "hyper-proxy", "lazy_static", "librespot-protocol", - "log 0.4.14", + "log 0.4.11", "num-bigint", "num-integer", "num-traits", @@ -1547,7 +1534,7 @@ dependencies = [ "librespot-core", "librespot-protocol", "linear-map", - "log 0.4.14", + "log 0.4.11", "protobuf", ] @@ -1569,7 +1556,7 @@ dependencies = [ "librespot-audio", "librespot-core", "librespot-metadata", - "log 0.4.14", + "log 0.4.11", "portaudio-rs", "rodio", "sdl2", @@ -1629,16 +1616,16 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e19e8d5c34a3e0e2223db8e060f9e8264aeeb5c5fc64a4ee9965c062211c024b" dependencies = [ - "log 0.4.14", + "log 0.4.11", ] [[package]] name = "log" -version = "0.4.14" +version = "0.4.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710" +checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" dependencies = [ - "cfg-if 1.0.0", + "cfg-if 0.1.10", ] [[package]] @@ -1670,15 +1657,15 @@ checksum = "60302e4db3a61da70c0cb7991976248362f30319e88850c487b9b95bbf059e00" [[package]] name = "memchr" -version = "2.3.4" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ee1c47aaa256ecabcaea351eae4a9b01ef39ed810004e298d2511ed284b1525" +checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400" [[package]] name = "memoffset" -version = "0.5.6" +version = "0.5.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "043175f069eda7b85febe4a74abbaeff828d9f8b448515d3151a14a3542811aa" +checksum = "c198b026e1bbf08a937e94c6c60f9ec4a2267f5b0d2eec9c1b21b061ce2be55f" dependencies = [ "autocfg", ] @@ -1701,9 +1688,9 @@ dependencies = [ [[package]] name = "mio" -version = "0.6.23" +version = "0.6.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4afd66f5b91bf2a3bc13fad0e21caedac168ca4c707504e75585648ae80e4cc4" +checksum = "fce347092656428bc8eaf6201042cb551b8d67855af7374542a92a0fbfcac430" dependencies = [ "cfg-if 0.1.10", "fuchsia-zircon", @@ -1711,8 +1698,8 @@ dependencies = [ "iovec", "kernel32-sys", "libc", - "log 0.4.14", - "miow 0.2.2", + "log 0.4.11", + "miow 0.2.1", "net2", "slab 0.4.2", "winapi 0.2.8", @@ -1724,9 +1711,9 @@ version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0840c1c50fd55e521b247f949c241c9997709f23bd7f023b9762cd561e935656" dependencies = [ - "log 0.4.14", + "log 0.4.11", "mio", - "miow 0.3.6", + "miow 0.3.5", "winapi 0.3.9", ] @@ -1743,9 +1730,9 @@ dependencies = [ [[package]] name = "miow" -version = "0.2.2" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ebd808424166322d4a38da87083bfddd3ac4c131334ed55856112eb06d46944d" +checksum = "8c1f2f3b1cf331de6896aabf6e9d55dca90356cc9960cca7eaaf408a355ae919" dependencies = [ "kernel32-sys", "net2", @@ -1755,9 +1742,9 @@ dependencies = [ [[package]] name = "miow" -version = "0.3.6" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a33c1b55807fbed163481b5ba66db4b2fa6cde694a5027be10fb724206c5897" +checksum = "07b88fb9795d4d36d62a012dfbf49a8f5cf12751f36d31a9dbe66d528e58979e" dependencies = [ "socket2", "winapi 0.3.9", @@ -1771,9 +1758,9 @@ checksum = "0419348c027fa7be448d2ae7ea0e4e04c2334c31dc4e74ab29f00a2a7ca69204" [[package]] name = "multimap" -version = "0.8.2" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1255076139a83bb467426e7f8d0134968a8118844faa755985e077cf31850333" +checksum = "d8883adfde9756c1d30b0f519c9b8c502a94b41ac62f696453c37c7fc0a958ce" dependencies = [ "serde", ] @@ -1798,7 +1785,7 @@ checksum = "bdf399b8b7a39c6fb153c4ec32c72fd5fe789df24a647f229c239aa7adb15241" dependencies = [ "lazy_static", "libc", - "log 0.4.14", + "log 0.4.11", "ndk", "ndk-macro", "ndk-sys", @@ -1825,9 +1812,9 @@ checksum = "c44922cb3dbb1c70b5e5f443d63b64363a898564d739ba5198e3a9138442868d" [[package]] name = "net2" -version = "0.2.37" +version = "0.2.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "391630d12b68002ae1e25e8f974306474966550ad82dac6886fb8910c19568ae" +checksum = "2ba7c918ac76704fb42afcbbb43891e72731f3dcca3bef2a19786297baf14af7" dependencies = [ "cfg-if 0.1.10", "libc", @@ -1881,9 +1868,9 @@ dependencies = [ [[package]] name = "num-integer" -version = "0.1.44" +version = "0.1.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2cc698a63b549a70bc047073d2949cce27cd1c7b0a4a862d08a8031bc2801db" +checksum = "8d59457e662d541ba17869cf51cf177c0b5f0cbf476c66bdc90bf1edac4f875b" dependencies = [ "autocfg", "num-traits", @@ -1902,9 +1889,9 @@ dependencies = [ [[package]] name = "num-traits" -version = "0.2.14" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290" +checksum = "ac267bcc07f48ee5f8935ab0d24f316fb722d7a1292e2913f0cc196b29ffd611" dependencies = [ "autocfg", ] @@ -1943,9 +1930,9 @@ dependencies = [ [[package]] name = "object" -version = "0.23.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9a7ab5d64814df0fe4a4b5ead45ed6c5f181ee3ff04ba344313a6c80446c5d4" +checksum = "8d3b63360ec3cb337817c2dbd47ab4a0f170d285d8e5a2064600f3def1402397" [[package]] name = "oboe" @@ -2027,7 +2014,7 @@ checksum = "6d7744ac029df22dca6284efe4e898991d28e3085c706c972bcd7da4a27a15eb" dependencies = [ "instant", "lock_api 0.4.2", - "parking_lot_core 0.8.2", + "parking_lot_core 0.8.0", ] [[package]] @@ -2037,25 +2024,26 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b876b1b9e7ac6e1a74a6da34d25c42e17e8862aa409cbbbdcfc8d86c6f3bc62b" dependencies = [ "cfg-if 0.1.10", - "cloudabi", + "cloudabi 0.0.3", "libc", - "redox_syscall 0.1.57", + "redox_syscall", "rustc_version", - "smallvec 0.6.14", + "smallvec 0.6.13", "winapi 0.3.9", ] [[package]] name = "parking_lot_core" -version = "0.8.2" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ccb628cad4f84851442432c60ad8e1f607e29752d0bf072cbd0baf28aa34272" +checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b" dependencies = [ - "cfg-if 1.0.0", + "cfg-if 0.1.10", + "cloudabi 0.1.0", "instant", "libc", - "redox_syscall 0.1.57", - "smallvec 1.6.1", + "redox_syscall", + "smallvec 1.5.0", "winapi 0.3.9", ] @@ -2093,11 +2081,31 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d4fd5641d01c8f18a23da7b6fe29298ff4b55afcccdf78973b24cf3175fee32e" +[[package]] +name = "pin-project" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12e3a6cdbfe94a5e4572812a0201f8c0ed98c1c452c7b8563ce2276988ef9c17" +dependencies = [ + "pin-project-internal", +] + +[[package]] +name = "pin-project-internal" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a0ffd45cf79d88737d7cc85bfd5d2894bee1139b356e616fe85dc389c61aaf7" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "pin-project-lite" -version = "0.2.4" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "439697af366c49a6d0a010c56a0d97685bc140ce0d377b13a2ea2aa42d64a827" +checksum = "c917123afa01924fc84bb20c4c03f004d9c38e5127e3c039bbf7f4b9c76a2f6b" [[package]] name = "pin-utils" @@ -2107,9 +2115,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.19" +version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3831453b3449ceb48b6d9c7ad7c96d5ea673e9b470a1dc578c2ce6521230884c" +checksum = "d36492546b6af1463394d46f0c834346f31548646f6ba10849802c9c9a27ac33" [[package]] name = "portaudio-rs" @@ -2134,9 +2142,9 @@ dependencies = [ [[package]] name = "ppv-lite86" -version = "0.2.10" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac74c624d6b2d21f425f752262f42188365d7b8ff1aff74c82e45136510a4857" +checksum = "237a5ed80e274dbc66f86bd59c1e25edc039660be53194b5fe0a482e0f2612ea" [[package]] name = "pretty-hex" @@ -2179,21 +2187,21 @@ dependencies = [ [[package]] name = "proc-macro-hack" -version = "0.5.19" +version = "0.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" +checksum = "7e0456befd48169b9f13ef0f0ad46d492cf9d2dbb918bcf38e01eed4ce3ec5e4" [[package]] name = "proc-macro-nested" -version = "0.1.7" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" +checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" [[package]] name = "proc-macro2" -version = "1.0.24" +version = "1.0.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e0704ee1a7e00d7bb417d0770ea303c1bccbabf0ef1667dae92b5967f5f8a71" +checksum = "04f5f085b5d71e2188cb8271e5da0161ad52c3f227a661a3c135fdf28e258b12" dependencies = [ "unicode-xid", ] @@ -2223,19 +2231,6 @@ dependencies = [ "protobuf-codegen", ] -[[package]] -name = "publicsuffix" -version = "1.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3bbaa49075179162b49acac1c6aa45fb4dafb5f13cf6794276d77bc7fd95757b" -dependencies = [ - "error-chain", - "idna 0.2.1", - "lazy_static", - "regex", - "url 2.2.0", -] - [[package]] name = "qstring" version = "0.7.2" @@ -2253,9 +2248,9 @@ checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" [[package]] name = "quote" -version = "1.0.8" +version = "1.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "991431c3519a3f36861882da93630ce66b52918dcf1b8e2fd66b397fc96f28df" +checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37" dependencies = [ "proc-macro2", ] @@ -2289,23 +2284,11 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "getrandom 0.1.16", + "getrandom", "libc", - "rand_chacha 0.2.2", + "rand_chacha", "rand_core 0.5.1", - "rand_hc 0.2.0", -] - -[[package]] -name = "rand" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" -dependencies = [ - "libc", - "rand_chacha 0.3.0", - "rand_core 0.6.1", - "rand_hc 0.3.0", + "rand_hc", ] [[package]] @@ -2318,16 +2301,6 @@ dependencies = [ "rand_core 0.5.1", ] -[[package]] -name = "rand_chacha" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" -dependencies = [ - "ppv-lite86", - "rand_core 0.6.1", -] - [[package]] name = "rand_core" version = "0.3.1" @@ -2349,16 +2322,7 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" dependencies = [ - "getrandom 0.1.16", -] - -[[package]] -name = "rand_core" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c026d7df8b298d90ccbbc5190bd04d85e159eaf5576caeacf8741da93ccbd2e5" -dependencies = [ - "getrandom 0.2.2", + "getrandom", ] [[package]] @@ -2370,15 +2334,6 @@ dependencies = [ "rand_core 0.5.1", ] -[[package]] -name = "rand_hc" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" -dependencies = [ - "rand_core 0.6.1", -] - [[package]] name = "rdrand" version = "0.4.0" @@ -2394,29 +2349,20 @@ version = "0.1.57" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" -[[package]] -name = "redox_syscall" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ec8ca9416c5ea37062b502703cd7fcb207736bc294f6e0cf367ac6fc234570" -dependencies = [ - "bitflags", -] - [[package]] name = "regex" -version = "1.4.3" +version = "1.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9251239e129e16308e70d853559389de218ac275b515068abc96829d05b948a" +checksum = "9c3780fcf44b193bc4d09f36d2a3c87b251da4a046c87795a0d35f4f927ad8e6" dependencies = [ "regex-syntax", ] [[package]] name = "regex-syntax" -version = "0.6.22" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5eb417147ba9860a96cfe72a0b93bf88fee1744b5636ec99ab20c1aa9376581" +checksum = "26412eb97c6b088a6997e05f69403a802a92d520de2f8e63c2b65f9e0f47c4e8" [[package]] name = "relay" @@ -2438,9 +2384,9 @@ dependencies = [ [[package]] name = "ring" -version = "0.16.20" +version = "0.16.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" +checksum = "70017ed5c555d79ee3538fc63ca09c70ad8f317dcadc1adc2c496b60c22bb24f" dependencies = [ "cc", "libc", @@ -2468,9 +2414,9 @@ dependencies = [ [[package]] name = "rpassword" -version = "5.0.1" +version = "5.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffc936cf8a7ea60c58f030fd36a612a48f440610214dc54bc36431f9ea0c3efb" +checksum = "d755237fc0f99d98641540e66abac8bc46a0652f19148ac9e21de2da06b326c9" dependencies = [ "libc", "winapi 0.3.9", @@ -2499,12 +2445,12 @@ dependencies = [ [[package]] name = "rustls" -version = "0.19.0" +version = "0.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "064fd21ff87c6e87ed4506e68beb42459caa4a0e2eb144932e6776768556980b" +checksum = "b25a18b1bf7387f0145e7f8324e700805aade3842dd3db2e74e4cdeb4677c09e" dependencies = [ - "base64 0.13.0", - "log 0.4.14", + "base64 0.10.1", + "log 0.4.11", "ring", "sct", "webpki", @@ -2593,18 +2539,15 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.123" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92d5161132722baa40d802cc70b15262b98258453e85e5d1d365c757c73869ae" -dependencies = [ - "serde_derive", -] +checksum = "5317f7588f0a5078ee60ef675ef96735a1442132dc645eb1d12c018620ed8cd3" [[package]] name = "serde_derive" -version = "1.0.123" +version = "1.0.114" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9391c295d64fc0abb2c556bad848f33cb8296276b1ad2677d1ae1ace4f258f31" +checksum = "2a0be94b04690fbaed37cddffc5c134bf537c8e3329d53e982fe04c374978f8e" dependencies = [ "proc-macro2", "quote", @@ -2613,9 +2556,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.61" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fceb2595057b6891a4ee808f70054bd2d12f0e97f1cbb78689b59f676df325a" +checksum = "3433e879a558dde8b5e8feb2a04899cf34fdde1fafb894687e52105fc1162ac3" dependencies = [ "itoa", "ryu", @@ -2647,12 +2590,6 @@ dependencies = [ "opaque-debug 0.3.0", ] -[[package]] -name = "sha1" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2579985fda508104f7587689507983eadd6a6e84dd35d6d115361f530916fa0d" - [[package]] name = "shannon" version = "0.2.0" @@ -2676,10 +2613,11 @@ checksum = "7fdf1b9db47230893d76faad238fd6097fd6d6a9245cd7a4d90dbd639536bbd2" [[package]] name = "signal-hook-registry" -version = "1.3.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "16f1d0fef1604ba8f7a073c7e701f213e056707210e9020af4528e0101ce11a6" +checksum = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41" dependencies = [ + "arc-swap", "libc", ] @@ -2703,27 +2641,28 @@ checksum = "4c8cbcd6df1e117c2210e13ab5109635ad68a929fcbb8964dc965b76cb5ee013" [[package]] name = "smallvec" -version = "0.6.14" +version = "0.6.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b97fcaeba89edba30f044a10c6a3cc39df9c3f17d7cd829dd1446cab35f890e0" +checksum = "f7b0758c52e15a8b5e3691eae6cc559f08eee9406e548a4477ba4e67770a82b6" dependencies = [ "maybe-uninit", ] [[package]] name = "smallvec" -version = "1.6.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe0f37c9e8f3c5a4a66ad655a93c74daac4ad00c441533bf5c6e7990bb42604e" +checksum = "7acad6f34eb9e8a259d3283d1e8c1d34d7415943d4895f65cc73813c7396fc85" [[package]] name = "socket2" -version = "0.3.19" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "122e570113d28d773067fab24266b66753f6ea915758651696b6e35e49f88d6e" +checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918" dependencies = [ - "cfg-if 1.0.0", + "cfg-if 0.1.10", "libc", + "redox_syscall", "winapi 0.3.9", ] @@ -2733,70 +2672,12 @@ version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" -[[package]] -name = "standback" -version = "0.2.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2beb4d1860a61f571530b3f855a1b538d0200f7871c63331ecd6f17b1f014f8" -dependencies = [ - "version_check", -] - [[package]] name = "stdweb" version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef5430c8e36b713e13b48a9f709cc21e046723fe44ce34587b73a830203b533e" -[[package]] -name = "stdweb" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d022496b16281348b52d0e30ae99e01a73d737b2f45d38fed4edf79f9325a1d5" -dependencies = [ - "discard", - "rustc_version", - "stdweb-derive", - "stdweb-internal-macros", - "stdweb-internal-runtime", - "wasm-bindgen", -] - -[[package]] -name = "stdweb-derive" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c87a60a40fccc84bef0652345bbbbbe20a605bf5d0ce81719fc476f5c03b50ef" -dependencies = [ - "proc-macro2", - "quote", - "serde", - "serde_derive", - "syn", -] - -[[package]] -name = "stdweb-internal-macros" -version = "0.2.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58fa5ff6ad0d98d1ffa8cb115892b6e69d67799f6763e162a1c9db421dc22e11" -dependencies = [ - "base-x", - "proc-macro2", - "quote", - "serde", - "serde_derive", - "serde_json", - "sha1", - "syn", -] - -[[package]] -name = "stdweb-internal-runtime" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "213701ba3370744dcd1a12960caa4843b3d68b4d1c0a5d575e0d65b2ee9d16c0" - [[package]] name = "strsim" version = "0.9.3" @@ -2829,9 +2710,9 @@ checksum = "1e81da0851ada1f3e9d4312c704aa4f8806f0f9d69faaf8df2f3464b4a9437c2" [[package]] name = "syn" -version = "1.0.60" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c700597eca8a5a762beb35753ef6b94df201c81cca676604f547495a0d7f0081" +checksum = "fb7f4c519df8c117855e19dd8cc851e89eb746fe7a73f0157e0d95fdec5369b0" dependencies = [ "proc-macro2", "quote", @@ -2871,54 +2752,61 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b157868d8ac1f56b64604539990685fa7611d8fa9e5476cf0c02cf34d32917c5" +[[package]] +name = "take_mut" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f764005d11ee5f36500a149ace24e00e3da98b0158b3e2d53a7495660d3f4d60" + [[package]] name = "tar" -version = "0.4.32" +version = "0.4.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0313546c01d59e29be4f09687bcb4fb6690cec931cc3607b6aec7a0e417f4cc6" +checksum = "489997b7557e9a43e192c527face4feacc78bfbe6eed67fd55c4c9e381cba290" dependencies = [ "filetime", "libc", + "redox_syscall", "xattr", ] [[package]] name = "tempfile" -version = "3.2.0" +version = "3.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" +checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" dependencies = [ - "cfg-if 1.0.0", + "cfg-if 0.1.10", "libc", - "rand 0.8.3", - "redox_syscall 0.2.4", + "rand 0.7.3", + "redox_syscall", "remove_dir_all", "winapi 0.3.9", ] [[package]] name = "termcolor" -version = "1.1.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2dfed899f0eb03f32ee8c6a0aabdb8a7949659e3466561fc0adf54e26d88c5f4" +checksum = "bb6bfa289a4d7c5766392812c0a1f4c1ba45afa1ad47803c11e1f407d846d75f" dependencies = [ "winapi-util", ] [[package]] name = "thiserror" -version = "1.0.23" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76cc616c6abf8c8928e2fdcc0dbfab37175edd8fb49a4641066ad1364fdab146" +checksum = "318234ffa22e0920fe9a40d7b8369b5f649d490980cf7aadcf1eb91594869b42" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.23" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9be73a2caec27583d0046ef3796c3794f868a5bc813db689eed00c7631275cd1" +checksum = "cae2447b6282786c3493999f40a9be2a6ad20cb8bd268b0a0dbf5a065535c0ab" dependencies = [ "proc-macro2", "quote", @@ -2936,42 +2824,10 @@ dependencies = [ ] [[package]] -name = "time" -version = "0.2.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1195b046942c221454c2539395f85413b33383a067449d78aab2b7b052a142f7" -dependencies = [ - "const_fn", - "libc", - "standback", - "stdweb 0.4.20", - "time-macros", - "version_check", - "winapi 0.3.9", -] - -[[package]] -name = "time-macros" -version = "0.1.1" +name = "tinyvec" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "957e9c6e26f12cb6d0dd7fc776bb67a706312e7299aed74c8dd5b17ebb27e2f1" -dependencies = [ - "proc-macro-hack", - "time-macros-impl", -] - -[[package]] -name = "time-macros-impl" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5c3be1edfad6027c69f5491cf4cb310d1a71ecd6af742788c6ff8bced86b8fa" -dependencies = [ - "proc-macro-hack", - "proc-macro2", - "quote", - "standback", - "syn", -] +checksum = "53953d2d3a5ad81d9f844a32f14ebb121f50b650cd59d0ee2a07cf13c617efed" [[package]] name = "tinyvec" @@ -3025,14 +2881,14 @@ dependencies = [ [[package]] name = "tokio-core" -version = "0.1.18" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87b1395334443abca552f63d4f61d0486f12377c2ba8b368e523f89e828cffd4" +checksum = "aeeffbbb94209023feaef3c196a41cbcdafa06b4a6f893f68779bb5e53796f71" dependencies = [ "bytes 0.4.12", "futures", "iovec", - "log 0.4.14", + "log 0.4.11", "mio", "scoped-tls", "tokio", @@ -3081,7 +2937,7 @@ checksum = "57fc868aae093479e3131e3d165c93b1c7474109d13c90ec0dda2a1bbfff0674" dependencies = [ "bytes 0.4.12", "futures", - "log 0.4.14", + "log 0.4.11", ] [[package]] @@ -3094,7 +2950,7 @@ dependencies = [ "futures", "lazy_static", "libc", - "log 0.4.14", + "log 0.4.11", "mio", "mio-named-pipes", "tokio-io", @@ -3130,7 +2986,7 @@ dependencies = [ "crossbeam-utils 0.7.2", "futures", "lazy_static", - "log 0.4.14", + "log 0.4.11", "mio", "num_cpus", "parking_lot 0.9.0", @@ -3201,7 +3057,7 @@ dependencies = [ "crossbeam-utils 0.7.2", "futures", "lazy_static", - "log 0.4.14", + "log 0.4.11", "num_cpus", "slab 0.4.2", "tokio-executor", @@ -3227,7 +3083,7 @@ checksum = "e2a0b10e610b39c38b031a2fcab08e4b82f16ece36504988dcbd81dbba650d82" dependencies = [ "bytes 0.4.12", "futures", - "log 0.4.14", + "log 0.4.11", "mio", "tokio-codec", "tokio-io", @@ -3244,7 +3100,7 @@ dependencies = [ "futures", "iovec", "libc", - "log 0.4.14", + "log 0.4.11", "mio", "mio-uds", "tokio-codec", @@ -3254,9 +3110,9 @@ dependencies = [ [[package]] name = "toml" -version = "0.5.8" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a31142970826733df8241ef35dc040ef98c679ab14d7c3e54d827099b3acecaa" +checksum = "75cf45bb0bef80604d001caaec0d09da99611b3c0fd39d3080468875cdb65645" dependencies = [ "serde", ] @@ -3293,11 +3149,11 @@ dependencies = [ [[package]] name = "unicode-normalization" -version = "0.1.16" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a13e63ab62dbe32aeee58d1c5408d35c36c392bba5d9d3142287219721afe606" +checksum = "6fb19cf769fa8c6a80a162df694621ebeb4dafb606470b2b2fce0be40a98a977" dependencies = [ - "tinyvec", + "tinyvec 0.3.3", ] [[package]] @@ -3335,16 +3191,14 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "ureq" -version = "1.5.4" +version = "0.11.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "294b85ef5dbc3670a72e82a89971608a1fcc4ed5c7c5a2895230d31a95f0569b" +checksum = "801125e6d1ba6864cf3a5a92cfb2f0b0a3ee73e40602a0cd206ad2f3c040aa96" dependencies = [ - "base64 0.13.0", + "base64 0.11.0", "chunked_transfer", "cookie", - "cookie_store", - "log 0.4.14", - "once_cell", + "lazy_static", "qstring", "rustls", "url 2.2.0", @@ -3370,18 +3224,18 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5909f2b0817350449ed73e8bcd81c8c3c8d9a7a5d8acba4b27db277f1868976e" dependencies = [ "form_urlencoded", - "idna 0.2.1", + "idna 0.2.0", "matches", "percent-encoding 2.1.0", ] [[package]] name = "uuid" -version = "0.8.2" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" +checksum = "9fde2f6a4bea1d6e007c4ad38c6839fa71cbb63b6dbf5b595aa38dc9b1093c11" dependencies = [ - "getrandom 0.2.2", + "rand 0.7.3", ] [[package]] @@ -3426,11 +3280,11 @@ dependencies = [ [[package]] name = "vorbis-sys" -version = "0.1.1" +version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd9ed6ef5361a85e68ccc005961d995c2d44e31f0816f142025f2ca2383dfbfd" +checksum = "3a0a8d7034313748da1d84b0adfa501f83f9ec83250f37fbacfa92a3580327c4" dependencies = [ - "cc", + "gcc", "libc", "ogg-sys", "pkg-config", @@ -3467,7 +3321,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a05d9d966753fa4b5c8db73fcab5eed4549cfe0e1e4e66911e5564a0085c35d1" dependencies = [ "futures", - "log 0.4.14", + "log 0.4.11", "try-lock", ] @@ -3477,17 +3331,11 @@ version = "0.9.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" -[[package]] -name = "wasi" -version = "0.10.2+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd6fbd9a79829dd1ad0cc20627bf1ed606756a7f77edff7b66b7064f9cb327c6" - [[package]] name = "wasm-bindgen" -version = "0.2.70" +version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55c0f7123de74f0dab9b7d00fd614e7b19349cd1e2f5252bbe9b1754b59433be" +checksum = "3cd364751395ca0f68cafb17666eee36b63077fb5ecd972bbcd74c90c4bf736e" dependencies = [ "cfg-if 1.0.0", "wasm-bindgen-macro", @@ -3495,13 +3343,13 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.70" +version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7bc45447f0d4573f3d65720f636bbcc3dd6ce920ed704670118650bcd47764c7" +checksum = "1114f89ab1f4106e5b55e688b828c0ab0ea593a1ea7c094b141b14cbaaec2d62" dependencies = [ "bumpalo", "lazy_static", - "log 0.4.14", + "log 0.4.11", "proc-macro2", "quote", "syn", @@ -3510,9 +3358,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.70" +version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b8853882eef39593ad4174dd26fc9865a64e84026d223f63bb2c42affcbba2c" +checksum = "7a6ac8995ead1f084a8dea1e65f194d0973800c7f571f6edd70adf06ecf77084" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3520,9 +3368,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.70" +version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4133b5e7f2a531fa413b3a1695e925038a05a71cf67e87dafa295cb645a01385" +checksum = "b5a48c72f299d80557c7c62e37e7225369ecc0c963964059509fbafe917c7549" dependencies = [ "proc-macro2", "quote", @@ -3533,15 +3381,15 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.70" +version = "0.2.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4945e4943ae02d15c13962b38a5b1e81eadd4b71214eee75af64a4d6a4fd64" +checksum = "7e7811dd7f9398f14cc76efd356f98f03aa30419dea46aa810d71e819fc97158" [[package]] name = "web-sys" -version = "0.3.47" +version = "0.3.46" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c40dc691fc48003eba817c38da7113c15698142da971298003cac3ef175680b3" +checksum = "222b1ef9334f92a21d3fb53dc3fd80f30836959a90f9274a626d7e06315ba3c3" dependencies = [ "js-sys", "wasm-bindgen", @@ -3549,9 +3397,9 @@ dependencies = [ [[package]] name = "webpki" -version = "0.21.4" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" +checksum = "ab146130f5f790d45f82aeeb09e55a256573373ec64409fc19a6fb82fb1032ae" dependencies = [ "ring", "untrusted", @@ -3559,9 +3407,9 @@ dependencies = [ [[package]] name = "webpki-roots" -version = "0.21.0" +version = "0.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82015b7e0b8bad8185994674a13a93306bea76cf5a16c5a181382fd3a5ec2376" +checksum = "91cd5736df7f12a964a5067a12c62fa38e1bd8080aff1f80bc29be7c80d19ab4" dependencies = [ "webpki", ] diff --git a/Cargo.toml b/Cargo.toml index 0b2545922..a898b40d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -63,7 +63,6 @@ alsa-backend = ["librespot-playback/alsa-backend"] portaudio-backend = ["librespot-playback/portaudio-backend"] pulseaudio-backend = ["librespot-playback/pulseaudio-backend"] jackaudio-backend = ["librespot-playback/jackaudio-backend"] -rodiojack-backend = ["librespot-playback/rodiojack-backend"] rodio-backend = ["librespot-playback/rodio-backend"] sdl-backend = ["librespot-playback/sdl-backend"] gstreamer-backend = ["librespot-playback/gstreamer-backend"] diff --git a/README.md b/README.md index 33b2b76e2..e7611aa80 100644 --- a/README.md +++ b/README.md @@ -56,7 +56,6 @@ ALSA PortAudio PulseAudio JACK -JACK over Rodio SDL Pipe ``` diff --git a/playback/Cargo.toml b/playback/Cargo.toml index b8995a4bc..69dcc3c33 100644 --- a/playback/Cargo.toml +++ b/playback/Cargo.toml @@ -42,7 +42,6 @@ alsa-backend = ["alsa"] portaudio-backend = ["portaudio-rs"] pulseaudio-backend = ["libpulse-binding", "libpulse-simple-binding"] jackaudio-backend = ["jack"] -rodiojack-backend = ["rodio", "cpal/jack"] rodio-backend = ["rodio", "cpal"] sdl-backend = ["sdl2"] gstreamer-backend = ["gstreamer", "gstreamer-app", "glib", "zerocopy"] diff --git a/playback/src/audio_backend/mod.rs b/playback/src/audio_backend/mod.rs index 3f5dae8d4..6bda39335 100644 --- a/playback/src/audio_backend/mod.rs +++ b/playback/src/audio_backend/mod.rs @@ -35,28 +35,15 @@ mod jackaudio; #[cfg(feature = "jackaudio-backend")] use self::jackaudio::JackSink; -#[cfg(all( - feature = "rodiojack-backend", - not(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd")) -))] -compile_error!("Rodio JACK backend is currently only supported on linux."); - -#[cfg(all( - feature = "rodiojack-backend", - any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd") -))] -use self::rodio::JackRodioSink; - #[cfg(feature = "gstreamer-backend")] mod gstreamer; #[cfg(feature = "gstreamer-backend")] use self::gstreamer::GstreamerSink; -#[cfg(any(feature = "rodio-backend", feature = "rodiojack-backend"))] +#[cfg(feature = "rodio-backend")] mod rodio; #[cfg(feature = "rodio-backend")] use self::rodio::RodioSink; - #[cfg(feature = "sdl-backend")] mod sdl; #[cfg(feature = "sdl-backend")] @@ -77,11 +64,6 @@ pub const BACKENDS: &'static [(&'static str, fn(Option) -> Box ("pulseaudio", mk_sink::), #[cfg(feature = "jackaudio-backend")] ("jackaudio", mk_sink::), - #[cfg(all( - feature = "rodiojack-backend", - any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd") - ))] - ("rodiojack", mk_sink::), #[cfg(feature = "gstreamer-backend")] ("gstreamer", mk_sink::), #[cfg(feature = "rodio-backend")] diff --git a/playback/src/audio_backend/rodio.rs b/playback/src/audio_backend/rodio.rs index 3b920c302..b20c53be0 100644 --- a/playback/src/audio_backend/rodio.rs +++ b/playback/src/audio_backend/rodio.rs @@ -13,17 +13,6 @@ pub struct RodioSink { stream: rodio::OutputStream, } -#[cfg(all( - feature = "rodiojack-backend", - any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd") -))] -pub struct JackRodioSink { - jackrodio_sink: rodio::Sink, - // We have to keep hold of this object, or the Sink can't play... - #[allow(dead_code)] - stream: rodio::OutputStream, -} - fn list_formats(ref device: &rodio::Device) { let default_fmt = match device.default_output_config() { Ok(fmt) => cpal::SupportedStreamConfig::from(fmt), @@ -51,19 +40,17 @@ fn list_formats(ref device: &rodio::Device) { } } -fn list_outputs(ref host: &cpal::Host) { - let default_device = get_default_device(host); +fn list_outputs() { + let default_device = get_default_device(); let default_device_name = default_device.name().expect("cannot get output name"); println!("Default Audio Device:\n {}", default_device_name); list_formats(&default_device); println!("Other Available Audio Devices:"); - - let found_devices = host.output_devices().expect(&format!( - "Cannot get list of output devices of Host: {:?}", - host.id() - )); - for device in found_devices { + for device in cpal::default_host() + .output_devices() + .expect("cannot get list of output devices") + { let device_name = device.name().expect("cannot get output name"); if device_name != default_device_name { println!(" {}", device_name); @@ -72,24 +59,23 @@ fn list_outputs(ref host: &cpal::Host) { } } -fn get_default_device(ref host: &cpal::Host) -> rodio::Device { - host.default_output_device() +fn get_default_device() -> rodio::Device { + cpal::default_host() + .default_output_device() .expect("no default output device available") } -fn match_device(ref host: &cpal::Host, device: Option) -> rodio::Device { +fn match_device(device: Option) -> rodio::Device { match device { Some(device_name) => { if device_name == "?".to_string() { - list_outputs(host); + list_outputs(); exit(0) } - - let found_devices = host.output_devices().expect(&format!( - "Cannot get list of output devices of Host: {:?}", - host.id() - )); - for d in found_devices { + for d in cpal::default_host() + .output_devices() + .expect("cannot get list of output devices") + { if d.name().expect("cannot get output name") == device_name { return d; } @@ -97,16 +83,18 @@ fn match_device(ref host: &cpal::Host, device: Option) -> rodio::Device println!("No output sink matching '{}' found.", device_name); exit(0) } - None => return get_default_device(host), + None => return get_default_device(), } } impl Open for RodioSink { fn open(device: Option) -> RodioSink { - let host = cpal::default_host(); - debug!("Using rodio sink with cpal host: {:?}", host.id()); + debug!( + "Using rodio sink with cpal host: {:?}", + cpal::default_host().id() + ); - let rodio_device = match_device(&host, device); + let rodio_device = match_device(device); debug!("Using cpal device"); let stream = rodio::OutputStream::try_from_device(&rodio_device) .expect("Couldn't open output stream."); @@ -121,36 +109,6 @@ impl Open for RodioSink { } } -#[cfg(all( - feature = "rodiojack-backend", - any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd") -))] -impl Open for JackRodioSink { - fn open(device: Option) -> JackRodioSink { - let host = cpal::host_from_id( - cpal::available_hosts() - .into_iter() - .find(|id| *id == cpal::HostId::Jack) - .expect("Jack Host not found"), - ) - .expect("Jack Host not found"); - debug!("Using jack rodio sink with cpal Jack host"); - - let rodio_device = match_device(&host, device); - debug!("Using cpal device"); - let stream = rodio::OutputStream::try_from_device(&rodio_device) - .expect("Couldn't open output stream."); - debug!("Using jack rodio stream"); - let sink = rodio::Sink::try_new(&stream.1).expect("Couldn't create output sink."); - debug!("Using jack rodio sink"); - - JackRodioSink { - jackrodio_sink: sink, - stream: stream.0, - } - } -} - impl Sink for RodioSink { fn start(&mut self) -> io::Result<()> { // More similar to an "unpause" than "play". Doesn't undo "stop". @@ -179,36 +137,3 @@ impl Sink for RodioSink { Ok(()) } } - -#[cfg(all( - feature = "rodiojack-backend", - any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd") -))] -impl Sink for JackRodioSink { - fn start(&mut self) -> io::Result<()> { - // More similar to an "unpause" than "play". Doesn't undo "stop". - // self.rodio_sink.play(); - Ok(()) - } - - fn stop(&mut self) -> io::Result<()> { - // This will immediately stop playback, but the sink is then unusable. - // We just have to let the current buffer play till the end. - // self.rodio_sink.stop(); - Ok(()) - } - - fn write(&mut self, data: &[i16]) -> io::Result<()> { - let source = rodio::buffer::SamplesBuffer::new(2, 44100, data); - self.jackrodio_sink.append(source); - - // Chunk sizes seem to be about 256 to 3000 ish items long. - // Assuming they're on average 1628 then a half second buffer is: - // 44100 elements --> about 27 chunks - while self.jackrodio_sink.len() > 26 { - // sleep and wait for rodio to drain a bit - thread::sleep(time::Duration::from_millis(10)); - } - Ok(()) - } -} From c0942f14e8868c3c0836438ed1d92cc698c8d38c Mon Sep 17 00:00:00 2001 From: johannesd3 Date: Tue, 23 Feb 2021 15:05:02 +0100 Subject: [PATCH 19/35] Restore rodiojack support Probably more simple than the previous approach which doubles the code: Instead of implementing the `Open` trait, we simply use custom SinkBuilder, one for the default host, and one for the "jack" host. --- .github/workflows/test.yml | 1 + COMPILING.md | 1 + Cargo.lock | 1 + Cargo.toml | 1 + README.md | 1 + playback/Cargo.toml | 1 + playback/src/audio_backend/mod.rs | 9 +-- playback/src/audio_backend/rodio.rs | 92 +++++++++++++++++------------ 8 files changed, 64 insertions(+), 43 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4ad4b406a..c20fe1c68 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -78,6 +78,7 @@ jobs: - run: cargo build --locked --no-default-features --features "portaudio-backend" - run: cargo build --locked --no-default-features --features "pulseaudio-backend" - run: cargo build --locked --no-default-features --features "jackaudio-backend" + - run: cargo build --locked --no-default-features --features "rodiojack-backend" - run: cargo build --locked --no-default-features --features "rodio-backend" - run: cargo build --locked --no-default-features --features "sdl-backend" - run: cargo build --locked --no-default-features --features "gstreamer-backend" diff --git a/COMPILING.md b/COMPILING.md index 7b3467eea..40eefb395 100644 --- a/COMPILING.md +++ b/COMPILING.md @@ -46,6 +46,7 @@ Depending on the chosen backend, specific development libraries are required. |PortAudio | `portaudio19-dev` | `portaudio-devel` | `portaudio` | |PulseAudio | `libpulse-dev` | `pulseaudio-libs-devel` | | |JACK | `libjack-dev` | `jack-audio-connection-kit-devel` | | +|JACK over Rodio | `libjack-dev` | `jack-audio-connection-kit-devel` | - | |SDL | `libsdl2-dev` | `SDL2-devel` | | |Pipe | - | - | - | diff --git a/Cargo.lock b/Cargo.lock index 33dbb922b..1e8176f62 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -433,6 +433,7 @@ dependencies = [ "alsa", "core-foundation-sys", "coreaudio-rs", + "jack", "jni 0.17.0", "js-sys", "lazy_static", diff --git a/Cargo.toml b/Cargo.toml index 21c010c90..d34189ec3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -66,6 +66,7 @@ portaudio-backend = ["librespot-playback/portaudio-backend"] pulseaudio-backend = ["librespot-playback/pulseaudio-backend"] jackaudio-backend = ["librespot-playback/jackaudio-backend"] rodio-backend = ["librespot-playback/rodio-backend"] +rodiojack-backend = ["librespot-playback/rodiojack-backend"] sdl-backend = ["librespot-playback/sdl-backend"] gstreamer-backend = ["librespot-playback/gstreamer-backend"] diff --git a/README.md b/README.md index e7611aa80..7102c28a0 100644 --- a/README.md +++ b/README.md @@ -56,6 +56,7 @@ ALSA PortAudio PulseAudio JACK +JACK over Rodio SDL Pipe ``` diff --git a/playback/Cargo.toml b/playback/Cargo.toml index acb20c46d..2759ae0e4 100644 --- a/playback/Cargo.toml +++ b/playback/Cargo.toml @@ -46,5 +46,6 @@ portaudio-backend = ["portaudio-rs"] pulseaudio-backend = ["libpulse-binding", "libpulse-simple-binding"] jackaudio-backend = ["jack"] rodio-backend = ["rodio", "cpal", "thiserror"] +rodiojack-backend = ["rodio", "cpal/jack", "thiserror"] sdl-backend = ["sdl2"] gstreamer-backend = ["gstreamer", "gstreamer-app", "glib", "zerocopy"] diff --git a/playback/src/audio_backend/mod.rs b/playback/src/audio_backend/mod.rs index 50031a40f..214ede8c3 100644 --- a/playback/src/audio_backend/mod.rs +++ b/playback/src/audio_backend/mod.rs @@ -42,10 +42,9 @@ mod gstreamer; #[cfg(feature = "gstreamer-backend")] use self::gstreamer::GstreamerSink; -#[cfg(feature = "rodio-backend")] +#[cfg(any(feature = "rodio-backend", feature = "rodiojack-backend"))] mod rodio; -#[cfg(feature = "rodio-backend")] -use self::rodio::RodioSink; + #[cfg(feature = "sdl-backend")] mod sdl; #[cfg(feature = "sdl-backend")] @@ -69,7 +68,9 @@ pub const BACKENDS: &'static [(&'static str, SinkBuilder)] = &[ #[cfg(feature = "gstreamer-backend")] ("gstreamer", mk_sink::), #[cfg(feature = "rodio-backend")] - ("rodio", mk_sink::), + ("rodio", rodio::mk_rodio), + #[cfg(feature = "rodiojack-backend")] + ("rodiojack", rodio::mk_rodiojack), #[cfg(feature = "sdl-backend")] ("sdl", mk_sink::), ("pipe", mk_sink::), diff --git a/playback/src/audio_backend/rodio.rs b/playback/src/audio_backend/rodio.rs index 1b7a8b8a2..56e19b61d 100644 --- a/playback/src/audio_backend/rodio.rs +++ b/playback/src/audio_backend/rodio.rs @@ -5,9 +5,28 @@ use std::{io, thread, time}; use cpal::traits::{DeviceTrait, HostTrait}; use thiserror::Error; -use super::{Open, Sink}; +use super::Sink; use crate::audio::AudioPacket; +#[cfg(all( + feature = "rodiojack-backend", + not(any(target_os = "linux", target_os = "dragonfly", target_os = "freebsd")) +))] +compile_error!("Rodio JACK backend is currently only supported on linux."); + +#[cfg(feature = "rodio-backend")] +pub fn mk_rodio(device: Option) -> Box { + Box::new(open(cpal::default_host(), device)) +} + +#[cfg(feature = "rodiojack-backend")] +pub fn mk_rodiojack(device: Option) -> Box { + Box::new(open( + cpal::host_from_id(cpal::HostId::Jack).unwrap(), + device, + )) +} + #[derive(Debug, Error)] pub enum RodioError { #[error("Rodio: no device available")] @@ -60,10 +79,10 @@ fn list_formats(device: &rodio::Device) { } } -fn list_outputs() -> Result<(), cpal::DevicesError> { +fn list_outputs(host: &cpal::Host) -> Result<(), cpal::DevicesError> { let mut default_device_name = None; - if let Some(default_device) = get_default_device() { + if let Some(default_device) = host.default_output_device() { default_device_name = default_device.name().ok(); println!( "Default Audio Device:\n {}", @@ -77,7 +96,7 @@ fn list_outputs() -> Result<(), cpal::DevicesError> { warn!("No default device was found"); } - for device in cpal::default_host().output_devices()? { + for device in host.output_devices()? { match device.name() { Ok(name) if Some(&name) == default_device_name.as_ref() => (), Ok(name) => { @@ -95,14 +114,13 @@ fn list_outputs() -> Result<(), cpal::DevicesError> { Ok(()) } -fn get_default_device() -> Option { - cpal::default_host().default_output_device() -} - -fn create_sink(device: Option) -> Result<(rodio::Sink, rodio::OutputStream), RodioError> { +fn create_sink( + host: &cpal::Host, + device: Option, +) -> Result<(rodio::Sink, rodio::OutputStream), RodioError> { let rodio_device = match device { Some(ask) if &ask == "?" => { - let exit_code = match list_outputs() { + let exit_code = match list_outputs(host) { Ok(()) => 0, Err(e) => { error!("{}", e); @@ -112,12 +130,13 @@ fn create_sink(device: Option) -> Result<(rodio::Sink, rodio::OutputStre exit(exit_code) } Some(device_name) => { - cpal::default_host() - .output_devices()? + host.output_devices()? .find(|d| d.name().ok().map_or(false, |name| name == device_name)) // Ignore devices for which getting name fails .ok_or(RodioError::DeviceNotAvailable(device_name))? } - None => get_default_device().ok_or(RodioError::NoDeviceAvailable)?, + None => host + .default_output_device() + .ok_or(RodioError::NoDeviceAvailable)?, }; let name = rodio_device.name().ok(); @@ -131,37 +150,32 @@ fn create_sink(device: Option) -> Result<(rodio::Sink, rodio::OutputStre Ok((sink, stream)) } -impl Open for RodioSink { - fn open(device: Option) -> RodioSink { - debug!( - "Using rodio sink with cpal host: {:?}", - cpal::default_host().id().name() - ); +pub fn open(host: cpal::Host, device: Option) -> RodioSink { + debug!("Using rodio sink with cpal host: {}", host.id().name()); - let (sink_tx, sink_rx) = mpsc::sync_channel(1); - let (close_tx, close_rx) = mpsc::sync_channel(1); + let (sink_tx, sink_rx) = mpsc::sync_channel(1); + let (close_tx, close_rx) = mpsc::sync_channel(1); - std::thread::spawn(move || match create_sink(device) { - Ok((sink, stream)) => { - sink_tx.send(Ok(sink)).unwrap(); + std::thread::spawn(move || match create_sink(&host, device) { + Ok((sink, stream)) => { + sink_tx.send(Ok(sink)).unwrap(); - close_rx.recv().unwrap_err(); // This will fail as soon as the sender is dropped - debug!("drop rodio::OutputStream"); - drop(stream); - } - Err(e) => { - sink_tx.send(Err(e)).unwrap(); - } - }); + close_rx.recv().unwrap_err(); // This will fail as soon as the sender is dropped + debug!("drop rodio::OutputStream"); + drop(stream); + } + Err(e) => { + sink_tx.send(Err(e)).unwrap(); + } + }); - // Instead of the second `unwrap`, better error handling could be introduced - let sink = sink_rx.recv().unwrap().unwrap(); + // Instead of the second `unwrap`, better error handling could be introduced + let sink = sink_rx.recv().unwrap().unwrap(); - debug!("Rodio sink was created"); - RodioSink { - rodio_sink: sink, - _close_tx: close_tx, - } + debug!("Rodio sink was created"); + RodioSink { + rodio_sink: sink, + _close_tx: close_tx, } } From 9253be7bc9675c266000a06fac218f444b63d66c Mon Sep 17 00:00:00 2001 From: johannesd3 Date: Wed, 10 Feb 2021 22:40:33 +0100 Subject: [PATCH 20/35] Small refactor of librespot-core * Remove default impl for `SessionConfig` * Move util mod to single file * Restore privacy of mods * Move `fn get_credentials` to application * Remove `extern crate` statements --- Cargo.lock | 10 ---------- core/Cargo.toml | 1 - core/build.rs | 3 --- core/src/authentication.rs | 24 ---------------------- core/src/config.rs | 15 -------------- core/src/lib.rs | 30 +++------------------------- core/src/{util/mod.rs => util.rs} | 0 src/main.rs | 33 ++++++++++++++++++++++++++----- 8 files changed, 31 insertions(+), 85 deletions(-) rename core/src/{util/mod.rs => util.rs} (100%) diff --git a/Cargo.lock b/Cargo.lock index 1e8176f62..c9bcef5bb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1475,7 +1475,6 @@ dependencies = [ "tokio-util", "tower-service", "url 1.7.2", - "uuid", "vergen", ] @@ -2990,15 +2989,6 @@ dependencies = [ "percent-encoding 2.1.0", ] -[[package]] -name = "uuid" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" -dependencies = [ - "getrandom 0.2.2", -] - [[package]] name = "vergen" version = "3.2.0" diff --git a/core/Cargo.toml b/core/Cargo.toml index 36d799885..673637a0d 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -40,7 +40,6 @@ tokio = { version = "1.0", features = ["io-util", "rt-multi-thread"] } tokio-util = { version = "0.6", features = ["codec"] } tower-service = "0.3" url = "1.7" -uuid = { version = "0.8", features = ["v4"] } [build-dependencies] rand = "0.7" diff --git a/core/build.rs b/core/build.rs index e8c71e4af..83f504728 100644 --- a/core/build.rs +++ b/core/build.rs @@ -1,6 +1,3 @@ -extern crate rand; -extern crate vergen; - use rand::distributions::Alphanumeric; use rand::Rng; use vergen::{generate_cargo_keys, ConstantsFlags}; diff --git a/core/src/authentication.rs b/core/src/authentication.rs index 5394ff351..fa5704098 100644 --- a/core/src/authentication.rs +++ b/core/src/authentication.rs @@ -142,30 +142,6 @@ where base64::decode(&v).map_err(|e| serde::de::Error::custom(e.to_string())) } -pub fn get_credentials String>( - username: Option, - password: Option, - cached_credentials: Option, - prompt: F, -) -> Option { - match (username, password, cached_credentials) { - (Some(username), Some(password), _) => Some(Credentials::with_password(username, password)), - - (Some(ref username), _, Some(ref credentials)) if *username == credentials.username => { - Some(credentials.clone()) - } - - (Some(username), None, _) => Some(Credentials::with_password( - username.clone(), - prompt(&username), - )), - - (None, _, Some(credentials)) => Some(credentials), - - (None, _, None) => None, - } -} - error_chain! { types { AuthenticationError, AuthenticationErrorKind, AuthenticationResultExt, AuthenticationResult; diff --git a/core/src/config.rs b/core/src/config.rs index 60cb66e0d..469b935a2 100644 --- a/core/src/config.rs +++ b/core/src/config.rs @@ -1,9 +1,6 @@ use std::fmt; use std::str::FromStr; use url::Url; -use uuid::Uuid; - -use crate::version; #[derive(Clone, Debug)] pub struct SessionConfig { @@ -13,18 +10,6 @@ pub struct SessionConfig { pub ap_port: Option, } -impl Default for SessionConfig { - fn default() -> SessionConfig { - let device_id = Uuid::new_v4().to_hyphenated().to_string(); - SessionConfig { - user_agent: version::version_string(), - device_id: device_id, - proxy: None, - ap_port: None, - } - } -} - #[derive(Clone, Copy, Debug, Hash, PartialOrd, Ord, PartialEq, Eq)] pub enum DeviceType { Unknown = 0, diff --git a/core/src/lib.rs b/core/src/lib.rs index 25ce5413c..6c180c2ec 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -8,43 +8,19 @@ extern crate serde_derive; extern crate pin_project_lite; #[macro_use] extern crate error_chain; -extern crate aes; -extern crate base64; -extern crate byteorder; -extern crate bytes; -extern crate futures; -extern crate hmac; -extern crate httparse; -extern crate hyper; -extern crate num_bigint; -extern crate num_integer; -extern crate num_traits; -extern crate once_cell; -extern crate pbkdf2; -extern crate protobuf; -extern crate rand; -extern crate serde; -extern crate serde_json; -extern crate sha1; -extern crate shannon; -pub extern crate tokio; -extern crate tokio_util; -extern crate tower_service; -extern crate url; -extern crate uuid; -extern crate librespot_protocol as protocol; +use librespot_protocol as protocol; #[macro_use] mod component; -pub mod apresolve; +mod apresolve; pub mod audio_key; pub mod authentication; pub mod cache; pub mod channel; pub mod config; -pub mod connection; +mod connection; pub mod diffie_hellman; pub mod keymaster; pub mod mercury; diff --git a/core/src/util/mod.rs b/core/src/util.rs similarity index 100% rename from core/src/util/mod.rs rename to core/src/util.rs diff --git a/src/main.rs b/src/main.rs index 71041f55e..31ef30019 100644 --- a/src/main.rs +++ b/src/main.rs @@ -12,7 +12,7 @@ use std::{ }; use url::Url; -use librespot::core::authentication::{get_credentials, Credentials}; +use librespot::core::authentication::Credentials; use librespot::core::cache::Cache; use librespot::core::config::{ConnectConfig, DeviceType, SessionConfig, VolumeCtrl}; use librespot::core::session::Session; @@ -70,6 +70,29 @@ fn list_backends() { } } +pub fn get_credentials Option>( + username: Option, + password: Option, + cached_credentials: Option, + prompt: F, +) -> Option { + if let Some(username) = username { + if let Some(password) = password { + return Some(Credentials::with_password(username, password)); + } + + match cached_credentials { + Some(credentials) if username == credentials.username => Some(credentials), + _ => { + let password = prompt(&username)?; + Some(Credentials::with_password(username, password)) + } + } + } else { + cached_credentials + } +} + #[derive(Clone)] struct Setup { backend: fn(Option) -> Box, @@ -317,10 +340,10 @@ fn setup(args: &[String]) -> Setup { let credentials = { let cached_credentials = cache.as_ref().and_then(Cache::credentials); - let password = |username: &String| -> String { - write!(stderr(), "Password for {}: ", username).unwrap(); - stderr().flush().unwrap(); - rpassword::read_password().unwrap() + let password = |username: &String| -> Option { + write!(stderr(), "Password for {}: ", username).ok()?; + stderr().flush().ok()?; + rpassword::read_password().ok() }; get_credentials( From 8cff10e983bcf87b44de01229e2e5154a125369e Mon Sep 17 00:00:00 2001 From: johannesd3 Date: Wed, 10 Feb 2021 22:50:08 +0100 Subject: [PATCH 21/35] Put apresolve behind feature flag --- Cargo.lock | 2 +- Cargo.toml | 5 +- core/Cargo.toml | 10 ++-- core/src/apresolve.rs | 107 ++++++++++++++++++++++------------------ core/src/lib.rs | 2 + core/src/proxytunnel.rs | 97 ++++++++++++++++++------------------ 6 files changed, 123 insertions(+), 100 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c9bcef5bb..282888ddd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1450,6 +1450,7 @@ dependencies = [ "base64", "byteorder", "bytes", + "cfg-if 1.0.0", "env_logger", "error-chain", "futures", @@ -1473,7 +1474,6 @@ dependencies = [ "shannon", "tokio", "tokio-util", - "tower-service", "url 1.7.2", "vergen", ] diff --git a/Cargo.toml b/Cargo.toml index d34189ec3..617ae0861 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -61,6 +61,9 @@ sha-1 = "0.8" hex = "0.4" [features] +apresolve = ["librespot-core/apresolve"] +apresolve-http2 = ["librespot-core/apresolve-http2"] + alsa-backend = ["librespot-playback/alsa-backend"] portaudio-backend = ["librespot-playback/portaudio-backend"] pulseaudio-backend = ["librespot-playback/pulseaudio-backend"] @@ -75,7 +78,7 @@ with-vorbis = ["librespot-audio/with-vorbis"] # with-dns-sd = ["librespot-connect/with-dns-sd"] -default = ["librespot-playback/rodio-backend"] +default = ["rodio-backend", "apresolve"] [package.metadata.deb] maintainer = "librespot-org" diff --git a/core/Cargo.toml b/core/Cargo.toml index 673637a0d..f1a15eb1d 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -17,11 +17,12 @@ aes = "0.6" base64 = "0.13" byteorder = "1.4" bytes = "1.0" +cfg-if = "1" error-chain = { version = "0.12", default-features = false } futures = { version = "0.3", features = ["bilock", "unstable"] } hmac = "0.10" httparse = "1.3" -hyper = { version = "0.14", features = ["client", "tcp", "http1", "http2"] } +hyper = { version = "0.14", optional = true, features = ["client", "tcp", "http1"] } log = "0.4" num-bigint = "0.3" num-integer = "0.1" @@ -38,7 +39,6 @@ sha-1 = "0.9" shannon = "0.2.0" tokio = { version = "1.0", features = ["io-util", "rt-multi-thread"] } tokio-util = { version = "0.6", features = ["codec"] } -tower-service = "0.3" url = "1.7" [build-dependencies] @@ -47,4 +47,8 @@ vergen = "3.0.4" [dev-dependencies] env_logger = "*" -tokio = {version = "1.0", features = ["macros"] } \ No newline at end of file +tokio = {version = "1.0", features = ["macros"] } + +[features] +apresolve = ["hyper"] +apresolve-http2 = ["apresolve", "hyper/http2"] diff --git a/core/src/apresolve.rs b/core/src/apresolve.rs index 81340c9d4..cd354d888 100644 --- a/core/src/apresolve.rs +++ b/core/src/apresolve.rs @@ -1,61 +1,72 @@ const AP_FALLBACK: &'static str = "ap.spotify.com:443"; -const APRESOLVE_ENDPOINT: &'static str = "http://apresolve.spotify.com:80"; -use hyper::{Body, Client, Method, Request, Uri}; -use std::error::Error; use url::Url; -use crate::proxytunnel::ProxyTunnel; +cfg_if! { + if #[cfg(feature = "apresolve")] { + const APRESOLVE_ENDPOINT: &'static str = "http://apresolve.spotify.com:80"; -#[derive(Clone, Debug, Serialize, Deserialize)] -pub struct APResolveData { - ap_list: Vec, -} + use std::error::Error; -async fn apresolve(proxy: &Option, ap_port: &Option) -> Result> { - let port = ap_port.unwrap_or(443); - - let req = Request::builder() - .method(Method::GET) - .uri( - APRESOLVE_ENDPOINT - .parse::() - .expect("invalid AP resolve URL"), - ) - .body(Body::empty())?; - - let response = if let Some(url) = proxy { - Client::builder() - .build(ProxyTunnel::new(url)?) - .request(req) - .await? - } else { - Client::new().request(req).await? - }; + use hyper::{Body, Client, Method, Request, Uri}; + + use crate::proxytunnel::ProxyTunnel; + + #[derive(Clone, Debug, Serialize, Deserialize)] + pub struct APResolveData { + ap_list: Vec, + } - let body = hyper::body::to_bytes(response.into_body()).await?; - let data: APResolveData = serde_json::from_slice(body.as_ref())?; + async fn apresolve(proxy: &Option, ap_port: &Option) -> Result> { + let port = ap_port.unwrap_or(443); - let ap = if ap_port.is_some() || proxy.is_some() { - data.ap_list.into_iter().find_map(|ap| { - if ap.parse::().ok()?.port()? == port { - Some(ap) + let req = Request::builder() + .method(Method::GET) + .uri( + APRESOLVE_ENDPOINT + .parse::() + .expect("invalid AP resolve URL"), + ) + .body(Body::empty())?; + + let response = if let Some(url) = proxy { + Client::builder() + .build(ProxyTunnel::new(url)?) + .request(req) + .await? } else { - None + Client::new().request(req).await? + }; + + let body = hyper::body::to_bytes(response.into_body()).await?; + let data: APResolveData = serde_json::from_slice(body.as_ref())?; + + let ap = if ap_port.is_some() || proxy.is_some() { + data.ap_list.into_iter().find_map(|ap| { + if ap.parse::().ok()?.port()? == port { + Some(ap) + } else { + None + } + }) + } else { + data.ap_list.into_iter().next() } - }) - } else { - data.ap_list.into_iter().next() - } - .ok_or("empty AP List")?; + .ok_or("empty AP List")?; - Ok(ap) -} + Ok(ap) + } -pub async fn apresolve_or_fallback(proxy: &Option, ap_port: &Option) -> String { - apresolve(proxy, ap_port).await.unwrap_or_else(|e| { - warn!("Failed to resolve Access Point: {}", e); - warn!("Using fallback \"{}\"", AP_FALLBACK); - AP_FALLBACK.into() - }) + pub async fn apresolve_or_fallback(proxy: &Option, ap_port: &Option) -> String { + apresolve(proxy, ap_port).await.unwrap_or_else(|e| { + warn!("Failed to resolve Access Point: {}", e); + warn!("Using fallback \"{}\"", AP_FALLBACK); + AP_FALLBACK.into() + }) + } + } else { + pub async fn apresolve_or_fallback(_: &Option, _: &Option) -> String { + AP_FALLBACK.to_string() + } + } } diff --git a/core/src/lib.rs b/core/src/lib.rs index 6c180c2ec..65fa898aa 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -3,6 +3,8 @@ #[macro_use] extern crate log; #[macro_use] +extern crate cfg_if; +#[macro_use] extern crate serde_derive; #[macro_use] extern crate pin_project_lite; diff --git a/core/src/proxytunnel.rs b/core/src/proxytunnel.rs index c2033c851..158d314f6 100644 --- a/core/src/proxytunnel.rs +++ b/core/src/proxytunnel.rs @@ -1,16 +1,6 @@ -use futures::Future; -use hyper::Uri; -use std::{ - io, - net::{SocketAddr, ToSocketAddrs}, - pin::Pin, - task::Poll, -}; -use tokio::{ - io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}, - net::TcpStream, -}; -use tower_service::Service; +use std::io; + +use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt}; pub async fn connect( mut proxy_connection: T, @@ -64,43 +54,56 @@ pub async fn connect( } } -#[derive(Clone)] -pub struct ProxyTunnel { - proxy_addr: SocketAddr, -} +cfg_if! { + if #[cfg(feature = "apresolve")] { + use std::future::Future; + use std::net::{SocketAddr, ToSocketAddrs}; + use std::pin::Pin; + use std::task::Poll; -impl ProxyTunnel { - pub fn new(addr: T) -> io::Result { - let addr = addr.to_socket_addrs()?.next().ok_or_else(|| { - io::Error::new(io::ErrorKind::InvalidInput, "No socket address given") - })?; - Ok(Self { proxy_addr: addr }) - } -} + use hyper::service::Service; + use hyper::Uri; + use tokio::net::TcpStream; -impl Service for ProxyTunnel { - type Response = TcpStream; - type Error = io::Error; - type Future = Pin> + Send>>; + #[derive(Clone)] + pub struct ProxyTunnel { + proxy_addr: SocketAddr, + } - fn poll_ready(&mut self, _: &mut std::task::Context<'_>) -> Poll> { - Poll::Ready(Ok(())) - } + impl ProxyTunnel { + pub fn new(addr: T) -> io::Result { + let addr = addr.to_socket_addrs()?.next().ok_or_else(|| { + io::Error::new(io::ErrorKind::InvalidInput, "No socket address given") + })?; + Ok(Self { proxy_addr: addr }) + } + } + + impl Service for ProxyTunnel { + type Response = TcpStream; + type Error = io::Error; + type Future = Pin> + Send>>; + + fn poll_ready(&mut self, _: &mut std::task::Context<'_>) -> Poll> { + Poll::Ready(Ok(())) + } - fn call(&mut self, url: Uri) -> Self::Future { - let proxy_addr = self.proxy_addr; - let fut = async move { - let host = url - .host() - .ok_or_else(|| io::Error::new(io::ErrorKind::InvalidInput, "Host is missing"))?; - let port = url - .port() - .ok_or_else(|| io::Error::new(io::ErrorKind::InvalidInput, "Port is missing"))?; - - let conn = TcpStream::connect(proxy_addr).await?; - connect(conn, host, port.as_u16()).await - }; - - Box::pin(fut) + fn call(&mut self, url: Uri) -> Self::Future { + let proxy_addr = self.proxy_addr; + let fut = async move { + let host = url + .host() + .ok_or_else(|| io::Error::new(io::ErrorKind::InvalidInput, "Host is missing"))?; + let port = url + .port() + .ok_or_else(|| io::Error::new(io::ErrorKind::InvalidInput, "Port is missing"))?; + + let conn = TcpStream::connect(proxy_addr).await?; + connect(conn, host, port.as_u16()).await + }; + + Box::pin(fut) + } + } } } From 10827bd6a8a2a098b35b5d6ad766ef34d460d3b6 Mon Sep 17 00:00:00 2001 From: johannesd3 Date: Wed, 10 Feb 2021 22:54:35 +0100 Subject: [PATCH 22/35] Clean up dependencies of librespot-core * Use sub-crates of future * Remove unnecessary pin-project * Removed unused crates and features * Replace futures channels by tokio channels * Use serde's "derive" feature flag instead of serde_derive --- Cargo.lock | 20 ++++++++++++++++---- core/Cargo.toml | 17 +++++++++-------- core/build.rs | 6 +++--- core/src/apresolve.rs | 1 + core/src/audio_key.rs | 2 +- core/src/authentication.rs | 5 ++++- core/src/channel.rs | 22 ++++++++++++---------- core/src/connection/mod.rs | 2 +- core/src/keymaster.rs | 2 ++ core/src/lib.rs | 4 ---- core/src/mercury/mod.rs | 34 +++++++++++++++++----------------- core/src/session.rs | 23 +++++++++++++++-------- 12 files changed, 81 insertions(+), 57 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 282888ddd..7fe8387d0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1453,7 +1453,9 @@ dependencies = [ "cfg-if 1.0.0", "env_logger", "error-chain", - "futures", + "futures-core", + "futures-sink", + "futures-util", "hmac", "httparse", "hyper", @@ -1464,15 +1466,14 @@ dependencies = [ "num-traits", "once_cell", "pbkdf2", - "pin-project-lite", "protobuf", - "rand 0.7.3", + "rand 0.8.3", "serde", - "serde_derive", "serde_json", "sha-1 0.9.4", "shannon", "tokio", + "tokio-stream", "tokio-util", "url 1.7.2", "vergen", @@ -2819,6 +2820,17 @@ dependencies = [ "syn", ] +[[package]] +name = "tokio-stream" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1981ad97df782ab506a1f43bf82c967326960d278acf3bf8279809648c3ff3ea" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + [[package]] name = "tokio-util" version = "0.6.3" diff --git a/core/Cargo.toml b/core/Cargo.toml index f1a15eb1d..85f3be621 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -19,7 +19,9 @@ byteorder = "1.4" bytes = "1.0" cfg-if = "1" error-chain = { version = "0.12", default-features = false } -futures = { version = "0.3", features = ["bilock", "unstable"] } +futures-core = { version = "0.3", default-features = false } +futures-sink = { version = "0.3", default-features = false } +futures-util = { version = "0.3", default-features = false, features = ["alloc", "bilock", "unstable", "sink"] } hmac = "0.10" httparse = "1.3" hyper = { version = "0.14", optional = true, features = ["client", "tcp", "http1"] } @@ -28,21 +30,20 @@ num-bigint = "0.3" num-integer = "0.1" num-traits = "0.2" once_cell = "1.5.2" -pbkdf2 = { version = "0.7", default_features = false, features = ["hmac"] } -pin-project-lite = "0.2.4" +pbkdf2 = { version = "0.7", default-features = false, features = ["hmac"] } protobuf = "~2.14.0" -rand = "0.7" -serde = "1.0" -serde_derive = "1.0" +rand = "0.8" +serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" sha-1 = "0.9" shannon = "0.2.0" -tokio = { version = "1.0", features = ["io-util", "rt-multi-thread"] } +tokio = { version = "1.0", features = ["io-util", "net", "rt", "sync"] } +tokio-stream = "0.1" tokio-util = { version = "0.6", features = ["codec"] } url = "1.7" [build-dependencies] -rand = "0.7" +rand = "0.8" vergen = "3.0.4" [dev-dependencies] diff --git a/core/build.rs b/core/build.rs index 83f504728..0fc293354 100644 --- a/core/build.rs +++ b/core/build.rs @@ -7,10 +7,10 @@ fn main() { flags.toggle(ConstantsFlags::REBUILD_ON_HEAD_CHANGE); generate_cargo_keys(ConstantsFlags::all()).expect("Unable to generate the cargo keys!"); - let mut rng = rand::thread_rng(); - let build_id: String = ::std::iter::repeat(()) - .map(|()| rng.sample(Alphanumeric)) + let build_id: String = rand::thread_rng() + .sample_iter(Alphanumeric) .take(8) + .map(char::from) .collect(); println!("cargo:rustc-env=VERGEN_BUILD_ID={}", build_id); } diff --git a/core/src/apresolve.rs b/core/src/apresolve.rs index cd354d888..7698691c9 100644 --- a/core/src/apresolve.rs +++ b/core/src/apresolve.rs @@ -9,6 +9,7 @@ cfg_if! { use std::error::Error; use hyper::{Body, Client, Method, Request, Uri}; + use serde::{Serialize, Deserialize}; use crate::proxytunnel::ProxyTunnel; diff --git a/core/src/audio_key.rs b/core/src/audio_key.rs index b9f0c2328..3bce1c73e 100644 --- a/core/src/audio_key.rs +++ b/core/src/audio_key.rs @@ -1,8 +1,8 @@ use byteorder::{BigEndian, ByteOrder, WriteBytesExt}; use bytes::Bytes; -use futures::channel::oneshot; use std::collections::HashMap; use std::io::Write; +use tokio::sync::oneshot; use crate::spotify_id::{FileId, SpotifyId}; use crate::util::SeqGenerator; diff --git a/core/src/authentication.rs b/core/src/authentication.rs index fa5704098..ff477df56 100644 --- a/core/src/authentication.rs +++ b/core/src/authentication.rs @@ -1,10 +1,13 @@ +use std::io::{self, Read}; +use std::ops::FnOnce; + use aes::Aes192; use byteorder::{BigEndian, ByteOrder}; use hmac::Hmac; use pbkdf2::pbkdf2; use protobuf::ProtobufEnum; +use serde::{Deserialize, Serialize}; use sha1::{Digest, Sha1}; -use std::io::{self, Read}; use crate::protocol::authentication::AuthenticationType; use crate::protocol::keyexchange::{APLoginFailed, ErrorCode}; diff --git a/core/src/channel.rs b/core/src/channel.rs index 7ada05d5e..54eee1841 100644 --- a/core/src/channel.rs +++ b/core/src/channel.rs @@ -1,12 +1,14 @@ +use std::collections::HashMap; +use std::pin::Pin; +use std::task::{Context, Poll}; +use std::time::Instant; + use byteorder::{BigEndian, ByteOrder}; use bytes::Bytes; -use futures::{channel::mpsc, lock::BiLock, Stream, StreamExt}; -use std::{ - collections::HashMap, - pin::Pin, - task::{Context, Poll}, - time::Instant, -}; +use futures_core::Stream; +use futures_util::lock::BiLock; +use futures_util::StreamExt; +use tokio::sync::mpsc; use crate::util::SeqGenerator; @@ -46,7 +48,7 @@ enum ChannelState { impl ChannelManager { pub fn allocate(&self) -> (u16, Channel) { - let (tx, rx) = mpsc::unbounded(); + let (tx, rx) = mpsc::unbounded_channel(); let seq = self.lock(|inner| { let seq = inner.sequence.get(); @@ -85,7 +87,7 @@ impl ChannelManager { inner.download_measurement_bytes += data.len(); if let Entry::Occupied(entry) = inner.channels.entry(id) { - let _ = entry.get().unbounded_send((cmd, data)); + let _ = entry.get().send((cmd, data)); } }); } @@ -105,7 +107,7 @@ impl ChannelManager { impl Channel { fn recv_packet(&mut self, cx: &mut Context<'_>) -> Poll> { - let (cmd, packet) = match self.receiver.poll_next_unpin(cx) { + let (cmd, packet) = match self.receiver.poll_recv(cx) { Poll::Pending => return Poll::Pending, Poll::Ready(o) => o.ok_or(ChannelError)?, }; diff --git a/core/src/connection/mod.rs b/core/src/connection/mod.rs index 68e2e7a50..6bdbde6a8 100644 --- a/core/src/connection/mod.rs +++ b/core/src/connection/mod.rs @@ -4,7 +4,7 @@ mod handshake; pub use self::codec::APCodec; pub use self::handshake::handshake; -use futures::{SinkExt, StreamExt}; +use futures_util::{SinkExt, StreamExt}; use protobuf::{self, Message}; use std::io; use std::net::ToSocketAddrs; diff --git a/core/src/keymaster.rs b/core/src/keymaster.rs index 87b3f1e30..8c3c00a21 100644 --- a/core/src/keymaster.rs +++ b/core/src/keymaster.rs @@ -1,3 +1,5 @@ +use serde::Deserialize; + use crate::{mercury::MercuryError, session::Session}; #[derive(Deserialize, Debug, Clone)] diff --git a/core/src/lib.rs b/core/src/lib.rs index 65fa898aa..54f83f17e 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -5,10 +5,6 @@ extern crate log; #[macro_use] extern crate cfg_if; #[macro_use] -extern crate serde_derive; -#[macro_use] -extern crate pin_project_lite; -#[macro_use] extern crate error_chain; use librespot_protocol as protocol; diff --git a/core/src/mercury/mod.rs b/core/src/mercury/mod.rs index 4baa674f3..537ff2cb8 100644 --- a/core/src/mercury/mod.rs +++ b/core/src/mercury/mod.rs @@ -1,14 +1,17 @@ +use std::collections::HashMap; +use std::future::Future; +use std::mem; +use std::pin::Pin; +use std::task::Context; +use std::task::Poll; + +use byteorder::{BigEndian, ByteOrder}; +use bytes::Bytes; +use tokio::sync::{mpsc, oneshot}; + use crate::protocol; use crate::util::url_encode; use crate::util::SeqGenerator; -use byteorder::{BigEndian, ByteOrder}; -use bytes::Bytes; -use futures::{ - channel::{mpsc, oneshot}, - Future, -}; -use std::{collections::HashMap, task::Poll}; -use std::{mem, pin::Pin, task::Context}; mod types; pub use self::types::*; @@ -31,18 +34,15 @@ pub struct MercuryPending { callback: Option>>, } -pin_project! { - pub struct MercuryFuture { - #[pin] - receiver: oneshot::Receiver> - } +pub struct MercuryFuture { + receiver: oneshot::Receiver>, } impl Future for MercuryFuture { type Output = Result; - fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { - match self.project().receiver.poll(cx) { + fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll { + match Pin::new(&mut self.receiver).poll(cx) { Poll::Ready(Ok(x)) => Poll::Ready(x), Poll::Ready(Err(_)) => Poll::Ready(Err(MercuryError)), Poll::Pending => Poll::Pending, @@ -119,7 +119,7 @@ impl MercuryManager { async move { let response = request.await?; - let (tx, rx) = mpsc::unbounded(); + let (tx, rx) = mpsc::unbounded_channel(); manager.lock(move |inner| { if !inner.invalid { @@ -221,7 +221,7 @@ impl MercuryManager { // if send fails, remove from list of subs // TODO: send unsub message - sub.unbounded_send(response.clone()).is_ok() + sub.send(response.clone()).is_ok() } else { // URI doesn't match true diff --git a/core/src/session.rs b/core/src/session.rs index b0eca0c00..858a0b696 100644 --- a/core/src/session.rs +++ b/core/src/session.rs @@ -1,14 +1,19 @@ +use std::future::Future; +use std::io; +use std::pin::Pin; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::{Arc, RwLock, Weak}; +use std::task::Context; use std::task::Poll; use std::time::{SystemTime, UNIX_EPOCH}; -use std::{io, pin::Pin, task::Context}; - -use once_cell::sync::OnceCell; use byteorder::{BigEndian, ByteOrder}; use bytes::Bytes; -use futures::{channel::mpsc, Future, FutureExt, StreamExt, TryStream, TryStreamExt}; +use futures_core::TryStream; +use futures_util::{FutureExt, StreamExt, TryStreamExt}; +use once_cell::sync::OnceCell; +use tokio::sync::mpsc; +use tokio_stream::wrappers::UnboundedReceiverStream; use crate::apresolve::apresolve_or_fallback; use crate::audio_key::AudioKeyManager; @@ -87,7 +92,7 @@ impl Session { ) -> Session { let (sink, stream) = transport.split(); - let (sender_tx, sender_rx) = mpsc::unbounded(); + let (sender_tx, sender_rx) = mpsc::unbounded_channel(); let session_id = SESSION_COUNTER.fetch_add(1, Ordering::Relaxed); debug!("new Session[{}]", session_id); @@ -114,11 +119,13 @@ impl Session { session_id: session_id, })); - let sender_task = sender_rx.map(Ok::<_, io::Error>).forward(sink); + let sender_task = UnboundedReceiverStream::new(sender_rx) + .map(Ok) + .forward(sink); let receiver_task = DispatchTask(stream, session.weak()); let task = - futures::future::join(sender_task, receiver_task).map(|_| io::Result::<_>::Ok(())); + futures_util::future::join(sender_task, receiver_task).map(|_| io::Result::<_>::Ok(())); tokio::spawn(task); session } @@ -193,7 +200,7 @@ impl Session { } pub fn send_packet(&self, cmd: u8, data: Vec) { - self.0.tx_connection.unbounded_send((cmd, data)).unwrap(); + self.0.tx_connection.send((cmd, data)).unwrap(); } pub fn cache(&self) -> Option<&Arc> { From a6ed6857d25e0eff8fd16bf14d17f5e2be6bf644 Mon Sep 17 00:00:00 2001 From: johannesd3 Date: Wed, 10 Feb 2021 23:03:33 +0100 Subject: [PATCH 23/35] Clean up dependencies in librespot-metadata * Replaced LinearMap by HashMap * Removed unnecessary dependencies * Removed "extern crate"s --- Cargo.lock | 8 -------- metadata/Cargo.toml | 2 -- metadata/src/lib.rs | 18 ++++++------------ 3 files changed, 6 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7fe8387d0..94aea40b2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1485,10 +1485,8 @@ version = "0.1.6" dependencies = [ "async-trait", "byteorder", - "futures", "librespot-core", "librespot-protocol", - "linear-map", "log", "protobuf", ] @@ -1542,12 +1540,6 @@ dependencies = [ "pkg-config", ] -[[package]] -name = "linear-map" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfae20f6b19ad527b550c223fddc3077a547fc70cda94b9b566575423fd303ee" - [[package]] name = "lock_api" version = "0.4.2" diff --git a/metadata/Cargo.toml b/metadata/Cargo.toml index 6baae5d90..f3087b8a9 100644 --- a/metadata/Cargo.toml +++ b/metadata/Cargo.toml @@ -10,8 +10,6 @@ edition = "2018" [dependencies] async-trait = "0.1" byteorder = "1.3" -futures = "0.3" -linear-map = "1.2" protobuf = "~2.14.0" log = "0.4" diff --git a/metadata/src/lib.rs b/metadata/src/lib.rs index f71bae95d..8faa027e1 100644 --- a/metadata/src/lib.rs +++ b/metadata/src/lib.rs @@ -1,26 +1,20 @@ #![allow(clippy::unused_io_amount)] #![allow(clippy::redundant_field_names)] + #[macro_use] extern crate log; #[macro_use] extern crate async_trait; -extern crate byteorder; -extern crate futures; -extern crate linear_map; -extern crate protobuf; - -extern crate librespot_core; -extern crate librespot_protocol as protocol; - pub mod cover; -use linear_map::LinearMap; +use std::collections::HashMap; use librespot_core::mercury::MercuryError; use librespot_core::session::Session; use librespot_core::spotify_id::{FileId, SpotifyAudioType, SpotifyId}; +use librespot_protocol as protocol; pub use crate::protocol::metadata::AudioFile_Format as FileFormat; @@ -64,7 +58,7 @@ where pub struct AudioItem { pub id: SpotifyId, pub uri: String, - pub files: LinearMap, + pub files: HashMap, pub name: String, pub duration: i32, pub available: bool, @@ -143,7 +137,7 @@ pub struct Track { pub duration: i32, pub album: SpotifyId, pub artists: Vec, - pub files: LinearMap, + pub files: HashMap, pub alternatives: Vec, pub available: bool, } @@ -165,7 +159,7 @@ pub struct Episode { pub duration: i32, pub language: String, pub show: SpotifyId, - pub files: LinearMap, + pub files: HashMap, pub covers: Vec, pub available: bool, pub explicit: bool, From 746e6c863eeb58a0dc55ed468edac3d8e85823f7 Mon Sep 17 00:00:00 2001 From: johannesd3 Date: Wed, 10 Feb 2021 23:07:59 +0100 Subject: [PATCH 24/35] Put lewton behind feature flag --- Cargo.lock | 1 + Cargo.toml | 3 ++- audio/Cargo.toml | 6 ++++-- audio/src/lib.rs | 32 ++++++++++++++++++++++---------- 4 files changed, 29 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 94aea40b2..55bc1f7e4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1402,6 +1402,7 @@ dependencies = [ "bit-set", "byteorder", "bytes", + "cfg-if 1.0.0", "futures", "lewton", "librespot-core", diff --git a/Cargo.toml b/Cargo.toml index 617ae0861..a26db2ed6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,10 +75,11 @@ gstreamer-backend = ["librespot-playback/gstreamer-backend"] with-tremor = ["librespot-audio/with-tremor"] with-vorbis = ["librespot-audio/with-vorbis"] +with-lewton = ["librespot-audio/with-lewton"] # with-dns-sd = ["librespot-connect/with-dns-sd"] -default = ["rodio-backend", "apresolve"] +default = ["rodio-backend", "apresolve", "with-lewton"] [package.metadata.deb] maintainer = "librespot-org" diff --git a/audio/Cargo.toml b/audio/Cargo.toml index 96af08f2b..01d81f044 100644 --- a/audio/Cargo.toml +++ b/audio/Cargo.toml @@ -15,18 +15,20 @@ aes-ctr = "0.6" bit-set = "0.5" byteorder = "1.4" bytes = "1.0" +cfg-if = "1" futures = "0.3" -lewton = "0.10" -ogg = "0.8" log = "0.4" num-bigint = "0.3" num-traits = "0.2" +ogg = "0.8" pin-project-lite = "0.2.4" tempfile = "3.1" +lewton = { version = "0.10", optional = true } librespot-tremor = { version = "0.2.0", optional = true } vorbis = { version ="0.0.14", optional = true } [features] +with-lewton = ["lewton"] with-tremor = ["librespot-tremor"] with-vorbis = ["vorbis"] diff --git a/audio/src/lib.rs b/audio/src/lib.rs index 3f22ac5d1..8b3a8dfa2 100644 --- a/audio/src/lib.rs +++ b/audio/src/lib.rs @@ -19,11 +19,29 @@ extern crate librespot_core; mod decrypt; mod fetch; -#[cfg(not(any(feature = "with-tremor", feature = "with-vorbis")))] -mod lewton_decoder; -#[cfg(any(feature = "with-tremor", feature = "with-vorbis"))] -mod libvorbis_decoder; +use cfg_if::cfg_if; + +#[cfg(any( + all(feature = "with-lewton", feature = "with-tremor"), + all(feature = "with-vorbis", feature = "with-tremor"), + all(feature = "with-lewton", feature = "with-vorbis") +))] +compile_error!("Cannot use two decoders at the same time."); + +cfg_if! { + if #[cfg(feature = "with-lewton")] { + mod lewton_decoder; + pub use lewton_decoder::{VorbisDecoder, VorbisError}; + } else if #[cfg(any(feature = "with-tremor", feature = "with-vorbis"))] { + mod libvorbis_decoder; + pub use crate::libvorbis_decoder::{VorbisDecoder, VorbisError}; + } else { + compile_error!("Must choose a vorbis decoder."); + } +} + mod passthrough_decoder; +pub use passthrough_decoder::{PassthroughDecoder, PassthroughError}; mod range_set; @@ -63,12 +81,6 @@ impl AudioPacket { } } -#[cfg(not(any(feature = "with-tremor", feature = "with-vorbis")))] -pub use crate::lewton_decoder::{VorbisDecoder, VorbisError}; -#[cfg(any(feature = "with-tremor", feature = "with-vorbis"))] -pub use libvorbis_decoder::{VorbisDecoder, VorbisError}; -pub use passthrough_decoder::{PassthroughDecoder, PassthroughError}; - #[derive(Debug)] pub enum AudioError { PassthroughError(PassthroughError), From b83976a8ec29f7b34ddcdadb02254dd8f90f7e2a Mon Sep 17 00:00:00 2001 From: johannesd3 Date: Wed, 10 Feb 2021 23:13:32 +0100 Subject: [PATCH 25/35] Remove "extern crate"s from librespot-audio --- audio/src/lewton_decoder.rs | 12 +++++------- audio/src/lib.rs | 11 ----------- audio/src/libvorbis_decoder.rs | 4 +--- 3 files changed, 6 insertions(+), 21 deletions(-) diff --git a/audio/src/lewton_decoder.rs b/audio/src/lewton_decoder.rs index 1addaa011..086ea57e0 100644 --- a/audio/src/lewton_decoder.rs +++ b/audio/src/lewton_decoder.rs @@ -1,6 +1,4 @@ -extern crate lewton; - -use self::lewton::inside_ogg::OggStreamReader; +use lewton::inside_ogg::OggStreamReader; use super::{AudioDecoder, AudioError, AudioPacket}; use std::error; @@ -32,10 +30,10 @@ where } fn next_packet(&mut self) -> Result, AudioError> { - use self::lewton::audio::AudioReadError::AudioIsHeader; - use self::lewton::OggReadError::NoCapturePatternFound; - use self::lewton::VorbisError::BadAudio; - use self::lewton::VorbisError::OggError; + use lewton::audio::AudioReadError::AudioIsHeader; + use lewton::OggReadError::NoCapturePatternFound; + use lewton::VorbisError::BadAudio; + use lewton::VorbisError::OggError; loop { match self.0.read_dec_packet_itl() { Ok(Some(packet)) => return Ok(Some(AudioPacket::Samples(packet))), diff --git a/audio/src/lib.rs b/audio/src/lib.rs index 8b3a8dfa2..9bb6f8e44 100644 --- a/audio/src/lib.rs +++ b/audio/src/lib.rs @@ -5,17 +5,6 @@ extern crate log; #[macro_use] extern crate pin_project_lite; -extern crate aes_ctr; -extern crate bit_set; -extern crate byteorder; -extern crate bytes; -extern crate futures; -extern crate num_bigint; -extern crate num_traits; -extern crate tempfile; - -extern crate librespot_core; - mod decrypt; mod fetch; diff --git a/audio/src/libvorbis_decoder.rs b/audio/src/libvorbis_decoder.rs index 8aced5562..eeef8ab9e 100644 --- a/audio/src/libvorbis_decoder.rs +++ b/audio/src/libvorbis_decoder.rs @@ -1,7 +1,5 @@ #[cfg(feature = "with-tremor")] -extern crate librespot_tremor as vorbis; -#[cfg(not(feature = "with-tremor"))] -extern crate vorbis; +use librespot_tremor as vorbis; use super::{AudioDecoder, AudioError, AudioPacket}; use std::error; From 5c42d2e879ae7b72c710a68ff992dfd792477d65 Mon Sep 17 00:00:00 2001 From: johannesd3 Date: Wed, 10 Feb 2021 23:18:13 +0100 Subject: [PATCH 26/35] Clean up dependencies in librespot-audio * Remove unused deps * Use futures-util instead of futures * Replace futures channels by tokio channels * Remove unnecessary pin_project * Reordered "use" statements --- Cargo.lock | 22 ++----------- audio/Cargo.toml | 7 ++-- audio/src/fetch.rs | 72 ++++++++++++++++++------------------------ audio/src/lib.rs | 2 -- audio/src/range_set.rs | 2 +- 5 files changed, 36 insertions(+), 69 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 55bc1f7e4..a8577d19d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -180,21 +180,6 @@ dependencies = [ "shlex", ] -[[package]] -name = "bit-set" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e11e16035ea35e4e5997b393eacbf6f63983188f7a2ad25bfb13465f5ad59de" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" - [[package]] name = "bitflags" version = "1.2.1" @@ -1399,20 +1384,17 @@ name = "librespot-audio" version = "0.1.6" dependencies = [ "aes-ctr", - "bit-set", "byteorder", "bytes", "cfg-if 1.0.0", - "futures", + "futures-util", "lewton", "librespot-core", "librespot-tremor", "log", - "num-bigint", - "num-traits", "ogg", - "pin-project-lite", "tempfile", + "tokio", "vorbis", ] diff --git a/audio/Cargo.toml b/audio/Cargo.toml index 01d81f044..d8c0eea28 100644 --- a/audio/Cargo.toml +++ b/audio/Cargo.toml @@ -12,17 +12,14 @@ version = "0.1.6" [dependencies] aes-ctr = "0.6" -bit-set = "0.5" byteorder = "1.4" bytes = "1.0" cfg-if = "1" -futures = "0.3" log = "0.4" -num-bigint = "0.3" -num-traits = "0.2" +futures-util = { version = "0.3", default_features = false } ogg = "0.8" -pin-project-lite = "0.2.4" tempfile = "3.1" +tokio = { version = "1", features = ["sync"] } lewton = { version = "0.10", optional = true } librespot-tremor = { version = "0.2.0", optional = true } diff --git a/audio/src/fetch.rs b/audio/src/fetch.rs index 286a2b882..0ec9b01df 100644 --- a/audio/src/fetch.rs +++ b/audio/src/fetch.rs @@ -1,30 +1,23 @@ -use crate::range_set::{Range, RangeSet}; -use byteorder::{BigEndian, ByteOrder, WriteBytesExt}; -use bytes::Bytes; -use futures::{ - channel::{mpsc, oneshot}, - future, -}; -use futures::{Future, Stream, StreamExt, TryFutureExt, TryStreamExt}; - +use std::cmp::{max, min}; use std::fs; +use std::future::Future; use std::io::{self, Read, Seek, SeekFrom, Write}; +use std::pin::Pin; +use std::sync::atomic::{self, AtomicUsize}; use std::sync::{Arc, Condvar, Mutex}; -use std::task::Poll; +use std::task::{Context, Poll}; use std::time::{Duration, Instant}; -use std::{ - cmp::{max, min}, - pin::Pin, - task::Context, -}; -use tempfile::NamedTempFile; -use futures::channel::mpsc::unbounded; +use byteorder::{BigEndian, ByteOrder, WriteBytesExt}; +use bytes::Bytes; +use futures_util::{future, StreamExt, TryFutureExt, TryStreamExt}; use librespot_core::channel::{Channel, ChannelData, ChannelError, ChannelHeaders}; use librespot_core::session::Session; use librespot_core::spotify_id::FileId; -use std::sync::atomic; -use std::sync::atomic::AtomicUsize; +use tempfile::NamedTempFile; +use tokio::sync::{mpsc, oneshot}; + +use crate::range_set::{Range, RangeSet}; const MINIMUM_DOWNLOAD_SIZE: usize = 1024 * 16; // The minimum size of a block that is requested from the Spotify servers in one request. @@ -96,6 +89,7 @@ pub enum AudioFile { Streaming(AudioFileStreaming), } +#[derive(Debug)] enum StreamLoaderCommand { Fetch(Range), // signal the stream loader to fetch a range of the file RandomAccessMode(), // optimise download strategy for random access @@ -147,7 +141,7 @@ impl StreamLoaderController { fn send_stream_loader_command(&mut self, command: StreamLoaderCommand) { if let Some(ref mut channel) = self.channel_tx { // ignore the error in case the channel has been closed already. - let _ = channel.unbounded_send(command); + let _ = channel.send(command); } } @@ -191,7 +185,7 @@ impl StreamLoaderController { // We can't use self.fetch here because self can't be borrowed mutably, so we access the channel directly. if let Some(ref mut channel) = self.channel_tx { // ignore the error in case the channel has been closed already. - let _ = channel.unbounded_send(StreamLoaderCommand::Fetch(range)); + let _ = channel.send(StreamLoaderCommand::Fetch(range)); } } } @@ -387,7 +381,7 @@ impl AudioFileStreaming { //let (seek_tx, seek_rx) = mpsc::unbounded(); let (stream_loader_command_tx, stream_loader_command_rx) = - mpsc::unbounded::(); + mpsc::unbounded_channel::(); let fetcher = AudioFileFetch::new( session.clone(), @@ -490,12 +484,12 @@ async fn audio_file_fetch_receive_data( duration_ms = duration.as_millis() as u64; } let _ = file_data_tx - .unbounded_send(ReceivedData::ResponseTimeMs(duration_ms as usize)); + .send(ReceivedData::ResponseTimeMs(duration_ms as usize)); measure_ping_time = false; } let data_size = data.len(); let _ = file_data_tx - .unbounded_send(ReceivedData::Data(PartialFileData { + .send(ReceivedData::Data(PartialFileData { offset: data_offset, data: data, })); @@ -696,21 +690,17 @@ async fn audio_file_fetch( future::select_all(vec![f1, f2, f3]).await }*/ -pin_project! { - struct AudioFileFetch { - session: Session, - shared: Arc, - output: Option, +struct AudioFileFetch { + session: Session, + shared: Arc, + output: Option, - file_data_tx: mpsc::UnboundedSender, - #[pin] - file_data_rx: mpsc::UnboundedReceiver, + file_data_tx: mpsc::UnboundedSender, + file_data_rx: mpsc::UnboundedReceiver, - #[pin] - stream_loader_command_rx: mpsc::UnboundedReceiver, - complete_tx: Option>, - network_response_times_ms: Vec, - } + stream_loader_command_rx: mpsc::UnboundedReceiver, + complete_tx: Option>, + network_response_times_ms: Vec, } impl AudioFileFetch { @@ -725,7 +715,7 @@ impl AudioFileFetch { stream_loader_command_rx: mpsc::UnboundedReceiver, complete_tx: oneshot::Sender, ) -> AudioFileFetch { - let (file_data_tx, file_data_rx) = unbounded::(); + let (file_data_tx, file_data_rx) = mpsc::unbounded_channel::(); { let requested_range = Range::new(0, initial_data_length); @@ -863,7 +853,7 @@ impl AudioFileFetch { fn poll_file_data_rx(&mut self, cx: &mut Context<'_>) -> Poll<()> { loop { - match Pin::new(&mut self.file_data_rx).poll_next(cx) { + match self.file_data_rx.poll_recv(cx) { Poll::Ready(None) => return Poll::Ready(()), Poll::Ready(Some(ReceivedData::ResponseTimeMs(response_time_ms))) => { trace!("Ping time estimated as: {} ms.", response_time_ms); @@ -939,7 +929,7 @@ impl AudioFileFetch { fn poll_stream_loader_command_rx(&mut self, cx: &mut Context<'_>) -> Poll<()> { loop { - match Pin::new(&mut self.stream_loader_command_rx).poll_next(cx) { + match self.stream_loader_command_rx.poll_recv(cx) { Poll::Ready(None) => return Poll::Ready(()), Poll::Ready(Some(cmd)) => match cmd { StreamLoaderCommand::Fetch(request) => { @@ -1059,7 +1049,7 @@ impl Read for AudioFileStreaming { for &range in ranges_to_request.iter() { self.stream_loader_command_tx - .unbounded_send(StreamLoaderCommand::Fetch(range)) + .send(StreamLoaderCommand::Fetch(range)) .unwrap(); } diff --git a/audio/src/lib.rs b/audio/src/lib.rs index 9bb6f8e44..099fb4a82 100644 --- a/audio/src/lib.rs +++ b/audio/src/lib.rs @@ -2,8 +2,6 @@ #[macro_use] extern crate log; -#[macro_use] -extern crate pin_project_lite; mod decrypt; mod fetch; diff --git a/audio/src/range_set.rs b/audio/src/range_set.rs index d01d888e7..31ce6500e 100644 --- a/audio/src/range_set.rs +++ b/audio/src/range_set.rs @@ -2,7 +2,7 @@ use std::cmp::{max, min}; use std::fmt; use std::slice::Iter; -#[derive(Copy, Clone)] +#[derive(Copy, Clone, Debug)] pub struct Range { pub start: usize, pub length: usize, From 5aeb733ad973537e7855a144abf0c64bad54c7e5 Mon Sep 17 00:00:00 2001 From: johannesd3 Date: Mon, 22 Feb 2021 09:55:40 +0100 Subject: [PATCH 27/35] Clean up dependencies in librespot-playback * Use futures-util instead of futures * Use tokio channels instead of futures channels * Removed "extern crate"s --- Cargo.lock | 4 +++- playback/Cargo.toml | 4 +++- playback/src/lib.rs | 36 +++------------------------- playback/src/player.rs | 53 +++++++++++++++++++++--------------------- 4 files changed, 36 insertions(+), 61 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a8577d19d..1d6871126 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1481,7 +1481,8 @@ dependencies = [ "alsa", "byteorder", "cpal", - "futures", + "futures-executor", + "futures-util", "glib", "gstreamer", "gstreamer-app", @@ -1498,6 +1499,7 @@ dependencies = [ "sdl2", "shell-words", "thiserror", + "tokio", "zerocopy", ] diff --git a/playback/Cargo.toml b/playback/Cargo.toml index 2759ae0e4..e32ee7ba2 100644 --- a/playback/Cargo.toml +++ b/playback/Cargo.toml @@ -18,10 +18,12 @@ path = "../metadata" version = "0.1.6" [dependencies] -futures = "0.3" +futures-executor = { version = "0.3", default_features = false } +futures-util = { version = "0.3", default_features = false } log = "0.4" byteorder = "1.4" shell-words = "1.0.0" +tokio = { version = "1", features = ["sync"] } alsa = { version = "0.4", optional = true } portaudio-rs = { version = "0.3", optional = true } diff --git a/playback/src/lib.rs b/playback/src/lib.rs index f46064305..9613f2e52 100644 --- a/playback/src/lib.rs +++ b/playback/src/lib.rs @@ -1,39 +1,9 @@ #[macro_use] extern crate log; -extern crate byteorder; -extern crate futures; -extern crate shell_words; - -#[cfg(feature = "alsa-backend")] -extern crate alsa; - -#[cfg(feature = "portaudio-backend")] -extern crate portaudio_rs; - -#[cfg(feature = "pulseaudio-backend")] -extern crate libpulse_binding; -#[cfg(feature = "pulseaudio-backend")] -extern crate libpulse_simple_binding; - -#[cfg(feature = "jackaudio-backend")] -extern crate jack; - -#[cfg(feature = "gstreamer-backend")] -extern crate glib; -#[cfg(feature = "gstreamer-backend")] -extern crate gstreamer as gst; -#[cfg(feature = "gstreamer-backend")] -extern crate gstreamer_app as gst_app; -#[cfg(feature = "gstreamer-backend")] -extern crate zerocopy; - -#[cfg(feature = "sdl-backend")] -extern crate sdl2; - -extern crate librespot_audio as audio; -extern crate librespot_core; -extern crate librespot_metadata as metadata; +use librespot_audio as audio; +use librespot_core as core; +use librespot_metadata as metadata; pub mod audio_backend; pub mod config; diff --git a/playback/src/player.rs b/playback/src/player.rs index 861f91b0d..bc4a1dda1 100644 --- a/playback/src/player.rs +++ b/playback/src/player.rs @@ -1,3 +1,16 @@ +use std::borrow::Cow; +use std::cmp::max; +use std::future::Future; +use std::io::{self, Read, Seek, SeekFrom}; +use std::pin::Pin; +use std::task::{Context, Poll}; +use std::time::{Duration, Instant}; +use std::{mem, thread}; + +use byteorder::{LittleEndian, ReadBytesExt}; +use futures_util::{future, TryFutureExt}; +use tokio::sync::{mpsc, oneshot}; + use crate::audio::{AudioDecoder, AudioError, AudioPacket, PassthroughDecoder, VorbisDecoder}; use crate::audio::{AudioDecrypt, AudioFile, StreamLoaderController}; use crate::audio::{ @@ -7,23 +20,11 @@ use crate::audio::{ use crate::audio_backend::Sink; use crate::config::NormalisationType; use crate::config::{Bitrate, PlayerConfig}; +use crate::core::session::Session; +use crate::core::spotify_id::SpotifyId; +use crate::core::util::SeqGenerator; use crate::metadata::{AudioItem, FileFormat}; use crate::mixer::AudioFilter; -use librespot_core::session::Session; -use librespot_core::spotify_id::SpotifyId; -use librespot_core::util::SeqGenerator; - -use byteorder::{LittleEndian, ReadBytesExt}; -use futures::channel::{mpsc, oneshot}; -use futures::{future, Future, Stream, StreamExt, TryFutureExt}; -use std::borrow::Cow; - -use std::cmp::max; -use std::io::{self, Read, Seek, SeekFrom}; -use std::pin::Pin; -use std::task::{Context, Poll}; -use std::time::{Duration, Instant}; -use std::{mem, thread}; const PRELOAD_NEXT_TRACK_BEFORE_END_DURATION_MS: u32 = 30000; @@ -244,8 +245,8 @@ impl Player { where F: FnOnce() -> Box + Send + 'static, { - let (cmd_tx, cmd_rx) = mpsc::unbounded(); - let (event_sender, event_receiver) = mpsc::unbounded(); + let (cmd_tx, cmd_rx) = mpsc::unbounded_channel(); + let (event_sender, event_receiver) = mpsc::unbounded_channel(); let handle = thread::spawn(move || { debug!("new Player[{}]", session.session_id()); @@ -265,8 +266,8 @@ impl Player { }; // While PlayerInternal is written as a future, it still contains blocking code. - // It must be run by using wait() in a dedicated thread. - futures::executor::block_on(internal); + // It must be run by using block_on() in a dedicated thread. + futures_executor::block_on(internal); debug!("PlayerInternal thread finished."); }); @@ -281,7 +282,7 @@ impl Player { } fn command(&self, cmd: PlayerCommand) { - self.commands.as_ref().unwrap().unbounded_send(cmd).unwrap(); + self.commands.as_ref().unwrap().send(cmd).unwrap(); } pub fn load(&mut self, track_id: SpotifyId, start_playing: bool, position_ms: u32) -> u64 { @@ -317,14 +318,14 @@ impl Player { } pub fn get_player_event_channel(&self) -> PlayerEventChannel { - let (event_sender, event_receiver) = mpsc::unbounded(); + let (event_sender, event_receiver) = mpsc::unbounded_channel(); self.command(PlayerCommand::AddEventSender(event_sender)); event_receiver } - pub async fn get_end_of_track_future(&self) { + pub async fn await_end_of_track(&self) { let mut channel = self.get_player_event_channel(); - while let Some(event) = channel.next().await { + while let Some(event) = channel.recv().await { if matches!( event, PlayerEvent::EndOfTrack { .. } | PlayerEvent::Stopped { .. } @@ -797,7 +798,7 @@ impl Future for PlayerInternal { let mut all_futures_completed_or_not_ready = true; // process commands that were sent to us - let cmd = match Pin::new(&mut self.commands).poll_next(cx) { + let cmd = match self.commands.poll_recv(cx) { Poll::Ready(None) => return Poll::Ready(()), // client has disconnected - shut down. Poll::Ready(Some(cmd)) => { all_futures_completed_or_not_ready = false; @@ -1580,7 +1581,7 @@ impl PlayerInternal { fn send_event(&mut self, event: PlayerEvent) { let mut index = 0; while index < self.event_senders.len() { - match self.event_senders[index].unbounded_send(event.clone()) { + match self.event_senders[index].send(event.clone()) { Ok(_) => index += 1, Err(_) => { self.event_senders.remove(index); @@ -1608,7 +1609,7 @@ impl PlayerInternal { let (result_tx, result_rx) = oneshot::channel(); std::thread::spawn(move || { - futures::executor::block_on(loader.load_track(spotify_id, position_ms)).and_then( + futures_executor::block_on(loader.load_track(spotify_id, position_ms)).and_then( move |data| { let _ = result_tx.send(data); Some(()) From 45f42acb8299119df0ca094524081dbfb80e4303 Mon Sep 17 00:00:00 2001 From: johannesd3 Date: Mon, 22 Feb 2021 09:58:08 +0100 Subject: [PATCH 28/35] Refactor 'find_available_alternatives' --- playback/Cargo.toml | 2 +- playback/src/player.rs | 29 ++++++++++++++--------------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/playback/Cargo.toml b/playback/Cargo.toml index e32ee7ba2..96a0d264d 100644 --- a/playback/Cargo.toml +++ b/playback/Cargo.toml @@ -19,7 +19,7 @@ version = "0.1.6" [dependencies] futures-executor = { version = "0.3", default_features = false } -futures-util = { version = "0.3", default_features = false } +futures-util = { version = "0.3", default_features = false, features = ["alloc"] } log = "0.4" byteorder = "1.4" shell-words = "1.0.0" diff --git a/playback/src/player.rs b/playback/src/player.rs index bc4a1dda1..9b2c7125b 100644 --- a/playback/src/player.rs +++ b/playback/src/player.rs @@ -1,4 +1,3 @@ -use std::borrow::Cow; use std::cmp::max; use std::future::Future; use std::io::{self, Read, Seek, SeekFrom}; @@ -8,7 +7,8 @@ use std::time::{Duration, Instant}; use std::{mem, thread}; use byteorder::{LittleEndian, ReadBytesExt}; -use futures_util::{future, TryFutureExt}; +use futures_util::stream::futures_unordered::FuturesUnordered; +use futures_util::{future, StreamExt, TryFutureExt}; use tokio::sync::{mpsc, oneshot}; use crate::audio::{AudioDecoder, AudioError, AudioPacket, PassthroughDecoder, VorbisDecoder}; @@ -576,21 +576,20 @@ struct PlayerTrackLoader { } impl PlayerTrackLoader { - async fn find_available_alternative<'a, 'b>( - &'a self, - audio: &'b AudioItem, - ) -> Option> { + async fn find_available_alternative(&self, audio: AudioItem) -> Option { if audio.available { - Some(Cow::Borrowed(audio)) + Some(audio) } else if let Some(alternatives) = &audio.alternatives { - let alternatives = alternatives + let alternatives: FuturesUnordered<_> = alternatives .iter() - .map(|alt_id| AudioItem::get_audio_item(&self.session, *alt_id)); - let alternatives = future::try_join_all(alternatives).await.unwrap(); + .map(|alt_id| AudioItem::get_audio_item(&self.session, *alt_id)) + .collect(); + alternatives - .into_iter() - .find(|alt| alt.available) - .map(Cow::Owned) + .filter_map(|x| future::ready(x.ok())) + .filter(|x| future::ready(x.available)) + .next() + .await } else { None } @@ -630,10 +629,10 @@ impl PlayerTrackLoader { info!("Loading <{}> with Spotify URI <{}>", audio.name, audio.uri); - let audio = match self.find_available_alternative(&audio).await { + let audio = match self.find_available_alternative(audio).await { Some(audio) => audio, None => { - warn!("<{}> is not available", audio.uri); + warn!("<{}> is not available", spotify_id.to_uri()); return None; } }; From 27f308b82f46ce5c72eb4b3c66181046978479de Mon Sep 17 00:00:00 2001 From: johannesd3 Date: Sat, 13 Feb 2021 11:53:23 +0100 Subject: [PATCH 29/35] Replace error_chain by thiserror --- Cargo.lock | 2 +- core/Cargo.toml | 2 +- core/src/authentication.rs | 36 ---------------------- core/src/connection/mod.rs | 63 ++++++++++++++++++++++++++++++-------- core/src/lib.rs | 2 -- core/src/session.rs | 13 ++++++-- 6 files changed, 63 insertions(+), 55 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1d6871126..d8f80b489 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1435,7 +1435,6 @@ dependencies = [ "bytes", "cfg-if 1.0.0", "env_logger", - "error-chain", "futures-core", "futures-sink", "futures-util", @@ -1455,6 +1454,7 @@ dependencies = [ "serde_json", "sha-1 0.9.4", "shannon", + "thiserror", "tokio", "tokio-stream", "tokio-util", diff --git a/core/Cargo.toml b/core/Cargo.toml index 85f3be621..0ab4e398a 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -18,7 +18,6 @@ base64 = "0.13" byteorder = "1.4" bytes = "1.0" cfg-if = "1" -error-chain = { version = "0.12", default-features = false } futures-core = { version = "0.3", default-features = false } futures-sink = { version = "0.3", default-features = false } futures-util = { version = "0.3", default-features = false, features = ["alloc", "bilock", "unstable", "sink"] } @@ -37,6 +36,7 @@ serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" sha-1 = "0.9" shannon = "0.2.0" +thiserror = "1" tokio = { version = "1.0", features = ["io-util", "net", "rt", "sync"] } tokio-stream = "0.1" tokio-util = { version = "0.6", features = ["codec"] } diff --git a/core/src/authentication.rs b/core/src/authentication.rs index ff477df56..544dda4c9 100644 --- a/core/src/authentication.rs +++ b/core/src/authentication.rs @@ -1,5 +1,4 @@ use std::io::{self, Read}; -use std::ops::FnOnce; use aes::Aes192; use byteorder::{BigEndian, ByteOrder}; @@ -10,7 +9,6 @@ use serde::{Deserialize, Serialize}; use sha1::{Digest, Sha1}; use crate::protocol::authentication::AuthenticationType; -use crate::protocol::keyexchange::{APLoginFailed, ErrorCode}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Credentials { @@ -144,37 +142,3 @@ where let v: String = serde::Deserialize::deserialize(de)?; base64::decode(&v).map_err(|e| serde::de::Error::custom(e.to_string())) } - -error_chain! { - types { - AuthenticationError, AuthenticationErrorKind, AuthenticationResultExt, AuthenticationResult; - } - - foreign_links { - Io(::std::io::Error); - } - - errors { - BadCredentials { - description("Bad credentials") - display("Authentication failed with error: Bad credentials") - } - PremiumAccountRequired { - description("Premium account required") - display("Authentication failed with error: Premium account required") - } - } -} - -impl From for AuthenticationError { - fn from(login_failure: APLoginFailed) -> Self { - let error_code = login_failure.get_error_code(); - match error_code { - ErrorCode::BadCredentials => Self::from_kind(AuthenticationErrorKind::BadCredentials), - ErrorCode::PremiumAccountRequired => { - Self::from_kind(AuthenticationErrorKind::PremiumAccountRequired) - } - _ => format!("Authentication failed with error: {:?}", error_code).into(), - } - } -} diff --git a/core/src/connection/mod.rs b/core/src/connection/mod.rs index 6bdbde6a8..a07f9a2de 100644 --- a/core/src/connection/mod.rs +++ b/core/src/connection/mod.rs @@ -4,21 +4,60 @@ mod handshake; pub use self::codec::APCodec; pub use self::handshake::handshake; -use futures_util::{SinkExt, StreamExt}; -use protobuf::{self, Message}; -use std::io; +use std::io::{self, ErrorKind}; use std::net::ToSocketAddrs; + +use futures_util::{SinkExt, StreamExt}; +use protobuf::{self, Message, ProtobufError}; +use thiserror::Error; use tokio::net::TcpStream; use tokio_util::codec::Framed; use url::Url; -use crate::authentication::{AuthenticationError, Credentials}; -use crate::version; - +use crate::authentication::Credentials; +use crate::protocol::keyexchange::{APLoginFailed, ErrorCode}; use crate::proxytunnel; +use crate::version; pub type Transport = Framed; +fn login_error_message(code: &ErrorCode) -> &'static str { + pub use ErrorCode::*; + match code { + ProtocolError => "Protocol error", + TryAnotherAP => "Try another AP", + BadConnectionId => "Bad connection id", + TravelRestriction => "Travel restriction", + PremiumAccountRequired => "Premium account required", + BadCredentials => "Bad credentials", + CouldNotValidateCredentials => "Could not validate credentials", + AccountExists => "Account exists", + ExtraVerificationRequired => "Extra verification required", + InvalidAppKey => "Invalid app key", + ApplicationBanned => "Application banned", + } +} + +#[derive(Debug, Error)] +pub enum AuthenticationError { + #[error("Login failed with reason: {}", login_error_message(.0))] + LoginFailed(ErrorCode), + #[error("Authentication failed: {0}")] + IoError(#[from] io::Error), +} + +impl From for AuthenticationError { + fn from(e: ProtobufError) -> Self { + io::Error::new(ErrorKind::InvalidData, e).into() + } +} + +impl From for AuthenticationError { + fn from(login_failure: APLoginFailed) -> Self { + Self::LoginFailed(login_failure.get_error_code()) + } +} + pub async fn connect(addr: String, proxy: &Option) -> io::Result { let socket = if let Some(proxy) = proxy { info!("Using proxy \"{}\"", proxy); @@ -66,7 +105,6 @@ pub async fn authenticate( device_id: &str, ) -> Result { use crate::protocol::authentication::{APWelcome, ClientResponseEncrypted, CpuFamily, Os}; - use crate::protocol::keyexchange::APLoginFailed; let mut packet = ClientResponseEncrypted::new(); packet @@ -101,7 +139,7 @@ pub async fn authenticate( let (cmd, data) = transport.next().await.expect("EOF")?; match cmd { 0xac => { - let welcome_data: APWelcome = protobuf::parse_from_bytes(data.as_ref()).unwrap(); + let welcome_data: APWelcome = protobuf::parse_from_bytes(data.as_ref())?; let reusable_credentials = Credentials { username: welcome_data.get_canonical_username().to_owned(), @@ -111,12 +149,13 @@ pub async fn authenticate( Ok(reusable_credentials) } - 0xad => { - let error_data: APLoginFailed = protobuf::parse_from_bytes(data.as_ref()).unwrap(); + let error_data: APLoginFailed = protobuf::parse_from_bytes(data.as_ref())?; Err(error_data.into()) } - - _ => panic!("Unexpected packet {:?}", cmd), + _ => { + let msg = format!("Received invalid packet: {}", cmd); + Err(io::Error::new(ErrorKind::InvalidData, msg).into()) + } } } diff --git a/core/src/lib.rs b/core/src/lib.rs index 54f83f17e..4ebe85819 100644 --- a/core/src/lib.rs +++ b/core/src/lib.rs @@ -4,8 +4,6 @@ extern crate log; #[macro_use] extern crate cfg_if; -#[macro_use] -extern crate error_chain; use librespot_protocol as protocol; diff --git a/core/src/session.rs b/core/src/session.rs index 858a0b696..9eaff3ed5 100644 --- a/core/src/session.rs +++ b/core/src/session.rs @@ -12,6 +12,7 @@ use bytes::Bytes; use futures_core::TryStream; use futures_util::{FutureExt, StreamExt, TryStreamExt}; use once_cell::sync::OnceCell; +use thiserror::Error; use tokio::sync::mpsc; use tokio_stream::wrappers::UnboundedReceiverStream; @@ -21,10 +22,16 @@ use crate::authentication::Credentials; use crate::cache::Cache; use crate::channel::ChannelManager; use crate::config::SessionConfig; -use crate::connection; +use crate::connection::{self, AuthenticationError}; use crate::mercury::MercuryManager; -pub use crate::authentication::{AuthenticationError, AuthenticationErrorKind}; +#[derive(Debug, Error)] +pub enum SessionError { + #[error(transparent)] + AuthenticationError(#[from] AuthenticationError), + #[error("Cannot create session: {0}")] + IoError(#[from] io::Error), +} struct SessionData { country: String, @@ -59,7 +66,7 @@ impl Session { config: SessionConfig, credentials: Credentials, cache: Option, - ) -> Result { + ) -> Result { let ap = apresolve_or_fallback(&config.proxy, &config.ap_port).await; info!("Connecting to AP \"{}\"", ap); From f9c0e26f6df22fa0bbb1e37e9546c5ed778195ec Mon Sep 17 00:00:00 2001 From: johannesd3 Date: Sat, 13 Feb 2021 15:38:05 +0100 Subject: [PATCH 30/35] Simplify code --- audio/src/fetch.rs | 77 ++++++++++++++++++++++------------------------ 1 file changed, 36 insertions(+), 41 deletions(-) diff --git a/audio/src/fetch.rs b/audio/src/fetch.rs index 0ec9b01df..ccbb89892 100644 --- a/audio/src/fetch.rs +++ b/audio/src/fetch.rs @@ -449,7 +449,7 @@ enum ReceivedData { async fn audio_file_fetch_receive_data( shared: Arc, file_data_tx: mpsc::UnboundedSender, - data_rx: ChannelData, + mut data_rx: ChannelData, initial_data_offset: usize, initial_request_length: usize, request_sent_time: Instant, @@ -465,49 +465,44 @@ async fn audio_file_fetch_receive_data( .number_of_open_requests .fetch_add(1, atomic::Ordering::SeqCst); - enum TryFoldErr { - ChannelError, - FinishEarly, - } + let result = loop { + let data = match data_rx.next().await { + Some(Ok(data)) => data, + Some(Err(e)) => break Err(e), + None => break Ok(()), + }; - let result = data_rx - .map_err(|_| TryFoldErr::ChannelError) - .try_for_each(|data| { - if measure_ping_time { - let duration = Instant::now() - request_sent_time; - let duration_ms: u64; - if 0.001 * (duration.as_millis() as f64) - > MAXIMUM_ASSUMED_PING_TIME_SECONDS - { - duration_ms = (MAXIMUM_ASSUMED_PING_TIME_SECONDS * 1000.0) as u64; - } else { - duration_ms = duration.as_millis() as u64; - } - let _ = file_data_tx - .send(ReceivedData::ResponseTimeMs(duration_ms as usize)); - measure_ping_time = false; - } - let data_size = data.len(); - let _ = file_data_tx - .send(ReceivedData::Data(PartialFileData { - offset: data_offset, - data: data, - })); - data_offset += data_size; - if request_length < data_size { - warn!("Data receiver for range {} (+{}) received more data from server than requested.", initial_data_offset, initial_request_length); - request_length = 0; + if measure_ping_time { + let duration = Instant::now() - request_sent_time; + let duration_ms: u64; + if 0.001 * (duration.as_millis() as f64) > MAXIMUM_ASSUMED_PING_TIME_SECONDS { + duration_ms = (MAXIMUM_ASSUMED_PING_TIME_SECONDS * 1000.0) as u64; } else { - request_length -= data_size; + duration_ms = duration.as_millis() as u64; } + let _ = file_data_tx.send(ReceivedData::ResponseTimeMs(duration_ms as usize)); + measure_ping_time = false; + } + let data_size = data.len(); + let _ = file_data_tx.send(ReceivedData::Data(PartialFileData { + offset: data_offset, + data: data, + })); + data_offset += data_size; + if request_length < data_size { + warn!( + "Data receiver for range {} (+{}) received more data from server than requested.", + initial_data_offset, initial_request_length + ); + request_length = 0; + } else { + request_length -= data_size; + } - future::ready(if request_length == 0 { - Err(TryFoldErr::FinishEarly) - } else { - Ok(()) - }) - }) - .await; + if request_length == 0 { + break Ok(()); + } + }; if request_length > 0 { let missing_range = Range::new(data_offset, request_length); @@ -521,7 +516,7 @@ async fn audio_file_fetch_receive_data( .number_of_open_requests .fetch_sub(1, atomic::Ordering::SeqCst); - if let Err(TryFoldErr::ChannelError) = result { + if result.is_err() { warn!( "Error from channel for data receiver for range {} (+{}).", initial_data_offset, initial_request_length From d064ffc670a28962eb73c50e04ad001c1a478e08 Mon Sep 17 00:00:00 2001 From: johannesd3 Date: Sun, 21 Feb 2021 19:38:40 +0100 Subject: [PATCH 31/35] Use tokio channels and fix compilation errors --- Cargo.lock | 3 ++- Cargo.toml | 2 +- connect/Cargo.toml | 3 ++- connect/src/spirc.rs | 39 ++++++++++++++++++++++----------------- src/main.rs | 5 +++-- 5 files changed, 30 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d8f80b489..16da85e41 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1416,12 +1416,13 @@ dependencies = [ "log", "num-bigint", "protobuf", - "rand 0.7.3", + "rand 0.8.3", "serde", "serde_derive", "serde_json", "sha-1 0.9.4", "tokio", + "tokio-stream", "url 1.7.2", ] diff --git a/Cargo.toml b/Cargo.toml index a26db2ed6..93866e290 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -55,7 +55,7 @@ num-bigint = "0.3" protobuf = "~2.14.0" rand = "0.7" rpassword = "5.0" -tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros", "signal", "process"] } +tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros", "signal", "sync", "process"] } url = "1.7" sha-1 = "0.8" hex = "0.4" diff --git a/connect/Cargo.toml b/connect/Cargo.toml index 1ca6d7dba..4997c5fba 100644 --- a/connect/Cargo.toml +++ b/connect/Cargo.toml @@ -27,12 +27,13 @@ hyper = { version = "0.14", features = ["server", "http1"] } log = "0.4" num-bigint = "0.3" protobuf = "~2.14.0" -rand = "0.7" +rand = "0.8" serde = "1.0" serde_derive = "1.0" serde_json = "1.0" sha-1 = "0.9" tokio = { version = "1.0", features = ["macros"] } +tokio-stream = { version = "0.1" } url = "1.7" dns-sd = { version = "0.1.3", optional = true } diff --git a/connect/src/spirc.rs b/connect/src/spirc.rs index 50307595f..dd495d82d 100644 --- a/connect/src/spirc.rs +++ b/connect/src/spirc.rs @@ -6,7 +6,7 @@ use crate::playback::mixer::Mixer; use crate::playback::player::{Player, PlayerEvent, PlayerEventChannel}; use crate::protocol; use crate::protocol::spirc::{DeviceState, Frame, MessageType, PlayStatus, State, TrackRef}; -use futures::channel::mpsc; + use futures::future::{self, FusedFuture}; use futures::stream::FusedStream; use futures::{Future, FutureExt, StreamExt}; @@ -21,6 +21,8 @@ use protobuf::{self, Message}; use rand; use rand::seq::SliceRandom; use serde_json; +use tokio::sync::mpsc; +use tokio_stream::wrappers::UnboundedReceiverStream; enum SpircPlayStatus { Stopped, @@ -59,8 +61,8 @@ struct SpircTask { subscription: BoxedStream, sender: MercurySender, - commands: mpsc::UnboundedReceiver, - player_events: PlayerEventChannel, + commands: Option>, + player_events: Option, shutdown: bool, session: Session, @@ -263,6 +265,7 @@ impl Spirc { .mercury() .subscribe(uri.clone()) .map(Result::unwrap) + .map(UnboundedReceiverStream::new) .flatten_stream() .map(|response| -> Frame { let data = response.payload.first().unwrap(); @@ -272,7 +275,7 @@ impl Spirc { let sender = session.mercury().sender(uri); - let (cmd_tx, cmd_rx) = mpsc::unbounded(); + let (cmd_tx, cmd_rx) = mpsc::unbounded_channel(); let volume = config.volume; let task_config = SpircTaskConfig { @@ -301,8 +304,8 @@ impl Spirc { subscription: subscription, sender: sender, - commands: cmd_rx, - player_events: player_events, + commands: Some(cmd_rx), + player_events: Some(player_events), shutdown: false, session: session, @@ -322,34 +325,36 @@ impl Spirc { } pub fn play(&self) { - let _ = self.commands.unbounded_send(SpircCommand::Play); + let _ = self.commands.send(SpircCommand::Play); } pub fn play_pause(&self) { - let _ = self.commands.unbounded_send(SpircCommand::PlayPause); + let _ = self.commands.send(SpircCommand::PlayPause); } pub fn pause(&self) { - let _ = self.commands.unbounded_send(SpircCommand::Pause); + let _ = self.commands.send(SpircCommand::Pause); } pub fn prev(&self) { - let _ = self.commands.unbounded_send(SpircCommand::Prev); + let _ = self.commands.send(SpircCommand::Prev); } pub fn next(&self) { - let _ = self.commands.unbounded_send(SpircCommand::Next); + let _ = self.commands.send(SpircCommand::Next); } pub fn volume_up(&self) { - let _ = self.commands.unbounded_send(SpircCommand::VolumeUp); + let _ = self.commands.send(SpircCommand::VolumeUp); } pub fn volume_down(&self) { - let _ = self.commands.unbounded_send(SpircCommand::VolumeDown); + let _ = self.commands.send(SpircCommand::VolumeDown); } pub fn shutdown(&self) { - let _ = self.commands.unbounded_send(SpircCommand::Shutdown); + let _ = self.commands.send(SpircCommand::Shutdown); } } impl SpircTask { async fn run(mut self) { while !self.session.is_invalid() && !self.shutdown { + let commands = self.commands.as_mut(); + let player_events = self.player_events.as_mut(); tokio::select! { frame = self.subscription.next() => match frame { Some(frame) => self.handle_frame(frame), @@ -358,10 +363,10 @@ impl SpircTask { break; } }, - cmd = self.commands.next(), if !self.commands.is_terminated() => if let Some(cmd) = cmd { + cmd = async { commands.unwrap().recv().await }, if commands.is_some() => if let Some(cmd) = cmd { self.handle_command(cmd); }, - event = self.player_events.next(), if !self.player_events.is_terminated() => if let Some(event) = event { + event = async { player_events.unwrap().recv().await }, if player_events.is_some() => if let Some(event) = event { self.handle_player_event(event) }, result = self.sender.flush(), if !self.sender.is_flushed() => if result.is_err() { @@ -508,7 +513,7 @@ impl SpircTask { SpircCommand::Shutdown => { CommandSender::new(self, MessageType::kMessageTypeGoodbye).send(); self.shutdown = true; - self.commands.close(); + self.commands.as_mut().map(|rx| rx.close()); } } } diff --git a/src/main.rs b/src/main.rs index 31ef30019..7882203bd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use futures::{channel::mpsc::UnboundedReceiver, future::FusedFuture, FutureExt, StreamExt}; +use futures::{future::FusedFuture, FutureExt, StreamExt}; use librespot_playback::player::PlayerEvent; use log::{error, info, warn}; use sha1::{Digest, Sha1}; @@ -10,6 +10,7 @@ use std::{ io::{stderr, Write}, pin::Pin, }; +use tokio::sync::mpsc::UnboundedReceiver; use url::Url; use librespot::core::authentication::Credentials; @@ -589,7 +590,7 @@ async fn main() { } } }, - event = async { player_event_channel.as_mut().unwrap().next().await }, if player_event_channel.is_some() => match event { + event = async { player_event_channel.as_mut().unwrap().recv().await }, if player_event_channel.is_some() => match event { Some(event) => { if let Some(program) = &setupp.player_event_program { if let Some(child) = run_program_on_events(event, program) { From 59c556635ebbd20897e8c739e3395da2decd5742 Mon Sep 17 00:00:00 2001 From: johannesd3 Date: Sun, 21 Feb 2021 19:38:44 +0100 Subject: [PATCH 32/35] Clean up librespot-connect dependencies --- Cargo.lock | 4 ++-- connect/Cargo.toml | 33 ++++++++++++++++++--------------- connect/src/context.rs | 4 ++-- connect/src/discovery.rs | 12 ++++++------ connect/src/lib.rs | 31 +++---------------------------- connect/src/spirc.rs | 23 +++++++++++------------ 6 files changed, 42 insertions(+), 65 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 16da85e41..1aaf97048 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1406,7 +1406,8 @@ dependencies = [ "base64", "block-modes", "dns-sd", - "futures", + "futures-core", + "futures-util", "hmac", "hyper", "libmdns", @@ -1418,7 +1419,6 @@ dependencies = [ "protobuf", "rand 0.8.3", "serde", - "serde_derive", "serde_json", "sha-1 0.9.4", "tokio", diff --git a/connect/Cargo.toml b/connect/Cargo.toml index 4997c5fba..f1d4a389f 100644 --- a/connect/Cargo.toml +++ b/connect/Cargo.toml @@ -7,39 +7,42 @@ license = "MIT" repository = "https://github.com/librespot-org/librespot" edition = "2018" -[dependencies.librespot-core] -path = "../core" -version = "0.1.6" -[dependencies.librespot-playback] -path = "../playback" -version = "0.1.6" -[dependencies.librespot-protocol] -path = "../protocol" -version = "0.1.6" - [dependencies] aes-ctr = "0.6" base64 = "0.13" block-modes = "0.7" -futures = "0.3" +futures-core = "0.3" +futures-util = "0.3" hmac = "0.10" hyper = { version = "0.14", features = ["server", "http1"] } log = "0.4" num-bigint = "0.3" protobuf = "~2.14.0" rand = "0.8" -serde = "1.0" -serde_derive = "1.0" +serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" sha-1 = "0.9" -tokio = { version = "1.0", features = ["macros"] } +tokio = { version = "1.0", features = ["macros", "sync"] } tokio-stream = { version = "0.1" } url = "1.7" dns-sd = { version = "0.1.3", optional = true } libmdns = { version = "0.6", optional = true } +[dependencies.librespot-core] +path = "../core" +version = "0.1.6" + +[dependencies.librespot-playback] +path = "../playback" +version = "0.1.6" + +[dependencies.librespot-protocol] +path = "../protocol" +version = "0.1.6" [features] -default = ["libmdns"] +with-libmdns = ["libmdns"] with-dns-sd = ["dns-sd"] + +default = ["with-libmdns"] diff --git a/connect/src/context.rs b/connect/src/context.rs index 5a94f6cb7..63a2aebb4 100644 --- a/connect/src/context.rs +++ b/connect/src/context.rs @@ -1,7 +1,7 @@ +use crate::core::spotify_id::SpotifyId; use crate::protocol::spirc::TrackRef; -use librespot_core::spotify_id::SpotifyId; -use serde; +use serde::Deserialize; #[derive(Deserialize, Debug)] pub struct StationContext { diff --git a/connect/src/discovery.rs b/connect/src/discovery.rs index 2951b3819..1c94ecc8f 100644 --- a/connect/src/discovery.rs +++ b/connect/src/discovery.rs @@ -1,13 +1,13 @@ use aes_ctr::cipher::generic_array::GenericArray; use aes_ctr::cipher::{NewStreamCipher, SyncStreamCipher}; use aes_ctr::Aes128Ctr; -use base64; -use futures::channel::{mpsc, oneshot}; -use futures::{Stream, StreamExt}; +use futures_core::Stream; use hmac::{Hmac, Mac, NewMac}; use hyper::service::{make_service_fn, service_fn}; use hyper::{Body, Method, Request, Response, StatusCode}; +use serde_json::json; use sha1::{Digest, Sha1}; +use tokio::sync::{mpsc, oneshot}; use std::borrow::Cow; use std::convert::Infallible; @@ -50,7 +50,7 @@ impl Discovery { config: ConnectConfig, device_id: String, ) -> (Discovery, mpsc::UnboundedReceiver) { - let (tx, rx) = mpsc::unbounded(); + let (tx, rx) = mpsc::unbounded_channel(); let key_data = util::rand_vec(&mut rand::thread_rng(), 95); let private_key = BigUint::from_bytes_be(&key_data); @@ -155,7 +155,7 @@ impl Discovery { let credentials = Credentials::with_blob(username.to_string(), &decrypted, &self.0.device_id); - self.0.tx.unbounded_send(credentials).unwrap(); + self.0.tx.send(credentials).unwrap(); let result = json!({ "status": 101, @@ -273,6 +273,6 @@ impl Stream for DiscoveryStream { type Item = Credentials; fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll> { - self.credentials.poll_next_unpin(cx) + self.credentials.poll_recv(cx) } } diff --git a/connect/src/lib.rs b/connect/src/lib.rs index 47777606e..600dd0335 100644 --- a/connect/src/lib.rs +++ b/connect/src/lib.rs @@ -1,34 +1,9 @@ #[macro_use] extern crate log; -#[macro_use] -extern crate serde_json; -#[macro_use] -extern crate serde_derive; -extern crate serde; - -extern crate base64; -extern crate futures; -extern crate hyper; -extern crate num_bigint; -extern crate protobuf; -extern crate rand; -extern crate tokio; -extern crate url; - -extern crate aes_ctr; -extern crate block_modes; -extern crate hmac; -extern crate sha1; - -#[cfg(feature = "with-dns-sd")] -extern crate dns_sd; - -#[cfg(not(feature = "with-dns-sd"))] -extern crate libmdns; -extern crate librespot_core; -extern crate librespot_playback as playback; -extern crate librespot_protocol as protocol; +use librespot_core as core; +use librespot_playback as playback; +use librespot_protocol as protocol; pub mod context; pub mod discovery; diff --git a/connect/src/spirc.rs b/connect/src/spirc.rs index dd495d82d..5afefe7f9 100644 --- a/connect/src/spirc.rs +++ b/connect/src/spirc.rs @@ -1,26 +1,25 @@ +use std::future::Future; use std::pin::Pin; use std::time::{SystemTime, UNIX_EPOCH}; use crate::context::StationContext; +use crate::core::config::{ConnectConfig, VolumeCtrl}; +use crate::core::mercury::{MercuryError, MercurySender}; +use crate::core::session::Session; +use crate::core::spotify_id::{SpotifyAudioType, SpotifyId, SpotifyIdError}; +use crate::core::util::url_encode; +use crate::core::util::SeqGenerator; +use crate::core::version; use crate::playback::mixer::Mixer; use crate::playback::player::{Player, PlayerEvent, PlayerEventChannel}; use crate::protocol; use crate::protocol::spirc::{DeviceState, Frame, MessageType, PlayStatus, State, TrackRef}; -use futures::future::{self, FusedFuture}; -use futures::stream::FusedStream; -use futures::{Future, FutureExt, StreamExt}; -use librespot_core::config::{ConnectConfig, VolumeCtrl}; -use librespot_core::mercury::{MercuryError, MercurySender}; -use librespot_core::session::Session; -use librespot_core::spotify_id::{SpotifyAudioType, SpotifyId, SpotifyIdError}; -use librespot_core::util::url_encode; -use librespot_core::util::SeqGenerator; -use librespot_core::version; +use futures_util::future::{self, FusedFuture}; +use futures_util::stream::FusedStream; +use futures_util::{FutureExt, StreamExt}; use protobuf::{self, Message}; -use rand; use rand::seq::SliceRandom; -use serde_json; use tokio::sync::mpsc; use tokio_stream::wrappers::UnboundedReceiverStream; From 18179e73eccd547b0a6bd1272922aa597ab7c9f8 Mon Sep 17 00:00:00 2001 From: johannesd3 Date: Sun, 21 Feb 2021 19:38:49 +0100 Subject: [PATCH 33/35] Remove unused dependencies and fix feature flags --- Cargo.lock | 208 ++++++-------------------------------------- Cargo.toml | 9 +- connect/Cargo.toml | 6 +- core/Cargo.toml | 1 - playback/Cargo.toml | 2 +- src/main.rs | 5 +- 6 files changed, 35 insertions(+), 196 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1aaf97048..426d4fd9c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -51,7 +51,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "be14c7498ea50828a38d0e24a765ed2effe92a705885b57d029cd67d45744072" dependencies = [ "cipher", - "opaque-debug 0.3.0", + "opaque-debug", ] [[package]] @@ -61,7 +61,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ea2e11f5e94c2f7d386164cc2aa1f97823fed6f259e486940a71c174dd01b0ce" dependencies = [ "cipher", - "opaque-debug 0.3.0", + "opaque-debug", ] [[package]] @@ -186,25 +186,13 @@ version = "1.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf1de2fe8c75bc145a2f577add951f8134889b4795d47466a54a5c846d691693" -[[package]] -name = "block-buffer" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c0940dc441f31689269e10ac70eb1002a3a1d3ad1390e030043662eb7fe4688b" -dependencies = [ - "block-padding 0.1.5", - "byte-tools", - "byteorder", - "generic-array 0.12.3", -] - [[package]] name = "block-buffer" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" dependencies = [ - "generic-array 0.14.4", + "generic-array", ] [[package]] @@ -213,19 +201,10 @@ version = "0.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "57a0e8073e8baa88212fb5823574c02ebccb395136ba9a164ab89379ec6072f0" dependencies = [ - "block-padding 0.2.1", + "block-padding", "cipher", ] -[[package]] -name = "block-padding" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa79dedbb091f449f1f39e53edf88d5dbe95f895dae6135a8d7b881fb5af73f5" -dependencies = [ - "byte-tools", -] - [[package]] name = "block-padding" version = "0.2.1" @@ -238,12 +217,6 @@ version = "3.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "63396b8a4b9de3f4fdfb320ab6080762242f66a8ef174c49d8e19b674db4cdbe" -[[package]] -name = "byte-tools" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3b5ca7a04898ad4bcd41c90c5285445ff5b791899bb1b0abdd2a2aa791211d7" - [[package]] name = "byteorder" version = "1.4.2" @@ -314,7 +287,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "12f8e7987cbd042a63249497f41aed09f8e65add917ea6566effbc56578d6801" dependencies = [ - "generic-array 0.14.4", + "generic-array", ] [[package]] @@ -456,7 +429,7 @@ version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4857fd85a0c34b3c3297875b747c1e02e06b6a0ea32dd892d8192b9ce0813ea6" dependencies = [ - "generic-array 0.14.4", + "generic-array", "subtle", ] @@ -515,22 +488,13 @@ dependencies = [ "syn", ] -[[package]] -name = "digest" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3d0c8c8752312f9713efd397ff63acb9f85585afbf179282e720e7704954dd5" -dependencies = [ - "generic-array 0.12.3", -] - [[package]] name = "digest" version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" dependencies = [ - "generic-array 0.14.4", + "generic-array", ] [[package]] @@ -578,12 +542,6 @@ dependencies = [ "version_check", ] -[[package]] -name = "fake-simd" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e88a8acf291dafb59c2d96e8f59828f3838bb1a70398823ade51a84de6a6deed" - [[package]] name = "fetch_unroll" version = "0.2.2" @@ -623,21 +581,6 @@ dependencies = [ "percent-encoding 2.1.0", ] -[[package]] -name = "futures" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f55667319111d593ba876406af7c409c0ebb44dc4be6132a783ccf163ea14c1" -dependencies = [ - "futures-channel", - "futures-core", - "futures-executor", - "futures-io", - "futures-sink", - "futures-task", - "futures-util", -] - [[package]] name = "futures-channel" version = "0.3.13" @@ -645,7 +588,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8c2dd2df839b57db9ab69c2c9d8f3e8c81984781937fe2807dc6dcf3b2ad2939" dependencies = [ "futures-core", - "futures-sink", ] [[package]] @@ -665,12 +607,6 @@ dependencies = [ "futures-util", ] -[[package]] -name = "futures-io" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71c2c65c57704c32f5241c1223167c2c3294fd34ac020c807ddbe6db287ba59" - [[package]] name = "futures-macro" version = "0.3.13" @@ -701,13 +637,10 @@ version = "0.3.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1812c7ab8aedf8d6f2701a43e1243acdbcc2b36ab26e2ad421eb99ac963d96d1" dependencies = [ - "futures-channel", "futures-core", - "futures-io", "futures-macro", "futures-sink", "futures-task", - "memchr", "pin-project-lite", "pin-utils", "proc-macro-hack", @@ -721,15 +654,6 @@ version = "0.3.55" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f5f3913fa0bfe7ee1fd8248b6b9f42a5af4b9d65ec2dd2c3c26132b950ecfc2" -[[package]] -name = "generic-array" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c68f0274ae0e023facc3c97b2e00f076be70e254bc851d972503b328db79b2ec" -dependencies = [ - "typenum", -] - [[package]] name = "generic-array" version = "0.14.4" @@ -749,17 +673,6 @@ dependencies = [ "unicode-width", ] -[[package]] -name = "getrandom" -version = "0.1.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fc3cb4d91f53b50155bdcfd23f6a4c39ae1969c2ae85982b135750cccaf5fce" -dependencies = [ - "cfg-if 1.0.0", - "libc", - "wasi 0.9.0+wasi-snapshot-preview1", -] - [[package]] name = "getrandom" version = "0.2.2" @@ -768,7 +681,7 @@ checksum = "c9495705279e7140bf035dde1f6e750c162df8b625267cd52cc44e0b156732c8" dependencies = [ "cfg-if 1.0.0", "libc", - "wasi 0.10.2+wasi-snapshot-preview1", + "wasi", ] [[package]] @@ -994,7 +907,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c1441c6b1e930e2817404b5046f1f989899143a12bf92de603b69f4e0aee1e15" dependencies = [ "crypto-mac", - "digest 0.9.0", + "digest", ] [[package]] @@ -1300,7 +1213,7 @@ dependencies = [ "log", "multimap", "quick-error", - "rand 0.8.3", + "rand", "socket2", "tokio", ] @@ -1359,7 +1272,7 @@ version = "0.1.6" dependencies = [ "base64", "env_logger", - "futures", + "futures-util", "getopts", "hex", "hyper", @@ -1370,11 +1283,8 @@ dependencies = [ "librespot-playback", "librespot-protocol", "log", - "num-bigint", - "protobuf", - "rand 0.7.3", "rpassword", - "sha-1 0.8.2", + "sha-1", "tokio", "url 1.7.2", ] @@ -1417,10 +1327,10 @@ dependencies = [ "log", "num-bigint", "protobuf", - "rand 0.8.3", + "rand", "serde", "serde_json", - "sha-1 0.9.4", + "sha-1", "tokio", "tokio-stream", "url 1.7.2", @@ -1437,7 +1347,6 @@ dependencies = [ "cfg-if 1.0.0", "env_logger", "futures-core", - "futures-sink", "futures-util", "hmac", "httparse", @@ -1450,10 +1359,10 @@ dependencies = [ "once_cell", "pbkdf2", "protobuf", - "rand 0.8.3", + "rand", "serde", "serde_json", - "sha-1 0.9.4", + "sha-1", "shannon", "thiserror", "tokio", @@ -1835,12 +1744,6 @@ version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ad167a2f54e832b82dbe003a046280dceffe5227b5f79e08e363a29638cfddd" -[[package]] -name = "opaque-debug" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2839e79665f131bdb5782e51f2c6c9599c133c6098982a54c794358bf432529c" - [[package]] name = "opaque-debug" version = "0.3.0" @@ -2102,19 +2005,6 @@ dependencies = [ "proc-macro2", ] -[[package]] -name = "rand" -version = "0.7.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" -dependencies = [ - "getrandom 0.1.16", - "libc", - "rand_chacha 0.2.2", - "rand_core 0.5.1", - "rand_hc 0.2.0", -] - [[package]] name = "rand" version = "0.8.3" @@ -2122,19 +2012,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0ef9e7e66b4468674bfcb0c81af8b7fa0bb154fa9f28eb840da5c447baeb8d7e" dependencies = [ "libc", - "rand_chacha 0.3.0", - "rand_core 0.6.2", - "rand_hc 0.3.0", -] - -[[package]] -name = "rand_chacha" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4c8ed856279c9737206bf725bf36935d8666ead7aa69b52be55af369d193402" -dependencies = [ - "ppv-lite86", - "rand_core 0.5.1", + "rand_chacha", + "rand_core", + "rand_hc", ] [[package]] @@ -2144,16 +2024,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e12735cf05c9e10bf21534da50a147b924d555dc7a547c42e6bb2d5b6017ae0d" dependencies = [ "ppv-lite86", - "rand_core 0.6.2", -] - -[[package]] -name = "rand_core" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bde5296fc891b0cef12a6d03ddccc162ce7b2aff54160af9338f8d40df6d19" -dependencies = [ - "getrandom 0.1.16", + "rand_core", ] [[package]] @@ -2162,16 +2033,7 @@ version = "0.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34cf66eb183df1c5876e2dcf6b13d57340741e8dc255b48e40a26de954d06ae7" dependencies = [ - "getrandom 0.2.2", -] - -[[package]] -name = "rand_hc" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca3129af7b92a17112d59ad498c6f81eaf463253766b90396d39ea7a39d6613c" -dependencies = [ - "rand_core 0.5.1", + "getrandom", ] [[package]] @@ -2180,7 +2042,7 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3190ef7066a446f2e7f42e239d161e905420ccab01eb967c9eb27d21b2322a73" dependencies = [ - "rand_core 0.6.2", + "rand_core", ] [[package]] @@ -2420,29 +2282,17 @@ dependencies = [ "serde", ] -[[package]] -name = "sha-1" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7d94d0bede923b3cea61f3f1ff57ff8cdfd77b400fb8f9998949e0cf04163df" -dependencies = [ - "block-buffer 0.7.3", - "digest 0.8.1", - "fake-simd", - "opaque-debug 0.2.3", -] - [[package]] name = "sha-1" version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dfebf75d25bd900fd1e7d11501efab59bc846dbc76196839663e6637bba9f25f" dependencies = [ - "block-buffer 0.9.0", + "block-buffer", "cfg-if 1.0.0", "cpuid-bool", - "digest 0.9.0", - "opaque-debug 0.3.0", + "digest", + "opaque-debug", ] [[package]] @@ -2661,7 +2511,7 @@ checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ "cfg-if 1.0.0", "libc", - "rand 0.8.3", + "rand", "redox_syscall", "remove_dir_all", "winapi", @@ -3066,12 +2916,6 @@ dependencies = [ "try-lock", ] -[[package]] -name = "wasi" -version = "0.9.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cccddf32554fecc6acb585f82a32a72e28b48f8c4c1883ddfeeeaa96f7d8e519" - [[package]] name = "wasi" version = "0.10.2+wasi-snapshot-preview1" diff --git a/Cargo.toml b/Cargo.toml index 93866e290..6e5ca0328 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -47,18 +47,15 @@ version = "0.1.6" [dependencies] base64 = "0.13" env_logger = {version = "0.8", default-features = false, features = ["termcolor","humantime","atty"]} -futures = "0.3" +futures-util = { version = "0.3", default_features = false } getopts = "0.2" +hex = "0.4" hyper = "0.14" log = "0.4" -num-bigint = "0.3" -protobuf = "~2.14.0" -rand = "0.7" rpassword = "5.0" tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros", "signal", "sync", "process"] } url = "1.7" -sha-1 = "0.8" -hex = "0.4" +sha-1 = "0.9" [features] apresolve = ["librespot-core/apresolve"] diff --git a/connect/Cargo.toml b/connect/Cargo.toml index f1d4a389f..554764668 100644 --- a/connect/Cargo.toml +++ b/connect/Cargo.toml @@ -12,9 +12,9 @@ aes-ctr = "0.6" base64 = "0.13" block-modes = "0.7" futures-core = "0.3" -futures-util = "0.3" +futures-util = { version = "0.3", default_features = false } hmac = "0.10" -hyper = { version = "0.14", features = ["server", "http1"] } +hyper = { version = "0.14", features = ["server", "http1", "tcp"] } log = "0.4" num-bigint = "0.3" protobuf = "~2.14.0" @@ -22,7 +22,7 @@ rand = "0.8" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" sha-1 = "0.9" -tokio = { version = "1.0", features = ["macros", "sync"] } +tokio = { version = "1.0", features = ["macros", "rt", "sync"] } tokio-stream = { version = "0.1" } url = "1.7" diff --git a/core/Cargo.toml b/core/Cargo.toml index 0ab4e398a..5c5fa6007 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -19,7 +19,6 @@ byteorder = "1.4" bytes = "1.0" cfg-if = "1" futures-core = { version = "0.3", default-features = false } -futures-sink = { version = "0.3", default-features = false } futures-util = { version = "0.3", default-features = false, features = ["alloc", "bilock", "unstable", "sink"] } hmac = "0.10" httparse = "1.3" diff --git a/playback/Cargo.toml b/playback/Cargo.toml index 96a0d264d..03675de81 100644 --- a/playback/Cargo.toml +++ b/playback/Cargo.toml @@ -18,7 +18,7 @@ path = "../metadata" version = "0.1.6" [dependencies] -futures-executor = { version = "0.3", default_features = false } +futures-executor = "0.3" futures-util = { version = "0.3", default_features = false, features = ["alloc"] } log = "0.4" byteorder = "1.4" diff --git a/src/main.rs b/src/main.rs index 7882203bd..5de83de14 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,4 @@ -use futures::{future::FusedFuture, FutureExt, StreamExt}; +use futures_util::{future, FutureExt, StreamExt}; use librespot_playback::player::PlayerEvent; use log::{error, info, warn}; use sha1::{Digest, Sha1}; @@ -468,8 +468,7 @@ async fn main() { let mut player_event_channel: Option> = None; let mut auto_connect_times: Vec = vec![]; let mut discovery = None; - let mut connecting: Pin>> = - Box::pin(futures::future::pending()); + let mut connecting: Pin>> = Box::pin(future::pending()); if setupp.enable_discovery { let config = setupp.connect_config.clone(); From b606d8c661fd6ad6f5cdcedfb04eadbd644b2d3a Mon Sep 17 00:00:00 2001 From: johannesd3 Date: Sun, 21 Feb 2021 19:38:52 +0100 Subject: [PATCH 34/35] Replace "extern crate"s --- src/lib.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 7cdd31789..7722e93e6 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,8 +1,8 @@ #![crate_name = "librespot"] -pub extern crate librespot_audio as audio; -pub extern crate librespot_connect as connect; -pub extern crate librespot_core as core; -pub extern crate librespot_metadata as metadata; -pub extern crate librespot_playback as playback; -pub extern crate librespot_protocol as protocol; +pub use librespot_audio as audio; +pub use librespot_connect as connect; +pub use librespot_core as core; +pub use librespot_metadata as metadata; +pub use librespot_playback as playback; +pub use librespot_protocol as protocol; From f22b41956f55c481d270c41ca17656027296bfe1 Mon Sep 17 00:00:00 2001 From: johannesd3 Date: Mon, 22 Feb 2021 11:26:12 +0100 Subject: [PATCH 35/35] Update url crate to 2.1 --- Cargo.lock | 54 +++++++++----------------------------- Cargo.toml | 2 +- connect/Cargo.toml | 2 +- core/Cargo.toml | 2 +- core/src/apresolve.rs | 2 +- core/src/connection/mod.rs | 4 +-- 6 files changed, 19 insertions(+), 47 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 426d4fd9c..65493a277 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -336,7 +336,7 @@ version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "784ad0fbab4f3e9cef09f20e0aea6000ae08d2cb98ac4c0abc53df18803d702f" dependencies = [ - "percent-encoding 2.1.0", + "percent-encoding", "time 0.2.25", "version_check", ] @@ -348,13 +348,13 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3818dfca4b0cb5211a659bbcbb94225b7127407b2b135e650d717bfb78ab10d3" dependencies = [ "cookie", - "idna 0.2.2", + "idna", "log", "publicsuffix", "serde", "serde_json", "time 0.2.25", - "url 2.2.1", + "url", ] [[package]] @@ -578,7 +578,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5fc25a87fa4fd2094bffb06925852034d90a17f0d1e05197d4956d3555752191" dependencies = [ "matches", - "percent-encoding 2.1.0", + "percent-encoding", ] [[package]] @@ -990,17 +990,6 @@ version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" -[[package]] -name = "idna" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38f09e0f0b1fb55fdee1f17470ad800da77af5186a1a76c026b679358b7e844e" -dependencies = [ - "matches", - "unicode-bidi", - "unicode-normalization", -] - [[package]] name = "idna" version = "0.2.2" @@ -1286,7 +1275,7 @@ dependencies = [ "rpassword", "sha-1", "tokio", - "url 1.7.2", + "url", ] [[package]] @@ -1333,7 +1322,7 @@ dependencies = [ "sha-1", "tokio", "tokio-stream", - "url 1.7.2", + "url", ] [[package]] @@ -1368,7 +1357,7 @@ dependencies = [ "tokio", "tokio-stream", "tokio-util", - "url 1.7.2", + "url", "vergen", ] @@ -1797,12 +1786,6 @@ version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" -[[package]] -name = "percent-encoding" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31010dd2e1ac33d5b46a5b413495239882813e0369f8ed8a5e266f173602f831" - [[package]] name = "percent-encoding" version = "2.1.0" @@ -1975,10 +1958,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3bbaa49075179162b49acac1c6aa45fb4dafb5f13cf6794276d77bc7fd95757b" dependencies = [ "error-chain", - "idna 0.2.2", + "idna", "lazy_static", "regex", - "url 2.2.1", + "url", ] [[package]] @@ -1987,7 +1970,7 @@ version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d464fae65fff2680baf48019211ce37aaec0c78e9264c84a3e484717f965104e" dependencies = [ - "percent-encoding 2.1.0", + "percent-encoding", ] [[package]] @@ -2801,22 +2784,11 @@ dependencies = [ "once_cell", "qstring", "rustls", - "url 2.2.1", + "url", "webpki", "webpki-roots", ] -[[package]] -name = "url" -version = "1.7.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd4e7c0d531266369519a4aa4f399d748bd37043b00bde1e4ff1f60a120b355a" -dependencies = [ - "idna 0.1.5", - "matches", - "percent-encoding 1.0.1", -] - [[package]] name = "url" version = "2.2.1" @@ -2824,9 +2796,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9ccd964113622c8e9322cfac19eb1004a07e636c545f325da085d5cdde6f1f8b" dependencies = [ "form_urlencoded", - "idna 0.2.2", + "idna", "matches", - "percent-encoding 2.1.0", + "percent-encoding", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 6e5ca0328..6b8cbee50 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -54,7 +54,7 @@ hyper = "0.14" log = "0.4" rpassword = "5.0" tokio = { version = "1", features = ["rt", "rt-multi-thread", "macros", "signal", "sync", "process"] } -url = "1.7" +url = "2.1" sha-1 = "0.9" [features] diff --git a/connect/Cargo.toml b/connect/Cargo.toml index 554764668..b03de885f 100644 --- a/connect/Cargo.toml +++ b/connect/Cargo.toml @@ -24,7 +24,7 @@ serde_json = "1.0" sha-1 = "0.9" tokio = { version = "1.0", features = ["macros", "rt", "sync"] } tokio-stream = { version = "0.1" } -url = "1.7" +url = "2.1" dns-sd = { version = "0.1.3", optional = true } libmdns = { version = "0.6", optional = true } diff --git a/core/Cargo.toml b/core/Cargo.toml index 5c5fa6007..373e30885 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -39,7 +39,7 @@ thiserror = "1" tokio = { version = "1.0", features = ["io-util", "net", "rt", "sync"] } tokio-stream = "0.1" tokio-util = { version = "0.6", features = ["codec"] } -url = "1.7" +url = "2.1" [build-dependencies] rand = "0.8" diff --git a/core/src/apresolve.rs b/core/src/apresolve.rs index 7698691c9..2086d3b10 100644 --- a/core/src/apresolve.rs +++ b/core/src/apresolve.rs @@ -32,7 +32,7 @@ cfg_if! { let response = if let Some(url) = proxy { Client::builder() - .build(ProxyTunnel::new(url)?) + .build(ProxyTunnel::new(&url.socket_addrs(|| None)?[..])?) .request(req) .await? } else { diff --git a/core/src/connection/mod.rs b/core/src/connection/mod.rs index a07f9a2de..b715d3578 100644 --- a/core/src/connection/mod.rs +++ b/core/src/connection/mod.rs @@ -76,8 +76,8 @@ pub async fn connect(addr: String, proxy: &Option) -> io::Result .next() .ok_or_else(|| io::Error::new(io::ErrorKind::InvalidInput, "Missing port"))?; - let socket_addr = proxy.to_socket_addrs().and_then(|mut iter| { - iter.next().ok_or_else(|| { + let socket_addr = proxy.socket_addrs(|| None).and_then(|addrs| { + addrs.into_iter().next().ok_or_else(|| { io::Error::new( io::ErrorKind::NotFound, "Can't resolve proxy server address",