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.
uvc_error_t | uvc_stream_ctrl (uvc_stream_handle_t *strmh, uvc_stream_ctrl_t *ctrl)
| Reconfigure stream with a new stream format.
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.
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.
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.
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.
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.
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.
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.
uvc_error_t | uvc_stream_get_frame (uvc_stream_handle_t *strmh, uvc_frame_t **frame, int32_t timeout_us)
| Poll for a frame.
void | uvc_stop_streaming (uvc_device_handle_t *devh)
| Stop streaming video.
uvc_error_t | uvc_stream_stop (uvc_stream_handle_t *strmh)
| Stop stream.
void | uvc_stream_close (uvc_stream_handle_t *strmh)
| Close stream.

## Detailed Description

Tools for creating, managing and consuming video streams.

## Enumeration Type Documentation

## uvc_frame_format

enum 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] | devh | Device handle
  [in] | still_ctrl | Still 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] | strmh | Stream handle
  [in] | ctrl | Control 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] | devh | Device handle
  [in,out] | ctrl | Control block
  [in] | format_class | Type of streaming format
  [in] | width | Desired frame width
  [in] | height | Desired frame height
  [in] | fps | Frame 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] | devh | Device handle
  [in] | ctrl | Control block
  [in,out] | still_ctrl | Still capture control block
  [in] | width | Desired frame width
  [in] | height | Desired 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

  devh | UVC device
  ctrl | Control block, processed using {uvc_probe_stream_ctrl} or {uvc_get_stream_ctrl_format_size}
  cb | User callback function. See {uvc_frame_callback_t} for restrictions.
  flags | Stream 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

  devh | UVC device
  ctrl | Control block, processed using {uvc_probe_stream_ctrl} or {uvc_get_stream_ctrl_format_size}
  cb | User 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

  devh | UVC device
  ctrl | Control 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

  strmh | UVC stream
  cb | User callback function. See {uvc_frame_callback_t} for restrictions.
  flags | Stream 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

  strmh | UVC stream
  cb | User 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

  | devh | UVC device
  [out] | frame | Location 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

  devh | UVC 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

  devh | UVC device

## uvc_stream_close()

void uvc_stream_close | ( | uvc_stream_handle_t * | strmh | ) |

Close stream.

Closes stream, frees handle and all streaming resources.

Parameters

  strmh | UVC stream handle