libsc  2.8.7
The SC library provides support for parallel scientific applications.
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Modules Pages
Typedefs | Functions
sc_v4l2.h File Reference

Support for video for linux version 2. More...

#include <sc.h>
Include dependency graph for sc_v4l2.h:

Go to the source code of this file.

Typedefs

typedef struct sc_v4l2_device sc_v4l2_device_t
 Opaque structure for a video device.
 

Functions

sc_v4l2_device_tsc_v4l2_device_open (const char *devname)
 Open a video device by special file name. More...
 
int sc_v4l2_device_close (sc_v4l2_device_t *vd)
 Close a video device. More...
 
const char * sc_v4l2_device_devstring (const sc_v4l2_device_t *vd)
 Return string that details some driver and device properties. More...
 
const char * sc_v4l2_device_capstring (const sc_v4l2_device_t *vd)
 Return string that details some device capabilities. More...
 
const char * sc_v4l2_device_outstring (const sc_v4l2_device_t *vd)
 Return string that details some output properties. More...
 
int sc_v4l2_device_is_readwrite (const sc_v4l2_device_t *vd)
 Query whether a device supports read/write I/O. More...
 
int sc_v4l2_device_is_streaming (const sc_v4l2_device_t *vd)
 Query whether a device supports streaming I/O. More...
 
int sc_v4l2_device_select (sc_v4l2_device_t *vd, unsigned usec)
 Call select (2) to wait for write availability of device. More...
 
int sc_v4l2_device_write (sc_v4l2_device_t *vd, const char *wbuf)
 Call write (2) to copy an image buffer to device. More...
 
int sc_v4l2_device_format (sc_v4l2_device_t *vd, unsigned int *width, unsigned int *height, unsigned int *bytesperline, unsigned int *sizeimage)
 Set output configuration of device. More...
 

Detailed Description

Support for video for linux version 2.

Function Documentation

◆ sc_v4l2_device_capstring()

const char* sc_v4l2_device_capstring ( const sc_v4l2_device_t vd)

Return string that details some device capabilities.

Parameters
[in]vdOpened sc_v4l2_device_t. Not modified.
Returns
NUL-terminated string only valid while the device vd is.

◆ sc_v4l2_device_close()

int sc_v4l2_device_close ( sc_v4l2_device_t vd)

Close a video device.

Parameters
[in,out]vdClose this device and deallocate associated resources.
Returns
0 on success, -1 otherwise.

◆ sc_v4l2_device_devstring()

const char* sc_v4l2_device_devstring ( const sc_v4l2_device_t vd)

Return string that details some driver and device properties.

Parameters
[in]vdOpened sc_v4l2_device_t. Not modified.
Returns
NUL-terminated string only valid while the device vd is.

◆ sc_v4l2_device_format()

int sc_v4l2_device_format ( sc_v4l2_device_t vd,
unsigned int *  width,
unsigned int *  height,
unsigned int *  bytesperline,
unsigned int *  sizeimage 
)

Set output configuration of device.

We demand sRGB color space with RGB 565 pixel format (2 bytes). The image size values on output define the buffer size to allocate.

Parameters
[in,out]vdDevice must support the desired output format.
[in,out]widthDesired width on input, actual width on output.
[in,out]heightDesired height on input, actual height on output.
[out]bytesperlineBytes per line on output, including padding.
[out]sizeimageBytes per image, including padding.
Returns
0 on success, -1 otherwise and setting errno.

◆ sc_v4l2_device_is_readwrite()

int sc_v4l2_device_is_readwrite ( const sc_v4l2_device_t vd)

Query whether a device supports read/write I/O.

Parameters
[in]vdAny pointer.
Returns
True iff vd is valid and read/write is supported.

◆ sc_v4l2_device_is_streaming()

int sc_v4l2_device_is_streaming ( const sc_v4l2_device_t vd)

Query whether a device supports streaming I/O.

Parameters
[in]vdAny pointer.
Returns
True iff vd is valid and streaming is supported.

◆ sc_v4l2_device_open()

sc_v4l2_device_t* sc_v4l2_device_open ( const char *  devname)

Open a video device by special file name.

The device is queried but its state is not modified.

Parameters
[in]devnameSpecial file name such as /dev/video8.
Returns
Valid pointer on success, NULL on error.

◆ sc_v4l2_device_outstring()

const char* sc_v4l2_device_outstring ( const sc_v4l2_device_t vd)

Return string that details some output properties.

Parameters
[in]vdOpened sc_v4l2_device_t. Not modified.
Returns
If output is supported as desired, return NUL-terminated string only valid while the vd object is alive. Otherwise return NULL.

◆ sc_v4l2_device_select()

int sc_v4l2_device_select ( sc_v4l2_device_t vd,
unsigned  usec 
)

Call select (2) to wait for write availability of device.

Parameters
[in]vdOpened sc_v4l2_device_t capable of output.
[in]usecNumber of microseconds to wait for device. We return sooner if interrupted by a signal.
Returns
-1 on error, 0 on timeout, 1 when ready for writing.

◆ sc_v4l2_device_write()

int sc_v4l2_device_write ( sc_v4l2_device_t vd,
const char *  wbuf 
)

Call write (2) to copy an image buffer to device.

Parameters
[in]vdOpened sc_v4l2_device_t capable of output.
[in]wbufBuffer holding at least sizeimage many bytes.
Returns
0 on success, -1 otherwise and setting errno.