uvcConfiguration()
Configures the UVC (USB Video Class) streaming parameters including frame resolution, frame interval (FPS), and buffer allocation for video data transfer.Signature
Parameters
Width of the video frame in pixels. Use
FRAME_RESOLUTION_ANY to accept any width supported by the camera.Height of the video frame in pixels. Use
FRAME_RESOLUTION_ANY to accept any height supported by the camera.Frame interval in 100-nanosecond units. Use the predefined constants for common frame rates:
FRAME_INTERVAL_FPS_5- 5 FPSFRAME_INTERVAL_FPS_10- 10 FPSFRAME_INTERVAL_FPS_15- 15 FPSFRAME_INTERVAL_FPS_20- 20 FPSFRAME_INTERVAL_FPS_30- 25 FPS (note: actually 25 FPS)
FPS2INTERVAL(fps) macro.Size of each transfer buffer in bytes. Must be larger than one frame size. Used for double buffering during USB payload transfer.
Pointer to the first transfer buffer. This buffer is used as part of the double buffering mechanism for USB payload transfer.
Pointer to the second transfer buffer. This buffer is used as part of the double buffering mechanism for USB payload transfer.
Size of the frame buffer in bytes. Must be larger than one complete frame size.
Pointer to the frame buffer where complete assembled frames will be stored.
Frame Resolution Constants
Constant value (
__UINT16_MAX__) that indicates any resolution should be accepted. Use for both width and height parameters when you want the library to accept any camera resolution.Frame Interval Constants
Frame intervals are specified in 100-nanosecond units. The library provides convenient constants:| Constant | FPS | Value |
|---|---|---|
FRAME_INTERVAL_FPS_5 | 5 FPS | FPS2INTERVAL(5) |
FRAME_INTERVAL_FPS_10 | 10 FPS | FPS2INTERVAL(10) |
FRAME_INTERVAL_FPS_15 | 15 FPS | FPS2INTERVAL(15) |
FRAME_INTERVAL_FPS_20 | 20 FPS | FPS2INTERVAL(20) |
FRAME_INTERVAL_FPS_30 | 25 FPS* | FPS2INTERVAL(25) |
The
FRAME_INTERVAL_FPS_30 constant actually sets 25 FPS, not 30 FPS. This appears to be intentional in the library.FPS2INTERVAL Macro
Convert frames per second to frame interval:Buffer Sizing Guidelines
Calculating Buffer Sizes
For uncompressed formats like MJPEG, estimate buffer sizes based on:Memory Allocation
- Allocate buffers in PSRAM for larger resolutions (e.g., 640x480 and above)
- Ensure sufficient heap memory is available
- Consider using DMA-capable memory if required by your platform
Example
Complete Configuration
Using Any Resolution
Custom Frame Rate
Notes
Call
uvcConfiguration() before starting USB streaming. Configuration cannot be changed while streaming is active.Transfer buffers use double buffering to improve performance. While one buffer is being filled by USB transfer, the other can be processed.