40 #ifndef vpDirectShowGrabberImpl_hh 41 #define vpDirectShowGrabberImpl_hh 43 #ifndef DOXYGEN_SHOULD_SKIP_THIS 45 #include <visp3/core/vpConfig.h> 46 #if (defined(VISP_HAVE_DIRECTSHOW)) 52 #include <visp3/core/vpFrameGrabber.h> 53 #include <visp3/core/vpFrameGrabberException.h> 55 #include <visp3/core/vpDebug.h> 56 #include <visp3/sensor/vpDirectShowDevice.h> 57 #include <visp3/sensor/vpDirectShowSampleGrabberI.h> 68 static const int MAX_DELAY = 10000;
69 static const int MAX_DEVICES = 10;
102 vpDirectShowGrabberImpl();
103 virtual ~vpDirectShowGrabberImpl();
117 unsigned int getDeviceNumber() {
return nbDevices; }
120 bool setDevice(
unsigned int id);
123 void displayDevices();
126 bool setImageSize(
unsigned int width,
unsigned int height);
129 bool setFramerate(
double framerate);
132 bool setFormat(
unsigned int width,
unsigned int height,
double framerate);
135 void getFormat(
unsigned int &width,
unsigned int &height,
double &framerate);
138 bool setMediaType(
int mediaTypeID);
144 bool getStreamCapabilities();
147 CComPtr<IGraphBuilder> pGraph;
149 CComPtr<ICaptureGraphBuilder2> pBuild;
152 CComPtr<IBaseFilter> pCapSource;
154 CComPtr<ISampleGrabber> pGrabberI;
155 CComPtr<IBaseFilter> pGrabberFilter;
157 CComPtr<IMediaControl> pControl;
158 CComPtr<IMediaEvent> pEvent;
160 vpDirectShowSampleGrabberI sgCB;
164 static vpDirectShowDevice *deviceList;
167 static unsigned int nbDevices;
173 bool initDirectShow();
176 bool enumerate(CComPtr<IEnumMoniker> &ppVideoInputEnum);
180 bool selectRandomSource(CComPtr<IEnumMoniker> &ppVideoInputEnum, CComPtr<IBaseFilter> &pCapSource);
186 bool createSampleGrabber(CComPtr<IBaseFilter> &ppGrabberFilter);
189 bool checkSourceType(CComPtr<IPin> &pCapSourcePin);
192 bool connectSourceToGrabber(CComPtr<IBaseFilter> &pCapSource, CComPtr<IBaseFilter> &pGrabberFilter);
195 void HRtoStr(std::string str);
198 bool createDeviceList(CComPtr<IEnumMoniker> &ppVideoInputEnum);
201 bool getDevice(
unsigned int n, CComPtr<IBaseFilter> &ppCapSource);
204 unsigned int getFirstUnusedDevice(CComPtr<IBaseFilter> &ppDevice);
210 void MyDeleteMediaType(AM_MEDIA_TYPE *pmt);
213 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