Files
Ayay/SHH.CameraSdk/Drivers/DaHua/DahuaPlaySDK.cs

52 lines
1.5 KiB
C#
Raw Normal View History

2026-01-17 19:17:49 +08:00
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);
}