36 lines
843 B
C++
36 lines
843 B
C++
|
|
#include <sys/types.h>
|
|
#include <sys/stat.h>
|
|
#include <fcntl.h>
|
|
#include <stdlib.h> /* exit() */
|
|
#include <sys/ioctl.h> /* ioctl() */
|
|
#include <libv4lconvert.h>
|
|
#include <iostream>
|
|
#include <vector>
|
|
|
|
class WebcamTracker
|
|
{
|
|
public:
|
|
WebcamTracker();
|
|
~WebcamTracker();
|
|
bool open(const char * device);
|
|
void start();
|
|
|
|
protected:
|
|
void requestBuffers(int num);
|
|
void mapBuffer(int i);
|
|
void queueBuffer(int i);
|
|
void beginStreaming();
|
|
void endStreaming();
|
|
void dequeueBuffer(v4l2_buffer * dqbuf);
|
|
void unmapBuffer(int i);
|
|
void freeBuffers();
|
|
void setFormat(int width, int height);
|
|
|
|
bool m_open;
|
|
int m_fd;
|
|
int m_numbufs;
|
|
void ** m_buffers;
|
|
int * m_lengths;
|
|
};
|