刘力
2 years ago
42 changed files with 1010 additions and 3 deletions
-
1pom.xml
-
68storeroom/pom.xml
-
600storeroom/src/main/java/com/storeroom/modules/storeroom3d/config/common/NVSSDK.java
-
120storeroom/src/main/java/com/storeroom/modules/storeroom3d/config/common/NetClient.java
-
192storeroom/src/main/java/com/storeroom/modules/storeroom3d/config/common/VideoClient.java
-
BINstoreroom/src/main/resources/lib/AVDecSDK.dll
-
BINstoreroom/src/main/resources/lib/AVFilterSDK.dll
-
BINstoreroom/src/main/resources/lib/AVShowSDK.dll
-
BINstoreroom/src/main/resources/lib/AbsoluteLayout.jar
-
BINstoreroom/src/main/resources/lib/ActiveLinkServer.dll
-
BINstoreroom/src/main/resources/lib/AudioDecAMR.dll
-
BINstoreroom/src/main/resources/lib/AudioDecV33.dll
-
BINstoreroom/src/main/resources/lib/DeviceDll/DOME_PELCO_D.dll
-
BINstoreroom/src/main/resources/lib/DeviceDll/DOME_PELCO_P.dll
-
BINstoreroom/src/main/resources/lib/DeviceDll/DOME_PLUS.dll
-
BINstoreroom/src/main/resources/lib/DeviceDll/PTZ_PELCO_D.dll
-
BINstoreroom/src/main/resources/lib/DeviceDll/PTZ_PELCO_P.dll
-
BINstoreroom/src/main/resources/lib/DeviceDll/PTZ_TC615_P.dll
-
BINstoreroom/src/main/resources/lib/MultiMedia.dll
-
BINstoreroom/src/main/resources/lib/NVSSDK.dll
-
BINstoreroom/src/main/resources/lib/NVSSDK.lib
-
BINstoreroom/src/main/resources/lib/NetAdmin.dll
-
BINstoreroom/src/main/resources/lib/Nslook.dll
-
BINstoreroom/src/main/resources/lib/OsCore.dll
-
BINstoreroom/src/main/resources/lib/PlaySdkM4.dll
-
BINstoreroom/src/main/resources/lib/RegServer.dll
-
BINstoreroom/src/main/resources/lib/SPDecSDK.dll
-
BINstoreroom/src/main/resources/lib/SPDecUtil.dll
-
BINstoreroom/src/main/resources/lib/TDStreamEnc.dll
-
BINstoreroom/src/main/resources/lib/VideoDecV33.dll
-
BINstoreroom/src/main/resources/lib/VideoMjpegDec.dll
-
BINstoreroom/src/main/resources/lib/jna.jar
-
BINstoreroom/src/main/resources/lib/libcurl.dll
-
BINstoreroom/src/main/resources/lib/libmp4adpter.dll
-
BINstoreroom/src/main/resources/lib/libmp4v2.dll
-
BINstoreroom/src/main/resources/lib/proxysdk.dll
-
BINstoreroom/src/main/resources/lib/pthreadVC2.dll
-
BINstoreroom/src/main/resources/lib/rt.jar
-
15storeroom/src/main/resources/lib/sdk_log_config.ini
-
BINstoreroom/src/main/resources/lib/swing-layout-1.0.3.jar
-
12storeroom/src/test/java/videoTest.java
-
5system/pom.xml
@ -0,0 +1,600 @@ |
|||
package com.storeroom.modules.storeroom3d.config.common; |
|||
|
|||
import com.sun.jna.Callback; |
|||
import com.sun.jna.Library; |
|||
import com.sun.jna.Pointer; |
|||
import com.sun.jna.Structure; |
|||
import com.sun.jna.ptr.IntByReference; |
|||
import com.sun.jna.win32.StdCallLibrary; |
|||
|
|||
import java.util.List; |
|||
|
|||
public interface NVSSDK extends Library { |
|||
public static final int WM_USER = 0x0400; // |
|||
|
|||
public static final int WM_MAIN_MESSAGE = WM_USER + 1001; // 系统消息 |
|||
public static final int WM_PARACHG = WM_USER + 1002; // 参数改变消息 |
|||
public static final int WM_ALARM = WM_USER + 1003; // 报警消息 |
|||
public static final int WCM_ERR_ORDER = 2; |
|||
public static final int WCM_ERR_DATANET = 3; |
|||
public static final int WCM_LOGON_NOTIFY = 7; |
|||
public static final int WCM_VIDEO_HEAD = 8; |
|||
public static final int WCM_VIDEO_DISCONNECT = 9; |
|||
public static final int WCM_RECORD_ERR = 13; |
|||
public static final int WCM_QUERYFILE_FINISHED = 18; |
|||
public static final int WCM_DWONLOAD_FINISHED = 19; |
|||
public static final int WCM_DWONLOAD_FAULT = 20; |
|||
public static final int WCM_DOWNLOAD_INTERRUPT = 29; |
|||
|
|||
public static final int LOGON_SUCCESS = 0; |
|||
public static final int LOGON_ING = 1; |
|||
public static final int LOGON_RETRY = 2; |
|||
public static final int LOGON_DSMING = 3; |
|||
public static final int LOGON_FAILED = 4; |
|||
public static final int LOGON_TIMEOUT = 5; |
|||
public static final int NOT_LOGON = 6; |
|||
public static final int LOGON_DSMFAILED = 7; |
|||
public static final int LOGON_DSMTIMEOUT = 8; |
|||
public static final int PLAYER_PLAYING = 0x02; |
|||
public static final int USER_ERROR = 0x10000000; |
|||
|
|||
public static final int MOVE_UP = 1; |
|||
public static final int MOVE_UP_STOP = 2; |
|||
public static final int MOVE_DOWN = 3; |
|||
public static final int MOVE_DOWN_STOP = 4; |
|||
public static final int MOVE_LEFT = 5; |
|||
public static final int MOVE_LEFT_STOP = 6; |
|||
public static final int MOVE_RIGHT = 7; |
|||
public static final int MOVE_RIGHT_STOP = 8; |
|||
public static final int MOVE_UP_LEFT = 9; |
|||
public static final int MOVE_UP_LEFT_STOP = 10; |
|||
public static final int MOVE_UP_RIGHT = 11; |
|||
public static final int MOVE_UP_RIGHT_STOP = 12; |
|||
public static final int MOVE_DOWN_LEFT = 13; |
|||
public static final int MOVE_DOWN_LEFT_STOP = 14; |
|||
public static final int MOVE_DOWN_RIGHT = 15; |
|||
public static final int MOVE_DOWN_RIGHT_STOP = 16; |
|||
|
|||
public static final int HOR_AUTO = 21; |
|||
public static final int HOR_AUTO_STOP = 22; |
|||
|
|||
public static final int ZOOM_BIG = 31; |
|||
public static final int ZOOM_BIG_STOP = 32; |
|||
public static final int ZOOM_SMALL = 33; |
|||
public static final int ZOOM_SMALL_STOP = 34; |
|||
public static final int FOCUS_FAR = 35; |
|||
public static final int FOCUS_FAR_STOP = 36; |
|||
public static final int FOCUS_NEAR = 37; |
|||
public static final int FOCUS_NEAR_STOP = 38; |
|||
public static final int IRIS_OPEN = 39; |
|||
public static final int IRIS_OPEN_STOP = 40; |
|||
public static final int IRIS_CLOSE = 41; |
|||
public static final int IRIS_CLOSE_STOP = 42; |
|||
public static final int LIGHT_ON = 43; |
|||
public static final int LIGHT_OFF = 44; |
|||
public static final int POWER_ON = 45; |
|||
public static final int POWER_OFF = 46; |
|||
public static final int RAIN_ON = 47; |
|||
public static final int RAIN_OFF = 48; |
|||
|
|||
public static final int MOVE = 60; |
|||
public static final int MOVE_STOP = 61; |
|||
public static final int CALL_VIEW = 62; |
|||
public static final int SET_VIEW = 63; |
|||
|
|||
public static final int ALARM_VDO_MOTION = 0; |
|||
public static final int ALARM_VDO_REC = 1; |
|||
public static final int ALARM_VDO_LOST = 2; |
|||
public static final int ALARM_VDO_INPORT = 3; |
|||
public static final int ALARM_VDO_OUTPORT = 4; |
|||
public static final int ALARM_VDO_COVER = 5; |
|||
public static final int ALARM_VCA_INFO = 6; // 智能分析报警信息 |
|||
|
|||
public static final int T_AUDIO8 = 0; |
|||
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 |
|||
|
|||
//Front end video query |
|||
public static final int CMD_NETFILE_QUERY_FILE = 0; |
|||
public static final int CMD_NETFILE_ITS_QUERY_DATA = 1; |
|||
public static final int CMD_NETFILE_ITS_GETTOTALCOUNT = 2; |
|||
public static final int CMD_NETFILE_ITS_GETCURRENTCOUNT = 3; |
|||
public static final int CMD_NETFILE_ITS_GETRESULT = 4; |
|||
public static final int CMD_NETFILE_ITS_QUERY_TOTALCOUNT = 5; |
|||
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_OPERATE_RECORD = 1; |
|||
public static final int DOWNLOAD_FLAG_BREAK_CONTINUE = 2; |
|||
|
|||
public static final int DOWNLOAD_CMD_FILE = 0; |
|||
public static final int DOWNLOAD_CMD_TIMESPAN = 1; |
|||
public static final int DOWNLOAD_CMD_CONTROL = 2; |
|||
public static final int DOWNLOAD_CMD_FILE_CONTINUE = 3; |
|||
public static final int DOWNLOAD_CMD_GET_FILE_COUNT = 4; |
|||
public static final int DOWNLOAD_CMD_GET_FILE_INFO = 5; |
|||
public static final int DOWNLOAD_CMD_SET_FILE_INFO = 6; |
|||
|
|||
//download file type |
|||
public static final int DOWNLOAD_FILE_TYPE_SDV = 0; |
|||
public static final int DOWNLOAD_FILE_TYPE_PS = 3; |
|||
public static final int DOWNLOAD_FILE_TYPE_TS = 6; |
|||
|
|||
public static final int VI_FRAME = 0; |
|||
public static final int VP_FRAME = 1; |
|||
public static final int AUDIO_FRAME = 5; |
|||
|
|||
public static final int RAW_VIDEO_H264 = 1; |
|||
public static final int RAW_VIDEO_MPEG4 = 2; |
|||
public static final int RAW_VIDEO_MJPEG = 41; |
|||
public static final int RAW_VIDEO_H265 = 23; |
|||
|
|||
public static final int RAW_AUDIO_G711_A = 0x01; |
|||
public static final int RAW_AUDIO_G711_U = 0x02; |
|||
public static final int RAW_AUDIO_ADPCM_A = 0x03; |
|||
public static final int RAW_AUDIO_AAC = 0x16; |
|||
|
|||
|
|||
|
|||
public static class RECT extends Structure implements Structure.ByValue { |
|||
public int left; |
|||
public int top; |
|||
public int right; |
|||
public int bottom; |
|||
|
|||
@Override |
|||
protected List getFieldOrder() { |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public static class SDK_VERSION extends Structure { |
|||
public short m_ulMajorVersion; |
|||
public short m_ulMinorVersion; |
|||
public short m_ulBuilder; |
|||
public String m_cVerInfo; |
|||
|
|||
@Override |
|||
protected List getFieldOrder() { |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public static class CLIENTINFO extends Structure { |
|||
public CLIENTINFO() { |
|||
allocateMemory(); |
|||
} |
|||
|
|||
@Override |
|||
protected List getFieldOrder() { |
|||
return null; |
|||
} |
|||
|
|||
public int m_iServerID; |
|||
public int m_iChannelNo; |
|||
public byte[] m_cNetFile = new byte[255]; |
|||
public byte[] m_cRemoteIP = new byte[16]; |
|||
public int m_iNetMode; |
|||
public int m_iTimeout; |
|||
public int m_iTTL; |
|||
public int m_iBufferCount; |
|||
public int m_iDelayNum; |
|||
public int m_iDelayTime; |
|||
public int m_iStreamNO; |
|||
public int m_iFlag; |
|||
public int m_iPosition; |
|||
public int m_iSpeed; |
|||
} |
|||
|
|||
|
|||
public static class ENCODERINFO extends Structure { |
|||
public byte[] m_cHostName = new byte[32]; |
|||
public byte[] m_cEncoder = new byte[16]; |
|||
public int m_iRecvMode; |
|||
public byte[] m_cProxy = new byte[16]; |
|||
public byte[] m_cFactoryID = new byte[32]; //ProductID |
|||
public int m_iPort;//NVS port |
|||
public int m_nvsType; //NVS type(NVS_T or NVS_S or DVR ...eg) |
|||
public int m_iChanNum; |
|||
public int m_iLogonState; |
|||
public int m_iServerType; |
|||
|
|||
@Override |
|||
protected List getFieldOrder() { |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public static class PicTime extends Structure { |
|||
|
|||
public int uiYear; |
|||
public int uiMonth; |
|||
public int uiDay; |
|||
public int uiWeek; |
|||
public int uiHour; |
|||
public int uiMinute; |
|||
public int uiSecondsr; |
|||
public int uiMilliseconds; |
|||
|
|||
@Override |
|||
protected List getFieldOrder() { |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public static class PicData extends Structure { |
|||
|
|||
public PicTime tPicTime; |
|||
public int iDataLen; |
|||
public Pointer pcPicData; |
|||
|
|||
@Override |
|||
protected List getFieldOrder() { |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public static class VcaPicStream extends Structure { |
|||
|
|||
public int iStructLen; |
|||
public int iWidth; |
|||
public int iHeight; |
|||
public int iChannelID; |
|||
public int iEventType; |
|||
public int iRuleID; |
|||
public int iTargetID; |
|||
public int iTargetType; |
|||
public int iTargetSpeed; |
|||
public int iTargetDirection; |
|||
public RECT tTargetPosition; |
|||
public int iPresetNo; |
|||
public byte[] m_cRemoteIP = new byte[16]; |
|||
public int iPicCount; |
|||
public PicData[] tPicData = new PicData[3]; |
|||
|
|||
@Override |
|||
protected List getFieldOrder() { |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public static class FaceAttribute extends Structure { |
|||
public int iType; |
|||
public int iValue; |
|||
|
|||
@Override |
|||
protected List getFieldOrder() { |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
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; |
|||
|
|||
@Override |
|||
protected List getFieldOrder() { |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public static class FacePicStream extends Structure { |
|||
|
|||
public int iStructLen; |
|||
public int iSizeOfFull; //The size of strcut PicData |
|||
public Pointer tFullData; |
|||
public int iFaceCount; |
|||
public int iSizeOfFace; //The size of strcut FacePicData |
|||
public Pointer[] tPicData = new Pointer[32]; |
|||
|
|||
@Override |
|||
protected List getFieldOrder() { |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public static class PICSTREAM_INFO extends Structure { |
|||
|
|||
public byte[] RecvBuffer = new byte[200*1024];//此处的400应不小于最大报警报文长度 |
|||
|
|||
@Override |
|||
protected List getFieldOrder() { |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
|
|||
public static interface MAIN_NOTIFY extends Callback { |
|||
void MainNotify(int _iLogonID, int _iwParam, Pointer _ilParam, |
|||
Pointer _pUserData); |
|||
} |
|||
|
|||
public static interface ALARM_NOTIFY extends Callback { |
|||
void AlarmNotify(int _iLogonID, int _iChannel, |
|||
int _iAlarmState, int _iAlarmType, Pointer _pUserData); |
|||
} |
|||
|
|||
public static interface PARACHANGE_NOTIFY extends Callback { |
|||
void ParaChangeNotify(int _iLogonID, int _iChannel, int _iParaType, |
|||
Pointer _strPara, Pointer _pUserData); |
|||
} |
|||
|
|||
public static interface COMRECV_NOTIFY extends Callback { |
|||
void ComRecvNotify(int _iLogonID, Pointer _pData, int _iLen, |
|||
int _iComNo, Pointer _pUserData); |
|||
} |
|||
|
|||
public static interface PROXY_NOTIFY extends Callback { |
|||
void ProxyNotify(int _iLogonID, int _iCmdKey, Pointer _pData, |
|||
int _iLen, Pointer _pUserData); |
|||
} |
|||
|
|||
public static interface RECVDATA_NOTIFY extends StdCallLibrary.StdCallCallback { |
|||
void RecvDataNotify(int _ulID, Pointer _ucData, int _iLen, int _iFlag, |
|||
Pointer _lpUserData); |
|||
} |
|||
|
|||
public static interface NET_PICSTREAM_NOTIFY extends StdCallLibrary.StdCallCallback { |
|||
int PicDataNotify(int _ulID, int _lCommand, Pointer _tInfo, int _iLen, |
|||
Pointer _lpUserData); |
|||
} |
|||
|
|||
public static class NetPicPara extends Structure { |
|||
public int iStructLen; //Structure length |
|||
public int iChannelNo; |
|||
public NET_PICSTREAM_NOTIFY cbkPicStreamNotify; |
|||
public Pointer pvUser; |
|||
|
|||
@Override |
|||
protected List getFieldOrder() { |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public static class PointerSize extends Structure { |
|||
public Pointer pPointer; |
|||
|
|||
@Override |
|||
protected List getFieldOrder() { |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
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 |
|||
|
|||
@Override |
|||
protected List getFieldOrder() { |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public static class QueryFileChannel extends Structure{ |
|||
public int iChannelNo; |
|||
public int iStreamNo; |
|||
|
|||
@Override |
|||
protected List getFieldOrder() { |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
public static class ArrayQueryFileChannel extends Structure { |
|||
public QueryFileChannel[] tArry = new QueryFileChannel[2]; |
|||
|
|||
@Override |
|||
protected List getFieldOrder() { |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
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 |
|||
|
|||
@Override |
|||
protected List getFieldOrder() { |
|||
return null; |
|||
} |
|||
} |
|||
|
|||
//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 |
|||
|
|||
@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 |
|||
|
|||
@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]; |
|||
|
|||
@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]; |
|||
|
|||
@Override |
|||
protected List getFieldOrder() { |
|||
return null; |
|||
} |
|||
}; |
|||
|
|||
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 |
|||
|
|||
@Override |
|||
protected List getFieldOrder() { |
|||
return null; |
|||
} |
|||
}; |
|||
|
|||
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 |
|||
|
|||
@Override |
|||
protected List getFieldOrder() { |
|||
return null; |
|||
} |
|||
}; |
|||
|
|||
//Not decode the standard data before the pure h264 data |
|||
public static interface RAWFRAME_NOTIFY extends StdCallLibrary.StdCallCallback { |
|||
void rawFrameNotify(int _uiID, Pointer _pcData, int _iLen, RAWFRAME_INFO _ptRawFrameInfo, Pointer _pvUsrData); |
|||
} |
|||
|
|||
int NetClient_GetVersion(SDK_VERSION _ver); |
|||
|
|||
int NetClient_SetNotifyFunction_V4(MAIN_NOTIFY _cbkMainNotify, |
|||
ALARM_NOTIFY _cbkAlarmNotify, |
|||
PARACHANGE_NOTIFY _cbkParaChangeNotify, |
|||
COMRECV_NOTIFY _cbkComRecv, |
|||
PROXY_NOTIFY _cbkProxyNotify); |
|||
|
|||
int NetClient_SetPort(int _iServerPort, int _iClientPort); |
|||
|
|||
int NetClient_Startup_V4(int _iServerPort, int _iClientPort, int _iWnd); |
|||
|
|||
int NetClient_Cleanup(); |
|||
|
|||
int NetClient_Logon(String _cProxy, String _cIP, String _cUserName, |
|||
String _cPassword, String _pcProID, int _iPort); |
|||
|
|||
int NetClient_Logoff(int _iLogonID); |
|||
|
|||
int NetClient_StartRecvEx(IntByReference _ulConID, CLIENTINFO _cltInfo, |
|||
RECVDATA_NOTIFY _cbkDataNotify, Pointer _pUserData); |
|||
|
|||
int NetClient_StartRecvNetPicStream(int _iLogonID, NetPicPara _ptPara, int _iBufLen, IntByReference _puiRecvID); |
|||
|
|||
int NetClient_StopRecv(int _ulConID); |
|||
|
|||
int NetClient_StartCaptureData(int _ulConID); |
|||
|
|||
int NetClient_StartPlay(int _ulConID, int _hWnd, RECT _rcShow, int _iDecflag); |
|||
|
|||
int NetClient_StopPlay(int _ulConID); |
|||
|
|||
int NetClient_StartCaptureFile(int _ulConID, String _cFileName, |
|||
int _iRecFileType); |
|||
|
|||
int NetClient_StopCaptureFile(int _ulConID); |
|||
int NetClient_GetLogonStatus(int _iLogonID); |
|||
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_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); |
|||
} |
@ -0,0 +1,120 @@ |
|||
package com.storeroom.modules.storeroom3d.config.common; |
|||
|
|||
import com.sun.jna.Native; |
|||
import com.sun.jna.Pointer; |
|||
import com.sun.jna.ptr.IntByReference; |
|||
import com.storeroom.modules.storeroom3d.config.common.NVSSDK.*; |
|||
|
|||
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)); |
|||
|
|||
public static int GetVersion(SDK_VERSION _ver) { |
|||
return nvssdk.NetClient_GetVersion(_ver); |
|||
} |
|||
|
|||
public static int SetNotifyFunction(MAIN_NOTIFY _cbkMainNotify, |
|||
ALARM_NOTIFY _cbkAlarmNotify, PARACHANGE_NOTIFY _cbkParaChangeNotify) { |
|||
return nvssdk.NetClient_SetNotifyFunction_V4(_cbkMainNotify, _cbkAlarmNotify, _cbkParaChangeNotify, null, null); |
|||
} |
|||
|
|||
public static int SetPort(int _iServerPort, int _iClientPort) { |
|||
return nvssdk.NetClient_SetPort(_iServerPort, _iClientPort); |
|||
} |
|||
|
|||
public static int Startup() { |
|||
return nvssdk.NetClient_Startup_V4(0, 0, 0); |
|||
} |
|||
|
|||
public static int Cleanup() { |
|||
return nvssdk.NetClient_Cleanup(); |
|||
} |
|||
|
|||
public static int Logon(String _cProxy, String _cIP, String _cUserName, |
|||
String _cPassword, String _pcProID, int _iPort) { |
|||
return nvssdk.NetClient_Logon(_cProxy, _cIP, _cUserName, |
|||
_cPassword, _pcProID, _iPort); |
|||
} |
|||
|
|||
public static int Logoff(int _iLogonID) { |
|||
return nvssdk.NetClient_Logoff(_iLogonID); |
|||
} |
|||
|
|||
public static int StartRecv(IntByReference _ulConID, CLIENTINFO _cltInfo, |
|||
RECVDATA_NOTIFY _cbkDataNotify) { |
|||
return nvssdk.NetClient_StartRecvEx(_ulConID, _cltInfo, |
|||
_cbkDataNotify, Pointer.NULL); |
|||
} |
|||
|
|||
public static int StopRecv(int _ulConID) { |
|||
return nvssdk.NetClient_StopRecv(_ulConID); |
|||
} |
|||
|
|||
public static int StartCaptureData(int _ulConID) { |
|||
return nvssdk.NetClient_StartCaptureData(_ulConID); |
|||
} |
|||
|
|||
public static int StartPlay(int _ulConID, Component _hWnd, int _iDecflag) { |
|||
int hWnd = (int) Native.getComponentID(_hWnd); |
|||
RECT rcShow = new RECT(); |
|||
return nvssdk.NetClient_StartPlay(_ulConID, hWnd, rcShow, |
|||
_iDecflag); |
|||
} |
|||
|
|||
public static int StopPlay(int _ulConID) { |
|||
return nvssdk.NetClient_StopPlay(_ulConID); |
|||
} |
|||
|
|||
public static int StartCaptureFile(int _ulConID, String _cFileName, |
|||
int _iRecFileType) { |
|||
return nvssdk.NetClient_StartCaptureFile(_ulConID, |
|||
_cFileName, _iRecFileType); |
|||
} |
|||
|
|||
public static int StopCaptureFile(int _ulConID) { |
|||
return nvssdk.NetClient_StopCaptureFile(_ulConID); |
|||
} |
|||
|
|||
public static int StartRecvNetPicStream(int _iLogonID, NetPicPara _ptPara, int _iBufLen, IntByReference _puiRecvID) { |
|||
return nvssdk.NetClient_StartRecvNetPicStream(_iLogonID, _ptPara, _iBufLen, _puiRecvID); |
|||
} |
|||
|
|||
public static int GetLogonStatus(int _iLogonID) { |
|||
return nvssdk.NetClient_GetLogonStatus(_iLogonID); |
|||
} |
|||
|
|||
public static int GetDevInfo(int _iLogonID, NVSSDK.ENCODERINFO _pEncoderInfo) { |
|||
return nvssdk.NetClient_GetDevInfo(_iLogonID, _pEncoderInfo); |
|||
} |
|||
|
|||
public static int Query_V4(int _iLogonID, int _iCmd, int _iChannel, Pointer _pvCmdBuf, int _iBufLen) { |
|||
return nvssdk.NetClient_Query_V4(_iLogonID, _iCmd, _iChannel, _pvCmdBuf, _iBufLen); |
|||
} |
|||
|
|||
public static int NetFileGetFileCount(int _iLogonID, IntByReference _piTotalCount, IntByReference _piCurrentCount) { |
|||
return nvssdk.NetClient_NetFileGetFileCount(_iLogonID, _piTotalCount, _piCurrentCount); |
|||
} |
|||
|
|||
public static int NetFileGetQueryfileEx(int _iLogonID, int _iFileIndex, NVS_FILE_DATA_EX _pFileInfo) { |
|||
return nvssdk.NetClient_NetFileGetQueryfileEx(_iLogonID, _iFileIndex, _pFileInfo); |
|||
} |
|||
|
|||
public static int NetFileDownload(IntByReference _uiConID, int _iLogonID, int _iCmd, Pointer _pvBuf, int _iBufSize) { |
|||
return nvssdk.NetClient_NetFileDownload(_uiConID, _iLogonID, _iCmd, _pvBuf, _iBufSize); |
|||
} |
|||
|
|||
public static int NetFileStopDownloadFile(int _uiConID) { |
|||
return nvssdk.NetClient_NetFileStopDownloadFile(_uiConID); |
|||
} |
|||
|
|||
public static int SetRawFrameCallBack(int _uiConID, RAWFRAME_NOTIFY _cbkGetFrame, Pointer _pContext) { |
|||
return nvssdk.NetClient_SetRawFrameCallBack(_uiConID, _cbkGetFrame, _pContext); |
|||
} |
|||
|
|||
public static int NetFileGetDownloadPos(int _uiConID, IntByReference _piPos, IntByReference _piDLSize) { |
|||
return nvssdk.NetClient_NetFileGetDownloadPos(_uiConID, _piPos, _piDLSize); |
|||
} |
|||
} |
@ -0,0 +1,192 @@ |
|||
package com.storeroom.modules.storeroom3d.config.common; |
|||
|
|||
|
|||
import com.sun.jna.Pointer; |
|||
import com.sun.jna.ptr.IntByReference; |
|||
|
|||
public class VideoClient { |
|||
|
|||
int m_iLogonID = -1; |
|||
int m_iConnectID = -1; |
|||
int m_iTotalCount = 0; |
|||
int m_iCurrentCount = 0; |
|||
String[] suffix = {".sdv", "", "", ".ps", "", "", ".ts"}; |
|||
|
|||
public void LogonNotify(String strIP, String strID, int iLogonID, int iLogonState) { |
|||
String strMsg = new String(); |
|||
m_iLogonID = -1; |
|||
switch (iLogonState) { |
|||
case NVSSDK.LOGON_SUCCESS: { |
|||
m_iLogonID = iLogonID; |
|||
strMsg = "LOGON_SUCCESS"; |
|||
break; |
|||
} |
|||
case NVSSDK.LOGON_FAILED: { |
|||
strMsg = "LOGON_FAILED"; |
|||
break; |
|||
} |
|||
case NVSSDK.LOGON_TIMEOUT: { |
|||
strMsg = "LOGON_TIMEOUT"; |
|||
break; |
|||
} |
|||
case NVSSDK.LOGON_RETRY: { |
|||
strMsg = "LOGON_RETRY"; |
|||
break; |
|||
} |
|||
case NVSSDK.LOGON_ING: { |
|||
strMsg = "LOGON_ING"; |
|||
break; |
|||
} |
|||
default: { |
|||
System.out.println("[WCM_LOGON_NOTIFY][" + iLogonState + "] IP(" |
|||
+ strIP + "),ID(" + strID + "),LogonID(" + iLogonID + ")"); |
|||
break; |
|||
} |
|||
} |
|||
System.out.println("[WCM_LOGON_NOTIFY][" + strMsg + "] IP(" + strIP |
|||
+ "),ID(" + strID + "),LogonID(" + iLogonID + ")"); |
|||
} |
|||
|
|||
; |
|||
|
|||
NVSSDK.ALARM_NOTIFY cbkAlarm = new NVSSDK.ALARM_NOTIFY() { |
|||
public void AlarmNotify(int _iLogonID, int _iChannel, |
|||
int _iAlarmState, int _iAlarmType, Pointer _pUserData) { |
|||
} |
|||
}; |
|||
|
|||
NVSSDK.PARACHANGE_NOTIFY cbkParaChange = new NVSSDK.PARACHANGE_NOTIFY() { |
|||
public void ParaChangeNotify(int iLogonID, int iChannel, int paraType, |
|||
Pointer para, Pointer noitfyUserData) { |
|||
} |
|||
}; |
|||
|
|||
NVSSDK.RECVDATA_NOTIFY cbkRecvData = new NVSSDK.RECVDATA_NOTIFY() { |
|||
public void RecvDataNotify(int _ulID, Pointer data, int len, int _iFlag, |
|||
Pointer _lpUserData) { |
|||
System.out.println("[RECVDATA_NOTIFY] ConnID(" + _ulID + "),DataLen(" |
|||
+ len + ")"); |
|||
} |
|||
}; |
|||
|
|||
NVSSDK.MAIN_NOTIFY cbkMain = new NVSSDK.MAIN_NOTIFY() { |
|||
public void MainNotify(int iLogonID, int wParam, Pointer lParam, Pointer noitfyUserData) { |
|||
int iMsgType = wParam & 0xFFFF; |
|||
switch (iMsgType) { |
|||
case NVSSDK.WCM_LOGON_NOTIFY: { |
|||
try { |
|||
int iLogonStatus = NetClient.GetLogonStatus(iLogonID); |
|||
NVSSDK.ENCODERINFO tDevInfo = new NVSSDK.ENCODERINFO(); |
|||
NetClient.GetDevInfo(iLogonID, tDevInfo); |
|||
|
|||
String strIP = new String(tDevInfo.m_cEncoder).trim(); |
|||
String strID = new String(tDevInfo.m_cFactoryID).trim(); |
|||
LogonNotify(strIP, strID, iLogonID, iLogonStatus); |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} |
|||
break; |
|||
} |
|||
case NVSSDK.WCM_QUERYFILE_FINISHED: { |
|||
try { |
|||
IntByReference iTotalCount = new IntByReference(); |
|||
IntByReference iCurrentCount = new IntByReference(); |
|||
int iRet = NetClient.NetFileGetFileCount(m_iLogonID, iTotalCount, iCurrentCount); |
|||
if (0 == iRet) { |
|||
m_iTotalCount = iTotalCount.getValue(); |
|||
m_iCurrentCount = iCurrentCount.getValue(); |
|||
System.out.println("MainNotify:WCM_QUERYFILE_FINISHED! m_iTotalCount= " |
|||
+ m_iTotalCount + ", m_iCurrentCount=" + m_iCurrentCount); |
|||
} else { |
|||
System.out.println("NetFileGetFileCount fail!iRet= " + iRet); |
|||
} |
|||
} catch (Exception e) { |
|||
e.printStackTrace(); |
|||
} |
|||
break; |
|||
} |
|||
case NVSSDK.WCM_DWONLOAD_FINISHED: { |
|||
System.out.println("MainNotify:WCM_DWONLOAD_FINISHED!下载成功!"); |
|||
if (null == lParam) { |
|||
m_iConnectID = 0; |
|||
} else { |
|||
m_iConnectID = (int) lParam.nativeValue(lParam); |
|||
} |
|||
NetClient.NetFileStopDownloadFile(m_iConnectID); |
|||
break; |
|||
} |
|||
case NVSSDK.WCM_DWONLOAD_FAULT: { |
|||
System.out.println("MainNotify:WCM_DWONLOAD_FAULT!下载失败!"); |
|||
if (null == lParam) { |
|||
m_iConnectID = 0; |
|||
} else { |
|||
m_iConnectID = (int) lParam.nativeValue(lParam); |
|||
} |
|||
NetClient.NetFileStopDownloadFile(m_iConnectID); |
|||
break; |
|||
} |
|||
case NVSSDK.WCM_DOWNLOAD_INTERRUPT: { |
|||
System.out.println("MainNotify:WCM_DOWNLOAD_INTERRUPT!下载中断!"); |
|||
if (null == lParam) { |
|||
m_iConnectID = 0; |
|||
} else { |
|||
m_iConnectID = (int) lParam.nativeValue(lParam); |
|||
} |
|||
NetClient.NetFileStopDownloadFile(m_iConnectID); |
|||
break; |
|||
} |
|||
default: |
|||
break; |
|||
} |
|||
} |
|||
}; |
|||
|
|||
private int SDKInit() { |
|||
NVSSDK.SDK_VERSION ver = new NVSSDK.SDK_VERSION(); |
|||
int iRet = NetClient.GetVersion(ver); |
|||
System.out.println("[SDK_VERSION]" + ver.m_cVerInfo); |
|||
|
|||
iRet = NetClient.SetNotifyFunction(cbkMain, cbkAlarm, cbkParaChange); |
|||
System.out.println("SetNotifyFunction(" + iRet + ")"); |
|||
|
|||
iRet = NetClient.Startup(); |
|||
System.out.println("Startup(" + iRet + ")"); |
|||
|
|||
return 0; |
|||
} |
|||
|
|||
; |
|||
|
|||
/** |
|||
* 登录设备 |
|||
* |
|||
* @param strIP ip 地址 |
|||
* @param iPort 端口号 |
|||
* @param strUserName 用户名 |
|||
* @param strUserPwd 密码 |
|||
* @return |
|||
*/ |
|||
public int LogonDevice(String strIP, int iPort, String strUserName, String strUserPwd) { |
|||
|
|||
VideoClient tPlayback = new VideoClient(); |
|||
tPlayback.SDKInit(); //初始化SDK |
|||
// Scanner scanInput = new Scanner(System.in); |
|||
System.out.println("Logon" + strIP + ":" + iPort + "-" +strUserName + "-" + strUserPwd); |
|||
while (true) { |
|||
m_iLogonID = NetClient.Logon("", strIP, strUserName, strUserPwd, "", iPort); |
|||
int iLogonStatus = NetClient.GetLogonStatus(m_iLogonID); |
|||
if (iLogonStatus == NVSSDK.LOGON_SUCCESS) { |
|||
break; |
|||
} |
|||
|
|||
try { |
|||
Thread.currentThread(); |
|||
Thread.sleep(1000); |
|||
} catch (InterruptedException e) { |
|||
System.err.println("Interrupted"); |
|||
} |
|||
} |
|||
|
|||
return 0; |
|||
} |
|||
} |
@ -0,0 +1,15 @@ |
|||
;Terminal log config |
|||
[Terminal] |
|||
;error log-100 message log-200 debug log-300 |
|||
Level=100 |
|||
|
|||
;File log config |
|||
[File] |
|||
;error log-100 message log-200 debug log-300 |
|||
Level=100 |
|||
;Log file max size,Unit:MB |
|||
Size=2048 |
|||
;Log file savetime,Unit:Days |
|||
SavaTime=30 |
|||
;Min disk free space,Percent[0-100] |
|||
FreePercent=10 |
@ -0,0 +1,12 @@ |
|||
import com.storeroom.modules.storeroom3d.config.common.VideoClient; |
|||
import org.junit.jupiter.api.Test; |
|||
|
|||
public class videoTest { |
|||
|
|||
|
|||
@Test |
|||
public void loginVideo() { |
|||
VideoClient videoClient = new VideoClient(); |
|||
videoClient.LogonDevice("192.168.99.21",3000,"admin","yxk63603325"); |
|||
} |
|||
} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue