using System.Runtime.InteropServices; namespace SHH.CameraSdk; /// /// 大华 PlaySDK 核心接口封装 (play.dll) /// 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); }