123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- #include "../libuvc/libuvc.h"
- #include <stdio.h>
- #include <unistd.h>
- #include <sys/time.h>
- 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; }
- // 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;
- // store the frame data
- };
|