core: Make nellymoser optional, enable on desktop and web

This commit is contained in:
= 2022-08-26 03:50:11 +02:00 committed by Mike Welsh
parent f5245d72da
commit c6c22cebc9
5 changed files with 13 additions and 9 deletions

View File

@ -35,7 +35,7 @@ encoding_rs = "0.8.31"
rand = { version = "0.8.5", features = ["std", "small_rng"], default-features = false }
serde = { version = "1.0.144", features = ["derive"] }
serde_json = { version = "1.0", features = ["preserve_order"] }
nellymoser-rs = { git = "https://github.com/ruffle-rs/nellymoser", rev = "4a33521c29a918950df8ae9fe07e527ac65553f5" }
nellymoser-rs = { git = "https://github.com/ruffle-rs/nellymoser", rev = "4a33521c29a918950df8ae9fe07e527ac65553f5", optional = true }
h263-rs = { git = "https://github.com/ruffle-rs/h263-rs", rev = "023e14c73e565c4c778d41f66cfbac5ece6419b2", optional = true }
h263-rs-yuv = { git = "https://github.com/ruffle-rs/h263-rs", rev = "023e14c73e565c4c778d41f66cfbac5ece6419b2", optional = true }
regress = "0.4"
@ -63,6 +63,7 @@ wasm-bindgen = [ "instant/wasm-bindgen" ]
avm_debug = []
deterministic = []
timeline_debug = []
nellymoser = ["nellymoser-rs"]
[build-dependencies]
build_playerglobal = { path = "build_playerglobal" }

View File

@ -3,6 +3,7 @@
mod adpcm;
#[cfg(any(feature = "minimp3", feature = "symphonia"))]
mod mp3;
#[cfg(feature = "nellymoser")]
mod nellymoser;
mod pcm;
@ -11,6 +12,7 @@ pub use adpcm::AdpcmDecoder;
pub use mp3::minimp3::Mp3Decoder;
#[cfg(all(feature = "symphonia", not(feature = "minimp3")))]
pub use mp3::symphonia::Mp3Decoder;
#[cfg(feature = "nellymoser")]
pub use nellymoser::NellymoserDecoder;
pub use pcm::PcmDecoder;
@ -75,6 +77,7 @@ pub fn make_decoder<R: 'static + Read + Send + Sync>(
)?),
#[cfg(any(feature = "minimp3", feature = "symphonia"))]
AudioCompression::Mp3 => Box::new(Mp3Decoder::new(data)?),
#[cfg(feature = "nellymoser")]
AudioCompression::Nellymoser => {
Box::new(NellymoserDecoder::new(data, format.sample_rate.into()))
}

View File

@ -1,6 +1,4 @@
use super::decoders::{
self, AdpcmDecoder, Decoder, NellymoserDecoder, PcmDecoder, SeekableDecoder,
};
use super::decoders::{self, AdpcmDecoder, Decoder, PcmDecoder, SeekableDecoder};
use super::{SoundHandle, SoundInstanceHandle, SoundTransform};
use crate::backend::audio::{DecodeError, RegisterError};
use crate::tag_utils::SwfSlice;
@ -224,9 +222,11 @@ impl AudioMixer {
AudioCompression::Mp3 => Box::new(decoders::Mp3Decoder::new(data)?),
#[cfg(all(feature = "symphonia", not(feature = "minimp3")))]
AudioCompression::Mp3 => Box::new(decoders::Mp3Decoder::new_seekable(data)?),
AudioCompression::Nellymoser => {
Box::new(NellymoserDecoder::new(data, format.sample_rate.into()))
}
#[cfg(feature = "nellymoser")]
AudioCompression::Nellymoser => Box::new(decoders::NellymoserDecoder::new(
data,
format.sample_rate.into(),
)),
_ => return Err(decoders::Error::UnhandledCompression(format.compression)),
};
Ok(decoder)

View File

@ -9,7 +9,7 @@ license = "MIT OR Apache-2.0"
[dependencies]
clap = { version = "3.2.17", features = ["derive"] }
cpal = "0.13.5"
ruffle_core = { path = "../core", features = ["minimp3"] }
ruffle_core = { path = "../core", features = ["minimp3", "nellymoser"] }
ruffle_render_wgpu = { path = "../render/wgpu", features = ["clap"] }
env_logger = { version = "0.9", default-features = false, features = ["humantime"] }
generational-arena = "0.2.8"

View File

@ -48,7 +48,7 @@ base64 = "0.13.0"
[dependencies.ruffle_core]
path = "../core"
default-features = false
features = ["h263", "vp6", "screenvideo", "symphonia", "wasm-bindgen"]
features = ["h263", "vp6", "screenvideo", "symphonia", "wasm-bindgen", "nellymoser"]
[dependencies.web-sys]
version = "0.3.58"