From 8e7e78adaeb3697f85f2b7c32b6afee30c2ded48 Mon Sep 17 00:00:00 2001 From: awiouy Date: Tue, 5 Sep 2017 09:10:53 +0200 Subject: [PATCH] librespot: update to ddfc28f --- .../addons/service/librespot/changelog.txt | 3 + packages/addons/service/librespot/package.mk | 6 +- .../patches/librespot-01_avahi.patch | 222 ------------------ .../patches/librespot-01_dns_sd.patch | 135 +++++++++++ ...ks.patch => librespot-02_kodi_hooks.patch} | 56 +++-- ...tch => librespot-03_pulseaudio_sink.patch} | 9 + .../librespot/source/bin/librespot.start | 3 +- 7 files changed, 185 insertions(+), 249 deletions(-) delete mode 100644 packages/addons/service/librespot/patches/librespot-01_avahi.patch create mode 100644 packages/addons/service/librespot/patches/librespot-01_dns_sd.patch rename packages/addons/service/librespot/patches/{librespot-03_libreelec_hooks.patch => librespot-02_kodi_hooks.patch} (70%) rename packages/addons/service/librespot/patches/{librespot-02_pulseaudio_device.patch => librespot-03_pulseaudio_sink.patch} (78%) diff --git a/packages/addons/service/librespot/changelog.txt b/packages/addons/service/librespot/changelog.txt index 7204e9a460..6c3d139237 100644 --- a/packages/addons/service/librespot/changelog.txt +++ b/packages/addons/service/librespot/changelog.txt @@ -1,3 +1,6 @@ +107 +- Update to ddfc28f + 106 - Rework code - Display artist and title on track load diff --git a/packages/addons/service/librespot/package.mk b/packages/addons/service/librespot/package.mk index 6b8a771d3b..4f7c492e75 100644 --- a/packages/addons/service/librespot/package.mk +++ b/packages/addons/service/librespot/package.mk @@ -18,8 +18,8 @@ ################################################################################ PKG_NAME="librespot" -PKG_VERSION="910974e" -PKG_REV="106" +PKG_VERSION="ddfc28f" +PKG_REV="107" PKG_ARCH="any" PKG_LICENSE="MIT" PKG_SITE="https://github.com/plietar/$PKG_NAME/" @@ -43,7 +43,7 @@ configure_target() { make_target() { cd src - $CARGO_BUILD --no-default-features --features "alsa-backend pulseaudio-backend with-avahi" + $CARGO_BUILD --no-default-features --features "alsa-backend pulseaudio-backend" cd "$ROOT/$PKG_BUILD/.$TARGET_NAME"/*/release $STRIP librespot } diff --git a/packages/addons/service/librespot/patches/librespot-01_avahi.patch b/packages/addons/service/librespot/patches/librespot-01_avahi.patch deleted file mode 100644 index 36d0ba66fb..0000000000 --- a/packages/addons/service/librespot/patches/librespot-01_avahi.patch +++ /dev/null @@ -1,222 +0,0 @@ -From a825f84d9d00b196232fcccc5b5e441654c4e5a0 Mon Sep 17 00:00:00 2001 -From: shanemeagher -Date: Fri, 9 Jun 2017 22:43:54 +0800 -Subject: [PATCH] Build librespot with avahi support for Discovery - -rust-mdns is still the default and can be specified explicitly with --with-rust-mdns switch. -Added --with-avahi switch to build librespot to use avahi for discovery using dns-sd package. ---- - Cargo.lock | 10 ++++++++++ - Cargo.toml | 7 +++++-- - contrib/Dockerfile | 3 +++ - contrib/docker-build-avahi.sh | 24 ++++++++++++++++++++++++ - src/authentication/discovery.rs | 27 ++++++++++++++++++++++++++- - src/lib.rs | 6 +++++- - 6 files changed, 73 insertions(+), 4 deletions(-) - create mode 100755 contrib/docker-build-avahi.sh - -diff --git a/Cargo.lock b/Cargo.lock -index 30fafca..eff0925 100644 ---- a/Cargo.lock -+++ b/Cargo.lock -@@ -6,6 +6,7 @@ dependencies = [ - "base64 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)", - "bit-set 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)", - "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", -+ "dns-sd 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", - "env_logger 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)", - "error-chain 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", - "futures 0.1.13 (registry+https://github.com/rust-lang/crates.io-index)", -@@ -144,6 +145,15 @@ dependencies = [ - ] - - [[package]] -+name = "dns-sd" -+version = "0.1.3" -+source = "registry+https://github.com/rust-lang/crates.io-index" -+dependencies = [ -+ "libc 0.2.22 (registry+https://github.com/rust-lang/crates.io-index)", -+ "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", -+] -+ -+[[package]] - name = "dtoa" - version = "0.4.1" - source = "registry+https://github.com/rust-lang/crates.io-index" -diff --git a/Cargo.toml b/Cargo.toml -index 5d64719..c543e92 100644 ---- a/Cargo.toml -+++ b/Cargo.toml -@@ -52,7 +52,8 @@ alsa = { git = "https://github.com/plietar/rust-alsa", optional = tru - portaudio-rs = { version = "0.3.0", optional = true } - libpulse-sys = { git = "https://github.com/astro/libpulse-sys", optional = true } - --mdns = { git = "https://github.com/plietar/rust-mdns" } -+mdns = { git = "https://github.com/plietar/rust-mdns", optional = true } -+dns-sd = { version = "~0.1.3", optional = true } - - error-chain = { version = "0.9.0", default_features = false } - futures = "0.1.8" -@@ -71,8 +72,10 @@ portaudio-backend = ["portaudio-rs"] - pulseaudio-backend = ["libpulse-sys"] - - with-tremor = ["tremor"] -+with-rust-mdns = ["mdns"] -+with-avahi = ["dns-sd"] - --default = ["portaudio-backend"] -+default = ["portaudio-backend","with-rust-mdns"] - - [package.metadata.deb] - maintainer = "nobody" -diff --git a/contrib/Dockerfile b/contrib/Dockerfile -index 68a39b7..f6aec14 100644 ---- a/contrib/Dockerfile -+++ b/contrib/Dockerfile -@@ -4,6 +4,8 @@ - # - # The resulting image can be used to build librespot for linux x86_64, armhf and armel. - # $ docker run -v /tmp/librespot-build:/build librespot-cross -+# To build librespot with avahi support -+# $ docker run -v /tmp/librespot-build:/build librespot-cross /src/contrib/docker-build-avahi.sh - # - # The compiled binaries will be located in /tmp/librespot-build - # -@@ -23,6 +25,7 @@ RUN apt-get update - - RUN apt-get install -y curl git build-essential crossbuild-essential-arm64 crossbuild-essential-armel crossbuild-essential-armhf crossbuild-essential-mipsel - RUN apt-get install -y libasound2-dev libasound2-dev:arm64 libasound2-dev:armel libasound2-dev:armhf libasound2-dev:mipsel -+RUN apt-get install -y libavahi-compat-libdnssd-dev libavahi-compat-libdnssd-dev:arm64 libavahi-compat-libdnssd-dev:armel libavahi-compat-libdnssd-dev:armhf libavahi-compat-libdnssd-dev:mipsel - - RUN curl https://sh.rustup.rs -sSf | sh -s -- -y - ENV PATH="/root/.cargo/bin/:${PATH}" -diff --git a/contrib/docker-build-avahi.sh b/contrib/docker-build-avahi.sh -new file mode 100755 -index 0000000..c25b248 ---- /dev/null -+++ b/contrib/docker-build-avahi.sh -@@ -0,0 +1,24 @@ -+#!/usr/bin/env bash -+set -eux -+ -+cargo build --release --no-default-features --features "alsa-backend with-avahi" -+cp /usr/lib/x86_64-linux-gnu/libdns_sd.so.1 /build/release -+ -+export PKG_CONFIG_ALLOW_CROSS=0 -+ -+export PKG_CONFIG_PATH=/usr/lib/aarch64-unknown-linux-gnu/pkgconfig -+cargo build --release --target aarch64-unknown-linux-gnu --no-default-features --features "alsa-backend with-avahi" -+cp /usr/lib/aarch64-linux-gnu/libdns_sd.so.1 /build/aarch64-unknown-linux-gnu/release -+ -+export PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabi/pkgconfig -+cargo build --release --target arm-unknown-linux-gnueabi --no-default-features --features "alsa-backend with-avahi" -+cp /usr/lib/arm-linux-gnueabi/libdns_sd.so.1 /build/arm-unknown-linux-gnueabi/release -+ -+export PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig -+cargo build --release --target arm-unknown-linux-gnueabihf --no-default-features --features "alsa-backend with-avahi" -+cp /usr/lib/arm-linux-gnueabihf/libdns_sd.so.1 /build/arm-unknown-linux-gnueabihf/release -+ -+export PKG_CONFIG_PATH=/usr/lib/mipsel-linux-gnu/pkgconfig -+cargo build --release --target mipsel-unknown-linux-gnu --no-default-features --features "alsa-backend with-avahi" -+cp /usr/libmipsel-linux-gnu/libdns_sd.so.1 /build/mipsel-unknown-linux-gnu/release -+ -diff --git a/src/authentication/discovery.rs b/src/authentication/discovery.rs -index 8c5b005..d385294 100644 ---- a/src/authentication/discovery.rs -+++ b/src/authentication/discovery.rs -@@ -7,7 +7,6 @@ use futures::sync::mpsc; - use futures::{Future, Stream, BoxFuture, Poll, Async}; - use hyper::server::{Service, NewService, Request, Response, Http}; - use hyper::{self, Get, Post, StatusCode}; --use mdns; - use num_bigint::BigUint; - use rand; - use std::collections::BTreeMap; -@@ -20,6 +19,12 @@ use url; - use authentication::Credentials; - use util; - -+#[cfg(feature = "with-rust-mdns")] -+use mdns; -+ -+#[cfg(feature = "with-avahi")] -+use dns_sd::DNSService; -+ - #[derive(Clone)] - struct Discovery(Arc); - struct DiscoveryInner { -@@ -202,7 +207,10 @@ impl NewService for Discovery { - - pub struct DiscoveryStream { - credentials: mpsc::UnboundedReceiver, -+ #[cfg(feature = "with-rust-mdns")] - _svc: mdns::Service, -+ #[cfg(feature = "with-avahi")] -+ _svc: DNSService, - task: Box>, - } - -@@ -212,8 +220,13 @@ pub fn discovery(handle: &Handle, device_name: String, device_id: String) - let (discovery, creds_rx) = Discovery::new(device_name.clone(), device_id); - - let listener = TcpListener::bind(&"0.0.0.0:0".parse().unwrap(), handle)?; -+ -+ #[cfg(feature = "with-rust-mdns")] - let addr = listener.local_addr()?; - -+ #[cfg(feature = "with-avahi")] -+ let port = listener.local_addr().unwrap().port(); -+ - let http = Http::new(); - let handle_ = handle.clone(); - let task = Box::new(listener.incoming().for_each(move |(socket, addr)| { -@@ -221,13 +234,25 @@ pub fn discovery(handle: &Handle, device_name: String, device_id: String) - Ok(()) - })); - -+ #[cfg(feature = "with-rust-mdns")] - let responder = mdns::Responder::spawn(&handle)?; -+ -+ #[cfg(feature = "with-rust-mdns")] - let svc = responder.register( - "_spotify-connect._tcp".to_owned(), - device_name, - addr.port(), - &["VERSION=1.0", "CPath=/"]); - -+ #[cfg(feature = "with-avahi")] -+ let svc = DNSService::register(Some(&*device_name), -+ "_spotify-connect._tcp", -+ None, -+ None, -+ port, -+ &["VERSION=1.0", "CPath=/"]) -+ .unwrap(); -+ - Ok(DiscoveryStream { - credentials: creds_rx, - _svc: svc, -diff --git a/src/lib.rs b/src/lib.rs -index 2a50249..b1b77ef 100644 ---- a/src/lib.rs -+++ b/src/lib.rs -@@ -19,7 +19,6 @@ extern crate crypto; - extern crate getopts; - extern crate hyper; - extern crate linear_map; --extern crate mdns; - extern crate num_bigint; - extern crate num_integer; - extern crate num_traits; -@@ -50,6 +49,11 @@ extern crate portaudio_rs; - #[cfg(feature = "libpulse-sys")] - extern crate libpulse_sys; - -+#[cfg(feature = "with-rust-mdns")] -+extern crate mdns; -+ -+#[cfg(feature = "with-avahi")] -+extern crate dns_sd; - - #[macro_use] mod component; - pub mod album_cover; diff --git a/packages/addons/service/librespot/patches/librespot-01_dns_sd.patch b/packages/addons/service/librespot/patches/librespot-01_dns_sd.patch new file mode 100644 index 0000000000..670493cddf --- /dev/null +++ b/packages/addons/service/librespot/patches/librespot-01_dns_sd.patch @@ -0,0 +1,135 @@ +From b0d70bed1d5f3614f0e966c53c3a4898c7b33918 Mon Sep 17 00:00:00 2001 +From: awiouy +Date: Mon, 4 Sep 2017 23:01:38 +0200 +Subject: [PATCH] use dns-sd instead of mdns for discovery + +--- + Cargo.lock | 19 +++++-------------- + Cargo.toml | 2 +- + src/discovery.rs | 19 ++++++++++--------- + src/lib.rs | 2 +- + 4 files changed, 17 insertions(+), 25 deletions(-) + +diff --git a/Cargo.lock b/Cargo.lock +index d8128db..5f54617 100644 +--- a/Cargo.lock ++++ b/Cargo.lock +@@ -277,7 +277,7 @@ dependencies = [ + "librespot-metadata 0.1.0", + "librespot-protocol 0.1.0", + "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +- "mdns 0.2.0 (git+https://github.com/plietar/rust-mdns)", ++ "dns-sd 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "num-bigint 0.1.40 (registry+https://github.com/rust-lang/crates.io-index)", + "portaudio-rs 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "protobuf 1.4.1 (registry+https://github.com/rust-lang/crates.io-index)", +@@ -386,20 +386,12 @@ version = "0.1.6" + source = "registry+https://github.com/rust-lang/crates.io-index" + + [[package]] +-name = "mdns" +-version = "0.2.0" +-source = "git+https://github.com/plietar/rust-mdns#c0fc73502d7d752a4ffeb5268a017561405e218c" ++name = "dns-sd" ++version = "0.1.3" ++source = "registry+https://github.com/rust-lang/crates.io-index" + dependencies = [ +- "byteorder 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)", +- "dns-parser 0.3.2 (git+https://github.com/plietar/dns-parser)", +- "futures 0.1.14 (registry+https://github.com/rust-lang/crates.io-index)", + "libc 0.2.29 (registry+https://github.com/rust-lang/crates.io-index)", +- "log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", +- "multimap 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", +- "net2 0.2.30 (registry+https://github.com/rust-lang/crates.io-index)", +- "nix 0.8.1 (registry+https://github.com/rust-lang/crates.io-index)", +- "rand 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", +- "tokio-core 0.1.9 (registry+https://github.com/rust-lang/crates.io-index)", ++ "pkg-config 0.3.9 (registry+https://github.com/rust-lang/crates.io-index)", + ] + + [[package]] +@@ -1099,7 +1091,6 @@ dependencies = [ + "checksum magenta 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "4bf0336886480e671965f794bc9b6fce88503563013d1bfb7a502c81fe3ac527" + "checksum magenta-sys 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "40d014c7011ac470ae28e2f76a02bfea4a8480f73e701353b49ad7a8d75f4699" + "checksum matches 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)" = "100aabe6b8ff4e4a7e32c1c13523379802df0772b82466207ac25b013f193376" +-"checksum mdns 0.2.0 (git+https://github.com/plietar/rust-mdns)" = "" + "checksum memchr 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1dbccc0e46f1ea47b9f17e6d67c5a96bd27030519c519c9c91327e31275a47b4" + "checksum mime 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)" = "c5ca99d8a021c1687882fd68dca26e601ceff5c26571c7cb41cf4ed60d57cb2d" + "checksum mio 0.6.10 (registry+https://github.com/rust-lang/crates.io-index)" = "dbd91d3bfbceb13897065e97b2ef177a09a438cb33612b2d371bf568819a9313" +diff --git a/Cargo.toml b/Cargo.toml +index f4e6349..131e4f3 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -36,7 +36,7 @@ futures = "0.1.8" + getopts = "0.2.14" + hyper = "0.11.2" + log = "0.3.5" +-mdns = { git = "https://github.com/plietar/rust-mdns" } ++dns-sd = "0.1.3" + num-bigint = "0.1.35" + protobuf = "1.1" + rand = "0.3.13" +diff --git a/src/discovery.rs b/src/discovery.rs +index 3eaa5f0..6f9a4ae 100644 +--- a/src/discovery.rs ++++ b/src/discovery.rs +@@ -6,7 +6,7 @@ use futures::sync::mpsc; + use futures::{Future, Stream, BoxFuture, Poll, Async}; + use hyper::server::{Service, NewService, Request, Response, Http}; + use hyper::{self, Get, Post, StatusCode}; +-use mdns; ++use dns_sd::DNSService; + use num_bigint::BigUint; + use rand; + use std::collections::BTreeMap; +@@ -203,7 +203,7 @@ impl NewService for Discovery { + + pub struct DiscoveryStream { + credentials: mpsc::UnboundedReceiver, +- _svc: mdns::Service, ++ _svc: DNSService, + task: Box>, + } + +@@ -213,7 +213,7 @@ pub fn discovery(handle: &Handle, config: ConnectConfig, device_id: String) + let (discovery, creds_rx) = Discovery::new(config.clone(), device_id); + + let listener = TcpListener::bind(&"0.0.0.0:0".parse().unwrap(), handle)?; +- let addr = listener.local_addr()?; ++ let port = listener.local_addr().unwrap().port(); + + let http = Http::new(); + let handle_ = handle.clone(); +@@ -222,12 +222,13 @@ pub fn discovery(handle: &Handle, config: ConnectConfig, device_id: String) + Ok(()) + })); + +- let responder = mdns::Responder::spawn(&handle)?; +- let svc = responder.register( +- "_spotify-connect._tcp".to_owned(), +- config.name, +- addr.port(), +- &["VERSION=1.0", "CPath=/"]); ++ let svc = DNSService::register(Some(&*config.name), ++ "_spotify-connect._tcp", ++ None, ++ None, ++ port, ++ &["VERSION=1.0", "CPath=/"]) ++ .unwrap(); + + Ok(DiscoveryStream { + credentials: creds_rx, +diff --git a/src/lib.rs b/src/lib.rs +index b9c920e..dfaf5a2 100644 +--- a/src/lib.rs ++++ b/src/lib.rs +@@ -13,7 +13,7 @@ extern crate base64; + extern crate crypto; + extern crate futures; + extern crate hyper; +-extern crate mdns; ++extern crate dns_sd; + extern crate num_bigint; + extern crate protobuf; + extern crate rand; diff --git a/packages/addons/service/librespot/patches/librespot-03_libreelec_hooks.patch b/packages/addons/service/librespot/patches/librespot-02_kodi_hooks.patch similarity index 70% rename from packages/addons/service/librespot/patches/librespot-03_libreelec_hooks.patch rename to packages/addons/service/librespot/patches/librespot-02_kodi_hooks.patch index d6d07df4ef..2512ca5eb6 100644 --- a/packages/addons/service/librespot/patches/librespot-03_libreelec_hooks.patch +++ b/packages/addons/service/librespot/patches/librespot-02_kodi_hooks.patch @@ -1,25 +1,35 @@ -diff -Naur librespot/src/player.rs librespot-hooks/src/player.rs ---- librespot/src/player.rs 2017-07-09 20:01:31.000000000 +0200 -+++ librespot-hooks/src/player.rs 2017-07-22 13:46:06.741727001 +0200 -@@ -2,6 +2,7 @@ +From a20f55c268bf44d6923be4cad6c6fdfecfc5dd8a Mon Sep 17 00:00:00 2001 +From: awiouy +Date: Tue, 12 Sep 2017 09:37:53 +0200 +Subject: [PATCH] kodi hooks + +--- + src/player.rs | 25 +++++++++++++++++-------- + 1 file changed, 17 insertions(+), 8 deletions(-) + +diff --git a/src/player.rs b/src/player.rs +index 29380e3..44b9a24 100644 +--- a/src/player.rs ++++ b/src/player.rs +@@ -1,6 +1,7 @@ + use futures::sync::oneshot; use futures::{future, Future}; use std::borrow::Cow; - use std::io::{Read, Seek}; +use std::env; use std::mem; use std::sync::mpsc::{RecvError, TryRecvError}; use std::thread; -@@ -11,7 +12,7 @@ +@@ -13,7 +14,7 @@ use core::util::{self, SpotifyId, Subfile}; use audio_backend::Sink; - use audio_decrypt::AudioDecrypt; - use audio_file::AudioFile; --use metadata::{FileFormat, Track}; -+use metadata::{Artist, FileFormat, Track}; - use session::{Bitrate, Session}; + use audio::{AudioFile, AudioDecrypt}; + use audio::{VorbisDecoder, VorbisPacket}; +-use metadata::{FileFormat, Track, Metadata}; ++use metadata::{Artist, FileFormat, Track, Metadata}; use mixer::AudioFilter; - use util::{self, SpotifyId, Subfile}; -@@ -212,7 +213,7 @@ - Some(Err(e)) => panic!("Vorbis error {:?}", e), + + #[derive(Clone)] +@@ -215,7 +216,7 @@ impl PlayerInternal { + None => { self.sink.stop().unwrap(); - self.run_onstop(); @@ -27,12 +37,12 @@ diff -Naur librespot/src/player.rs librespot-hooks/src/player.rs let old_state = mem::replace(&mut self.state, PlayerState::Stopped); old_state.signal_end_of_track(); -@@ -224,6 +225,12 @@ +@@ -227,6 +228,12 @@ impl PlayerInternal { debug!("command={:?}", cmd); match cmd { PlayerCommand::Load(track_id, play, position, end_of_track) => { -+ let track = self.session.metadata().get::(track_id).wait().unwrap(); -+ let artist = self.session.metadata().get::(track.artists[0]).wait().unwrap(); ++ let track = Track::get(&self.session, track_id).wait().unwrap(); ++ let artist = Artist::get(&self.session, track.artists[0]).wait().unwrap(); + env::set_var("LS_ARTIST", artist.name); + env::set_var("LS_TITLE", track.name); + self.run_onstart(); @@ -40,7 +50,7 @@ diff -Naur librespot/src/player.rs librespot-hooks/src/player.rs if self.state.is_playing() { self.sink.stop().unwrap(); } -@@ -232,7 +239,7 @@ +@@ -235,7 +242,7 @@ impl PlayerInternal { Some(decoder) => { if play { if !self.state.is_playing() { @@ -49,7 +59,7 @@ diff -Naur librespot/src/player.rs librespot-hooks/src/player.rs } self.sink.start().unwrap(); -@@ -242,7 +249,7 @@ +@@ -245,7 +252,7 @@ impl PlayerInternal { }; } else { if self.state.is_playing() { @@ -58,16 +68,16 @@ diff -Naur librespot/src/player.rs librespot-hooks/src/player.rs } self.state = PlayerState::Paused { -@@ -255,7 +262,7 @@ +@@ -258,7 +265,7 @@ impl PlayerInternal { None => { end_of_track.complete(()); if self.state.is_playing() { - self.run_onstop(); -+ info!("onstart 3"); ++ info!("onstop 3"); } } } -@@ -276,7 +283,7 @@ +@@ -279,7 +286,7 @@ impl PlayerInternal { if let PlayerState::Paused { .. } = self.state { self.state.paused_to_playing(); @@ -76,7 +86,7 @@ diff -Naur librespot/src/player.rs librespot-hooks/src/player.rs self.sink.start().unwrap(); } else { warn!("Player::play called from invalid state"); -@@ -288,17 +295,19 @@ +@@ -291,17 +298,19 @@ impl PlayerInternal { self.state.playing_to_paused(); self.sink.stop().unwrap(); diff --git a/packages/addons/service/librespot/patches/librespot-02_pulseaudio_device.patch b/packages/addons/service/librespot/patches/librespot-03_pulseaudio_sink.patch similarity index 78% rename from packages/addons/service/librespot/patches/librespot-02_pulseaudio_device.patch rename to packages/addons/service/librespot/patches/librespot-03_pulseaudio_sink.patch index d56b431e6b..7596eb776d 100644 --- a/packages/addons/service/librespot/patches/librespot-02_pulseaudio_device.patch +++ b/packages/addons/service/librespot/patches/librespot-03_pulseaudio_sink.patch @@ -1,3 +1,12 @@ +From e9bb269936ea26b1c0c698b8d05aaf68e2e79bcc Mon Sep 17 00:00:00 2001 +From: awiouy +Date: Tue, 12 Sep 2017 09:41:14 +0200 +Subject: [PATCH] use librespot_sink pulseadio sink + +--- + src/audio_backend/pulseaudio.rs | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + diff --git a/src/audio_backend/pulseaudio.rs b/src/audio_backend/pulseaudio.rs index 3b9a09b..ce78062 100644 --- a/src/audio_backend/pulseaudio.rs diff --git a/packages/addons/service/librespot/source/bin/librespot.start b/packages/addons/service/librespot/source/bin/librespot.start index 8fb8aaad44..c496dc61c8 100755 --- a/packages/addons/service/librespot/source/bin/librespot.start +++ b/packages/addons/service/librespot/source/bin/librespot.start @@ -101,12 +101,13 @@ if [ -n "$ls_p" -a -n "$ls_u" ]; then fi if [ "$ls_O" == "Kodi" ]; then - LIBRESPOT="$LIBRESPOT --backend pulseaudio" + LIBRESPOT="$LIBRESPOT --backend pulseaudio --device-type TV" else init_alsa if [ -n "$ls_o" ]; then LIBRESPOT="$LIBRESPOT --device \"$ls_o\"" fi + LIBRESPOT="$LIBRESPOT --device-type Speaker" fi if [ -z "$(pactl list short modules | grep sink_name=$LS_SINK)" ]; then