mirror of
https://github.com/Psychotoxical/psysonic.git
synced 2026-07-22 15:25:46 +00:00
41e75663f1
Moves all audio playback code (Symphonia decode, rodio output, HTTP
streaming, gapless, previews, and the seven stream/ source-type
submodules from the prior split) out of the top crate into a new
psysonic-audio crate.
crates/psysonic-audio/ new lib crate, depends on
psysonic-core + psysonic-analysis
src/{engine,helpers,decode,…}.rs flattened layout (no more
extra audio/ namespace level)
src/stream/ seven submodules from M0
src/lib.rs re-exports macros from
psysonic-core and the public
API surface
The audio↔analysis edges identified in the dep survey are now real
crate deps (audio depends on analysis directly: AnalysisCache reads,
recommended_gain_for_target, submit_analysis_cpu_seed). Only the
analysis→audio back-edge goes through the PlaybackQueryHandle port
registered in M2.
Cross-crate ref migrations applied via batch sed:
crate::audio::* → crate::* (intra-crate)
crate::analysis_cache::* → psysonic_analysis::analysis_cache::*
crate::submit_analysis_cpu_seed → psysonic_analysis::analysis_runtime::*
crate::subsonic_wire_user_agent → psysonic_core::user_agent::*
Top crate keeps `crate::audio::*` paths working via
`pub use psysonic_audio as audio;` — lib_commands/cli callers untouched.
`stop_audio_engine` (mac process-exit cleanup) moved into the audio
crate as `pub fn stop_audio_engine` since it reaches AudioEngine
internals; tray.rs now re-exports the moved fn.
Two small visibility promotions in engine.rs:
pub(crate) fn analysis_track_id_is_current_playback → pub
pub(crate) fn ranged_loudness_backfill_should_defer → pub
Behaviour preserving. Cargo check + clippy --workspace clean.
27 lines
1.1 KiB
Rust
27 lines
1.1 KiB
Rust
//! Small shared structs for preload / gapless chain metadata.
|
|
use std::sync::atomic::{AtomicBool, AtomicU64};
|
|
use std::sync::Arc;
|
|
|
|
pub(crate) struct PreloadedTrack {
|
|
pub(crate) url: String,
|
|
pub(crate) data: Vec<u8>,
|
|
}
|
|
|
|
/// Info about the track that has been appended (chained) to the current Sink
|
|
/// but whose source has not yet started playing (gapless mode only).
|
|
pub(crate) struct ChainedInfo {
|
|
/// The URL that was chained — used by audio_play to detect a pre-chain hit.
|
|
pub(crate) url: String,
|
|
/// Raw file bytes (shared with the chained decoder). Lets manual skip reuse
|
|
/// them instead of re-downloading after dropping the Sink queue.
|
|
pub(crate) raw_bytes: Arc<Vec<u8>>,
|
|
pub(crate) duration_secs: f64,
|
|
pub(crate) replay_gain_linear: f32,
|
|
pub(crate) base_volume: f32,
|
|
/// Set by NotifyingSource when this chained track's source is exhausted.
|
|
pub(crate) source_done: Arc<AtomicBool>,
|
|
/// Atomic sample counter for this chained source (swapped into
|
|
/// samples_played on transition).
|
|
pub(crate) sample_counter: Arc<AtomicU64>,
|
|
}
|