Overview
TheUSB_STREAM class is the main C++ wrapper for the ESP32 USB Stream library. It provides a high-level interface for managing USB video (UVC) and audio (UAC) streaming from connected USB devices.
Class Definition
Constructor
Creates a new USB_STREAM object.Example
Destructor
Destroys the USB_STREAM object and cleans up resources.The destructor is called automatically when the object goes out of scope. It ensures proper cleanup of internal resources.
Public Member Variables
The class exposes several public member variables for storing user-defined callback functions and arguments:Callback Storage
State Callback Type
Connection state event:
STREAM_CONNECTED(0): Device connectedSTREAM_DISCONNECTED: Device disconnected
User-defined argument passed during callback registration
Private Member Variables
The class maintains internal state for video and audio configurations:These private variables are managed internally by the class methods. Users should not access them directly.
Related Documentation
- Lifecycle Methods - Start, stop, and connection management
- UVC Configuration - Video streaming configuration
- UVC Control - Video streaming control
- UVC Callbacks - Video frame callbacks
- UAC Configuration - Audio configuration
- UAC Microphone - Microphone audio control
- UAC Speaker - Speaker audio control
State Management
The USB_STREAM class manages the lifecycle of USB streaming through state transitions:- Initial State: Object created but not configured
- Configured State: Video/audio parameters set via configuration methods
- Running State: Streaming active after calling
start() - Stopped State: Streaming stopped, resources freed