mirror of
https://github.com/RustAudio/rodio
synced 2025-03-04 15:07:18 +00:00
formats everything with cargo fmt
This commit is contained in:
parent
82bfa417ff
commit
d1a809feac
28 changed files with 32 additions and 88 deletions
|
@ -88,11 +88,10 @@ where
|
|||
|
||||
#[inline]
|
||||
fn try_seek(&mut self, _: Duration) -> Result<(), SeekError> {
|
||||
Err(SeekError::NotSupported { underlying_source: std::any::type_name::<Self>() })
|
||||
Err(SeekError::NotSupported {
|
||||
underlying_source: std::any::type_name::<Self>(),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
impl<S> Iterator for SamplesBuffer<S>
|
||||
|
|
|
@ -3,8 +3,8 @@ use std::io::{Read, Seek, SeekFrom};
|
|||
use std::mem;
|
||||
use std::time::Duration;
|
||||
|
||||
use crate::Source;
|
||||
use crate::source::SeekError;
|
||||
use crate::Source;
|
||||
|
||||
use claxon::FlacReader;
|
||||
|
||||
|
@ -83,7 +83,9 @@ where
|
|||
|
||||
#[inline]
|
||||
fn try_seek(&mut self, _: Duration) -> Result<(), SeekError> {
|
||||
Err(SeekError::NotSupported { underlying_source: std::any::type_name::<Self>() })
|
||||
Err(SeekError::NotSupported {
|
||||
underlying_source: std::any::type_name::<Self>(),
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@ use std::time::Duration;
|
|||
use crate::source::SeekError;
|
||||
use crate::Source;
|
||||
|
||||
use minimp3_fixed as minimp3;
|
||||
use minimp3::Frame;
|
||||
use minimp3::Decoder;
|
||||
use minimp3::Frame;
|
||||
use minimp3_fixed as minimp3;
|
||||
// use minimp3::{Decoder, SeekDecoder};
|
||||
|
||||
pub struct Mp3Decoder<R>
|
||||
|
@ -29,9 +29,9 @@ where
|
|||
}
|
||||
// let mut decoder = SeekDecoder::new(data)
|
||||
let mut decoder = Decoder::new(data);
|
||||
// paramaters are correct and minimp3 is used correctly
|
||||
// thus if we crash here one of these invariants is broken:
|
||||
// .expect("should be able to allocate memory, perform IO");
|
||||
// paramaters are correct and minimp3 is used correctly
|
||||
// thus if we crash here one of these invariants is broken:
|
||||
// .expect("should be able to allocate memory, perform IO");
|
||||
// let current_frame = decoder.decode_frame()
|
||||
let current_frame = decoder.next_frame()
|
||||
// the reader makes enough data availible therefore
|
||||
|
@ -97,7 +97,7 @@ where
|
|||
fn next(&mut self) -> Option<i16> {
|
||||
if self.current_frame_offset == self.current_frame_len().unwrap() {
|
||||
if let Ok(frame) = self.decoder.next_frame() {
|
||||
// if let Ok(frame) = self.decoder.decode_frame() {
|
||||
// if let Ok(frame) = self.decoder.decode_frame() {
|
||||
self.current_frame = frame;
|
||||
self.current_frame_offset = 0;
|
||||
} else {
|
||||
|
|
|
@ -109,7 +109,9 @@ where
|
|||
|
||||
#[inline]
|
||||
fn try_seek(&mut self, _: Duration) -> Result<(), SeekError> {
|
||||
Err(SeekError::NotSupported { underlying_source: std::any::type_name::<Self>() })
|
||||
Err(SeekError::NotSupported {
|
||||
underlying_source: std::any::type_name::<Self>(),
|
||||
})
|
||||
|
||||
// uncomment when #510 is implemented (query position of playback)
|
||||
|
||||
|
|
|
@ -100,7 +100,4 @@ where
|
|||
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
|
||||
self.input.try_seek(pos)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -154,9 +154,6 @@ where
|
|||
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
|
||||
self.input.try_seek(pos)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
|
|
|
@ -244,11 +244,10 @@ where
|
|||
|
||||
#[inline]
|
||||
fn try_seek(&mut self, _: Duration) -> Result<(), SeekError> {
|
||||
Err(SeekError::NotSupported { underlying_source: std::any::type_name::<Self>() })
|
||||
Err(SeekError::NotSupported {
|
||||
underlying_source: std::any::type_name::<Self>(),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
impl<I> Clone for Buffered<I>
|
||||
|
|
|
@ -145,7 +145,4 @@ where
|
|||
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
|
||||
self.input.try_seek(pos)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -113,7 +113,4 @@ where
|
|||
let pos_without_delay = pos.saturating_sub(self.requested_duration);
|
||||
self.input.try_seek(pos_without_delay)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -94,7 +94,4 @@ where
|
|||
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
|
||||
self.input.try_seek(pos)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -58,9 +58,8 @@ where
|
|||
|
||||
#[inline]
|
||||
fn try_seek(&mut self, _: Duration) -> Result<(), SeekError> {
|
||||
Err(SeekError::NotSupported { underlying_source: std::any::type_name::<Self>() })
|
||||
Err(SeekError::NotSupported {
|
||||
underlying_source: std::any::type_name::<Self>(),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -57,9 +57,8 @@ where
|
|||
|
||||
#[inline]
|
||||
fn try_seek(&mut self, _: Duration) -> Result<(), SeekError> {
|
||||
Err(SeekError::NotSupported { underlying_source: std::any::type_name::<Self>() })
|
||||
Err(SeekError::NotSupported {
|
||||
underlying_source: std::any::type_name::<Self>(),
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -112,7 +112,4 @@ where
|
|||
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
|
||||
self.input.try_seek(pos)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -146,9 +146,6 @@ where
|
|||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -122,7 +122,4 @@ where
|
|||
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
|
||||
self.input.try_seek(pos)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -124,9 +124,6 @@ where
|
|||
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
|
||||
self.input.try_seek(pos)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -91,9 +91,6 @@ where
|
|||
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
|
||||
self.inner.try_seek(pos)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
impl<I> Clone for Repeat<I>
|
||||
|
|
|
@ -102,7 +102,4 @@ where
|
|||
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
|
||||
self.inner.try_seek(pos)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -60,12 +60,10 @@ impl Source for SineWave {
|
|||
|
||||
#[inline]
|
||||
fn try_seek(&mut self, _: Duration) -> Result<(), SeekError> {
|
||||
// This is a constant sound, normal seeking would not have any effect.
|
||||
// While changing the phase of the sine wave could change how it sounds in
|
||||
// combination with another sound (beating) such precision is not the intend
|
||||
// This is a constant sound, normal seeking would not have any effect.
|
||||
// While changing the phase of the sine wave could change how it sounds in
|
||||
// combination with another sound (beating) such precision is not the intend
|
||||
// of seeking
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -164,9 +164,6 @@ where
|
|||
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
|
||||
self.input.try_seek(pos)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -96,7 +96,4 @@ where
|
|||
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
|
||||
self.input.try_seek(pos)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -124,7 +124,4 @@ where
|
|||
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
|
||||
self.input.try_seek(pos)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -106,7 +106,4 @@ where
|
|||
let pos_accounting_for_speedup = pos.mul_f32(self.factor);
|
||||
self.input.try_seek(pos_accounting_for_speedup)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -95,7 +95,4 @@ where
|
|||
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
|
||||
self.input.try_seek(pos)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -183,7 +183,4 @@ where
|
|||
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
|
||||
self.input.try_seek(pos)
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -84,7 +84,4 @@ where
|
|||
fn try_seek(&mut self, _: Duration) -> Result<(), SeekError> {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ use std::time::Duration;
|
|||
|
||||
use cpal::FromSample;
|
||||
|
||||
use crate::source::{Spatial, SeekError};
|
||||
use crate::source::{SeekError, Spatial};
|
||||
use crate::stream::{OutputStreamHandle, PlayError};
|
||||
use crate::{Sample, Sink, Source};
|
||||
|
||||
|
@ -170,7 +170,7 @@ impl SpatialSink {
|
|||
/// This blocks between 0 and ~5 milliseconds.
|
||||
///
|
||||
/// As long as the *duration of the source is known* seeking saturates. This means
|
||||
/// when you try to seek beyong the length of the source this function will seek
|
||||
/// when you try to seek beyong the length of the source this function will seek
|
||||
/// to the end of the source instead.
|
||||
///
|
||||
/// If the duration of the source is known and the seek position lies beyond
|
||||
|
|
|
@ -30,7 +30,7 @@ fn sink_and_decoder(format: &str) -> (Sink, Decoder<impl Read + Seek>) {
|
|||
(sink, decoder)
|
||||
}
|
||||
|
||||
// run the following to get the other configuration:
|
||||
// run the following to get the other configuration:
|
||||
// cargo test --no-default-features
|
||||
// --features symphonia-wav --features symphonia-vorbis
|
||||
// --features symphonia-flac --features symphonia-isomp4 --features minimp3
|
||||
|
@ -83,7 +83,7 @@ fn seek_beyond_end_saturates() {
|
|||
|
||||
println!("seeking beyond end for: {format}\t decoded by: {decoder_name}");
|
||||
let res = sink.try_seek(Duration::from_secs(999));
|
||||
assert!(dbg!(res).is_ok());
|
||||
assert!(res.is_ok());
|
||||
|
||||
let now = Instant::now();
|
||||
sink.sleep_until_end();
|
||||
|
|
Loading…
Add table
Reference in a new issue