pub struct PreAnalyzedSong {
pub path: PathBuf,
pub artist: Option<String>,
pub album_artist: Option<String>,
pub title: Option<String>,
pub album: Option<String>,
pub track_number: Option<i32>,
pub disc_number: Option<i32>,
pub genre: Option<String>,
pub duration: Duration,
pub sample_array: Vec<f32>,
}Expand description
A struct used to represent a song that has been decoded, but not analyzed yet.
Most users will not need to use it, as most users won’t implement
their decoders, but rely on ffmpeg to decode songs, and use FFmpegDecoder::song_from_path.
Since it contains the fully decoded song inside of
PreAnalyzedSong::sample_array, it can be very large. Users should
convert it to a Song as soon as possible, since it is this
structure’s only reason to be.
Fields§
§path: PathBufSong’s provided file path
artist: Option<String>Song’s artist, read from the metadata
album_artist: Option<String>Song’s album’s artist name, read from the metadata
title: Option<String>Song’s title, read from the metadata
album: Option<String>Song’s album name, read from the metadata
track_number: Option<i32>Song’s tracked number, read from the metadata
disc_number: Option<i32>Song’s disc number, read from the metadata
genre: Option<String>Song’s genre, read from the metadata
duration: DurationThe song’s duration
sample_array: Vec<f32>An array of the song’s decoded sample which should be,
prior to analysis, resampled to f32le, one channel, with a sampling rate
of 22050 Hz. Anything other than that will yield wrong results.
To double-check that your sample array has the right format, you could run
ffmpeg -i path_to_your_song.flac -ar 22050 -ac 1 -c:a pcm_f32le -f hash -hash addler32 -,
which will give you the addler32 checksum of the sample array if the song
has been decoded properly. You can then compute the addler32 checksum of your sample
array (see _test_decode in the tests) and make sure both are the same.
(Running ffmpeg -i path_to_your_song.flac -ar 22050 -ac 1 -c:a pcm_f32le will simply give
you the raw sample array as it should look like, if you’re not into computing checksums)
Trait Implementations§
Source§impl Debug for PreAnalyzedSong
impl Debug for PreAnalyzedSong
Source§impl Default for PreAnalyzedSong
impl Default for PreAnalyzedSong
Source§fn default() -> PreAnalyzedSong
fn default() -> PreAnalyzedSong
Source§impl TryFrom<PreAnalyzedSong> for Song
impl TryFrom<PreAnalyzedSong> for Song
Source§type Error = BlissError
type Error = BlissError
Source§fn try_from(raw_song: PreAnalyzedSong) -> BlissResult<Song>
fn try_from(raw_song: PreAnalyzedSong) -> BlissResult<Song>
Auto Trait Implementations§
impl Freeze for PreAnalyzedSong
impl RefUnwindSafe for PreAnalyzedSong
impl Send for PreAnalyzedSong
impl Sync for PreAnalyzedSong
impl Unpin for PreAnalyzedSong
impl UnwindSafe for PreAnalyzedSong
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more