41 , imgBufferForCallback(NULL)
44 InitializeCriticalSection(&
crit);
45 next_event = CreateEvent(NULL, FALSE, FALSE, NULL);
58 DeleteCriticalSection(&
crit);
69 ZeroMemory(&mt,
sizeof(AM_MEDIA_TYPE));
70 mt.majortype = MEDIATYPE_Video;
71 mt.subtype = MEDIASUBTYPE_RGB24;
84 ZeroMemory(&mt,
sizeof(AM_MEDIA_TYPE));
88 if ((mt.formattype == FORMAT_VideoInfo) &&
89 (mt.cbFormat >=
sizeof(VIDEOINFOHEADER)) &&
90 (mt.pbFormat != NULL) )
92 if(mt.subtype == MEDIASUBTYPE_RGB24)
94 else if(mt.subtype == MEDIASUBTYPE_RGB32)
97 VIDEOINFOHEADER *pVih = (VIDEOINFOHEADER*)mt.pbFormat;
136 IplImage *ret = NULL;
137 if (WaitForSingleObject(
next_event, 1000) == WAIT_OBJECT_0) {
138 EnterCriticalSection(&
crit);
142 LeaveCriticalSection(&
crit);
149 HRESULT hr =
m_pDSCapture->ShowVideoCaptureFormatDialog();
150 return SUCCEEDED(hr);
155 return "CaptureDSCapture";
165 EnterCriticalSection(&
crit);
172 LeaveCriticalSection(&
crit);
189 device_map* vids = capture.GetVideoCaptureDevices();
190 for (device_map::iterator i = vids->begin(); i != vids->end(); ++i) {
192 devices.push_back(dev);
Capture * createCapture(const CaptureDevice captureDevice)
Create Capture class. Transfers onwership to the caller.
std::string SerializeId()
The identification of the class for serialization.
void OnVideoSample(BYTE *pBuffer, DWORD dwDataLen, REFERENCE_TIME t_start)
~CapturePluginDSCapture()
Destructor.
IplImage * captureImage()
Capture one image from the camera.
CaptureDevice mCaptureDevice
CaptureDeviceVector enumerateDevices()
Enumerate capture devices currently available.
CapturePluginDSCapture(const std::string &captureType)
Constructor.
CDSCapture * m_pDSCapture
CaptureDevice holder for camera information.
BYTE * imgBufferForCallback
void registerPlugin(const std::string &captureType, alvar::CapturePlugin *&capturePlugin)
CapturePlugin interface that plugins must implement.
Implementation of Capture interface for DSCapture plugin.
std::string id() const
The id of the camera.
This file implements a capture plugin based on DSCapture.
bool isCapturing()
Test if the camera was properly initialized.
void stop()
Stops the camera capture.
Capture interface that plugins must implement.
Class for serializing class content to/from file or std::iostream.
alvar::plugins::CaptureDSCapture::VideoSampler sampler
bool start()
Starts the camera capture.
std::vector< CaptureDevice > CaptureDeviceVector
Vector of CaptureDevices.
bool showSettingsDialog()
Show the settings dialog of the camera.
~CaptureDSCapture()
Destructor.
bool Serialize(Serialization *serialization)
Performs serialization of the class members and configuration.