Create a video capture context


#include <vcapture/capture.h>
capture_context_t capture_create_context(uint32_t flags)


Bitmask parameter; set to either 0 if the context to be created is for a local device, or to CAPTURE_FLAG_EXTERNAL_SOURCE if the context to be created is for an external source.




This function:
  • creates a new context for video capture
  • returns a pointer to the context in capture_context_t

You must create a context before you can set video capture properties and start video capture. The context contains both mandatory information, such as device ID and input source ID (e.g., device 1, input source 2), and optional settings, such as brightness.

You can create multiple contexts, but you can have only one context in use for each device-source combination. If you have created multiple contexts for the same device-source combination, capture_get_frame() will use the first context you have enabled with capture_set_property_i().

Before your application exits, it must call capture_destroy_context() to destroy every context that it created. Failure to destroy a context before exiting can lead to memory corruption and unpredictable system behavior.


A pointer to a new context if successful; or NULL if an error occurred (errno is set; refer to errno.h for more details). The value that's observed for errno may vary as it is hardware dependent.