Restore previous feature flags

Some of the feature flags librespot uses are not really additive but
rather mutual exclusive. A previous attempt to improve the situation
had other drawbacks, so it's better to postpone a decision and restore
the old behaviour.
This commit is contained in:
johannesd3 2021-04-09 16:38:43 +02:00
parent cb8c9c2afa
commit b7350b71da
4 changed files with 7 additions and 20 deletions

View file

@ -70,11 +70,10 @@ gstreamer-backend = ["librespot-playback/gstreamer-backend"]
with-tremor = ["librespot-audio/with-tremor"] with-tremor = ["librespot-audio/with-tremor"]
with-vorbis = ["librespot-audio/with-vorbis"] with-vorbis = ["librespot-audio/with-vorbis"]
with-lewton = ["librespot-audio/with-lewton"]
# with-dns-sd = ["librespot-connect/with-dns-sd"] with-dns-sd = ["librespot-connect/with-dns-sd"]
default = ["rodio-backend", "with-lewton"] default = ["rodio-backend"]
[package.metadata.deb] [package.metadata.deb]
maintainer = "librespot-org" maintainer = "librespot-org"

View file

@ -15,17 +15,16 @@ aes-ctr = "0.6"
byteorder = "1.4" byteorder = "1.4"
bytes = "1.0" bytes = "1.0"
cfg-if = "1" cfg-if = "1"
lewton = "0.10"
log = "0.4" log = "0.4"
futures-util = { version = "0.3", default_features = false } futures-util = { version = "0.3", default_features = false }
ogg = "0.8" ogg = "0.8"
tempfile = "3.1" tempfile = "3.1"
tokio = { version = "1", features = ["sync"] } tokio = { version = "1", features = ["sync"] }
lewton = { version = "0.10", optional = true }
librespot-tremor = { version = "0.2.0", optional = true } librespot-tremor = { version = "0.2.0", optional = true }
vorbis = { version ="0.0.14", optional = true } vorbis = { version ="0.0.14", optional = true }
[features] [features]
with-lewton = ["lewton"]
with-tremor = ["librespot-tremor"] with-tremor = ["librespot-tremor"]
with-vorbis = ["vorbis"] with-vorbis = ["vorbis"]

View file

@ -8,22 +8,13 @@ mod fetch;
use cfg_if::cfg_if; 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! { cfg_if! {
if #[cfg(feature = "with-lewton")] { if #[cfg(any(feature = "with-tremor", feature = "with-vorbis"))] {
mod lewton_decoder;
pub use lewton_decoder::{VorbisDecoder, VorbisError};
} else if #[cfg(any(feature = "with-tremor", feature = "with-vorbis"))] {
mod libvorbis_decoder; mod libvorbis_decoder;
pub use crate::libvorbis_decoder::{VorbisDecoder, VorbisError}; pub use crate::libvorbis_decoder::{VorbisDecoder, VorbisError};
} else { } else {
compile_error!("Must choose a vorbis decoder."); mod lewton_decoder;
pub use lewton_decoder::{VorbisDecoder, VorbisError};
} }
} }

View file

@ -16,6 +16,7 @@ futures-core = "0.3"
futures-util = { version = "0.3", default_features = false } futures-util = { version = "0.3", default_features = false }
hmac = "0.10" hmac = "0.10"
hyper = { version = "0.14", features = ["server", "http1", "tcp"] } hyper = { version = "0.14", features = ["server", "http1", "tcp"] }
libmdns = "0.6"
log = "0.4" log = "0.4"
protobuf = "~2.14.0" protobuf = "~2.14.0"
rand = "0.8" rand = "0.8"
@ -27,7 +28,6 @@ tokio-stream = { version = "0.1" }
url = "2.1" url = "2.1"
dns-sd = { version = "0.1.3", optional = true } dns-sd = { version = "0.1.3", optional = true }
libmdns = { version = "0.6", optional = true }
[dependencies.librespot-core] [dependencies.librespot-core]
path = "../core" path = "../core"
@ -42,7 +42,5 @@ path = "../protocol"
version = "0.1.6" version = "0.1.6"
[features] [features]
with-libmdns = ["libmdns"]
with-dns-sd = ["dns-sd"] with-dns-sd = ["dns-sd"]
default = ["with-libmdns"]