1 #ifndef usbthread_HEADER_GUARD
2 #define usbthread_HEADER_GUARD
41 using namespace std::chrono_literals;
42 using std::this_thread::sleep_for;
44 #define CLEAR(x) memset(&(x), 0, sizeof(x))
70 device(device), slot(slot), framefilter(f), width(N720.width), height(N720.height), time_correction(TimeCorrectionType::smart) {};
90 register_camera_stream,
91 deregister_camera_stream,
119 int getFd() {
return fd;}
120 virtual bool isPlaying() {
return this->playing;}
125 virtual void open_();
126 virtual void close_();
138 int xioctl(
int fh,
int request,
void *arg);
179 struct v4l2_buffer buf;
180 std::vector<BasicFrame*> ring_buffer;
182 static const int n_ring_buffer = 5;
189 const v4l_status getStatus() {
return this->status;}
190 const std::string getName() {
return this->camera_ctx.device;}
193 virtual bool isPlaying();
194 virtual void open_();
195 virtual void close_();
229 void handleSignals();
244 void requestStopCall();
Custom payload Frame.
Definition: frame.h:166
The mother class of all frame filters! FrameFilters are used to create "filter chains".
Definition: framefilter.h:44
Setup frame.
Definition: frame.h:277
A class for multithreading with a signaling system.
Definition: thread.h:87
Definition: usbthread.h:204
std::deque< USBDeviceSignalContext > signal_fifo
Redefinition of signal fifo.
Definition: usbthread.h:219
std::map< SlotNumber, USBDevice * > slots_
Devices are organized in slots.
Definition: usbthread.h:216
Definition: usbthread.h:105
SetupFrame setupframe
This frame is used to send subsession information.
Definition: usbthread.h:114
bool playing
Is currently streaming or not.
Definition: usbthread.h:116
BasicFrame basicframe
Data is being copied into this frame.
Definition: usbthread.h:115
FrameFilter * framefilter
Output FrameFilter.
Definition: usbthread.h:113
Definition: usbthread.h:160
v4l_status status
State of the device.
Definition: usbthread.h:178
List of common header files.
TimeCorrectionType
Methods to correct frame timestamps.
Definition: frame.h:87
Definition of FrameFilter and derived classes for various purposes.
@ signal
signal to AVThread or OpenGLThread. Also custom signals to custom Threads
Parameters for connecting to a usb camera.
Definition: usbthread.h:68
FrameFilter * framefilter
Frames are feeded into this FrameFilter.
Definition: usbthread.h:76
SlotNumber slot
A unique stream slot that identifies this stream.
Definition: usbthread.h:74
TimeCorrectionType time_correction
How to perform frame timestamp correction.
Definition: usbthread.h:80
Redefinition of characteristic signal contexts (info that goes with the signal)
Definition: usbthread.h:99
Base class for multithreading.
USBDeviceSignal
Signals used by USBDeviceThread.
Definition: usbthread.h:87
v4l_status
Different stages of v4l2 device initialization.
Definition: usbthread.h:142
@ not_on
could not turn stream on
Definition: usbthread.h:155
@ not_found
file not found
Definition: usbthread.h:144
@ not_v4l2
not v4l2 device
Definition: usbthread.h:148
@ not_ptr
does not support user pointers
Definition: usbthread.h:153
@ not_read
could not read device
Definition: usbthread.h:146
@ not_device
not device file
Definition: usbthread.h:145
@ ok_format
format is ok
Definition: usbthread.h:152
@ not_stream
does not support streaming
Definition: usbthread.h:150
@ not_format
device could not satisfy the demanded format
Definition: usbthread.h:151
@ not_map
could not communicate pointers with the drivers
Definition: usbthread.h:154
@ ok_open
device opened
Definition: usbthread.h:147
@ none
undefined (initial value)
Definition: usbthread.h:143
@ not_video_cap
not video capture devices
Definition: usbthread.h:149
@ ok
stream is playing allright
Definition: usbthread.h:156