🔧 Add #[allow(dead_code)] to unused items
- Suppress dead code warnings for utility functions, enums and traits not yet used in production - Reorganize imports to follow module conventions (e.g., `DeviceIdentity` moved earlier in openhome_renderer.rs) - Improve formatting of ClientMessage variants for readability These changes prepare codebase groundwork without altering runtime behavior.
This commit is contained in:
@@ -38,6 +38,7 @@ impl BroadcastPacer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Reset the pacer clock (call when audio timestamp resets to 0).
|
/// Reset the pacer clock (call when audio timestamp resets to 0).
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn reset(&mut self) {
|
pub fn reset(&mut self) {
|
||||||
self.start_time = Instant::now();
|
self.start_time = Instant::now();
|
||||||
trace!("{} broadcaster: pacer reset", self.label);
|
trace!("{} broadcaster: pacer reset", self.label);
|
||||||
|
|||||||
@@ -296,6 +296,7 @@ pub(crate) fn validate_frame_header_crc(data: &[u8], offset: usize) -> bool {
|
|||||||
/// keeping the data from the last sync code onward for the next iteration.
|
/// keeping the data from the last sync code onward for the next iteration.
|
||||||
///
|
///
|
||||||
/// We need at least 2 validated sync codes to identify one complete frame.
|
/// We need at least 2 validated sync codes to identify one complete frame.
|
||||||
|
#[allow(dead_code)]
|
||||||
pub(crate) fn find_complete_frames_boundary(data: &[u8]) -> usize {
|
pub(crate) fn find_complete_frames_boundary(data: &[u8]) -> usize {
|
||||||
if data.len() < 4 {
|
if data.len() < 4 {
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ use tokio_util::sync::CancellationToken;
|
|||||||
// ═══════════════════════════════════════════════════════════════════════════
|
// ═══════════════════════════════════════════════════════════════════════════
|
||||||
|
|
||||||
/// Signal retourné par pump_segments indiquant pourquoi l'encodage s'est arrêté.
|
/// Signal retourné par pump_segments indiquant pourquoi l'encodage s'est arrêté.
|
||||||
|
#[allow(dead_code)]
|
||||||
enum StopReason {
|
enum StopReason {
|
||||||
TrackBoundary(Arc<tokio::sync::RwLock<dyn pmometadata::TrackMetadata>>),
|
TrackBoundary(Arc<tokio::sync::RwLock<dyn pmometadata::TrackMetadata>>),
|
||||||
EndOfStream,
|
EndOfStream,
|
||||||
@@ -418,6 +419,7 @@ async fn wait_for_first_audio_chunk_with_metadata(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Pompe les segments pour une seule track (s'arrête au TrackBoundary).
|
/// Pompe les segments pour une seule track (s'arrête au TrackBoundary).
|
||||||
|
#[allow(dead_code)]
|
||||||
async fn pump_track_segments(
|
async fn pump_track_segments(
|
||||||
first_segment: Arc<AudioSegment>,
|
first_segment: Arc<AudioSegment>,
|
||||||
rx: &mut mpsc::Receiver<Arc<AudioSegment>>,
|
rx: &mut mpsc::Receiver<Arc<AudioSegment>>,
|
||||||
|
|||||||
@@ -17,11 +17,13 @@ pub trait RendererBackend {
|
|||||||
///
|
///
|
||||||
/// These operations combine queue management with transport control,
|
/// These operations combine queue management with transport control,
|
||||||
/// allowing navigation (next/previous) and track selection from the queue.
|
/// allowing navigation (next/previous) and track selection from the queue.
|
||||||
|
#[allow(dead_code)]
|
||||||
pub trait QueueTransportControl {
|
pub trait QueueTransportControl {
|
||||||
/// Play the next track from the queue.
|
/// Play the next track from the queue.
|
||||||
fn play_next(&self) -> Result<(), ControlPointError>;
|
fn play_next(&self) -> Result<(), ControlPointError>;
|
||||||
|
|
||||||
/// Play the previous track from the queue.
|
/// Play the previous track from the queue.
|
||||||
|
#[allow(dead_code)]
|
||||||
fn play_previous(&self) -> Result<(), ControlPointError>;
|
fn play_previous(&self) -> Result<(), ControlPointError>;
|
||||||
|
|
||||||
/// Play from the queue at the current index (or initialize to 0 if not set).
|
/// Play from the queue at the current index (or initialize to 0 if not set).
|
||||||
|
|||||||
@@ -810,6 +810,7 @@ impl MusicRenderer {
|
|||||||
/// Acquires the backend mutex with a default context message.
|
/// Acquires the backend mutex with a default context message.
|
||||||
///
|
///
|
||||||
/// Convenience wrapper around `lock_backend_for` for simple cases.
|
/// Convenience wrapper around `lock_backend_for` for simple cases.
|
||||||
|
#[allow(dead_code)]
|
||||||
fn lock_backend(&self) -> std::sync::MutexGuard<'_, MusicRendererBackend> {
|
fn lock_backend(&self) -> std::sync::MutexGuard<'_, MusicRendererBackend> {
|
||||||
self.lock_backend_for("unknown operation")
|
self.lock_backend_for("unknown operation")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ pub enum OhServiceKind {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl OhServiceKind {
|
impl OhServiceKind {
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn as_str(&self) -> &'static str {
|
pub fn as_str(&self) -> &'static str {
|
||||||
match self {
|
match self {
|
||||||
OhServiceKind::Playlist => "playlist",
|
OhServiceKind::Playlist => "playlist",
|
||||||
@@ -60,10 +61,12 @@ pub fn control_url_for(info: &RendererInfo, kind: OhServiceKind) -> Option<Strin
|
|||||||
endpoint_for(info, kind).map(|endpoint| endpoint.control_url)
|
endpoint_for(info, kind).map(|endpoint| endpoint.control_url)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn service_type_for(info: &RendererInfo, kind: OhServiceKind) -> Option<String> {
|
pub fn service_type_for(info: &RendererInfo, kind: OhServiceKind) -> Option<String> {
|
||||||
endpoint_for(info, kind).map(|endpoint| endpoint.service_type)
|
endpoint_for(info, kind).map(|endpoint| endpoint.service_type)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn build_playlist_client(info: &RendererInfo) -> Option<OhPlaylistClient> {
|
pub fn build_playlist_client(info: &RendererInfo) -> Option<OhPlaylistClient> {
|
||||||
let endpoint = endpoint_for(info, OhServiceKind::Playlist)?;
|
let endpoint = endpoint_for(info, OhServiceKind::Playlist)?;
|
||||||
Some(OhPlaylistClient::new(
|
Some(OhPlaylistClient::new(
|
||||||
@@ -114,8 +117,8 @@ pub fn build_radio_client(info: &RendererInfo) -> Option<OhRadioClient> {
|
|||||||
mod tests {
|
mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
use crate::{
|
use crate::{
|
||||||
DeviceId,
|
|
||||||
model::{RendererCapabilities, RendererInfo, RendererProtocol},
|
model::{RendererCapabilities, RendererInfo, RendererProtocol},
|
||||||
|
DeviceId,
|
||||||
};
|
};
|
||||||
|
|
||||||
fn sample_renderer_info() -> RendererInfo {
|
fn sample_renderer_info() -> RendererInfo {
|
||||||
|
|||||||
@@ -1,25 +1,25 @@
|
|||||||
use std::sync::{Arc, Mutex};
|
use std::sync::{Arc, Mutex};
|
||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
|
|
||||||
use crate::DeviceIdentity;
|
|
||||||
use crate::music_renderer::capabilities::{
|
use crate::music_renderer::capabilities::{
|
||||||
PlaybackPosition, PlaybackPositionInfo, PlaybackStatus, QueueTransportControl, RendererBackend,
|
PlaybackPosition, PlaybackPositionInfo, PlaybackStatus, QueueTransportControl, RendererBackend,
|
||||||
TransportControl, VolumeControl,
|
TransportControl, VolumeControl,
|
||||||
};
|
};
|
||||||
use crate::music_renderer::time_utils::{format_hhmmss_u32, parse_time_flexible};
|
use crate::music_renderer::time_utils::{format_hhmmss_u32, parse_time_flexible};
|
||||||
|
use crate::DeviceIdentity;
|
||||||
|
|
||||||
use crate::errors::ControlPointError;
|
use crate::errors::ControlPointError;
|
||||||
use crate::model::{PlaybackState, RendererInfo};
|
use crate::model::{PlaybackState, RendererInfo};
|
||||||
use crate::music_renderer::RendererFromMediaRendererInfo;
|
|
||||||
use crate::music_renderer::musicrenderer::MusicRendererBackend;
|
use crate::music_renderer::musicrenderer::MusicRendererBackend;
|
||||||
use crate::music_renderer::openhome::{
|
use crate::music_renderer::openhome::{
|
||||||
build_info_client, build_playlist_client, build_product_client, build_radio_client,
|
build_info_client, build_playlist_client, build_product_client, build_radio_client,
|
||||||
build_time_client, build_volume_client,
|
build_time_client, build_volume_client,
|
||||||
};
|
};
|
||||||
|
use crate::music_renderer::RendererFromMediaRendererInfo;
|
||||||
use crate::queue::{EnqueueMode, MusicQueue, PlaybackItem, QueueBackend, QueueSnapshot};
|
use crate::queue::{EnqueueMode, MusicQueue, PlaybackItem, QueueBackend, QueueSnapshot};
|
||||||
use crate::upnp_clients::{
|
use crate::upnp_clients::{
|
||||||
OPENHOME_PLAYLIST_HEAD_ID, OhInfoClient, OhPlaylistClient, OhProductClient, OhRadioClient,
|
OhInfoClient, OhPlaylistClient, OhProductClient, OhRadioClient, OhTimeClient, OhVolumeClient,
|
||||||
OhTimeClient, OhVolumeClient,
|
OPENHOME_PLAYLIST_HEAD_ID,
|
||||||
};
|
};
|
||||||
use tracing::debug;
|
use tracing::debug;
|
||||||
|
|
||||||
@@ -500,6 +500,7 @@ impl PlaybackPosition for OpenHomeRenderer {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Parse duration from DIDL-Lite metadata XML (OpenHome version)
|
/// Parse duration from DIDL-Lite metadata XML (OpenHome version)
|
||||||
|
#[allow(dead_code)]
|
||||||
fn parse_didl_duration_openhome(didl: &str) -> Option<String> {
|
fn parse_didl_duration_openhome(didl: &str) -> Option<String> {
|
||||||
// Search for duration attribute in <res> element
|
// Search for duration attribute in <res> element
|
||||||
let res_start = didl.find("<res ")?;
|
let res_start = didl.find("<res ")?;
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ pub fn playback_position_equal(a: &PlaybackPositionInfo, b: &PlaybackPositionInf
|
|||||||
/// Parse "HH:MM:SS" style time strings to seconds.
|
/// Parse "HH:MM:SS" style time strings to seconds.
|
||||||
///
|
///
|
||||||
/// Returns None for empty or sentinel values such as "NOT_IMPLEMENTED" or "-:--:--".
|
/// Returns None for empty or sentinel values such as "NOT_IMPLEMENTED" or "-:--:--".
|
||||||
|
#[allow(dead_code)]
|
||||||
fn parse_hms_to_secs(s: &str) -> Option<u64> {
|
fn parse_hms_to_secs(s: &str) -> Option<u64> {
|
||||||
let s = s.trim();
|
let s = s.trim();
|
||||||
if s.is_empty() {
|
if s.is_empty() {
|
||||||
|
|||||||
@@ -145,6 +145,7 @@ impl InternalQueue {
|
|||||||
/// Fusionne les métadonnées en protégeant les streams contre la diminution de durée.
|
/// Fusionne les métadonnées en protégeant les streams contre la diminution de durée.
|
||||||
/// Pour les streams continus, si c'est la même chanson (même titre ET même artiste ET même URI),
|
/// Pour les streams continus, si c'est la même chanson (même titre ET même artiste ET même URI),
|
||||||
/// la durée ne peut jamais diminuer.
|
/// la durée ne peut jamais diminuer.
|
||||||
|
#[allow(dead_code)]
|
||||||
fn merge_metadata_protecting_streams(
|
fn merge_metadata_protecting_streams(
|
||||||
old_metadata: &Option<crate::model::TrackMetadata>,
|
old_metadata: &Option<crate::model::TrackMetadata>,
|
||||||
new_metadata: &Option<crate::model::TrackMetadata>,
|
new_metadata: &Option<crate::model::TrackMetadata>,
|
||||||
|
|||||||
@@ -13,6 +13,7 @@ use crate::{
|
|||||||
|
|
||||||
const DEFAULT_MAX_AGE: u32 = 1800;
|
const DEFAULT_MAX_AGE: u32 = 1800;
|
||||||
|
|
||||||
|
#[allow(dead_code)]
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct DeviceItem {
|
pub struct DeviceItem {
|
||||||
music_renderer: Option<Arc<MusicRenderer>>,
|
music_renderer: Option<Arc<MusicRenderer>>,
|
||||||
|
|||||||
@@ -1001,6 +1001,8 @@ pub fn parse_track_metadata_from_didl(xml: &str) -> Option<TrackMetadata> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Extracts the ID from DIDL-Lite XML metadata.
|
||||||
|
#[allow(dead_code)]
|
||||||
pub fn didl_id_from_metadata(xml: &str) -> Option<String> {
|
pub fn didl_id_from_metadata(xml: &str) -> Option<String> {
|
||||||
if xml.trim().is_empty() {
|
if xml.trim().is_empty() {
|
||||||
return None;
|
return None;
|
||||||
@@ -1115,6 +1117,8 @@ fn parse_product_source_list(xml: &str) -> Result<Vec<OhProductSource>> {
|
|||||||
Ok(sources)
|
Ok(sources)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Check if error is an invalid OpenHome entry ID error.
|
||||||
|
#[allow(dead_code)]
|
||||||
fn is_invalid_entry_id_error(err: &ControlPointError) -> bool {
|
fn is_invalid_entry_id_error(err: &ControlPointError) -> bool {
|
||||||
let msg = format!("{err}");
|
let msg = format!("{err}");
|
||||||
msg.contains("Invalid OpenHome Entry Id") || msg.contains("comma-separated IDs")
|
msg.contains("Invalid OpenHome Entry Id") || msg.contains("comma-separated IDs")
|
||||||
|
|||||||
@@ -333,6 +333,7 @@ impl PersistenceManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Supprime tous les tracks contenant un cache_pk donné
|
/// Supprime tous les tracks contenant un cache_pk donné
|
||||||
|
#[allow(dead_code)]
|
||||||
pub async fn remove_by_cache_pk(&self, cache_pk: &str) -> Result<()> {
|
pub async fn remove_by_cache_pk(&self, cache_pk: &str) -> Result<()> {
|
||||||
let conn = self.conn.lock().unwrap();
|
let conn = self.conn.lock().unwrap();
|
||||||
conn.execute("DELETE FROM tracks WHERE cache_pk = ?1", params![cache_pk])
|
conn.execute("DELETE FROM tracks WHERE cache_pk = ?1", params![cache_pk])
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ use serde::{Deserialize, Serialize};
|
|||||||
/// Messages envoyés du Backend → Navigateur
|
/// Messages envoyés du Backend → Navigateur
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
#[serde(tag = "type", rename_all = "snake_case")]
|
#[serde(tag = "type", rename_all = "snake_case")]
|
||||||
|
#[allow(dead_code)]
|
||||||
pub enum ServerMessage {
|
pub enum ServerMessage {
|
||||||
SessionCreated {
|
SessionCreated {
|
||||||
token: String,
|
token: String,
|
||||||
@@ -38,6 +39,7 @@ pub enum ServerMessage {
|
|||||||
|
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
#[serde(rename_all = "snake_case")]
|
#[serde(rename_all = "snake_case")]
|
||||||
|
#[allow(dead_code)]
|
||||||
pub enum TransportAction {
|
pub enum TransportAction {
|
||||||
Play,
|
Play,
|
||||||
Pause,
|
Pause,
|
||||||
@@ -60,12 +62,25 @@ pub struct CommandParams {
|
|||||||
/// Messages envoyés du Navigateur → Backend
|
/// Messages envoyés du Navigateur → Backend
|
||||||
#[derive(Debug, Clone, Serialize, Deserialize)]
|
#[derive(Debug, Clone, Serialize, Deserialize)]
|
||||||
#[serde(tag = "type", rename_all = "snake_case")]
|
#[serde(tag = "type", rename_all = "snake_case")]
|
||||||
|
#[allow(dead_code)]
|
||||||
pub enum ClientMessage {
|
pub enum ClientMessage {
|
||||||
Init { capabilities: BrowserCapabilities },
|
Init {
|
||||||
StateUpdate { state: PlaybackState },
|
capabilities: BrowserCapabilities,
|
||||||
PositionUpdate { position: String, duration: String },
|
},
|
||||||
MetadataUpdate { metadata: TrackMetadata },
|
StateUpdate {
|
||||||
VolumeUpdate { volume: u16, mute: bool },
|
state: PlaybackState,
|
||||||
|
},
|
||||||
|
PositionUpdate {
|
||||||
|
position: String,
|
||||||
|
duration: String,
|
||||||
|
},
|
||||||
|
MetadataUpdate {
|
||||||
|
metadata: TrackMetadata,
|
||||||
|
},
|
||||||
|
VolumeUpdate {
|
||||||
|
volume: u16,
|
||||||
|
mute: bool,
|
||||||
|
},
|
||||||
/// Envoyé quand la piste courante se termine naturellement (gapless).
|
/// Envoyé quand la piste courante se termine naturellement (gapless).
|
||||||
/// Le backend fait avancer current → next dans l'état partagé.
|
/// Le backend fait avancer current → next dans l'état partagé.
|
||||||
TrackEnded,
|
TrackEnded,
|
||||||
|
|||||||
Reference in New Issue
Block a user