Files
qbz/crates/qconnect-protocol/src/renderer.rs
T
vicrodh 03a551e6ff feat(qconnect): real duration/queue_item_ids in join report + DeviceAudioQualityChanged(27)
Add the RndrSrvrDeviceAudioQualityChanged(27) renderer report end to end:
the report-type variant + message string in qconnect-protocol renderer.rs,
the RendererDeviceAudioQualityChangedMessage proto struct plus the genuinely
free tag-27 field on QConnectMessage (26=file AQ, 28=max AQ), and the mapper
arm. Wire the adapter emitter report_device_audio_quality_if_changed (deduped
via a new last_reported_device_audio_quality sync-state field) next to the
file-AQ report, sourcing the real output stream config. Fix the deferred-join
StateUpdated report to resolve the real current track duration (via CoreBridge)
and current/next queue_item_ids instead of hardcoding nulls.

cc
2026-06-01 04:29:18 -06:00

104 lines
3.3 KiB
Rust

use qconnect_core::QueueVersion;
use serde::{Deserialize, Serialize};
use serde_json::Value;
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum RendererCommandType {
SrvrRndrSetState,
SrvrRndrSetVolume,
SrvrRndrSetActive,
SrvrRndrSetMaxAudioQuality,
SrvrRndrSetLoopMode,
SrvrRndrSetShuffleMode,
SrvrRndrMuteVolume,
}
impl RendererCommandType {
pub const fn as_message_type(self) -> &'static str {
match self {
Self::SrvrRndrSetState => "MESSAGE_TYPE_SRVR_RNDR_SET_STATE",
Self::SrvrRndrSetVolume => "MESSAGE_TYPE_SRVR_RNDR_SET_VOLUME",
Self::SrvrRndrSetActive => "MESSAGE_TYPE_SRVR_RNDR_SET_ACTIVE",
Self::SrvrRndrSetMaxAudioQuality => "MESSAGE_TYPE_SRVR_RNDR_SET_MAX_AUDIO_QUALITY",
Self::SrvrRndrSetLoopMode => "MESSAGE_TYPE_SRVR_RNDR_SET_LOOP_MODE",
Self::SrvrRndrSetShuffleMode => "MESSAGE_TYPE_SRVR_RNDR_SET_SHUFFLE_MODE",
Self::SrvrRndrMuteVolume => "MESSAGE_TYPE_SRVR_RNDR_MUTE_VOLUME",
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RendererServerCommand {
pub command_type: RendererCommandType,
#[serde(default)]
pub payload: Value,
}
impl RendererServerCommand {
pub const fn message_type(&self) -> &'static str {
self.command_type.as_message_type()
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum RendererReportType {
RndrSrvrJoinSession,
RndrSrvrDeviceInfoUpdated,
RndrSrvrStateUpdated,
RndrSrvrVolumeChanged,
RndrSrvrVolumeMuted,
RndrSrvrFileAudioQualityChanged,
RndrSrvrDeviceAudioQualityChanged,
RndrSrvrMaxAudioQualityChanged,
}
impl RendererReportType {
pub const fn as_message_type(self) -> &'static str {
match self {
Self::RndrSrvrJoinSession => "MESSAGE_TYPE_RNDR_SRVR_JOIN_SESSION",
Self::RndrSrvrDeviceInfoUpdated => "MESSAGE_TYPE_RNDR_SRVR_DEVICE_INFO_UPDATED",
Self::RndrSrvrStateUpdated => "MESSAGE_TYPE_RNDR_SRVR_STATE_UPDATED",
Self::RndrSrvrVolumeChanged => "MESSAGE_TYPE_RNDR_SRVR_VOLUME_CHANGED",
Self::RndrSrvrVolumeMuted => "MESSAGE_TYPE_RNDR_SRVR_VOLUME_MUTED",
Self::RndrSrvrFileAudioQualityChanged => {
"MESSAGE_TYPE_RNDR_SRVR_FILE_AUDIO_QUALITY_CHANGED"
}
Self::RndrSrvrDeviceAudioQualityChanged => {
"MESSAGE_TYPE_RNDR_SRVR_DEVICE_AUDIO_QUALITY_CHANGED"
}
Self::RndrSrvrMaxAudioQualityChanged => {
"MESSAGE_TYPE_RNDR_SRVR_MAX_AUDIO_QUALITY_CHANGED"
}
}
}
}
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct RendererReport {
pub report_type: RendererReportType,
pub action_uuid: String,
pub queue_version_ref: QueueVersion,
#[serde(default)]
pub payload: Value,
}
impl RendererReport {
pub fn new(
report_type: RendererReportType,
action_uuid: impl Into<String>,
queue_version_ref: QueueVersion,
payload: Value,
) -> Self {
Self {
report_type,
action_uuid: action_uuid.into(),
queue_version_ref,
payload,
}
}
pub const fn message_type(&self) -> &'static str {
self.report_type.as_message_type()
}
}