mirror of
https://github.com/librespot-org/librespot.git
synced 2024-12-18 17:11:53 +00:00
Put lewton behind feature flag
This commit is contained in:
parent
a6ed6857d2
commit
746e6c863e
4 changed files with 29 additions and 13 deletions
1
Cargo.lock
generated
1
Cargo.lock
generated
|
@ -1402,6 +1402,7 @@ dependencies = [
|
||||||
"bit-set",
|
"bit-set",
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"bytes",
|
"bytes",
|
||||||
|
"cfg-if 1.0.0",
|
||||||
"futures",
|
"futures",
|
||||||
"lewton",
|
"lewton",
|
||||||
"librespot-core",
|
"librespot-core",
|
||||||
|
|
|
@ -75,10 +75,11 @@ 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", "apresolve"]
|
default = ["rodio-backend", "apresolve", "with-lewton"]
|
||||||
|
|
||||||
[package.metadata.deb]
|
[package.metadata.deb]
|
||||||
maintainer = "librespot-org"
|
maintainer = "librespot-org"
|
||||||
|
|
|
@ -15,18 +15,20 @@ aes-ctr = "0.6"
|
||||||
bit-set = "0.5"
|
bit-set = "0.5"
|
||||||
byteorder = "1.4"
|
byteorder = "1.4"
|
||||||
bytes = "1.0"
|
bytes = "1.0"
|
||||||
|
cfg-if = "1"
|
||||||
futures = "0.3"
|
futures = "0.3"
|
||||||
lewton = "0.10"
|
|
||||||
ogg = "0.8"
|
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
num-bigint = "0.3"
|
num-bigint = "0.3"
|
||||||
num-traits = "0.2"
|
num-traits = "0.2"
|
||||||
|
ogg = "0.8"
|
||||||
pin-project-lite = "0.2.4"
|
pin-project-lite = "0.2.4"
|
||||||
tempfile = "3.1"
|
tempfile = "3.1"
|
||||||
|
|
||||||
|
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"]
|
||||||
|
|
|
@ -19,11 +19,29 @@ extern crate librespot_core;
|
||||||
mod decrypt;
|
mod decrypt;
|
||||||
mod fetch;
|
mod fetch;
|
||||||
|
|
||||||
#[cfg(not(any(feature = "with-tremor", feature = "with-vorbis")))]
|
use cfg_if::cfg_if;
|
||||||
mod lewton_decoder;
|
|
||||||
#[cfg(any(feature = "with-tremor", feature = "with-vorbis"))]
|
#[cfg(any(
|
||||||
mod libvorbis_decoder;
|
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;
|
mod passthrough_decoder;
|
||||||
|
pub use passthrough_decoder::{PassthroughDecoder, PassthroughError};
|
||||||
|
|
||||||
mod range_set;
|
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)]
|
#[derive(Debug)]
|
||||||
pub enum AudioError {
|
pub enum AudioError {
|
||||||
PassthroughError(PassthroughError),
|
PassthroughError(PassthroughError),
|
||||||
|
|
Loading…
Reference in a new issue