capture_create_context()
Establish a connection to the capture device and create a video capture context.
Synopsis:
#include <vcapture/capture.h>
capture_context_t capture_create_context(uint32_t flags)
Arguments:
- 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.
Library:
libcapture
Description:
The function
capture_create_context():
- connects to a video capture device
- 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 the device ID and input source ID (e.g. device 1,
input source 2), and optional settings, such as brightness.
You can create more than one context, 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(). Calls to capture_update() for the other contexts will fail.
DANGER
Before your application exits, it must call
capture_destroy_context() to destroy every context it
created. Failure to destroy a context before exiting can lead to memory corruption and unpredictable
system behavior.
For more information about video capture contexts, see "Contexts".
Returns:
- A pointer to a new context in capture_context_t.
- Success.
- NULL
- An error occurred (errno is set).
Errors:
- EBUSY
- Unable to create a context because one is already in use.
- EINVAL
- Invalid flags.