Version 8.8.5
 
Loading...
Searching...
No Matches
IRDeviceUVC.h
1/******************************************************************************
2 * Copyright (c) 2012-2017 All Rights Reserved, http://www.evocortex.com *
3 * Evocortex GmbH *
4 * Emilienstr. 1 *
5 * 90489 Nuremberg *
6 * Germany *
7 * *
8 * Contributors: *
9 * Initial version for Linux 64-Bit platform supported by Fraunhofer IPA, *
10 * http://www.ipa.fraunhofer.de *
11 *****************************************************************************/
12
13#ifndef IRDEVICEUVC
14#define IRDEVICEUVC
15
16#include <string.h>
17#include "IRDevice.h"
18
19namespace evo
20{
21
27class IRDeviceUVC : public IRDevice
28{
29public:
30
35 IRDeviceUVC(char* devPath, unsigned long serial, int videoFormatIndex, unsigned int bufferQueueSize);
36
41
46 char* getPath();
47
52 void setSerial(unsigned long serno);
53
59 int openDevice(unsigned int chFormat=0, unsigned int bufferQueueSize=4);
60
65 bool isOpen();
66
72 int setFramerate(unsigned int numerator, unsigned int denominator);
73
78
83
89
96 IRDeviceError getFrame(unsigned char* buffer, double* timestamp=NULL, int timeoutMilliseconds = -1);
97
103 virtual void run();
104
108 virtual void exit();
109
110protected:
111
112 char* _path;
113
114private:
115
119 int releaseFrame();
120
121 int initMmap(unsigned short bufferQueueSize);
122
123 int xioctl(int request, void *arg);
124
125 int _fd;
126
127 struct buffer
128 {
129 void * start;
130 size_t length;
131 };
132
133 buffer* _buffers;
134
135 unsigned int _cntBuffers;
136
137 int _index;
138
139 size_t _len;
140
141 bool _isStreaming;
142
143 bool _run;
144};
145
146} //namespace
147
148#endif // IRDEVICEUVC
UVC device interface (Linux platforms)
Definition: IRDeviceUVC.h:28
int startStreaming()
Start video grabbing.
bool isOpen()
Check if device was already opened.
IRDeviceUVC(char *devPath, unsigned long serial, int videoFormatIndex, unsigned int bufferQueueSize)
Standard constructor.
virtual void run()
Run device, i.e., treat main thread in blocking mode.
IRDeviceError getFrame(unsigned char *buffer, double *timestamp=NULL, int timeoutMilliseconds=-1)
Acquire one frame.
virtual void exit()
Exit blocking run method, if previously called.
int stopStreaming()
Stop video grabbing.
int openDevice(unsigned int chFormat=0, unsigned int bufferQueueSize=4)
Open device.
int closeDevice()
Close device.
int setFramerate(unsigned int numerator, unsigned int denominator)
Set framerate of device (numerator / denominator)
char * getPath()
Get UVC path.
~IRDeviceUVC()
Destructor.
void setSerial(unsigned long serno)
Force serial number.