mirror of
https://github.com/talwat/lowfi
synced 2025-08-14 21:42:43 +00:00
fix: add byte len to prevent unknown track duration when decoding
This commit is contained in:
parent
0b7638468c
commit
9f7c895154
@ -30,7 +30,7 @@ use mpris_server::{PlaybackStatus, PlayerInterface, Property};
|
||||
|
||||
use crate::{
|
||||
messages::Messages,
|
||||
play::{PersistentVolume},
|
||||
play::PersistentVolume,
|
||||
tracks::{self, list::List},
|
||||
Args,
|
||||
};
|
||||
@ -109,7 +109,9 @@ impl Player {
|
||||
let volume = PersistentVolume::load().await?;
|
||||
|
||||
// Load the track list.
|
||||
let list = List::load(args.track_list.as_ref()).await.wrap_err("unable to load the track list")?;
|
||||
let list = List::load(args.track_list.as_ref())
|
||||
.await
|
||||
.wrap_err("unable to load the track list")?;
|
||||
|
||||
// We should only shut up alsa forcefully on Linux if we really have to.
|
||||
#[cfg(target_os = "linux")]
|
||||
@ -118,10 +120,10 @@ impl Player {
|
||||
} else {
|
||||
OutputStreamBuilder::open_default_stream()?
|
||||
};
|
||||
|
||||
|
||||
stream.log_on_drop(false); // Frankly, this is a stupid feature. Stop shoving your crap into my beloved stderr!!!
|
||||
let sink = Sink::connect_new(stream.mixer());
|
||||
|
||||
|
||||
if args.paused {
|
||||
sink.pause();
|
||||
}
|
||||
|
@ -215,7 +215,11 @@ impl DecodedTrack {
|
||||
/// Creates a new track.
|
||||
/// This is equivalent to [`QueuedTrack::decode`].
|
||||
pub fn new(track: QueuedTrack) -> eyre::Result<Self, TrackError> {
|
||||
let data = Decoder::new(Cursor::new(track.data))?;
|
||||
let data = Decoder::builder()
|
||||
.with_byte_len(track.data.len().try_into().unwrap())
|
||||
.with_data(Cursor::new(track.data))
|
||||
.build()?;
|
||||
|
||||
let info = Info::new(track.name, track.full_path, &data)?;
|
||||
|
||||
Ok(Self { info, data })
|
||||
|
Loading…
x
Reference in New Issue
Block a user