From 6eda8a85b84c4e661a8763429ae1978f8da7f9dd Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 5 May 2019 12:34:01 +0200 Subject: video/ps3eye: WIP --- video-ps3eye/PS3EYEDriver/singleton.hpp | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 video-ps3eye/PS3EYEDriver/singleton.hpp (limited to 'video-ps3eye/PS3EYEDriver/singleton.hpp') diff --git a/video-ps3eye/PS3EYEDriver/singleton.hpp b/video-ps3eye/PS3EYEDriver/singleton.hpp new file mode 100644 index 000000000..7e8dc23c6 --- /dev/null +++ b/video-ps3eye/PS3EYEDriver/singleton.hpp @@ -0,0 +1,32 @@ +#pragma once + +#include +#include +#include +#include + +struct libusb_context; +struct ps3eye_camera; + +struct USBMgr +{ + USBMgr(); + ~USBMgr(); + USBMgr(const USBMgr&) = delete; + void operator=(const USBMgr&) = delete; + + static USBMgr& instance(); + int list_devices(std::vector>& list); + void camera_started(); + void camera_stopped(); + +private: + libusb_context* usb_context = nullptr; + std::thread update_thread; + std::atomic_int active_camera_count = 0; + std::atomic_bool exit_signaled = false; + + void start_xfer_thread(); + void stop_xfer_thread(); + void transfer_loop(); +}; -- cgit v1.2.3