#ifndef V4L1_VIDCAPMANAGER_H_
#define V4L1_VIDCAPMANAGER_H_
#include <sys/types.h>
#include <list>
#include <time.h>
#include "CaptureManager.h"
namespace avcap
{
class V4L1_DeviceDescriptor;
class V4L1_FormatManager;
class IOBuffer;
class CaptureHandler;
class V4L1_VidCapManager: public CaptureManager
{
private:
typedef std::list<IOBuffer*> IOBufList_t;
typedef std::list<int> IndexList_t;
V4L1_DeviceDescriptor *mDeviceDescriptor;
V4L1_FormatManager *mFormatMgr;
IOBufList_t mBuffers;
IndexList_t mCaptureIndices;
int mNumBufs;
int mMethod;
int mState;
pthread_t* mThread;
int mFinish;
pthread_mutex_t mLock;
timeval mStartTime;
long mSequence;
unsigned char* mVideobuf;
size_t mVideobufSize;
int mWidth;
int mHeight;
unsigned int mPalette;
int mAvailableBuffers;
public:
V4L1_VidCapManager(V4L1_DeviceDescriptor* dd, V4L1_FormatManager* fmt_mgr, int nbufs = DEFAULT_BUFFERS);
virtual ~V4L1_VidCapManager();
int init();
int destroy();
int startCapture();
int stopCapture();
int getNumIOBuffers();
private:
int start_read();
int start_mmap();
int stop_read();
int stop_mmap();
IOBuffer* dequeue();
int enqueue(IOBuffer* buf);
IOBuffer* findBuffer(int index);
static void run(void* mgr);
void clearBuffers();
int getUsedBufferCount();
};
};
#endif