39 #ifndef vpDirectShowGrabberImpl_hh
40 #define vpDirectShowGrabberImpl_hh
42 #ifndef DOXYGEN_SHOULD_SKIP_THIS
44 #include <visp3/core/vpConfig.h>
45 #if ( defined(VISP_HAVE_DIRECTSHOW) )
51 #include <visp3/core/vpFrameGrabber.h>
52 #include <visp3/core/vpFrameGrabberException.h>
54 #include <visp3/sensor/vpDirectShowSampleGrabberI.h>
55 #include <visp3/sensor/vpDirectShowDevice.h>
56 #include <visp3/core/vpDebug.h>
67 static const int MAX_DELAY = 10000;
68 static const int MAX_DEVICES = 10;
103 vpDirectShowGrabberImpl();
104 virtual ~vpDirectShowGrabberImpl();
118 unsigned int getDeviceNumber() {
return nbDevices;}
121 bool setDevice(
unsigned int id);
124 void displayDevices();
127 bool setImageSize(
unsigned int width,
unsigned int height);
130 bool setFramerate(
double framerate);
133 bool setFormat(
unsigned int width,
unsigned int height,
double framerate);
136 void getFormat(
unsigned int &width,
unsigned int &height,
double &framerate);
139 bool setMediaType(
int mediaTypeID);
145 bool getStreamCapabilities();
150 CComPtr<IGraphBuilder> pGraph;
152 CComPtr<ICaptureGraphBuilder2> pBuild;
155 CComPtr<IBaseFilter> pCapSource;
157 CComPtr<ISampleGrabber> pGrabberI;
158 CComPtr<IBaseFilter> pGrabberFilter;
160 CComPtr<IMediaControl> pControl;
161 CComPtr<IMediaEvent> pEvent;
163 vpDirectShowSampleGrabberI sgCB;
167 static vpDirectShowDevice * deviceList;
170 static unsigned int nbDevices;
176 bool initDirectShow();
179 bool enumerate(CComPtr<IEnumMoniker>& ppVideoInputEnum);
182 bool selectRandomSource(CComPtr<IEnumMoniker>& ppVideoInputEnum, CComPtr<IBaseFilter>& pCapSource);
188 bool createSampleGrabber(CComPtr<IBaseFilter>& ppGrabberFilter);
191 bool checkSourceType(CComPtr<IPin>& pCapSourcePin);
194 bool connectSourceToGrabber(CComPtr<IBaseFilter>& pCapSource, CComPtr<IBaseFilter>& pGrabberFilter);
197 void HRtoStr(std::string str);
200 bool createDeviceList(CComPtr<IEnumMoniker>& ppVideoInputEnum);
203 bool getDevice(
unsigned int n, CComPtr<IBaseFilter>& ppCapSource);
206 unsigned int getFirstUnusedDevice(CComPtr<IBaseFilter>& ppDevice);
212 void MyDeleteMediaType(AM_MEDIA_TYPE *pmt);
215 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