libuvc
Data Structures | Typedefs | Enumerations | Functions
Streaming control functions

Tools for creating, managing and consuming video streams. More...

Data Structures

struct  uvc_frame
 An image frame received from the UVC device. More...
 
struct  uvc_stream_ctrl
 Streaming mode, includes all information needed to select stream. More...
 

Typedefs

typedef struct uvc_frame uvc_frame_t
 An image frame received from the UVC device.
 
typedef void() uvc_frame_callback_t(struct uvc_frame *frame, void *user_ptr)
 A callback function to handle incoming assembled UVC frames.
 
typedef struct uvc_stream_ctrl uvc_stream_ctrl_t
 Streaming mode, includes all information needed to select stream.
 

Enumerations

enum  uvc_frame_format {
}
 Color coding of stream, transport-independent. More...
 

Functions

uvc_error_t uvc_trigger_still (uvc_device_handle_t *devh, uvc_still_ctrl_t *still_ctrl)
 Initiate a method 2 (in stream) still capture. More...
 
uvc_error_t uvc_stream_ctrl (uvc_stream_handle_t *strmh, uvc_stream_ctrl_t *ctrl)
 Reconfigure stream with a new stream format. More...
 
uvc_error_t uvc_get_stream_ctrl_format_size (uvc_device_handle_t *devh, uvc_stream_ctrl_t *ctrl, enum uvc_frame_format cf, int width, int height, int fps)
 Get a negotiated streaming control block for some common parameters. More...
 
uvc_error_t uvc_get_still_ctrl_format_size (uvc_device_handle_t *devh, uvc_stream_ctrl_t *ctrl, uvc_still_ctrl_t *still_ctrl, int width, int height)
 Get a negotiated still control block for some common parameters. More...
 
uvc_error_t uvc_start_streaming (uvc_device_handle_t *devh, uvc_stream_ctrl_t *ctrl, uvc_frame_callback_t *cb, void *user_ptr, uint8_t flags)
 Begin streaming video from the camera into the callback function. More...
 
uvc_error_t uvc_start_iso_streaming (uvc_device_handle_t *devh, uvc_stream_ctrl_t *ctrl, uvc_frame_callback_t *cb, void *user_ptr)
 Begin streaming video from the camera into the callback function. More...
 
uvc_error_t uvc_stream_open_ctrl (uvc_device_handle_t *devh, uvc_stream_handle_t **strmhp, uvc_stream_ctrl_t *ctrl)
 Open a new video stream. More...
 
uvc_error_t uvc_stream_start (uvc_stream_handle_t *strmh, uvc_frame_callback_t *cb, void *user_ptr, uint8_t flags)
 Begin streaming video from the stream into the callback function. More...
 
uvc_error_t uvc_stream_start_iso (uvc_stream_handle_t *strmh, uvc_frame_callback_t *cb, void *user_ptr)
 Begin streaming video from the stream into the callback function. More...
 
uvc_error_t uvc_stream_get_frame (uvc_stream_handle_t *strmh, uvc_frame_t **frame, int32_t timeout_us)
 Poll for a frame. More...
 
void uvc_stop_streaming (uvc_device_handle_t *devh)
 Stop streaming video. More...
 
uvc_error_t uvc_stream_stop (uvc_stream_handle_t *strmh)
 Stop stream. More...
 
void uvc_stream_close (uvc_stream_handle_t *strmh)
 Close stream. More...
 

Detailed Description

Tools for creating, managing and consuming video streams.

Enumeration Type Documentation

◆ uvc_frame_format

Color coding of stream, transport-independent.

Enumerator
UVC_FRAME_FORMAT_ANY 

Any supported format.

UVC_FRAME_FORMAT_YUYV 

YUYV/YUV2/YUV422: YUV encoding with one luminance value per pixel and one UV (chrominance) pair for every two pixels.

UVC_FRAME_FORMAT_RGB 

24-bit RGB

UVC_FRAME_FORMAT_MJPEG 

Motion-JPEG (or JPEG) encoded images.

UVC_FRAME_FORMAT_GRAY8 

Greyscale images.

UVC_FRAME_FORMAT_NV12 

YUV420: NV12.

UVC_FRAME_FORMAT_P010 

YUV: P010.

UVC_FRAME_FORMAT_COUNT 

Number of formats understood.

Function Documentation

◆ uvc_trigger_still()

uvc_error_t uvc_trigger_still ( uvc_device_handle_t *  devh,
uvc_still_ctrl_t *  still_ctrl 
)

Initiate a method 2 (in stream) still capture.

Parameters
[in]devhDevice handle
[in]still_ctrlStill capture control block

◆ uvc_stream_ctrl()

uvc_error_t uvc_stream_ctrl ( uvc_stream_handle_t *  strmh,
uvc_stream_ctrl_t ctrl 
)

Reconfigure stream with a new stream format.

This may be executed whether or not the stream is running.

Parameters
[in]strmhStream handle
[in]ctrlControl block, processed using {uvc_probe_stream_ctrl} or {uvc_get_stream_ctrl_format_size}

◆ uvc_get_stream_ctrl_format_size()

uvc_error_t uvc_get_stream_ctrl_format_size ( uvc_device_handle_t *  devh,
uvc_stream_ctrl_t ctrl,
enum uvc_frame_format  cf,
int  width,
int  height,
int  fps 
)

Get a negotiated streaming control block for some common parameters.

Parameters
[in]devhDevice handle
[in,out]ctrlControl block
[in]format_classType of streaming format
[in]widthDesired frame width
[in]heightDesired frame height
[in]fpsFrame rate, frames per second

◆ uvc_get_still_ctrl_format_size()

uvc_error_t uvc_get_still_ctrl_format_size ( uvc_device_handle_t *  devh,
uvc_stream_ctrl_t ctrl,
uvc_still_ctrl_t *  still_ctrl,
int  width,
int  height 
)

Get a negotiated still control block for some common parameters.

Parameters
[in]devhDevice handle
[in]ctrlControl block
[in,out]still_ctrlStill capture control block
[in]widthDesired frame width
[in]heightDesired frame height

◆ uvc_start_streaming()

uvc_error_t uvc_start_streaming ( uvc_device_handle_t *  devh,
uvc_stream_ctrl_t ctrl,
uvc_frame_callback_t cb,
void *  user_ptr,
uint8_t  flags 
)

Begin streaming video from the camera into the callback function.

Parameters
devhUVC device
ctrlControl block, processed using {uvc_probe_stream_ctrl} or {uvc_get_stream_ctrl_format_size}
cbUser callback function. See {uvc_frame_callback_t} for restrictions.
flagsStream setup flags, currently undefined. Set this to zero. The lower bit is reserved for backward compatibility.

◆ uvc_start_iso_streaming()

uvc_error_t uvc_start_iso_streaming ( uvc_device_handle_t *  devh,
uvc_stream_ctrl_t ctrl,
uvc_frame_callback_t cb,
void *  user_ptr 
)

Begin streaming video from the camera into the callback function.

Deprecated:
The stream type (bulk vs. isochronous) will be determined by the type of interface associated with the uvc_stream_ctrl_t parameter, regardless of whether the caller requests isochronous streaming. Please switch to uvc_start_streaming().
Parameters
devhUVC device
ctrlControl block, processed using {uvc_probe_stream_ctrl} or {uvc_get_stream_ctrl_format_size}
cbUser callback function. See {uvc_frame_callback_t} for restrictions.

◆ uvc_stream_open_ctrl()

uvc_error_t uvc_stream_open_ctrl ( uvc_device_handle_t *  devh,
uvc_stream_handle_t **  strmhp,
uvc_stream_ctrl_t ctrl 
)

Open a new video stream.

Parameters
devhUVC device
ctrlControl block, processed using {uvc_probe_stream_ctrl} or {uvc_get_stream_ctrl_format_size}

◆ uvc_stream_start()

uvc_error_t uvc_stream_start ( uvc_stream_handle_t *  strmh,
uvc_frame_callback_t cb,
void *  user_ptr,
uint8_t  flags 
)

Begin streaming video from the stream into the callback function.

Parameters
strmhUVC stream
cbUser callback function. See {uvc_frame_callback_t} for restrictions.
flagsStream setup flags, currently undefined. Set this to zero. The lower bit is reserved for backward compatibility.

◆ uvc_stream_start_iso()

uvc_error_t uvc_stream_start_iso ( uvc_stream_handle_t *  strmh,
uvc_frame_callback_t cb,
void *  user_ptr 
)

Begin streaming video from the stream into the callback function.

Deprecated:
The stream type (bulk vs. isochronous) will be determined by the type of interface associated with the uvc_stream_ctrl_t parameter, regardless of whether the caller requests isochronous streaming. Please switch to uvc_stream_start().
Parameters
strmhUVC stream
cbUser callback function. See {uvc_frame_callback_t} for restrictions.

◆ uvc_stream_get_frame()

uvc_error_t uvc_stream_get_frame ( uvc_stream_handle_t *  strmh,
uvc_frame_t **  frame,
int32_t  timeout_us 
)

Poll for a frame.

Parameters
devhUVC device
[out]frameLocation to store pointer to captured frame (NULL on error)
timeout_us>0: Wait at most N microseconds; 0: Wait indefinitely; -1: return immediately

◆ uvc_stop_streaming()

void uvc_stop_streaming ( uvc_device_handle_t *  devh)

Stop streaming video.

Closes all streams, ends threads and cancels pollers

Parameters
devhUVC device

◆ uvc_stream_stop()

uvc_error_t uvc_stream_stop ( uvc_stream_handle_t *  strmh)

Stop stream.

Stops stream, ends threads and cancels pollers

Parameters
devhUVC device

◆ uvc_stream_close()

void uvc_stream_close ( uvc_stream_handle_t *  strmh)

Close stream.

Closes stream, frees handle and all streaming resources.

Parameters
strmhUVC stream handle