At present, our development of EasyCVR private protocol SDK has entered the test stage. EasyCVR can access Huawei video platform in the form of private protocol SDK (eSDK). The first step of access is resource preparation interface.
Initialization and release
1. Set the eSDK log file path. The default log file path is… / log/SDK”
Applicable to the following operating systems: Windows 7 Professional 32-bit, Windows 7 Professional 64-bit, Windows Server 2008 R2 64-bit, Windows Server 2016 SUSE Linux 11 SP1(2.6.16.21 or later) 64-bit, Euler Linux(above 2.8) 64-bit, CentOS Linux(above 7.6) 64-bit, Ubuntu(16.04) 64-bit, and CentOS 7.6_ARM 64-bit
If you call the interface to set the log file path, do so before initializing the interface. You can also modify the configuration file to set the log file path in the \bin\config\log.xml directory.
//cpp code IVS_INT32 iRet = IVS_SDK_SetLogPath(".. \\ivs_log"); If (IVS_SUCCEED == iRet) {Copy the code
2. Initialize the entire SDK system, pre-allocate memory and other operations
//cpp code IVS_INT32 iRet = IVS_SDK_Init(); If (IVS_SUCCEED == iRet) {// Initialize SDK successfully}Copy the code
3. Release SDK resources
//cpp code IVS_INT32 iRet = IVS_SDK_Cleanup(); If (IVS_SUCCEED == iRet) {// Release SDK successfully}Copy the code
Set the callback function
1. Set the event callback function
// CPP code /* callback, */ void _STDCall EventCallBackFunc(IVS_INT32 iEventType, IVS_VOID* pEventBuf, IVS_UINT32 uiBufSize, IVS_VOID* pUserData) {if (IVS_EVENT_DOWNLOAD_FAILED == iEventType)// For the definition of the event type, see the macro definition {STREAM_EXCEPTION_INFO* ExceptionInfo = (STREAM_EXCEPTION_INFO*)pEventBuf; if (NULL == ExceptionInfo) { return; } /* If (IVS_PLAYER_RET_RTSP_NORMAL_STOP == ExceptionInfo->iExceptionCode) {CIVSDownLoadPage* pDownloadPage = (CIVSDownLoadPage*)pUserData; pDownloadPage->PostMessage(WM_DOWNLOADSUCCESS); }}} /* Set the callback function, Use the above callback function */ IVS_SDK_SetEventCallBack(iSessionID, (EventCallBack)EventCallBackFunc, &m_DownLoadPage);Copy the code
2. Set the video metadata callback function
//cpp code void ProcessMetaTlvL1(char *data, unsigned int size) { TLV *tlv1 = (TLV *)data; if (tlv1->type ! = METADATA_TYPE || tlv1->length + 8 > size) { return; } ProcessMetaTlvL2(tlv1->data, tlv1->length); } void ProcessMetaTlvL2(char *base, unsigned int size) { unsigned int off = 0; while ((off + 8) < size) { TLV *tlv = (TLV *)(base + off); off += (8 + tlv->length); if (! tlv->length || off > size) { return; } switch (tlv->type) { case COMMON: case TARGET: ProcessMetaTlvL3(tlv->data, tlv->length); break; case RULE: ProcessMetaTlvL3(tlv->data, tlv->length); break; default: break; } } } void ProcessMetaTlvL3(char *base, unsigned int size) { unsigned int uiStatus = 0; unsigned int uiTmpObjectID = 0; unsigned int off = 0; while ((off + 8) < size) { TLV *tlv = (TLV *)(base + off); off += (8 + tlv->length); if (! tlv->length || off > size) { return; } switch (tlv->type) { case OBJ_ID: // TODO OBJ_ID process break; case OBJ_POS: // TODO OBJ_POS process break; case OBJ_STATUS: // TODO OBJ_STATUS process break; default: // TODO default process break; }}} /* Callback function, */ void _STDCall pfnMetadataCallbackFunc(IVS_UINT32 uiTimeStamp, IVS_VOID* pData, IVS_UINT32 uiLen, IVS_VOID* pUser); {if (0xAA == *((unsigned char*)pData)) {ProcessMetaTlvL1((char*)pData+1, uiLen-1); } return; } / * set a callback function, the use of the callback function to achieve the above * / IVS_SDK_SetVideoMetadataCallBack (iSessionID ulPlayHandle, pfnMetadataCallbackFunc, pUserDataCopy the code