Get a frame from the video capture device
#include <vcapture/capture.h>
int capture_get_frame(capture_context_t context, uint64_t timeout, uint32_t flags)
This function retrieves frames from the device. If more than one frame is in the queue, depending on the behavior specified by the flags argument, this function will either retrieve the first queued frame in sequence or retrieve only the latest frame, dropping the others.
The index returned by this function corresponds to the sequence number of the CAPTURE_PROPERTY_FRAME_SEQNO property, if this array is provided. The application can use this property and the index returned by this function to calculate the number of frames that have been dropped since the last call to capture_get_frame().
It's safe to call this function even if capturing hasn't started (i.e., you haven't set the CAPTURE_ENABLE property and called capture_update()) yet. Your application must ensure that another thread will enable and disable capturing when required.
The index of the captured buffer (CAPTURE_PROPERTY_FRAME_BUFFERS) if successful; or -1 if an error occurred (errno is set; refer to errno.h for more details). The return value and the value that's observed for errno may vary as they are dependent on the implementation by the library that handles your hardware.