Skip to content

Commit

Permalink
formats everything with cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
dvdsk committed Oct 11, 2023
1 parent 347c482 commit 961e941
Show file tree
Hide file tree
Showing 29 changed files with 33 additions and 89 deletions.
7 changes: 3 additions & 4 deletions src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
6 changes: 4 additions & 2 deletions src/decoder/flac.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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>(),
})
}
}

Expand Down
12 changes: 6 additions & 6 deletions src/decoder/mp3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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
Expand Down Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion src/dynamic_mixer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion src/sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ impl Sink {
/// 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
Expand Down
3 changes: 0 additions & 3 deletions src/source/amplify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,4 @@ where
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
self.input.try_seek(pos)
}



}
3 changes: 0 additions & 3 deletions src/source/blt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,6 @@ where
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
self.input.try_seek(pos)
}



}

#[derive(Clone, Debug)]
Expand Down
7 changes: 3 additions & 4 deletions src/source/buffered.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 0 additions & 3 deletions src/source/channel_volume.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,4 @@ where
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
self.input.try_seek(pos)
}



}
3 changes: 0 additions & 3 deletions src/source/delay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,4 @@ where
let pos_without_delay = pos.saturating_sub(self.requested_duration);
self.input.try_seek(pos_without_delay)
}



}
3 changes: 0 additions & 3 deletions src/source/done.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,4 @@ where
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
self.input.try_seek(pos)
}



}
7 changes: 3 additions & 4 deletions src/source/empty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>(),
})
}



}
7 changes: 3 additions & 4 deletions src/source/empty_callback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>(),
})
}



}
3 changes: 0 additions & 3 deletions src/source/fadein.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,4 @@ where
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
self.input.try_seek(pos)
}



}
3 changes: 0 additions & 3 deletions src/source/from_iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,6 @@ where
Ok(())
}
}



}

#[cfg(test)]
Expand Down
3 changes: 0 additions & 3 deletions src/source/pausable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,4 @@ where
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
self.input.try_seek(pos)
}



}
3 changes: 0 additions & 3 deletions src/source/periodic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,6 @@ where
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
self.input.try_seek(pos)
}



}

#[cfg(test)]
Expand Down
3 changes: 0 additions & 3 deletions src/source/repeat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 0 additions & 3 deletions src/source/samples_converter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,4 @@ where
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
self.inner.try_seek(pos)
}



}
8 changes: 3 additions & 5 deletions src/source/sine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(())
}


}
3 changes: 0 additions & 3 deletions src/source/skip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,9 +164,6 @@ where
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
self.input.try_seek(pos)
}



}

#[cfg(test)]
Expand Down
3 changes: 0 additions & 3 deletions src/source/skippable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,4 @@ where
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
self.input.try_seek(pos)
}



}
3 changes: 0 additions & 3 deletions src/source/spatial.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,4 @@ where
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
self.input.try_seek(pos)
}



}
3 changes: 0 additions & 3 deletions src/source/speed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,4 @@ where
let pos_accounting_for_speedup = pos.mul_f32(self.factor);
self.input.try_seek(pos_accounting_for_speedup)
}



}
3 changes: 0 additions & 3 deletions src/source/stoppable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,4 @@ where
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
self.input.try_seek(pos)
}



}
3 changes: 0 additions & 3 deletions src/source/take.rs
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,4 @@ where
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekError> {
self.input.try_seek(pos)
}



}
3 changes: 0 additions & 3 deletions src/source/zero.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,4 @@ where
fn try_seek(&mut self, _: Duration) -> Result<(), SeekError> {
Ok(())
}



}
4 changes: 2 additions & 2 deletions src/spatial_sink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/seek.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 961e941

Please sign in to comment.