Input: lazy_static -> once_cell::sync::Lazy (#136)
This commit is contained in:
@@ -59,10 +59,6 @@ version = "0.10"
|
|||||||
[dependencies.futures]
|
[dependencies.futures]
|
||||||
version = "0.3"
|
version = "0.3"
|
||||||
|
|
||||||
[dependencies.lazy_static]
|
|
||||||
optional = true
|
|
||||||
version = "1"
|
|
||||||
|
|
||||||
[dependencies.parking_lot]
|
[dependencies.parking_lot]
|
||||||
optional = true
|
optional = true
|
||||||
version = "0.12"
|
version = "0.12"
|
||||||
@@ -194,7 +190,7 @@ driver = [
|
|||||||
"discortp",
|
"discortp",
|
||||||
"reqwest",
|
"reqwest",
|
||||||
"flume",
|
"flume",
|
||||||
"lazy_static",
|
"once_cell",
|
||||||
"parking_lot",
|
"parking_lot",
|
||||||
"rand",
|
"rand",
|
||||||
"ringbuf",
|
"ringbuf",
|
||||||
|
|||||||
@@ -200,14 +200,14 @@ impl Config {
|
|||||||
|
|
||||||
/// Sets this `Config`'s symphonia codec registry.
|
/// Sets this `Config`'s symphonia codec registry.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn codec_registry(mut self, codec_registry: &'static CODEC_REGISTRY) -> Self {
|
pub fn codec_registry(mut self, codec_registry: &'static CodecRegistry) -> Self {
|
||||||
self.codec_registry = codec_registry;
|
self.codec_registry = codec_registry;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sets this `Config`'s symphonia format registry/probe set.
|
/// Sets this `Config`'s symphonia format registry/probe set.
|
||||||
#[must_use]
|
#[must_use]
|
||||||
pub fn format_registry(mut self, format_registry: &'static PROBE) -> Self {
|
pub fn format_registry(mut self, format_registry: &'static Probe) -> Self {
|
||||||
self.format_registry = format_registry;
|
self.format_registry = format_registry;
|
||||||
self
|
self
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,30 +5,25 @@ mod opus;
|
|||||||
mod raw;
|
mod raw;
|
||||||
|
|
||||||
pub use self::{dca::DcaReader, opus::OpusDecoder, raw::*};
|
pub use self::{dca::DcaReader, opus::OpusDecoder, raw::*};
|
||||||
use lazy_static::lazy_static;
|
use once_cell::sync::Lazy;
|
||||||
use symphonia::{
|
use symphonia::{
|
||||||
core::{codecs::CodecRegistry, probe::Probe},
|
core::{codecs::CodecRegistry, probe::Probe},
|
||||||
default::*,
|
default::*,
|
||||||
};
|
};
|
||||||
|
|
||||||
lazy_static! {
|
/// Default Symphonia [`CodecRegistry`], including the (audiopus-backed) Opus codec.
|
||||||
/// Default Symphonia CodecRegistry, including the (audiopus-backed)
|
pub static CODEC_REGISTRY: Lazy<CodecRegistry> = Lazy::new(|| {
|
||||||
/// Opus codec.
|
let mut registry = CodecRegistry::new();
|
||||||
pub static ref CODEC_REGISTRY: CodecRegistry = {
|
register_enabled_codecs(&mut registry);
|
||||||
let mut registry = CodecRegistry::new();
|
registry.register_all::<OpusDecoder>();
|
||||||
register_enabled_codecs(&mut registry);
|
registry
|
||||||
registry.register_all::<OpusDecoder>();
|
});
|
||||||
registry
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
lazy_static! {
|
/// Default Symphonia Probe, including DCA format support.
|
||||||
/// Default Symphonia Probe, including DCA format support.
|
pub static PROBE: Lazy<Probe> = Lazy::new(|| {
|
||||||
pub static ref PROBE: Probe = {
|
let mut probe = Probe::default();
|
||||||
let mut probe = Probe::default();
|
probe.register_all::<DcaReader>();
|
||||||
probe.register_all::<DcaReader>();
|
probe.register_all::<RawReader>();
|
||||||
probe.register_all::<RawReader>();
|
register_enabled_formats(&mut probe);
|
||||||
register_enabled_formats(&mut probe);
|
probe
|
||||||
probe
|
});
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user