mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-03-15 15:36:44 +08:00
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:
@@ -55,7 +55,12 @@ fn get_usb_bus_info(card_index: i32) -> Option<String> {
|
||||
// Match patterns like "1-1", "1-2", "1-1.2", "2-1.3.1"
|
||||
if component.contains('-') && !component.contains(':') {
|
||||
// Verify it looks like a USB port (starts with digit)
|
||||
if component.chars().next().map(|c| c.is_ascii_digit()).unwrap_or(false) {
|
||||
if component
|
||||
.chars()
|
||||
.next()
|
||||
.map(|c| c.is_ascii_digit())
|
||||
.unwrap_or(false)
|
||||
{
|
||||
return Some(component.to_string());
|
||||
}
|
||||
}
|
||||
@@ -223,15 +228,14 @@ pub fn find_best_audio_device() -> Result<AudioDeviceInfo> {
|
||||
let devices = enumerate_audio_devices()?;
|
||||
|
||||
if devices.is_empty() {
|
||||
return Err(AppError::AudioError("No audio capture devices found".to_string()));
|
||||
return Err(AppError::AudioError(
|
||||
"No audio capture devices found".to_string(),
|
||||
));
|
||||
}
|
||||
|
||||
// First, look for HDMI/capture card devices that support 48kHz stereo
|
||||
for device in &devices {
|
||||
if device.is_hdmi
|
||||
&& device.sample_rates.contains(&48000)
|
||||
&& device.channels.contains(&2)
|
||||
{
|
||||
if device.is_hdmi && device.sample_rates.contains(&48000) && device.channels.contains(&2) {
|
||||
info!("Selected HDMI audio device: {}", device.description);
|
||||
return Ok(device.clone());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user