mirror of
https://github.com/librespot-org/librespot.git
synced 2025-10-03 01:39:28 +02:00
Put lewton behind feature flag
This commit is contained in:
parent
a6ed6857d2
commit
746e6c863e
4 changed files with 29 additions and 13 deletions
|
@ -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"]
|
||||
|
|
|
@ -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),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue