支持通过网页增加、删除、修改摄像头配置信息

支持摄像头配置信息中句柄的设置,并实测有效
This commit is contained in:
2025-12-28 08:07:55 +08:00
parent 3718465463
commit 2ee25a4f7c
25 changed files with 2298 additions and 75 deletions

View File

@@ -0,0 +1,69 @@
namespace SHH.CameraSdk
{
/// <summary>
/// 图像预处理配置模型
/// 用于定义相机采集后的原始帧在分发给订阅者之前的通用处理参数
/// </summary>
public class PreprocessConfig
{
#region --- (Resolution & Scale) ---
/// <summary>
/// 目标输出宽度(单位:像素)
/// 范围约束176 - 1920 px
/// </summary>
public int Width { get; set; }
/// <summary>
/// 目标输出高度(单位:像素)
/// 范围约束44 - 1080 px
/// </summary>
public int Height { get; set; }
/// <summary>
/// 等比缩放倍率(基于原始分辨率的系数)
/// 例如0.5 表示缩小一半1.2 表示放大 20%
/// </summary>
public double Scale { get; set; } = 1.0;
/// <summary>
/// 是否锁定等比缩放
/// true: 修改宽度时高度按比例自动调整false: 允许拉伸或压缩变形
/// </summary>
public bool IsAspectRatio { get; set; } = true;
#endregion
#region --- (Business Constraints) ---
/// <summary>
/// 是否允许缩小图像
/// 默认为 true。若为 false则 Target 尺寸不得低于原始分辨率
/// </summary>
public bool AllowShrink { get; set; } = true;
/// <summary>
/// 是否启用放大功能
/// 默认为 false。若未开启当目标尺寸大于原始分辨率时将强制回退到原始尺寸
/// </summary>
public bool AllowEnlarge { get; set; } = false;
#endregion
#region --- (Image Enhancement) ---
/// <summary>
/// 是否开启图像增量(亮度/对比度补偿)
/// 只有此项为 true 时Brightness 增益参数才会生效
/// </summary>
public bool EnableGain { get; set; } = false;
/// <summary>
/// 图像增量百分比Gain/Gamma 调节)
/// 范围0 - 100%。用于在暗光环境下提升画面可见度
/// </summary>
public int Brightness { get; set; } = 0;
#endregion
}
}

View File

@@ -2,28 +2,36 @@
{
public class ProcessingOptions
{
// --- 缩放控制 ---
/// <summary> 是否允许缩小 (默认 True: 节约性能与带宽) </summary>
public bool EnableShrink { get; set; } = true;
/// <summary> 是否允许放大 (默认 False: 防止性能浪费与失真) </summary>
public bool EnableExpand { get; set; } = false;
// ==========================================
// 1. 尺寸控制参数
// ==========================================
/// <summary> 目标宽度 </summary>
public int TargetWidth { get; set; } = 640;
public int TargetWidth { get; set; } = 1280;
/// <summary> 目标高度 </summary>
public int TargetHeight { get; set; } = 360;
public int TargetHeight { get; set; } = 720;
// --- 增亮控制 ---
/// <summary> 仅允许缩小 (如果原图比目标大,则缩放;否则不处理) </summary>
public bool EnableShrink { get; set; } = true;
/// <summary> 是否启用图像增强 </summary>
public bool EnableEnhance { get; set; } = false; // 默认关闭,按需开启
/// <summary> 仅允许放大 (如果原图比目标小,则缩放;否则不处理) </summary>
public bool EnableExpand { get; set; } = false;
/// <summary> 增亮强度 (0-100, 默认30) </summary>
public double BrightnessLevel { get; set; } = 30.0;
// ==========================================
// 2. 画质增强参数
// ==========================================
/// <summary> 是否启用图像增亮 </summary>
public bool EnableBrightness { get; set; } = false;
/// <summary> 增亮百分比 (建议范围 0-100对应增加的像素亮度值) </summary>
public int Brightness { get; set; } = 0;
// 默认实例
[JsonIgnore]
public static ProcessingOptions Default => new ProcessingOptions();
}
}

View File

@@ -35,8 +35,7 @@ public class VideoSourceConfig
public string Password { get; set; } = string.Empty;
/// <summary> 渲染句柄(可选):用于硬解码时直接绑定显示窗口,提升渲染性能 </summary>
[JsonIgnore]
public IntPtr RenderHandle { get; set; } = IntPtr.Zero;
public long RenderHandle { get; set; }
/// <summary> 物理通道号IPC 通常为 1NVR 对应接入的摄像头通道索引) </summary>
public int ChannelIndex { get; set; } = 1;
@@ -44,6 +43,13 @@ public class VideoSourceConfig
/// <summary> 默认码流类型0 = 主码流(高清)1 = 子码流(低带宽) </summary>
public int StreamType { get; set; } = 0;
/// <summary> 关联的主板IP </summary>
public string MainboardIp { get; set; }
= string.Empty;
/// <summary>关联的主板端口</summary>
public int MainboardPort { get; set; }
/// <summary> Rtsp 播放路径 </summary>
public string RtspPath { get; set; } = string.Empty;
@@ -136,6 +142,8 @@ public class VideoSourceConfig
Password = this.Password,
RenderHandle = this.RenderHandle,
ChannelIndex = this.ChannelIndex,
MainboardIp = this.MainboardIp,
MainboardPort = this.MainboardPort,
RtspPath = this.RtspPath,
StreamType = this.StreamType,
Transport = this.Transport,