feat: readwithwait函数增加了新参数;camera有更多分辨率选择。

This commit is contained in:
alivender
2025-07-19 11:36:07 +08:00
parent ba79a2093b
commit 1492f16fdd
6 changed files with 84 additions and 104 deletions

View File

@@ -946,14 +946,6 @@ public class HttpVideoStreamService : BackgroundService
{
logger.Info($"正在设置视频流分辨率为 {width}x{height}");
// 验证分辨率
if (!IsSupportedResolution(width, height))
{
var message = $"不支持的分辨率: {width}x{height},支持的分辨率: 640x480, 1280x720";
logger.Error(message);
return (false, message);
}
Camera? currentCamera = null;
lock (_cameraLock)
{
@@ -1007,18 +999,6 @@ public class HttpVideoStreamService : BackgroundService
}
}
/// <summary>
/// 检查是否支持该分辨率
/// </summary>
/// <param name="width">宽度</param>
/// <param name="height">高度</param>
/// <returns>是否支持</returns>
private bool IsSupportedResolution(int width, int height)
{
var resolution = $"{width}x{height}";
return resolution == "640x480" || resolution == "1280x720";
}
/// <summary>
/// 获取支持的分辨率列表
/// </summary>
@@ -1028,7 +1008,9 @@ public class HttpVideoStreamService : BackgroundService
return new List<(int, int, string)>
{
(640, 480, "640x480 (VGA)"),
(1280, 720, "1280x720 (HD)")
(1280, 720, "1280x720 (HD)"),
(1280, 960, "1280x960 (SXGA)"),
(1920, 1080, "1920x1080 (Full HD)")
};
}