Files
psysonic/src-tauri/crates/psysonic-audio/src/lib.rs
T
cucadmuh 6ea0acede5 feat(playback): stream buffering UI, M4A moov-at-end streaming, hot-cache spill (#737)
* feat(playback): stream buffering UI, ranged M4A tail prefetch, demuxer fix

Defer seekbar/progress until HTTP stream is armed for both legacy and
RangedHttpSource; show buffering overlay on cover art. Add MP4 tail
prefetch and Symphonia isomp4 bounded-mdat/moov-at-EOF probing so
moov-at-end M4A can start without reading the full mdat.

* feat(hot-cache): spill large ranged streams to disk for promote

When a ranged HTTP download completes above the 64 MiB RAM promote cap,
write the existing buffer once to app-data stream-spill/ and register it
for hot-cache promote (rename) and replay via fetch_data. Analysis seeds
from the spill file up to the local-file cap (512 MiB).

* fix(ui): stream buffering — grayscale cover and static clock icon

Desaturate player and queue cover art while isPlaybackBuffering; keep a
non-animated clock overlay for visibility without the spinning animation.

* fix(playback): review follow-up — tests, i18n, spill cleanup, changelog

Clippy and test layout fixes; stream spill orphan cleanup on startup;
buffering flag guard in progress handler; bufferingStream in all player
locales; CHANGELOG and contributor credits for stream/M4A work.

* docs: attribute stream buffering and M4A streaming to PR #737

* test(audio): avoid create_engine in stream spill unit test

CI runners have no audio output device; test spill take/consume via
the Mutex slot only, matching install_stream_completed_spill tests.
2026-05-16 22:56:47 +03:00

62 lines
2.1 KiB
Rust

//! `psysonic-audio` — Symphonia decode, rodio output, HTTP radio/streaming,
//! gapless, previews. Submodules (`sources`, `decode`, `stream`, `commands`, …)
//! preserve the historical single `audio.rs` partitioning.
// Re-export the logging facade so submodules can keep using
// `crate::app_eprintln!()` / `crate::app_deprintln!()`.
pub use psysonic_core::{app_deprintln, app_eprintln, logging};
pub mod autoeq_commands;
mod codec;
pub mod commands;
mod decode;
mod dev_io;
pub mod device_commands;
pub mod mix_commands;
mod play_input;
pub mod preload_commands;
pub(crate) mod progress_task;
pub mod radio_commands;
pub mod transport_commands;
mod device_watcher;
mod engine;
#[cfg(any(target_os = "windows", target_os = "linux"))]
mod power_resume;
#[cfg(target_os = "windows")]
mod power_notify_win;
#[cfg(target_os = "linux")]
mod power_notify_linux;
mod helpers;
mod ipc;
pub mod preview;
mod sources;
mod state;
mod stream;
pub use device_commands::{audio_default_output_device_name, audio_list_devices_for_engine};
pub use device_watcher::start_device_watcher;
pub use engine::{create_engine, refresh_http_user_agent, AudioEngine};
pub use helpers::{
cleanup_orphan_stream_spill_dir, take_stream_completed_for_url,
take_stream_completed_spill_for_url,
};
/// Register platform-specific listeners so the output stream is reopened after sleep/resume
/// when the device name may be unchanged (Windows WASAPI, Linux PipeWire, …).
pub fn register_post_sleep_audio_recovery(app: tauri::AppHandle) {
#[cfg(target_os = "windows")]
power_notify_win::register(app);
#[cfg(target_os = "linux")]
power_notify_linux::register(app);
// macOS intentionally falls through for now: we only ship native resume hooks
// where we have verified regressions (Windows WASAPI, Linux logind/PipeWire).
// macOS currently relies on the generic device watcher path.
#[cfg(all(
not(target_os = "windows"),
not(target_os = "linux")
))]
let _ = app;
}
pub use engine::{analysis_track_id_is_current_playback, ranged_loudness_backfill_should_defer, stop_audio_engine};