- Migrate pmomediarenderer: extract all core logic (adapter, handlers, pipeline etc.) into dedicated modules - Rename types to MediaRenderer* for clarity (Web → Mediarenderer) pmowebrenderer becomes a pure browser adapter crate - Update Cargo.toml dependencies accordingly, add pmoserver feature propagation PMOMusic: remove obsolete MEDIA_RENDERER import - Update all imports across workspace to reflect new crate boundaries
52 lines
1.3 KiB
Rust
52 lines
1.3 KiB
Rust
//! État partagé du renderer (backend ↔ pipeline)
|
|
|
|
use parking_lot::RwLock;
|
|
use std::collections::VecDeque;
|
|
use std::sync::Arc;
|
|
|
|
use crate::adapter::DeviceCommand;
|
|
use crate::messages::PlaybackState;
|
|
|
|
#[derive(Debug, Clone)]
|
|
pub struct RendererState {
|
|
pub playback_state: PlaybackState,
|
|
pub current_uri: Option<String>,
|
|
pub current_metadata: Option<String>,
|
|
pub next_uri: Option<String>,
|
|
pub next_metadata: Option<String>,
|
|
pub position: Option<String>,
|
|
pub duration: Option<String>,
|
|
pub volume: u16,
|
|
pub mute: bool,
|
|
pub pending_commands: VecDeque<DeviceCommand>,
|
|
}
|
|
|
|
impl RendererState {
|
|
pub fn push_command(&mut self, cmd: DeviceCommand) {
|
|
self.pending_commands.push_back(cmd);
|
|
}
|
|
|
|
pub fn pop_command(&mut self) -> Option<DeviceCommand> {
|
|
self.pending_commands.pop_front()
|
|
}
|
|
}
|
|
|
|
impl Default for RendererState {
|
|
fn default() -> Self {
|
|
Self {
|
|
playback_state: PlaybackState::Stopped,
|
|
current_uri: None,
|
|
current_metadata: None,
|
|
next_uri: None,
|
|
next_metadata: None,
|
|
position: None,
|
|
duration: None,
|
|
volume: 100,
|
|
mute: false,
|
|
pending_commands: VecDeque::new(),
|
|
}
|
|
}
|
|
}
|
|
|
|
pub type SharedState = Arc<RwLock<RendererState>>;
|