v4l2rtspserver/inc/V4l2MmapCapture.h

47 lines
1.1 KiB
C
Raw Normal View History

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.
**
2014-11-02 15:42:30 +00:00
** V4l2MmapCapture.h
2014-08-17 15:29:08 +00:00
**
** V4L2 source using mmap API
**
** -------------------------------------------------------------------------*/
2014-11-02 15:42:30 +00:00
#ifndef V4L2_MMAP_CAPTURE
#define V4L2_MMAP_CAPTURE
2014-08-17 15:29:08 +00:00
// project
2014-11-02 15:42:30 +00:00
#include "V4l2Capture.h"
2014-08-17 15:29:08 +00:00
#define V4L2MMAP_NBBUFFER 10
2014-11-02 15:42:30 +00:00
class V4l2MmapCapture : public V4l2Capture
2014-08-17 15:29:08 +00:00
{
public:
2014-11-02 15:42:30 +00:00
static V4l2MmapCapture* createNew(V4L2DeviceParameters params);
2014-08-17 15:29:08 +00:00
protected:
2014-11-02 15:42:30 +00:00
V4l2MmapCapture(V4L2DeviceParameters params) : V4l2Capture(params), n_buffers(0) {};
2014-08-17 15:29:08 +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();
2014-09-07 17:02:42 +00:00
virtual bool isReady() { return ((m_fd != -1)&& (n_buffers != 0)); };
2014-08-17 15:29:08 +00:00
protected:
2014-09-07 16:41:00 +00:00
unsigned int n_buffers;
2014-08-17 15:29:08 +00:00
struct buffer
{
void * start;
size_t length;
};
buffer m_buffer[V4L2MMAP_NBBUFFER];
};
2014-09-07 16:41:00 +00:00
#endif