audio: Fix symphonia feature
This feature stopped building with the bump to symphonia 0.5, which added a `Sync` bound to its traits. * Add `Sync` bounds to our own internal audio traits to match. * nellymoser::Decoder was also tweaked to add a Sync bound. * Lock the nellymoser dependency to a specific git commit.
This commit is contained in:
parent
a5f7fccca2
commit
24f00238a7
|
@ -2290,10 +2290,11 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "nellymoser-rs"
|
||||
version = "0.1.0"
|
||||
source = "git+https://github.com/ruffle-rs/nellymoser#77000f763b58021295429ca5740e3dc3b5228cbd"
|
||||
version = "0.1.2"
|
||||
source = "git+https://github.com/ruffle-rs/nellymoser?rev=4a33521c29a918950df8ae9fe07e527ac65553f5#4a33521c29a918950df8ae9fe07e527ac65553f5"
|
||||
dependencies = [
|
||||
"bitstream-io",
|
||||
"once_cell",
|
||||
"rustdct",
|
||||
]
|
||||
|
||||
|
@ -2389,9 +2390,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "num-complex"
|
||||
version = "0.3.1"
|
||||
version = "0.4.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "747d632c0c558b87dbabbe6a82f3b4ae03720d0646ac5b7b4dae89394be5f2c5"
|
||||
checksum = "26873667bbbb7c5182d4a37c1add32cdf09f841af72da53318fdb81543c15085"
|
||||
dependencies = [
|
||||
"num-traits",
|
||||
]
|
||||
|
@ -3197,18 +3198,18 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "rustdct"
|
||||
version = "0.6.0"
|
||||
version = "0.7.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "fadcb505b98aa64da1dadb1498b912e3642aae4606623cb3ae952cd8da33f80d"
|
||||
checksum = "620247053ace0eddd3e607c66423537e45c3ae36008e6d6fac1552f51ea1a63a"
|
||||
dependencies = [
|
||||
"rustfft",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "rustfft"
|
||||
version = "5.1.1"
|
||||
version = "6.0.1"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "1869bb2a6ff77380d52ff4bc631f165637035a55855c76aa462c85474dadc42f"
|
||||
checksum = "b1d089e5c57521629a59f5f39bca7434849ff89bd6873b521afe389c1c602543"
|
||||
dependencies = [
|
||||
"num-complex",
|
||||
"num-integer",
|
||||
|
|
|
@ -38,7 +38,7 @@ encoding_rs = "0.8.31"
|
|||
rand = { version = "0.8.5", features = ["std", "small_rng"], default-features = false }
|
||||
serde = { version = "1.0.136", features = ["derive"] }
|
||||
serde_json = { version = "1.0", features = ["preserve_order"] }
|
||||
nellymoser-rs = { git = "https://github.com/ruffle-rs/nellymoser" }
|
||||
nellymoser-rs = { git = "https://github.com/ruffle-rs/nellymoser", rev = "4a33521c29a918950df8ae9fe07e527ac65553f5" }
|
||||
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"
|
||||
|
|
|
@ -22,7 +22,7 @@ type Error = Box<dyn std::error::Error>;
|
|||
|
||||
/// An audio decoder. Can be used as an `Iterator` to return stero sample frames.
|
||||
/// If the sound is mono, the sample is duplicated across both channels.
|
||||
pub trait Decoder: Iterator<Item = [i16; 2]> {
|
||||
pub trait Decoder: Iterator<Item = [i16; 2]> + Send + Sync {
|
||||
/// The number of channels of this audio decoder. Always 1 or 2.
|
||||
fn num_channels(&self) -> u8;
|
||||
|
||||
|
@ -31,11 +31,11 @@ pub trait Decoder: Iterator<Item = [i16; 2]> {
|
|||
}
|
||||
|
||||
/// Instantiate a decoder for the compression that the sound data uses.
|
||||
pub fn make_decoder<R: 'static + Send + Read>(
|
||||
pub fn make_decoder<R: 'static + Read + Send + Sync>(
|
||||
format: &SoundFormat,
|
||||
data: R,
|
||||
) -> Result<Box<dyn Send + Decoder>, Error> {
|
||||
let decoder: Box<dyn Send + Decoder> = match format.compression {
|
||||
) -> Result<Box<dyn Decoder>, Error> {
|
||||
let decoder: Box<dyn Decoder> = match format.compression {
|
||||
AudioCompression::UncompressedUnknownEndian => {
|
||||
// Cross fingers that it's little endian.
|
||||
log::warn!("make_decoder: PCM sound is unknown endian; assuming little endian");
|
||||
|
@ -74,7 +74,7 @@ pub fn make_decoder<R: 'static + Send + Read>(
|
|||
Ok(decoder)
|
||||
}
|
||||
|
||||
impl Decoder for Box<dyn Decoder + Send> {
|
||||
impl<T: Decoder + ?Sized> Decoder for Box<T> {
|
||||
#[inline]
|
||||
fn num_channels(&self) -> u8 {
|
||||
self.as_ref().num_channels()
|
||||
|
@ -100,7 +100,7 @@ pub trait StreamDecoder: Decoder {}
|
|||
/// and feeds it to the decoder.
|
||||
struct StandardStreamDecoder {
|
||||
/// The underlying decoder. The decoder will get its data from a `StreamTagReader`.
|
||||
decoder: Box<dyn Decoder + Send>,
|
||||
decoder: Box<dyn Decoder>,
|
||||
}
|
||||
|
||||
impl StandardStreamDecoder {
|
||||
|
|
|
@ -146,7 +146,7 @@ impl<R: Read> Iterator for AdpcmDecoder<R> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<R: std::io::Read> Decoder for AdpcmDecoder<R> {
|
||||
impl<R: std::io::Read + Send + Sync> Decoder for AdpcmDecoder<R> {
|
||||
#[inline]
|
||||
fn num_channels(&self) -> u8 {
|
||||
self.channels.len() as u8
|
||||
|
@ -158,7 +158,7 @@ impl<R: std::io::Read> Decoder for AdpcmDecoder<R> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<R: AsRef<[u8]> + Default> SeekableDecoder for AdpcmDecoder<Cursor<R>> {
|
||||
impl<R: AsRef<[u8]> + Default + Send + Sync> SeekableDecoder for AdpcmDecoder<Cursor<R>> {
|
||||
#[inline]
|
||||
fn reset(&mut self) {
|
||||
// TODO: This is funky.
|
||||
|
|
|
@ -38,7 +38,7 @@ pub mod minimp3 {
|
|||
}
|
||||
}
|
||||
|
||||
impl<R: Read> Iterator for Mp3Decoder<R> {
|
||||
impl<R: Read + Send + Sync> Iterator for Mp3Decoder<R> {
|
||||
type Item = [i16; 2];
|
||||
|
||||
#[inline]
|
||||
|
@ -65,7 +65,7 @@ pub mod minimp3 {
|
|||
}
|
||||
}
|
||||
|
||||
impl<R: AsRef<[u8]> + Default> SeekableDecoder for Mp3Decoder<Cursor<R>> {
|
||||
impl<R: AsRef<[u8]> + Default + Send + Sync> SeekableDecoder for Mp3Decoder<Cursor<R>> {
|
||||
#[inline]
|
||||
fn reset(&mut self) {
|
||||
// TODO: This is funky.
|
||||
|
@ -79,7 +79,7 @@ pub mod minimp3 {
|
|||
}
|
||||
}
|
||||
|
||||
impl<R: Read> Decoder for Mp3Decoder<R> {
|
||||
impl<R: Read + Send + Sync> Decoder for Mp3Decoder<R> {
|
||||
#[inline]
|
||||
fn num_channels(&self) -> u8 {
|
||||
self.num_channels
|
||||
|
@ -121,7 +121,7 @@ pub mod symphonia {
|
|||
impl Mp3Decoder {
|
||||
const SAMPLE_BUFFER_DURATION: u64 = 4096;
|
||||
|
||||
pub fn new<R: 'static + Read + Send>(reader: R) -> Result<Self, Error> {
|
||||
pub fn new<R: 'static + Read + Send + Sync>(reader: R) -> Result<Self, Error> {
|
||||
let source = Box::new(io::ReadOnlySource::new(reader)) as Box<dyn io::MediaSource>;
|
||||
let source = io::MediaSourceStream::new(source, Default::default());
|
||||
let reader = SymphoniaMp3Reader::try_new(source, &Default::default())?;
|
||||
|
@ -145,7 +145,7 @@ pub mod symphonia {
|
|||
})
|
||||
}
|
||||
|
||||
pub fn new_seekable<R: 'static + AsRef<[u8]> + Send>(
|
||||
pub fn new_seekable<R: 'static + AsRef<[u8]> + Send + Sync>(
|
||||
reader: Cursor<R>,
|
||||
) -> Result<Self, Error> {
|
||||
let source = Box::new(reader) as Box<dyn io::MediaSource>;
|
||||
|
|
|
@ -22,7 +22,7 @@ impl<R: Read> Iterator for NellymoserDecoder<R> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<R: Read> Decoder for NellymoserDecoder<R> {
|
||||
impl<R: Read + Send + Sync> Decoder for NellymoserDecoder<R> {
|
||||
#[inline]
|
||||
fn num_channels(&self) -> u8 {
|
||||
1
|
||||
|
@ -34,7 +34,7 @@ impl<R: Read> Decoder for NellymoserDecoder<R> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<R: AsRef<[u8]>> SeekableDecoder for NellymoserDecoder<Cursor<R>> {
|
||||
impl<R: AsRef<[u8]> + Send + Sync> SeekableDecoder for NellymoserDecoder<Cursor<R>> {
|
||||
#[inline]
|
||||
fn reset(&mut self) {
|
||||
self.decoder.reset();
|
||||
|
|
|
@ -47,7 +47,7 @@ impl<R: Read> Iterator for PcmDecoder<R> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<R: Read> Decoder for PcmDecoder<R> {
|
||||
impl<R: Read + Send + Sync> Decoder for PcmDecoder<R> {
|
||||
#[inline]
|
||||
fn num_channels(&self) -> u8 {
|
||||
if self.is_stereo {
|
||||
|
@ -63,7 +63,7 @@ impl<R: Read> Decoder for PcmDecoder<R> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<R: AsRef<[u8]>> SeekableDecoder for PcmDecoder<Cursor<R>> {
|
||||
impl<R: AsRef<[u8]> + Send + Sync> SeekableDecoder for PcmDecoder<Cursor<R>> {
|
||||
#[inline]
|
||||
fn reset(&mut self) {
|
||||
self.inner.set_position(0);
|
||||
|
|
|
@ -32,7 +32,7 @@ pub struct AudioMixer {
|
|||
type Error = Box<dyn std::error::Error>;
|
||||
|
||||
/// An audio stream.
|
||||
trait Stream: dasp::signal::Signal<Frame = [i16; 2]> + Send {
|
||||
trait Stream: dasp::signal::Signal<Frame = [i16; 2]> + Send + Sync {
|
||||
/// The position of this stream in sample frames.
|
||||
///
|
||||
/// For infinite streams, this will be the number of sample frames since the start of the
|
||||
|
@ -64,7 +64,7 @@ impl<D> DecoderStream<D> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<D: Decoder + Send> Stream for DecoderStream<D> {
|
||||
impl<D: Decoder> Stream for DecoderStream<D> {
|
||||
#[inline]
|
||||
fn source_position(&self) -> u32 {
|
||||
self.position
|
||||
|
@ -76,7 +76,7 @@ impl<D: Decoder + Send> Stream for DecoderStream<D> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<D: Decoder + Send> dasp::signal::Signal for DecoderStream<D> {
|
||||
impl<D: Decoder> dasp::signal::Signal for DecoderStream<D> {
|
||||
type Frame = [i16; 2];
|
||||
|
||||
#[inline]
|
||||
|
@ -191,8 +191,8 @@ impl AudioMixer {
|
|||
fn make_seekable_decoder(
|
||||
format: &swf::SoundFormat,
|
||||
data: Cursor<ArcAsRef>,
|
||||
) -> Result<Box<dyn Send + SeekableDecoder>, Error> {
|
||||
let decoder: Box<dyn Send + SeekableDecoder> = match format.compression {
|
||||
) -> Result<Box<dyn SeekableDecoder>, Error> {
|
||||
let decoder: Box<dyn SeekableDecoder> = match format.compression {
|
||||
AudioCompression::Uncompressed => Box::new(PcmDecoder::new(
|
||||
data,
|
||||
format.is_stereo,
|
||||
|
@ -273,7 +273,7 @@ impl AudioMixer {
|
|||
///
|
||||
/// This is used for cases where there is no custom envelope or looping on the sound instance.
|
||||
/// Otherwise, `AudioMixer::make_stream_from_event_sound` should be used.
|
||||
fn make_stream_from_simple_event_sound<R: 'static + std::io::Read + Send>(
|
||||
fn make_stream_from_simple_event_sound<R: 'static + std::io::Read + Send + Sync>(
|
||||
&self,
|
||||
format: &swf::SoundFormat,
|
||||
data_stream: R,
|
||||
|
@ -548,7 +548,7 @@ impl Default for ArcAsRef {
|
|||
|
||||
/// A stream for event sound instances with custom envelopes, start/end point, or loop settings.
|
||||
struct EventSoundStream {
|
||||
decoder: Box<dyn SeekableDecoder + Send>,
|
||||
decoder: Box<dyn SeekableDecoder>,
|
||||
num_loops: u16,
|
||||
start_sample_frame: u32,
|
||||
end_sample_frame: Option<u32>,
|
||||
|
@ -559,7 +559,7 @@ struct EventSoundStream {
|
|||
|
||||
impl EventSoundStream {
|
||||
fn new_with_settings(
|
||||
decoder: Box<dyn SeekableDecoder + Send>,
|
||||
decoder: Box<dyn SeekableDecoder>,
|
||||
settings: &swf::SoundInfo,
|
||||
num_sample_frames: u32,
|
||||
skip_sample_frames: u16,
|
||||
|
@ -652,7 +652,7 @@ where
|
|||
impl<S, I> Stream for ConverterStream<S, I>
|
||||
where
|
||||
S: Stream,
|
||||
I: dasp::interpolate::Interpolator<Frame = [i16; 2]> + Send,
|
||||
I: dasp::interpolate::Interpolator<Frame = [i16; 2]> + Send + Sync,
|
||||
{
|
||||
#[inline]
|
||||
fn source_position(&self) -> u32 {
|
||||
|
@ -668,7 +668,7 @@ where
|
|||
impl<S, I> dasp::signal::Signal for ConverterStream<S, I>
|
||||
where
|
||||
S: Stream,
|
||||
I: dasp::interpolate::Interpolator<Frame = [i16; 2]> + Send,
|
||||
I: dasp::interpolate::Interpolator<Frame = [i16; 2]> + Send + Sync,
|
||||
{
|
||||
type Frame = [i16; 2];
|
||||
|
||||
|
@ -687,7 +687,7 @@ where
|
|||
struct MulAmpStream<S, E>
|
||||
where
|
||||
S: Stream,
|
||||
E: dasp::signal::Signal<Frame = [f32; 2]> + Send,
|
||||
E: dasp::signal::Signal<Frame = [f32; 2]> + Send + Sync,
|
||||
{
|
||||
stream: S,
|
||||
envelope: E,
|
||||
|
@ -696,7 +696,7 @@ where
|
|||
impl<S, E> MulAmpStream<S, E>
|
||||
where
|
||||
S: Stream,
|
||||
E: dasp::signal::Signal<Frame = [f32; 2]> + Send,
|
||||
E: dasp::signal::Signal<Frame = [f32; 2]> + Send + Sync,
|
||||
{
|
||||
fn new(stream: S, envelope: E) -> Self {
|
||||
Self { stream, envelope }
|
||||
|
@ -706,7 +706,7 @@ where
|
|||
impl<S, E> Stream for MulAmpStream<S, E>
|
||||
where
|
||||
S: Stream,
|
||||
E: dasp::signal::Signal<Frame = [f32; 2]> + Send,
|
||||
E: dasp::signal::Signal<Frame = [f32; 2]> + Send + Sync,
|
||||
{
|
||||
#[inline]
|
||||
fn source_position(&self) -> u32 {
|
||||
|
@ -722,7 +722,7 @@ where
|
|||
impl<S, E> dasp::signal::Signal for MulAmpStream<S, E>
|
||||
where
|
||||
S: Stream,
|
||||
E: dasp::signal::Signal<Frame = [f32; 2]> + Send,
|
||||
E: dasp::signal::Signal<Frame = [f32; 2]> + Send + Sync,
|
||||
{
|
||||
type Frame = [i16; 2];
|
||||
|
||||
|
|
Loading…
Reference in New Issue