feat(video): 事务化切换与前端统一编排,增强视频输入格式支持

- 后端:切换事务+transition_id,/stream/mode 返回 switching/transition_id 与实际 codec

- 事件:新增 mode_switching/mode_ready,config/webrtc_ready/mode_changed 关联事务

- 编码/格式:扩展 NV21/NV16/NV24/RGB/BGR 输入与转换链路,RKMPP direct input 优化

- 前端:useVideoSession 统一切换,失败回退真实切回 MJPEG,菜单格式同步修复

- 清理:useVideoStream 降级为 MJPEG-only
This commit is contained in:
mofeng-git
2026-01-11 10:41:57 +08:00
parent 9feb74b72c
commit 206594e292
110 changed files with 3955 additions and 2251 deletions

View File

@@ -161,7 +161,10 @@ impl MsdFunction {
// Write only changed attributes
let cdrom_changed = current_cdrom != new_cdrom;
if cdrom_changed {
debug!("Updating LUN {} cdrom: {} -> {}", lun, current_cdrom, new_cdrom);
debug!(
"Updating LUN {} cdrom: {} -> {}",
lun, current_cdrom, new_cdrom
);
write_file(&lun_path.join("cdrom"), new_cdrom)?;
}
if current_ro != new_ro {
@@ -169,11 +172,17 @@ impl MsdFunction {
write_file(&lun_path.join("ro"), new_ro)?;
}
if current_removable != new_removable {
debug!("Updating LUN {} removable: {} -> {}", lun, current_removable, new_removable);
debug!(
"Updating LUN {} removable: {} -> {}",
lun, current_removable, new_removable
);
write_file(&lun_path.join("removable"), new_removable)?;
}
if current_nofua != new_nofua {
debug!("Updating LUN {} nofua: {} -> {}", lun, current_nofua, new_nofua);
debug!(
"Updating LUN {} nofua: {} -> {}",
lun, current_nofua, new_nofua
);
write_file(&lun_path.join("nofua"), new_nofua)?;
}
@@ -258,11 +267,17 @@ impl MsdFunction {
// forced_eject forcibly detaches the backing file regardless of host state
let forced_eject_path = lun_path.join("forced_eject");
if forced_eject_path.exists() {
debug!("Using forced_eject to disconnect LUN {} at {:?}", lun, forced_eject_path);
debug!(
"Using forced_eject to disconnect LUN {} at {:?}",
lun, forced_eject_path
);
match write_file(&forced_eject_path, "1") {
Ok(_) => debug!("forced_eject write succeeded"),
Err(e) => {
warn!("forced_eject write failed: {}, falling back to clearing file", e);
warn!(
"forced_eject write failed: {}, falling back to clearing file",
e
);
write_file(&lun_path.join("file"), "")?;
}
}