Skip to content

Instantly share code, notes, and snippets.

@alexsunday
Created July 6, 2015 10:19
Show Gist options
  • Save alexsunday/4e1d80cee96d4f60cad6 to your computer and use it in GitHub Desktop.
Save alexsunday/4e1d80cee96d4f60cad6 to your computer and use it in GitHub Desktop.
海康摄像头使用回调模式取得数据。
#include <stdio.h>
#include <windows.h>
#include "HCNetSDK.h"
void CALLBACK mucbfunc(LONG lRealHandle,DWORD dwDataType,BYTE *pBuffer,DWORD dwBufSize,void *pUser)
{
printf("IN [%d]\n", dwBufSize);
}
int main(int argc, char** argv)
{
printf("HELLO,WORLD\n");
NET_DVR_Init();
NET_DVR_DEVICEINFO_V30 devInfo;
LONG lUserID = NET_DVR_Login_V30("183.249.250.166", 8000,"admin", "jr123123", &devInfo);
printf("login user id: [%d]\n", lUserID);
//======
NET_DVR_IPPARACFG_V40 IpAccessCfg;
memset(&IpAccessCfg,0,sizeof(IpAccessCfg));
DWORD dwReturned;
bool iRet = NET_DVR_GetDVRConfig(lUserID, NET_DVR_GET_IPPARACFG_V40, 0, &IpAccessCfg, sizeof(NET_DVR_IPPARACFG_V40), &dwReturned);
//======= 不行就删
NET_DVR_CLIENTINFO ClientInfo;
ClientInfo.hPlayWnd = NULL;
ClientInfo.lChannel = 33;
ClientInfo.lLinkMode = 0;
ClientInfo.sMultiCastIP = NULL;
LONG llRealHandle = NET_DVR_RealPlay_V30(lUserID,&ClientInfo, mucbfunc, NULL,TRUE);
printf("realplay handle: [%d]\n", llRealHandle);
if (llRealHandle<0)
{
printf("NET_DVR_RealPlay_V30 failed! Error number: %d\n",NET_DVR_GetLastError());
}
system("pause");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment