#include "../libuvc/libuvc.h" #include #include #include class UVCDevice { public: // Constructor UVCDevice() = default; // Destructor ~UVCDevice() = default; // init void init(int index,uvc_context_t *ctx, uvc_device_t *dev); // set stream parameters void setStreamParameters(int width, int height, int fps, uvc_frame_format frame_format); void setCallBack(uvc_frame_callback_t *cb); uvc_device_handle_t *getDevh() { return devh; } void setTotalIndex(int total_index) { this->total_index = total_index; } int getTotalIndex() { return total_index; } // start streaming void startStreaming(); // stop streaming void stopStreaming(); // close void close(); // get frame void getFrame(); private: int index; uvc_device_t *dev; uvc_device_handle_t *devh; uvc_stream_ctrl_t ctrl; int width{3840}; int height{2160}; int fps{25}; uvc_frame_format frame_format; uvc_frame_callback_t *cb; int total_index{0}; // store the frame data };