capture_get_free_buffer()

Get a free video capture buffer when bringing in video from an external source, and call the video capture function.

Synopsis:

#include <vcapture/capture.h>
            
int capture_get_free_buffer( capture_context_t
            context, uint64_t
            timeout, (uint_32_t
            flags | CAPTURE_FLAG_FREE_BUFFER )            

Arguments:

context
Pointer to the video capture context.
timeout
Wait before timing out. Set to any of:
  • The number of nanoseconds the function should wait for a buffer before timing out. The function may return in less time than the period specified by this argument.
  • CAPTURE_TIMEOUT_INFINITE to wait indefinitely for a buffer (never time out).
  • CAPTURE_TIMEOUT_NO_WAIT to return immediately, even if there is no buffer.
flags
For internal use at this time. Must be set to 0 (zero).

Library:

libcapture

Description:

The function capture_get_free_buffer() returns the index to a free buffer. After calling this function, the client application should call capture_put_buffer() to place the capture buffer in the video capture stream, then use another thread to call capture_get_frame() to return a processed frame (for example, the frame is scaled or deinterlaced).

Returns:

≥0
Success: the index of the captured buffer returned by capture_put_buffer().
-1
An error occurred, or the function has timed out (errno is set).

Errors:

EINVAL
Invalid argument.