36 #ifndef vpDirectShowGrabberImpl_hh
37 #define vpDirectShowGrabberImpl_hh
39 #ifndef DOXYGEN_SHOULD_SKIP_THIS
41 #include <visp3/core/vpConfig.h>
42 #if (defined(VISP_HAVE_DIRECTSHOW))
48 #include <visp3/core/vpFrameGrabber.h>
49 #include <visp3/core/vpFrameGrabberException.h>
51 #include <visp3/core/vpDebug.h>
52 #include <visp3/sensor/vpDirectShowDevice.h>
53 #include <visp3/sensor/vpDirectShowSampleGrabberI.h>
64 static const int MAX_DELAY = 10000;
65 static const int MAX_DEVICES = 10;
98 vpDirectShowGrabberImpl();
99 virtual ~vpDirectShowGrabberImpl();
113 unsigned int getDeviceNumber() {
return nbDevices; }
116 bool setDevice(
unsigned int id);
119 void displayDevices();
122 bool setImageSize(
unsigned int width,
unsigned int height);
125 bool setFramerate(
double framerate);
128 bool setFormat(
unsigned int width,
unsigned int height,
double framerate);
131 void getFormat(
unsigned int &width,
unsigned int &height,
double &framerate);
134 bool setMediaType(
int mediaTypeID);
140 bool getStreamCapabilities();
143 CComPtr<IGraphBuilder> pGraph;
145 CComPtr<ICaptureGraphBuilder2> pBuild;
148 CComPtr<IBaseFilter> pCapSource;
150 CComPtr<ISampleGrabber> pGrabberI;
151 CComPtr<IBaseFilter> pGrabberFilter;
153 CComPtr<IMediaControl> pControl;
154 CComPtr<IMediaEvent> pEvent;
156 vpDirectShowSampleGrabberI sgCB;
160 static vpDirectShowDevice *deviceList;
163 static unsigned int nbDevices;
169 bool initDirectShow();
172 bool enumerate(CComPtr<IEnumMoniker> &ppVideoInputEnum);
176 bool selectRandomSource(CComPtr<IEnumMoniker> &ppVideoInputEnum, CComPtr<IBaseFilter> &pCapSource);
182 bool createSampleGrabber(CComPtr<IBaseFilter> &ppGrabberFilter);
185 bool checkSourceType(CComPtr<IPin> &pCapSourcePin);
188 bool connectSourceToGrabber(CComPtr<IBaseFilter> &pCapSource, CComPtr<IBaseFilter> &pGrabberFilter);
191 void HRtoStr(std::string &str);
194 bool createDeviceList(CComPtr<IEnumMoniker> &ppVideoInputEnum);
197 bool getDevice(
unsigned int n, CComPtr<IBaseFilter> &ppCapSource);
200 unsigned int getFirstUnusedDevice(CComPtr<IBaseFilter> &ppDevice);
206 void MyDeleteMediaType(AM_MEDIA_TYPE *pmt);
209 void MyFreeMediaType(AM_MEDIA_TYPE &mt);
Base class for all video devices. It is designed to provide a front end to video sources.
virtual void open(vpImage< unsigned char > &I)=0
virtual void acquire(vpImage< unsigned char > &I)=0