Send a string to the server
This function is very simple and it doesn't feel practical.
1.vc++ Code:
MP4_ClientCommandtoServer((LPCTSTR)ctemp,sendcont,400);
2.c# Code:
PcHikClient.MP4_ClientCommandtoServer("192.168.0.188", "服务器你好:)", 14);
A description of this method can be found from the API documentation: the first parameter is the IP of the server, the second is the string to send, and the third is the length of the string.
Second, the client to video recording
Client video recording from the API document (Hikvision Card Network Development Package Programming manual V4.7) can be seen by the mp4_clientstartcapture or Mp4_clientstartcapturefile function to achieve this function, from VC + + source can see that he is implemented with the latter, simple and easy, but the server side does not have this function-_-#. But Mp4_clientstartcapture is more flexible by recalling its own write storage code, and can implement additional functions such as statistics, which only provide VC + + corresponding to the C # version of the Mp4_clientstartcapturefile
1.vc++ Code:
//开始录像
if (nn1 >= 0)
{
sprintf(filename,"d:\\mp4test1_%d.mp4",capcount);
MP4_ClientStartCaptureFile(nn1,filename);
//MP4_ClientStartCapture(nn1);
}
//关闭录像
if (nn1>=0)
MP4_ClientStopCapture(nn1);
2.c# Code:
/// <summary>
/// 开始录像
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnStartCap_Click(object sender, EventArgs e)
{
PcHikClient.MP4_ClientStartCaptureFile(cs, "D:\\mp4test1_0.mp4");
}
/// <summary>
/// 停止录像
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void btnStopCap_Click(object sender, EventArgs e)
{
PcHikClient.MP4_ClientStopCapture(cs);
}
The method is simple, but notice that the previous post's mp4_clientstartcapturefile parameter corresponds to an error, otherwise the file cannot be created and returns false, and the previous SDK encapsulation API has been updated with the following specific error:
VC + + Prototype:
BOOL __stdcall MP4_ClientStartCaptureFile(LONG StockHandle, LPTSTR FileName);
Previous version:
public static extern bool MP4_ClientStartCaptureFile(long StockHandle, string FileName);
Change after version:
public static extern bool MP4_ClientStartCaptureFile(int StockHandle, string FileName);
Note that the Stockhandle parameter data type changes. The Mp4_clientstopcapture parameter is also a long data type, but it doesn't matter if it doesn't change to int.
Legacy issues
The saved MP4 file shows the total playback time and the actual playback time is always 3 seconds, such as total time is 48 seconds, and broadcast to 45 No, more strange, but little impact:
End
The content of this chapter is still simple, error still occurs in the data type corresponding, so we need to pay more attention to: