43 #ifndef vpDirectShowGrabberImpl_hh
44 #define vpDirectShowGrabberImpl_hh
46 #ifndef DOXYGEN_SHOULD_SKIP_THIS
48 #include <visp/vpConfig.h>
49 #if ( defined(VISP_HAVE_DIRECTSHOW) )
55 #include <visp/vpFrameGrabber.h>
56 #include <visp/vpFrameGrabberException.h>
58 #include <visp/vpDirectShowSampleGrabberI.h>
59 #include <visp/vpDirectShowDevice.h>
60 #include <visp/vpDebug.h>
73 static const int MAX_DELAY = 10000;
74 static const int MAX_DEVICES = 10;
109 vpDirectShowGrabberImpl();
110 virtual ~vpDirectShowGrabberImpl();
124 unsigned int getDeviceNumber() {
return nbDevices;}
127 bool setDevice(
unsigned int id);
130 void displayDevices();
133 bool setImageSize(
unsigned int width,
unsigned int height);
136 bool setFramerate(
double framerate);
139 bool setFormat(
unsigned int width,
unsigned int height,
double framerate);
142 void getFormat(
unsigned int &width,
unsigned int &height,
double &framerate);
145 bool setMediaType(
int mediaTypeID);
151 bool getStreamCapabilities();
156 CComPtr<IGraphBuilder> pGraph;
158 CComPtr<ICaptureGraphBuilder2> pBuild;
161 CComPtr<IBaseFilter> pCapSource;
163 CComPtr<ISampleGrabber> pGrabberI;
164 CComPtr<IBaseFilter> pGrabberFilter;
166 CComPtr<IMediaControl> pControl;
167 CComPtr<IMediaEvent> pEvent;
169 vpDirectShowSampleGrabberI sgCB;
173 static vpDirectShowDevice * deviceList;
176 static unsigned int nbDevices;
182 bool initDirectShow();
185 bool enumerate(CComPtr<IEnumMoniker>& ppVideoInputEnum);
188 bool selectRandomSource(CComPtr<IEnumMoniker>& ppVideoInputEnum, CComPtr<IBaseFilter>& pCapSource);
194 bool createSampleGrabber(CComPtr<IBaseFilter>& ppGrabberFilter);
197 bool checkSourceType(CComPtr<IPin>& pCapSourcePin);
200 bool connectSourceToGrabber(CComPtr<IBaseFilter>& pCapSource, CComPtr<IBaseFilter>& pGrabberFilter);
203 void HRtoStr(std::string str);
206 bool createDeviceList(CComPtr<IEnumMoniker>& ppVideoInputEnum);
209 bool getDevice(
unsigned int n, CComPtr<IBaseFilter>& ppCapSource);
212 unsigned int getFirstUnusedDevice(CComPtr<IBaseFilter>& ppDevice);
218 void MyDeleteMediaType(AM_MEDIA_TYPE *pmt);
221 void MyFreeMediaType(AM_MEDIA_TYPE& mt);
virtual void open(vpImage< unsigned char > &I)=0
Base class for all video devices. It is designed to provide a front end to video sources.
virtual void acquire(vpImage< unsigned char > &I)=0