diff --git a/storeroom/src/main/java/com/storeroom/modules/storeroom3d/config/common/NVSSDK.java b/storeroom/src/main/java/com/storeroom/modules/storeroom3d/config/common/NVSSDK.java index 3658a20..f6e56c9 100644 --- a/storeroom/src/main/java/com/storeroom/modules/storeroom3d/config/common/NVSSDK.java +++ b/storeroom/src/main/java/com/storeroom/modules/storeroom3d/config/common/NVSSDK.java @@ -6,7 +6,10 @@ import com.sun.jna.Pointer; import com.sun.jna.Structure; import com.sun.jna.ptr.IntByReference; import com.sun.jna.win32.StdCallLibrary; +import com.sun.jna.Structure.ByValue; +import java.util.ArrayList; +import java.util.Arrays; import java.util.List; public interface NVSSDK extends Library { @@ -94,10 +97,10 @@ public interface NVSSDK extends Library { public static final int T_YUV420 = 1; public static final int T_YUV422 = 2; - public static final int NET_PICSTREAM_CMD_VCA = 1; //Callback VCA image stream information - public static final int NET_PICSTREAM_CMD_ITS = 2; //Callback ITS image stream information - public static final int NET_PICSTREAM_CMD_FACE = 3; //Callback face image stream information - public static final int NET_PICSTREAM_CMD_NORMALSNAP = 4; //Callback normal snap image stream information + public static final int NET_PICSTREAM_CMD_VCA = 1; //Callback VCA image stream information + public static final int NET_PICSTREAM_CMD_ITS = 2; //Callback ITS image stream information + public static final int NET_PICSTREAM_CMD_FACE = 3; //Callback face image stream information + public static final int NET_PICSTREAM_CMD_NORMALSNAP = 4; //Callback normal snap image stream information //Front end video query public static final int CMD_NETFILE_QUERY_FILE = 0; @@ -109,7 +112,7 @@ public interface NVSSDK extends Library { public static final int CMD_NETFILE_MULTI_CHANNEL_QUERY_FILE = 6; public static final int CMD_NETFILE_QUERY_VCA = 7; - public static final int DOWNLOAD_FLAG_FIRST_REQUEST = 0; + public static final int DOWNLOAD_FLAG_FIRST_REQUEST = 0; public static final int DOWNLOAD_FLAG_OPERATE_RECORD = 1; public static final int DOWNLOAD_FLAG_BREAK_CONTINUE = 2; @@ -141,8 +144,7 @@ public interface NVSSDK extends Library { public static final int RAW_AUDIO_AAC = 0x16; - - public static class RECT extends Structure implements Structure.ByValue { + public static class RECT extends Structure implements ByValue { public int left; public int top; public int right; @@ -150,7 +152,7 @@ public interface NVSSDK extends Library { @Override protected List getFieldOrder() { - return null; + return Arrays.asList("left", "top", "right", "bottom"); } } @@ -162,8 +164,9 @@ public interface NVSSDK extends Library { @Override protected List getFieldOrder() { - return null; + return Arrays.asList("m_ulMajorVersion", "m_ulMinorVersion", "m_ulBuilder", "m_cVerInfo"); } + } public static class CLIENTINFO extends Structure { @@ -171,11 +174,6 @@ public interface NVSSDK extends Library { allocateMemory(); } - @Override - protected List getFieldOrder() { - return null; - } - public int m_iServerID; public int m_iChannelNo; public byte[] m_cNetFile = new byte[255]; @@ -190,6 +188,11 @@ public interface NVSSDK extends Library { public int m_iFlag; public int m_iPosition; public int m_iSpeed; + + @Override + protected List getFieldOrder() { + return Arrays.asList("m_iServerID", "m_iChannelNo", "m_cNetFile", "m_cRemoteIP", "m_iNetMode", "m_iTimeout", "m_iTTL", "m_iBufferCount", "m_iDelayNum", "m_iDelayTime", "m_iStreamNO", "m_iFlag", "m_iPosition", "m_iSpeed"); + } } @@ -207,8 +210,9 @@ public interface NVSSDK extends Library { @Override protected List getFieldOrder() { - return null; + return Arrays.asList("m_cHostName", "m_cEncoder", "m_iRecvMode", "m_cProxy", "m_cFactoryID", "m_iPort", "m_nvsType", "m_iChanNum", "m_iLogonState", "m_iServerType"); } + } public static class PicTime extends Structure { @@ -224,8 +228,9 @@ public interface NVSSDK extends Library { @Override protected List getFieldOrder() { - return null; + return Arrays.asList("uiYear", "uiMonth", "uiDay", "uiWeek", "uiHour", "uiMinute", "uiSecondsr", "uiMilliseconds"); } + } public static class PicData extends Structure { @@ -236,7 +241,7 @@ public interface NVSSDK extends Library { @Override protected List getFieldOrder() { - return null; + return Arrays.asList("tPicTime", "iDataLen", "pcPicData"); } } @@ -260,63 +265,64 @@ public interface NVSSDK extends Library { @Override protected List getFieldOrder() { - return null; + return Arrays.asList("iStructLen", "iWidth", "iHeight", "iChannelID", "iEventType", "iRuleID", "iTargetID", "iTargetType", "iTargetSpeed", "iTargetDirection", "tTargetPosition", "iPresetNo", "m_cRemoteIP", "iPicCount", "tPicData"); } } public static class FaceAttribute extends Structure { - public int iType; - public int iValue; + public int iType; + public int iValue; @Override protected List getFieldOrder() { - return null; + return Arrays.asList("iType", "iValue"); } } public static class FacePicData extends Structure { - public int iFaceId; - public int iDrop; - public int iFaceLevel; - public RECT tFaceRect; - public int iWidth; - public int iHeight; - public int iFaceAttrCount; //Number of face attributes - public int iFaceAttrStructSize; //The size of strcut FaceAttribute - public Pointer[] ptFaceAttr = new Pointer[256]; //Face attributes,supports up to 256 attribute types,the subscript is the face attribute type://0-age,1-gender,2-masks,3-beard,4-eye open,5-mouth,6-glasses,7-race,8-emotion,9-smile,10-value...... - public int iDataLen; - public Pointer pcPicData; + public int iFaceId; + public int iDrop; + public int iFaceLevel; + public RECT tFaceRect; + public int iWidth; + public int iHeight; + public int iFaceAttrCount; //Number of face attributes + public int iFaceAttrStructSize; //The size of strcut FaceAttribute + public Pointer[] ptFaceAttr = new Pointer[256]; //Face attributes,supports up to 256 attribute types,the subscript is the face attribute type://0-age,1-gender,2-masks,3-beard,4-eye open,5-mouth,6-glasses,7-race,8-emotion,9-smile,10-value...... + public int iDataLen; + public Pointer pcPicData; @Override protected List getFieldOrder() { - return null; + return Arrays.asList("iFaceId", "iDrop", "iFaceLevel", "tFaceRect", "iWidth", "iHeight", "iFaceAttrCount", "iFaceAttrStructSize", "ptFaceAttr", "iDataLen", "pcPicData"); } } public static class FacePicStream extends Structure { public int iStructLen; - public int iSizeOfFull; //The size of strcut PicData + public int iSizeOfFull; //The size of strcut PicData public Pointer tFullData; public int iFaceCount; - public int iSizeOfFace; //The size of strcut FacePicData + public int iSizeOfFace; //The size of strcut FacePicData public Pointer[] tPicData = new Pointer[32]; @Override protected List getFieldOrder() { - return null; + return Arrays.asList("iStructLen", "iSizeOfFull", "tFullData", "iFaceCount", "iSizeOfFace", "tPicData"); } } public static class PICSTREAM_INFO extends Structure { - public byte[] RecvBuffer = new byte[200*1024];//此处的400应不小于最大报警报文长度 + public byte[] RecvBuffer = new byte[200 * 1024];//此处的400应不小于最大报警报文长度 @Override protected List getFieldOrder() { - return null; + return Arrays.asList("RecvBuffer"); } + } @@ -356,196 +362,196 @@ public interface NVSSDK extends Library { } public static class NetPicPara extends Structure { - public int iStructLen; //Structure length - public int iChannelNo; - public NET_PICSTREAM_NOTIFY cbkPicStreamNotify; - public Pointer pvUser; + public int iStructLen; //Structure length + public int iChannelNo; + public NET_PICSTREAM_NOTIFY cbkPicStreamNotify; + public Pointer pvUser; @Override protected List getFieldOrder() { - return null; + return Arrays.asList("iStructLen", "iChannelNo", "cbkPicStreamNotify", "pvUser"); } } public static class PointerSize extends Structure { - public Pointer pPointer; + public Pointer pPointer; @Override protected List getFieldOrder() { - return null; + return Arrays.asList("pPointer"); } } public static class NVS_FILE_TIME extends Structure implements Structure.ByValue { - public short iYear; // Year - public short iMonth; // Month - public short iDay; // Day - public short iHour; // Hour - public short iMinute; // Minute - public short iSecond; // Second + public short iYear; // Year + public short iMonth; // Month + public short iDay; // Day + public short iHour; // Hour + public short iMinute; // Minute + public short iSecond; // Second @Override protected List getFieldOrder() { - return null; + return Arrays.asList("iYear", "iMonth", "iDay", "iHour", "iMinute", "iSecond"); } + } - public static class QueryFileChannel extends Structure{ - public int iChannelNo; - public int iStreamNo; + public static class QueryFileChannel extends Structure { + public int iChannelNo; + public int iStreamNo; @Override protected List getFieldOrder() { - return null; + return Arrays.asList("iChannelNo", "iStreamNo"); } } public static class ArrayQueryFileChannel extends Structure { + public QueryFileChannel[] tArry = new QueryFileChannel[2]; @Override protected List getFieldOrder() { - return null; + return Arrays.asList("tArry"); } } public static class NETFILE_QUERY_V5 extends Structure { - public int iBufSize; //Size of the structure - public int iQueryChannelNo; //query channel no, 0x7FFFFFFF means query all channel - public int iStreamNo; //stream no - public int iType; //Video type 33:ATM - public NVS_FILE_TIME tStartTime; //Start time - public NVS_FILE_TIME tStopTime; //End time - public int iPageSize; //Page size - public int iPageNo; //Page number - public int iFiletype; //File type 0:all,1:Video,2:picture - public int iDevType; //Device type 0:Video camera,1:Network video server,2:Web camera ,0xff: all - public byte[] cOtherQuery = new byte[65]; //Character overlay - public int iTriggerType; //Alarm type 3:Port alarm,4:Mobile alarm ,5:Video loss alarm ,0x7FFFFFFF:invalid - public int iTrigger; //Port(channel)number - public int iQueryType; //Query type 0: Basic query 1:ATM query 2:ITS query - public int iQueryCondition; //Query criteria 0:Domain query 1:According to the card number query ;2:Traffic query condition: - public byte[] cField = new byte[5 * 68]; //Query message - public int iQueryChannelCount; //if iQueryChannelCount = 0, query single channel with iQueryChannelNo - public int iBufferSize; //sizeof(QueryFileChannel) - public Pointer ptChannelList; //buffer len = sizeof(QueryFileChannel)*iQueryChannelCount - public byte[] cLaneNo = new byte[65]; //lane no - public byte[] cVehicleType = new byte[65]; //vehicle type - public int iFileAttr; //File attributes:0: nvr local storage; 10000: ipc storage + public int iBufSize; //Size of the structure + public int iQueryChannelNo; //query channel no, 0x7FFFFFFF means query all channel + public int iStreamNo; //stream no + public int iType; //Video type 33:ATM + public NVS_FILE_TIME tStartTime; //Start time + public NVS_FILE_TIME tStopTime; //End time + public int iPageSize; //Page size + public int iPageNo; //Page number + public int iFiletype; //File type 0:all,1:Video,2:picture + public int iDevType; //Device type 0:Video camera,1:Network video server,2:Web camera ,0xff: all + public byte[] cOtherQuery = new byte[65]; //Character overlay + public int iTriggerType; //Alarm type 3:Port alarm,4:Mobile alarm ,5:Video loss alarm ,0x7FFFFFFF:invalid + public int iTrigger; //Port(channel)number + public int iQueryType; //Query type 0: Basic query 1:ATM query 2:ITS query + public int iQueryCondition; //Query criteria 0:Domain query 1:According to the card number query ;2:Traffic query condition: + public byte[] cField = new byte[5 * 68]; //Query message + public int iQueryChannelCount; //if iQueryChannelCount = 0, query single channel with iQueryChannelNo + public int iBufferSize; //sizeof(QueryFileChannel) + public Pointer ptChannelList; //buffer len = sizeof(QueryFileChannel)*iQueryChannelCount + public byte[] cLaneNo = new byte[65]; //lane no + public byte[] cVehicleType = new byte[65]; //vehicle type + public int iFileAttr; //File attributes:0: nvr local storage; 10000: ipc storage @Override protected List getFieldOrder() { - return null; + return Arrays.asList("iBufSize", "iQueryChannelNo", "iStreamNo", "iType", "tStartTime", "tStopTime", "iPageSize", "iPageNo", "iFiletype", "iDevType" + , "cOtherQuery", "iTriggerType", "iTrigger", "iQueryType", "iQueryCondition", "cField", "iQueryChannelCount", "iBufferSize", "ptChannelList", "cLaneNo", "cVehicleType", "iFileAttr"); } } //Record File Property public static class NVS_FILE_DATA extends Structure { - public int iType; //Record type 1-Manual record, 2-Schedule record, 3-Alarm record - public int iChannel; //Record channel 0~channel defined channel number - public byte[] cFileName = new byte[250]; //File name - public NVS_FILE_TIME tStartTime; //File start time - public NVS_FILE_TIME tStopTime; //File end time - public int iFileSize; //File size + public int iType; //Record type 1-Manual record, 2-Schedule record, 3-Alarm record + public int iChannel; //Record channel 0~channel defined channel number + public byte[] cFileName = new byte[250]; //File name + public NVS_FILE_TIME tStartTime; //File start time + public NVS_FILE_TIME tStopTime; //File end time + public int iFileSize; //File size + + + } + - @Override - protected List getFieldOrder() { - return null; - } - }; public static class NVS_FILE_DATA_EX extends Structure { - public int iSize; - public NVS_FILE_DATA tFileData; //file basic information - public int iLocked; //add unlock state - public int iFileAttr; //File attributes:0: nvr local storage; 10000: ipc storage + public int iSize; + public NVS_FILE_DATA tFileData; //file basic information + public int iLocked; //add unlock state + public int iFileAttr; //File attributes:0: nvr local storage; 10000: ipc storage + + + } + - @Override - protected List getFieldOrder() { - return null; - } - }; public static class DOWNLOAD_FILE extends Structure { - public int m_iSize; //Structure size - public byte[] m_cRemoteFilename = new byte[255]; //Fornt end video file name - public byte[] m_cLocalFilename = new byte[255]; //Local video file name - public int m_iPosition; //File location by percentage 0~100;When continue send after stop send,file pointer offset request - public int m_iSpeed; //1,2,4,8,Control file play speed, 0-Suspend - public int m_iIFrame; //Only send I frame 1,Only play I Frame;0, All play - public int m_iReqMode; //Require data mode 1,Frame mode;0,Stream mode - public int m_iRemoteFileLen; //If local file is not null,the parameter set to null - public int m_iVodTransEnable; //Enable - public int m_iVodTransVideoSize; //Video pixel - public int m_iVodTransFrameRate; //Frame rate - public int m_iVodTransStreamRate; //Code rate - public int m_iSaveFileType; //0:SDV 3:ps - public int m_iFileAttr; //File attributes:0: nvr local storage; 10000: ipc storage - public int m_iCryptType; //iCryptType = 0, no encryption; iCryptType = 1, is AES encryption - public byte[] m_cCryptKey = new byte[32]; + public int m_iSize; //Structure size + public byte[] m_cRemoteFilename = new byte[255]; //Fornt end video file name + public byte[] m_cLocalFilename = new byte[255]; //Local video file name + public int m_iPosition; //File location by percentage 0~100;When continue send after stop send,file pointer offset request + public int m_iSpeed; //1,2,4,8,Control file play speed, 0-Suspend + public int m_iIFrame; //Only send I frame 1,Only play I Frame;0, All play + public int m_iReqMode; //Require data mode 1,Frame mode;0,Stream mode + public int m_iRemoteFileLen; //If local file is not null,the parameter set to null + public int m_iVodTransEnable; //Enable + public int m_iVodTransVideoSize; //Video pixel + public int m_iVodTransFrameRate; //Frame rate + public int m_iVodTransStreamRate; //Code rate + public int m_iSaveFileType; //0:SDV 3:ps + public int m_iFileAttr; //File attributes:0: nvr local storage; 10000: ipc storage + public int m_iCryptType; //iCryptType = 0, no encryption; iCryptType = 1, is AES encryption + public byte[] m_cCryptKey = new byte[32]; - @Override - protected List getFieldOrder() { - return null; - } - }; + + } public static class DOWNLOAD_TIMESPAN extends Structure { - public int m_iSize; //Structure size - public byte[] m_cLocalFilename = new byte[255]; //Local video file name - public int m_iChannelNO; //Channel number - public NVS_FILE_TIME m_tTimeBegin; //Start time - public NVS_FILE_TIME m_tTimeEnd; //End time - public int m_iPosition; //Position according to time point,>100 - public int m_iSpeed; //1,2,4,8,Control file playback speed, 0-Suspend - public int m_iIFrame; //Only I frames 1,I only play; 0,Full play - public int m_iReqMode; //Required data model 1,Frame mode;0,Flow pattern - public int m_iVodTransEnable; //Enable - public int m_iVodTransVideoSize; //Video frequency ratio - public int m_iVodTransFrameRate; //Frame rate - public int m_iVodTransStreamRate; //Code Rate - public int m_iFileFlag; //0:Download multiple files 1:Download into a single file - public int m_iSaveFileType; //0:SDV 3:ps - public int m_iStreamNo; //stream number,0-main stream, 1-sub stream - public int m_iFileAttr; //File attributes:0: nvr local storage; 10000: ipc storage - public int m_iCryptType; //iCryptType = 0, no encryption; iCryptType = 1, is AES encryption - public byte[] m_cCryptKey = new byte[32]; + public int m_iSize; //Structure size + public byte[] m_cLocalFilename = new byte[255]; //Local video file name + public int m_iChannelNO; //Channel number + public NVS_FILE_TIME m_tTimeBegin; //Start time + public NVS_FILE_TIME m_tTimeEnd; //End time + public int m_iPosition; //Position according to time point,>100 + public int m_iSpeed; //1,2,4,8,Control file playback speed, 0-Suspend + public int m_iIFrame; //Only I frames 1,I only play; 0,Full play + public int m_iReqMode; //Required data model 1,Frame mode;0,Flow pattern + public int m_iVodTransEnable; //Enable + public int m_iVodTransVideoSize; //Video frequency ratio + public int m_iVodTransFrameRate; //Frame rate + public int m_iVodTransStreamRate; //Code Rate + public int m_iFileFlag; //0:Download multiple files 1:Download into a single file + public int m_iSaveFileType; //0:SDV 3:ps + public int m_iStreamNo; //stream number,0-main stream, 1-sub stream + public int m_iFileAttr; //File attributes:0: nvr local storage; 10000: ipc storage + public int m_iCryptType; //iCryptType = 0, no encryption; iCryptType = 1, is AES encryption + public byte[] m_cCryptKey = new byte[32]; @Override protected List getFieldOrder() { - return null; + return Arrays.asList("m_iSize", "m_cLocalFilename", "m_iChannelNO", "m_tTimeBegin", "m_tTimeEnd", "m_iPosition", "m_iSpeed", "m_iIFrame", "m_iReqMode", "m_iVodTransEnable" + , "m_iVodTransVideoSize", "m_iVodTransFrameRate", "m_iVodTransStreamRate", "m_iFileFlag", "m_iSaveFileType", "m_iStreamNo", "m_iFileAttr", "m_iCryptType", "m_cCryptKey"); } - }; + } public static class DOWNLOAD_CONTROL extends Structure { - public int m_iSize; //Structure size - public int m_iPosition; //0~100,Location file playback ;-1,Does not carry on the localization - public int m_iSpeed; //1,2,4,8,Control file playback speed, 0-Suspend - public int m_iIFrame; //Only I frames 1,I only play;0,Full play - public int m_iReqMode; //Demand data model 1,Frame mode ;0,Flow pattern + public int m_iSize; //Structure size + public int m_iPosition; //0~100,Location file playback ;-1,Does not carry on the localization + public int m_iSpeed; //1,2,4,8,Control file playback speed, 0-Suspend + public int m_iIFrame; //Only I frames 1,I only play;0,Full play + public int m_iReqMode; //Demand data model 1,Frame mode ;0,Flow pattern @Override protected List getFieldOrder() { - return null; + return Arrays.asList("m_iSize", "m_iPosition", "m_iSpeed", "m_iIFrame", "m_iReqMode"); } - }; + } public static class RAWFRAME_INFO extends Structure { - public int nWidth; //Video width, audio data is 0 - public int nHeight; //Video height, audio data is 0 - public int nStamp; //Time stamp(ms) - public int nType; //RAWFRAMETYPE, I Frame:0,P Frame:1,B Frame:2,Audio:5 - public int nEnCoder; //Audio or Video encoder(Video,0:H263,1:H264, 2:MP4. Audio:0,G711_A:0x01,G711_U:0x02,ADPCM_A:0x03,G726:0x04) - public int nFrameRate; //Frame rate - public int nAbsStamp; //Absolute Time(s) - public byte ucBitsPerSample; // bit per sample [8/16/24] default 16 - public int uiSamplesPerSec; // Samples Per Sec,default 8000 + public int nWidth; //Video width, audio data is 0 + public int nHeight; //Video height, audio data is 0 + public int nStamp; //Time stamp(ms) + public int nType; //RAWFRAMETYPE, I Frame:0,P Frame:1,B Frame:2,Audio:5 + public int nEnCoder; //Audio or Video encoder(Video,0:H263,1:H264, 2:MP4. Audio:0,G711_A:0x01,G711_U:0x02,ADPCM_A:0x03,G726:0x04) + public int nFrameRate; //Frame rate + public int nAbsStamp; //Absolute Time(s) + public byte ucBitsPerSample; // bit per sample [8/16/24] default 16 + public int uiSamplesPerSec; // Samples Per Sec,default 8000 @Override protected List getFieldOrder() { - return null; + return Arrays.asList("nWidth", "nHeight", "nStamp", "nType", "nEnCoder","nFrameRate","nAbsStamp","ucBitsPerSample","uiSamplesPerSec"); } - }; + + } //Not decode the standard data before the pure h264 data public static interface RAWFRAME_NOTIFY extends StdCallLibrary.StdCallCallback { @@ -588,13 +594,22 @@ public interface NVSSDK extends Library { int _iRecFileType); int NetClient_StopCaptureFile(int _ulConID); + int NetClient_GetLogonStatus(int _iLogonID); - int NetClient_GetDevInfo(int _iLogonID,ENCODERINFO _pEncoderInfo); + + int NetClient_GetDevInfo(int _iLogonID, ENCODERINFO _pEncoderInfo); + int NetClient_Query_V4(int _iLogonID, int _iCmd, int _iChannel, Pointer _pvCmdBuf, int _iBufLen); + int NetClient_NetFileGetFileCount(int _iLogonID, IntByReference _piTotalCount, IntByReference _piCurrentCount); - int NetClient_NetFileGetQueryfileEx(int _iLogonID,int _iFileIndex, NVS_FILE_DATA_EX _pFileInfo); + + int NetClient_NetFileGetQueryfileEx(int _iLogonID, int _iFileIndex, NVS_FILE_DATA_EX _pFileInfo); + int NetClient_NetFileDownload(IntByReference _uiConID, int _iLogonID, int _iCmd, Pointer _pvBuf, int _iBufSize); + int NetClient_NetFileStopDownloadFile(int _uiConID); + int NetClient_NetFileGetDownloadPos(int _uiConID, IntByReference _piPos, IntByReference _piDLSize); + int NetClient_SetRawFrameCallBack(int _uiConID, RAWFRAME_NOTIFY _cbkGetFrame, Pointer _pContext); } diff --git a/storeroom/src/main/java/com/storeroom/modules/storeroom3d/config/common/NetClient.java b/storeroom/src/main/java/com/storeroom/modules/storeroom3d/config/common/NetClient.java index 5e1e504..8432b55 100644 --- a/storeroom/src/main/java/com/storeroom/modules/storeroom3d/config/common/NetClient.java +++ b/storeroom/src/main/java/com/storeroom/modules/storeroom3d/config/common/NetClient.java @@ -10,7 +10,7 @@ import java.awt.*; public class NetClient { - private static NVSSDK nvssdk = (NVSSDK) (System.getProperty("os.name").toLowerCase().startsWith("win") ? Native.loadLibrary("src/main/resources/lib/NVSSDK.dll", NVSSDK.class) : Native.loadLibrary("libnvssdk.so", NVSSDK.class)); + private static NVSSDK nvssdk = (NVSSDK) (System.getProperty("os.name").toLowerCase().startsWith("win") ? Native.loadLibrary("storeroom/src/main/resources/lib/NVSSDK.dll", NVSSDK.class) : Native.loadLibrary("libnvssdk.so", NVSSDK.class)); public static int GetVersion(SDK_VERSION _ver) { return nvssdk.NetClient_GetVersion(_ver); diff --git a/storeroom/src/main/java/com/storeroom/modules/storeroom3d/config/common/VideoClient.java b/storeroom/src/main/java/com/storeroom/modules/storeroom3d/config/common/VideoClient.java index 1b5d893..e394d5f 100644 --- a/storeroom/src/main/java/com/storeroom/modules/storeroom3d/config/common/VideoClient.java +++ b/storeroom/src/main/java/com/storeroom/modules/storeroom3d/config/common/VideoClient.java @@ -3,7 +3,7 @@ package com.storeroom.modules.storeroom3d.config.common; import com.storeroom.modules.storeroom3d.config.common.NVSSDK.DOWNLOAD_TIMESPAN; import com.storeroom.modules.storeroom3d.config.common.NVSSDK.RAWFRAME_INFO; -import com.storeroom.modules.storeroom3d.config.common.NVSSDK.RAWFRAME_NOTIFY; +import com.storeroom.modules.storeroom3d.config.common.NVSSDK.*; import com.sun.jna.Pointer; import com.sun.jna.ptr.IntByReference; @@ -149,7 +149,7 @@ public class VideoClient { }; private int SDKInit() { - NVSSDK.SDK_VERSION ver = new NVSSDK.SDK_VERSION(); + SDK_VERSION ver = new SDK_VERSION(); int iRet = NetClient.GetVersion(ver); System.out.println("[SDK_VERSION]" + ver.m_cVerInfo); @@ -185,7 +185,7 @@ public class VideoClient { if (iLogonStatus == NVSSDK.LOGON_SUCCESS) { break; } - tPlayback.PlaybackByTimespanMode(); + // tPlayback.PlaybackByTimespanMode(); try { Thread.currentThread(); Thread.sleep(1000); diff --git a/storeroom/src/main/java/com/storeroom/modules/storeroom3d/controller/VideosTestController.java b/storeroom/src/main/java/com/storeroom/modules/storeroom3d/controller/VideosTestController.java new file mode 100644 index 0000000..0578710 --- /dev/null +++ b/storeroom/src/main/java/com/storeroom/modules/storeroom3d/controller/VideosTestController.java @@ -0,0 +1,28 @@ +package com.storeroom.modules.storeroom3d.controller; + + +import com.storeroom.annotaion.rest.AnonymousGetMapping; +import com.storeroom.modules.storeroom3d.config.common.VideoClient; +import com.storeroom.utils.ApiResponse; +import com.storeroom.utils.enums.ResponseStatus; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.RequiredArgsConstructor; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +@RestController +@RequestMapping("/api/videos/") +@Api(tags = "测试视频第三方SDK") +@RequiredArgsConstructor +public class VideosTestController { + + + @ApiOperation("测试") + @AnonymousGetMapping("ok") + public ApiResponse ok() { + VideoClient videoClient = new VideoClient(); + videoClient.LogonDevice("192.168.99.21", 3000, "admin", "yxk63603325"); + return ApiResponse.success(ResponseStatus.SUCCESS); + } +}