1. The internal memory of capture device
- Every Pro Capture device has an onboard memory, where input signal data is initially stored after being captured;
- Onboard memory can buffer multiple frames, the maximum of frames is different and is determined by the model of capture card. It’s possible to use MWGetVideoBufferInfo() to obtain the maximum buffer frames on onboard memory;
2. Event notification mechanism
- Use MWRegisterNotify() to register an event notification object. One or more masks of notification modes can be set;
- When event notification object is connected to a signal, you can use MWGetNotifyStatus() to obtain the current notification mode;
- If notification MWCAP_NOTIFY_VIDEO_FRAME_BUFFERED is set, and when input frames data is entirely transferred into the onboard memory cache, application will be able to receive the notification. From now on, DMA data is transmitting from onboard memory to target memory area;
- If notification MWCAP_NOTIFY_VIDEO_FRAME_BUFFERING is set, and when input frames data starts to be transferred into the onboard memory cache, application will be able to receive the notification. From now on, video is being captured with low latency;
- For other notification definitions, please refer to the development manual;
3. Two methods to capture video data with SDK
(1) Capture according to the frame rate of signal source (byInput)
MWOpenChannel() → CreateEvent() → MWRegisterNotify() → MWStartVideoCapture() → WaitForSingleObject()→ MWGetNotifyStatus() → MWCaptureVideoFrameToVirtualAddress() → WaitForSingleObject() → MWGetVideoCaptureStatus()
(2)Capture according to the customized frame rate (byTimer)
MWOpenChannel() → CreateEvent() → MWRegisterTimer() → MWStartVideoCapture() → MWScheduleTimer() → WaitForSingleObject()→ MWCaptureVideoFrameToVirtualAddress() → WaitForSingleObject() → MWGetVideoCaptureStatus()
For method 1, the captured frame rate is fixed, as it keeps the sane as the frame rate of input signal source; meanwhile, notification event object needs to be registered. By executing WaitForSingleObject(), when the status of event is “valid” and notification mode is MWCAP_NOTIFY_VIDEO_FRAME_BUFFERED or MWCAP_NOTIFY_VIDEO_FRAME_BUFFERING, it is ready to capture the video data.
For method 2, the frame rate can be customized, and time event object needs to be registered. Time value in MWScheduleTimer() should be set according to different frame rates. When the time event status of WaitForSingleObject() shows valid, it’s ready to capture video data .
If you want to capture with low latency, please only use 1 (byInput).
3. Two methods to capture video data with SDK
- Before capturing, you can prepare some memory area for the storage of captured video frames if necessary
- By executing MWCaptureVideoFrameToVirtualAddress(), import the video frames from onboard memory to system memory by DMA; Function pbFrame is the assigned memory pointer; iFrame is the serial number of to-be-captured frame, which can be set as iNewestBufferedFullFrame (the frame numbers of latest buffered frames) in MWCAP_VIDEO_BUFFER_INFO
- MWCaptureVideoFrameToPhysicalAddressEx() is a spread function, with which you can easily set more capture parameters and add OSD feature as well
- MWCaptureVideoFrameToVirtualAddress() is an asynchronous function. Users must use WaitForSingleObject() and wait until the capture is finished. By executing MWGetVideoCaptureStatus() users can know whether capture is finished or not
In all, capture device will firstly buffer the video frames into onboard memory, and then transmit the data to appointed memory address by DMA; capture parameters can be set with MWCaptureVideoFrameToVirtualAddress(), so as to achieve different capture effects.
Examples \ CmdLineTools\CaptureByInput is a demo for method 1;
Examples \ CmdLineTools\CaptureByTimer is a demo for method 2.