You can get the video data of multi cameras simultaneously using the following steps.
1. Create and Initialize XnsSdkDevice, XnsSdkWindow control.
- Create the XnsSdkWindow control to the number of video (camera).
2. Set the connect information by using XnsSdkDevice::SetConnectionInfo().
3. Connect to devices by using XnsSdkDevice::Connect() or ConnectNonBlock().
4. Request streaming by using XnsSdkDevice::OpenMedia() or OpenMediaEx().
long OpenMedia(
long hDevice,
long nControlID,
long nMediaType,
long tStart,
long tEnd,
long* phMediaSource
);
2nd parameter (nControlID) indicates camera number;
- 1 mean DVR/NVR itself
- 2 mean 1st camera
- 3 mean 2nd camera, etc.
- For more information of Control ID, please refer to the “Control Module Information” in API Document
5. Display received streaming on to window control by using XnsSdkWindow::Start(phMediaSource).
[SAMPLE SOURCE]
nError = AxXnsSdkDevice.Initialize()
AxXnsSdkWindow1.Initialize(0, 0)
AxXnsSdkWindow2.Initialize(0, 0)
AxXnsSdkDevice.SetConnectionInfo(hDevice, "samsung", strModel, XADDRESS_IP, strIpAddress, nPort, 0, strID, strPW)
AxXnsSdkDevice.ConnectNonBlock(hDevice, False, False)
...
...
// After check the success of connecting device, process followings
...
...
// Media Streaming Start (use 2, 3, 4, 5 for CH1, 2, 3, 4 or 3, 4, 5, 6 for CH1, 2, 3, 4)
// If you can’t display streaming when start with 2,3, retry to start with 3,4.)
nError = AxXnsSdkDevice.OpenMedia(hDevice, 2, XMediaType.XMEDIA_LIVE, 0, 0, hMediaSource1)
nError = AxXnsSdkDevice.OpenMedia(hDevice, 3, XMediaType.XMEDIA_LIVE, 0, 0, hMediaSource2)
// Do window start with hMediaSource which is a returned value.
AxXnsSdkWindow1.Start(hMediaSource1);
AxXnsSdkWindow2.Start(hMediaSource2);
|