增加大华驱动

This commit is contained in:
2026-01-17 19:17:49 +08:00
parent 0b4c6fe913
commit 927ba09f66
14 changed files with 162157 additions and 21 deletions

View File

@@ -0,0 +1,52 @@
using System.Runtime.InteropServices;
namespace SHH.CameraSdk;
/// <summary>
/// 大华 PlaySDK 核心接口封装 (play.dll)
/// </summary>
public static class DahuaPlaySDK
{
private const string DLL_PATH = "Drivers\\Dahua\\play.dll";
// 解码回调委托
public delegate void DECCBFUN(int nPort, IntPtr pBuf, int nSize, ref FRAME_INFO pFrameInfo, IntPtr nUser, int nReserved2);
[StructLayout(LayoutKind.Sequential)]
public struct FRAME_INFO
{
public int nWidth;
public int nHeight;
public int nStamp;
public int nType;
public int nFrameRate;
public uint dwFrameNum;
}
[DllImport(DLL_PATH)]
public static extern bool PLAY_GetFreePort(ref int plPort);
[DllImport(DLL_PATH)]
public static extern bool PLAY_ReleasePort(int nPort);
[DllImport(DLL_PATH)]
public static extern bool PLAY_OpenStream(int nPort, IntPtr pFileHead, uint nSize, uint nBufPoolSize);
[DllImport(DLL_PATH)]
public static extern bool PLAY_CloseStream(int nPort);
[DllImport(DLL_PATH)]
public static extern bool PLAY_Play(int nPort, IntPtr hWnd);
[DllImport(DLL_PATH)]
public static extern bool PLAY_Stop(int nPort);
[DllImport(DLL_PATH)]
public static extern bool PLAY_InputData(int nPort, IntPtr pBuf, uint nSize);
[DllImport(DLL_PATH)]
public static extern bool PLAY_SetDecCallBack(int nPort, DECCBFUN DecCBFun);
[DllImport(DLL_PATH)]
public static extern bool PLAY_SetStreamOpenMode(int nPort, uint nMode);
}