43 lines
847 B
C++
Executable file
43 lines
847 B
C++
Executable file
#pragma once
|
|
|
|
#include "Device.h"
|
|
|
|
namespace Video
|
|
{
|
|
namespace V4L2
|
|
{
|
|
#define V4L2MMAP_NBBUFFER 10
|
|
|
|
class MmapDevice: public Device
|
|
{
|
|
protected:
|
|
size_t writeInternal(char* buffer, size_t bufferSize);
|
|
bool startPartialWrite();
|
|
size_t writePartialInternal(char*, size_t);
|
|
bool endPartialWrite();
|
|
size_t readInternal(char* buffer, size_t bufferSize);
|
|
|
|
public:
|
|
MmapDevice(const DeviceParameters& params, v4l2_buf_type deviceType);
|
|
virtual ~MmapDevice();
|
|
|
|
virtual bool init(unsigned int mandatoryCapabilities);
|
|
virtual bool isReady()
|
|
{
|
|
return ((m_fd != -1) && (n_buffers != 0));
|
|
}
|
|
virtual bool start();
|
|
virtual bool stop();
|
|
|
|
protected:
|
|
unsigned int n_buffers;
|
|
|
|
struct buffer
|
|
{
|
|
void* start;
|
|
size_t length;
|
|
};
|
|
buffer m_buffer[V4L2MMAP_NBBUFFER];
|
|
};
|
|
}
|
|
}
|