Add CurrentSpeed to GetTransportInfo

This commit adds the CurrentSpeed field to the GetTransportInfo action, including updates to the action definition, handler, and web renderer. The speed is set to '1' as a default value.
This commit is contained in:
2026-02-21 09:43:29 +01:00
parent 58ec5f96f2
commit 03775f7574
3 changed files with 12 additions and 1 deletions

View File

@@ -1,4 +1,6 @@
use crate::avtransport::variables::{A_ARG_TYPE_INSTANCE_ID, TRANSPORTSTATE, TRANSPORTSTATUS};
use crate::avtransport::variables::{
A_ARG_TYPE_INSTANCE_ID, TRANSPORTPLAYSPEED, TRANSPORTSTATE, TRANSPORTSTATUS,
};
use pmoupnp::define_action;
define_action! {
@@ -6,5 +8,6 @@ define_action! {
in "InstanceID" => A_ARG_TYPE_INSTANCE_ID,
out "CurrentTransportState" => TRANSPORTSTATE,
out "CurrentTransportStatus" => TRANSPORTSTATUS,
out "CurrentSpeed" => TRANSPORTPLAYSPEED,
}
}

View File

@@ -203,6 +203,7 @@ pub fn get_transport_info_handler(state: SharedState) -> ActionHandler {
Box::pin(async move {
let mut data = data;
let s = state.read();
tracing::info!("[WebRenderer] GetTransportInfo handler called, state={:?}", s.playback_state);
let transport_state = match s.playback_state {
PlaybackState::Stopped => "STOPPED",
PlaybackState::Playing => "PLAYING",
@@ -215,6 +216,7 @@ pub fn get_transport_info_handler(state: SharedState) -> ActionHandler {
transport_state.to_string()
);
set!(&mut data, "CurrentTransportStatus", "OK".to_string());
set!(&mut data, "CurrentSpeed", "1".to_string());
Ok(data)
})
})

View File

@@ -332,6 +332,12 @@ impl WebRendererFactory {
Arc::clone(&TRANSPORTSTATUS),
)))
.map_err(|e| FactoryError::ActionError(format!("{:?}", e)))?;
get_info
.add_argument(Arc::new(Argument::new_out(
"CurrentSpeed".to_string(),
Arc::clone(&TRANSPORTPLAYSPEED),
)))
.map_err(|e| FactoryError::ActionError(format!("{:?}", e)))?;
get_info.set_stateful(false);
get_info.set_handler(handlers::get_transport_info_handler(state.clone()));
add_action(&mut svc, Arc::new(get_info))?;