*
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
#ifndef WebCamera_h__
|
||||
#define WebCamera_h__
|
||||
|
||||
#include "../ICamera.h"
|
||||
#include "../IImage.h"
|
||||
#include <mfapi.h>
|
||||
#include <mfidl.h>
|
||||
#include <mferror.h>
|
||||
#include <mfcaptureengine.h>
|
||||
#include "WinMfImageGrabber.h"
|
||||
#include <shlwapi.h>
|
||||
#pragma comment(lib, "mf.lib")
|
||||
#pragma comment(lib, "mfplat.lib")
|
||||
#pragma comment(lib, "mfuuid.lib")
|
||||
#pragma comment(lib, "shlwapi.lib")
|
||||
|
||||
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#include "../Delegate.h"
|
||||
|
||||
namespace LifeCore {
|
||||
class WebCameraDescription {
|
||||
public:
|
||||
virtual ~WebCameraDescription() {}
|
||||
virtual std::wstring GetName() = 0;
|
||||
};
|
||||
|
||||
typedef std::shared_ptr<WebCameraDescription> webcam_desc_ptr;
|
||||
|
||||
class WebCamera : public ICamera, public IImage
|
||||
{
|
||||
public:
|
||||
Delegate<WebCamera*, RawBuffer<uint8>*> Event_ImageCapture;
|
||||
WebCamera(webcam_desc_ptr desc);
|
||||
int2 GetSize();
|
||||
int32 GetBpp();
|
||||
bool Read(int2 size, uint8* buffer);
|
||||
static std::vector<webcam_desc_ptr> GetConnectedDevices();
|
||||
bool Open();
|
||||
void Close();
|
||||
void OnImageGrabbed(WinMfImageGrabber* grabber, RawBuffer<uint8>* image);
|
||||
void OnCaptureEvent(IMFMediaEvent* pEvent);
|
||||
void Update();
|
||||
RawBuffer<uint8>* GetImage();
|
||||
int FrameNumber;
|
||||
private:
|
||||
webcam_desc_ptr description;
|
||||
WinMfImageGrabber* grabber;
|
||||
IMFMediaSource *pSource;
|
||||
void* callback;
|
||||
};
|
||||
}
|
||||
#endif // WebCamera_h__
|
||||
Reference in New Issue
Block a user