#ifndef DSVIDCAPMANAGER_H_
#define DSVIDCAPMANAGER_H_
#include <list>
#include "CaptureManager.h"
#include "SampleGrabberCallback.h"
#include "avcap-export.h"
namespace avcap
{
class DS_DeviceDescriptor;
class DS_FormatManager;
class IOBuffer;
class CaptureHandler;
class SampleGrabberCallback;
class AVCAP_Export DS_VidCapManager : public CaptureManager
{
private:
typedef std::list<IOBuffer*> IOBufList;
DS_DeviceDescriptor* mDSDeviceDescriptor;
SampleGrabberCallback* mGrabberCallback;
HANDLE mLock;
int mSequence;
int mNumBuffers;
public:
DS_VidCapManager(DS_DeviceDescriptor* dd, DS_FormatManager* fmt_mgr,
int nbufs = DEFAULT_BUFFERS);
virtual ~DS_VidCapManager();
int init();
int destroy();
int startCapture();
int stopCapture();
int getNumIOBuffers();
private:
IOBuffer* dequeue();
int enqueue(IOBuffer* buf);
friend class IOBuffer;
friend class SampleGrabberCallback;
};
class MutexGuard
{
private:
HANDLE mLock;
public:
inline MutexGuard(HANDLE lock) :
mLock(lock)
{ WaitForSingleObject(mLock, INFINITE); }
inline virtual ~MutexGuard()
{ ReleaseMutex(mLock); }
private:
inline MutexGuard()
{}
};
}
#endif