KCL-BMEIS / pymagewell

Python library for interfacing with Magewell ProCapture frame grabbers
MIT License
9 stars 0 forks source link

Enable low latency mode #1

Closed crnbaker closed 2 years ago

crnbaker commented 2 years ago

Low latency mode allows:

This is described in [this Magewell document(https://www.magewell.com/files/LowLatency%20&PartialNotification.pdf). This Magewell documentation page explains how to achieve this using the SDK.

In summary, instead of using a Timer to control the acquisition of frames, you register MWCAP_NOTIFY_VIDEO_FRAME_BUFFERING as an event, and when the event occurs, copy the last received chunk out of memory. The size of the chunks (number of lines) can be set using the cyParitalNotify input to the frame grabbing function (must be a power of 2, minimum 64).

For some reason, MWCAP_NOTIFY_VIDEO_FRAME_BUFFERING is not included as a constant in the Python wrapper for the SDK. From looking around in the C++ examples, I found that it should be: #define MWCAP_NOTIFY_VIDEO_FRAME_BUFFERING 0x0100ULL

NB: Currently we use a timer to decide when to grab the frames. to use the source frame rate (without low latency mode) requires #define MWCAP_NOTIFY_VIDEO_FRAME_BUFFERED 0x0400ULL which is also not provided in the Python wrapper for some reason.

crnbaker commented 2 years ago

This was implemented directly in main branch