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>
66 static const int MAX_DELAY = 10000;
67 static const int MAX_DEVICES = 10;
100 vpDirectShowGrabberImpl();
101 virtual ~vpDirectShowGrabberImpl();
115 unsigned int getDeviceNumber() {
return nbDevices; }
118 bool setDevice(
unsigned int id);
121 void displayDevices();
124 bool setImageSize(
unsigned int width,
unsigned int height);
127 bool setFramerate(
double framerate);
130 bool setFormat(
unsigned int width,
unsigned int height,
double framerate);
133 void getFormat(
unsigned int &width,
unsigned int &height,
double &framerate);
136 bool setMediaType(
int mediaTypeID);
142 bool getStreamCapabilities();
145 CComPtr<IGraphBuilder> pGraph;
147 CComPtr<ICaptureGraphBuilder2> pBuild;
150 CComPtr<IBaseFilter> pCapSource;
152 CComPtr<ISampleGrabber> pGrabberI;
153 CComPtr<IBaseFilter> pGrabberFilter;
155 CComPtr<IMediaControl> pControl;
156 CComPtr<IMediaEvent> pEvent;
158 vpDirectShowSampleGrabberI sgCB;
162 static vpDirectShowDevice *deviceList;
165 static unsigned int nbDevices;
171 bool initDirectShow();
174 bool enumerate(CComPtr<IEnumMoniker> &ppVideoInputEnum);
178 bool selectRandomSource(CComPtr<IEnumMoniker> &ppVideoInputEnum, CComPtr<IBaseFilter> &pCapSource);
184 bool createSampleGrabber(CComPtr<IBaseFilter> &ppGrabberFilter);
187 bool checkSourceType(CComPtr<IPin> &pCapSourcePin);
190 bool connectSourceToGrabber(CComPtr<IBaseFilter> &pCapSource, CComPtr<IBaseFilter> &pGrabberFilter);
193 void HRtoStr(std::string &str);
196 bool createDeviceList(CComPtr<IEnumMoniker> &ppVideoInputEnum);
199 bool getDevice(
unsigned int n, CComPtr<IBaseFilter> &ppCapSource);
202 unsigned int getFirstUnusedDevice(CComPtr<IBaseFilter> &ppDevice);
208 void MyDeleteMediaType(AM_MEDIA_TYPE *pmt);
211 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