细化接口内容

This commit is contained in:
2025-12-31 20:43:54 +08:00
parent 8cd36f44ac
commit 0534ddca75
5 changed files with 26 additions and 7 deletions

View File

@@ -1,7 +1,7 @@
 
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 18 # Visual Studio Version 17
VisualStudioVersion = 18.1.11304.174 VisualStudioVersion = 17.14.36623.8 d17.14
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SHH.CameraSdk", "SHH.CameraSdk\SHH.CameraSdk.csproj", "{21B70A94-43FC-4D17-AB83-9E4B5178397E}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SHH.CameraSdk", "SHH.CameraSdk\SHH.CameraSdk.csproj", "{21B70A94-43FC-4D17-AB83-9E4B5178397E}"
EndProject EndProject

View File

@@ -32,11 +32,23 @@ public class CamerasController : ControllerBase
var devices = _manager.GetAllDevices().Select(d => new var devices = _manager.GetAllDevices().Select(d => new
{ {
d.Id, d.Id,
d.Config.IpAddress,
d.Config.Name, d.Config.Name,
d.Config.RenderHandle,
d.Config.StreamType,
d.Config.IpAddress,
Brand = d.Config.Brand.ToString(),
Status = d.Status.ToString(), Status = d.Status.ToString(),
d.RealFps, d.RealFps,
d.TotalFrames d.TotalFrames,
d.IsPhysicalOnline,
d.IsOnline,
d.IsRunning,
d.Width,
d.Height,
d.PreprocessSettings.AllowEnlarge,
d.PreprocessSettings.AllowShrink,
ScalingWidth = d.PreprocessSettings.Width,
ScalingHeight = d.PreprocessSettings.Height,
}); });
return Ok(devices); return Ok(devices);
} }

View File

@@ -377,6 +377,8 @@ public class HikVideoSource : BaseVideoSource,
Cv2.CvtColor(rawYuvWrapper, smartFrame.InternalMat, ColorConversionCodes.YUV2BGR_YV12); Cv2.CvtColor(rawYuvWrapper, smartFrame.InternalMat, ColorConversionCodes.YUV2BGR_YV12);
} }
smartFrame.SubscriberIds.AddRange(decision.TargetAppIds);
// ========================================================================= // =========================================================================
// 【新增】插入这一行! // 【新增】插入这一行!
// 此时 smartFrame.InternalMat 已经有了图像数据 // 此时 smartFrame.InternalMat 已经有了图像数据

View File

@@ -52,8 +52,9 @@ namespace SHH.CameraSdk
DispatchTime = DateTime.Now, DispatchTime = DateTime.Now,
OriginalWidth = safeMat.Width, OriginalWidth = safeMat.Width,
OriginalHeight = safeMat.Height, OriginalHeight = safeMat.Height,
OriginalImageBytes = jpgBytes OriginalImageBytes = jpgBytes,
}; };
payload.SubscriberIds.AddRange(frame.SubscriberIds);
// 4. 发射 // 4. 发射
_distributor.Broadcast(payload); _distributor.Broadcast(payload);

View File

@@ -1,5 +1,6 @@
using System; using Newtonsoft.Json;
using Newtonsoft.Json; using System;
using System.Collections.Generic;
namespace SHH.Contracts namespace SHH.Contracts
{ {
@@ -8,6 +9,8 @@ namespace SHH.Contracts
/// </summary> /// </summary>
public class VideoPayload public class VideoPayload
{ {
public List<string> SubscriberIds { get; } = new List<string>(16);
// ========================================== // ==========================================
// 1. 基础元数据 (将被序列化到 JSON) // 1. 基础元数据 (将被序列化到 JSON)
// ========================================== // ==========================================
@@ -65,6 +68,7 @@ namespace SHH.Contracts
OriginalHeight, OriginalHeight,
TargetWidth, TargetWidth,
TargetHeight, TargetHeight,
SubscriberIds,
// 标记一下是否有目标图方便接收端判断要不要读第3帧 // 标记一下是否有目标图方便接收端判断要不要读第3帧
HasTargetImage = (TargetImageBytes != null && TargetImageBytes.Length > 0) HasTargetImage = (TargetImageBytes != null && TargetImageBytes.Length > 0)
}; };