refactor(v2): migrate get_pipewire_sinks to v2
Path C: legacy CPAL output-sink enumeration was inlined directly in
commands/playback.rs (cfg-gated Linux + non-Linux variants), with
no equivalent in any domain crate. Extract a domain function
`qbz_audio::output_sinks::list_output_sinks` that returns the same
{name, description, volume, is_default} shape (mirrored as the new
public `OutputSinkInfo` struct) for both Linux and non-Linux
platforms, preserving the original logging cadence and the rule
that name == CPAL device name (so saved IDs reopen correctly).
Add v2_get_pipewire_sinks in commands_v2/audio.rs that calls into
qbz_audio directly — no `crate::commands::*` delegation. Updates the
two frontend call sites (AudioOutputBadges.loadStatus and
SettingsView.loadAudioDevices). Legacy command in
commands/playback.rs is preserved untouched; the audio-protected
files (pipewire_backend.rs, audio_settings.rs, player init_device)
are not modified.
cc
This commit is contained in:
6 files changed
+187
-2
No files matched your search
@@ -43,6 +43,18 @@ pub async fn v2_get_audio_output_status(
|
||||
})
|
||||
}
|
||||
|
||||
/// List the available CPAL output sinks (V2).
|
||||
///
|
||||
/// Delegates enumeration to `qbz_audio::output_sinks::list_output_sinks`,
|
||||
/// which returns the same `{name, description, volume, is_default}` shape
|
||||
/// the legacy `get_pipewire_sinks` command returned. Used by the audio
|
||||
/// settings UI and AudioOutputBadges to populate the device picker and
|
||||
/// label the currently-routed sink.
|
||||
#[tauri::command]
|
||||
pub fn v2_get_pipewire_sinks() -> Result<Vec<qbz_audio::OutputSinkInfo>, RuntimeError> {
|
||||
qbz_audio::list_output_sinks().map_err(RuntimeError::Internal)
|
||||
}
|
||||
|
||||
/// Snapshot the presence of the user's currently-selected output
|
||||
/// device. Frontend calls this on demand (e.g. when a
|
||||
/// `audio:device-missing` toast button fires Retry).
|
||||
|
||||
@@ -1732,6 +1732,7 @@ pub fn run() {
|
||||
commands_v2::v2_reinit_audio_device,
|
||||
commands_v2::v2_check_audio_device_presence,
|
||||
commands_v2::v2_get_audio_output_status,
|
||||
commands_v2::v2_get_pipewire_sinks,
|
||||
commands_v2::v2_get_audio_settings,
|
||||
commands_v2::v2_set_audio_output_device,
|
||||
commands_v2::v2_set_audio_exclusive_mode,
|
||||
|
||||
Reference in new issue
Block a user