2014-08-17 15:29:08 +00:00
|
|
|
/* ---------------------------------------------------------------------------
|
|
|
|
** This software is in the public domain, furnished "as is", without technical
|
|
|
|
** support, and with no warranty, express or implied, as to its usefulness for
|
|
|
|
** any purpose.
|
|
|
|
**
|
|
|
|
** V4L2MMAPDeviceSource.h
|
|
|
|
**
|
|
|
|
** V4L2 source using mmap API
|
|
|
|
**
|
|
|
|
** -------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef V4L2_MMAP_DEVICE_SOURCE
|
|
|
|
#define V4L2_MMAP_DEVICE_SOURCE
|
|
|
|
|
|
|
|
// project
|
2014-08-23 21:57:07 +00:00
|
|
|
#include "V4l2Device.h"
|
2014-08-17 15:29:08 +00:00
|
|
|
|
|
|
|
#define V4L2MMAP_NBBUFFER 10
|
2014-08-23 21:57:07 +00:00
|
|
|
class V4L2MMAPDeviceSource : public V4L2Device
|
2014-08-17 15:29:08 +00:00
|
|
|
{
|
|
|
|
public:
|
2014-08-23 21:57:07 +00:00
|
|
|
static V4L2MMAPDeviceSource* createNew(V4L2DeviceParameters params);
|
2014-08-17 15:29:08 +00:00
|
|
|
|
|
|
|
protected:
|
2014-08-23 21:57:07 +00:00
|
|
|
V4L2MMAPDeviceSource(V4L2DeviceParameters params) : V4L2Device(params), n_buffers(0) {};
|
2014-08-17 15:29:08 +00:00
|
|
|
|
2014-08-23 21:57:07 +00:00
|
|
|
public:
|
2014-08-17 15:29:08 +00:00
|
|
|
virtual bool captureStart();
|
|
|
|
virtual size_t read(char* buffer, size_t bufferSize);
|
|
|
|
virtual bool captureStop();
|
|
|
|
|
|
|
|
protected:
|
|
|
|
int n_buffers;
|
|
|
|
|
|
|
|
struct buffer
|
|
|
|
{
|
|
|
|
void * start;
|
|
|
|
size_t length;
|
|
|
|
};
|
|
|
|
buffer m_buffer[V4L2MMAP_NBBUFFER];
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|