ViSP  2.8.0
vpDirectShowGrabber.cpp
1 /****************************************************************************
2  *
3  * $Id: vpDirectShowGrabber.cpp 4056 2013-01-05 13:04:42Z fspindle $
4  *
5  * This file is part of the ViSP software.
6  * Copyright (C) 2005 - 2013 by INRIA. All rights reserved.
7  *
8  * This software is free software; you can redistribute it and/or
9  * modify it under the terms of the GNU General Public License
10  * ("GPL") version 2 as published by the Free Software Foundation.
11  * See the file LICENSE.txt at the root directory of this source
12  * distribution for additional information about the GNU GPL.
13  *
14  * For using ViSP with software that can not be combined with the GNU
15  * GPL, please contact INRIA about acquiring a ViSP Professional
16  * Edition License.
17  *
18  * See http://www.irisa.fr/lagadic/visp/visp.html for more information.
19  *
20  * This software was developed at:
21  * INRIA Rennes - Bretagne Atlantique
22  * Campus Universitaire de Beaulieu
23  * 35042 Rennes Cedex
24  * France
25  * http://www.irisa.fr/lagadic
26  *
27  * If you have questions regarding the use of this file, please contact
28  * INRIA at visp@inria.fr
29  *
30  * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
31  * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
32  *
33  *
34  * Description:
35  * DirectShow framegrabber.
36  *
37  * Authors:
38  * Bruno Renier
39  * Anthony Saunier
40  *
41  *****************************************************************************/
42 
43 
44 #include <visp/vpConfig.h>
45 #if ( defined(VISP_HAVE_DIRECTSHOW) )
46 
47 #include <visp/vpDirectShowGrabber.h>
48 #include <visp/vpDirectShowGrabberImpl.h>
49 
53 unsigned int vpDirectShowGrabber::getHeight(){ return grabber->getHeight(); }
54 
58 unsigned int vpDirectShowGrabber::getWidth(){ return grabber->getWidth(); }
59 
60 
66 {
67  grabber = new vpDirectShowGrabberImpl();
68 }
69 
74 {
75  delete grabber;
76 }
82 {
83  grabber->open();
84 }
85 
91 {
92  grabber->open();
93 }
94 
100 {
101  grabber->open();
102 }
103 
104 
114 {
115  grabber->acquire(I);
116 }
117 
127 {
128  grabber->acquire(I);
129 }
130 
131 
135 void vpDirectShowGrabber::close() { grabber->close(); }
136 
142 {
143  return grabber->getDeviceNumber();
144 }
145 
152 bool vpDirectShowGrabber::setDevice(unsigned int id)
153 {
154  return grabber->setDevice(id);
155 }
156 
161 {
162  grabber->displayDevices();
163 }
171 bool vpDirectShowGrabber::setImageSize(unsigned int width,unsigned int height)
172 {
173  return grabber->setImageSize(width, height);
174 }
181 bool vpDirectShowGrabber::setFramerate(double framerate)
182 {
183  return grabber->setFramerate(framerate);
184 }
193 bool vpDirectShowGrabber::setFormat(unsigned int width,unsigned int height,double framerate)
194 {
195  return grabber->setFormat(width, height, framerate);
196 }
197 /*
198  Get capture format
199  \param width : Pointer to a variable that receives the width in pixel
200  \param height : Pointer to a variable that receives the height in pixel
201  \param framerate : Pointer to a variable that receives the framerate in fps
202 */
203 void vpDirectShowGrabber::getFormat(unsigned int &width,unsigned int &height, double &framerate)
204 {
205  grabber->getFormat(width, height, framerate);
206 }
207 
214 {
215  return grabber->getStreamCapabilities();
216 }
217 
225 {
226  return grabber->setMediaType(mediaTypeID);
227 }
228 
229 /*
230  Get current capture MediaType
231 
232  \return the current mediaTypeID
233 */
235 {
236  return grabber->getMediaType();
237 }
238 
239 
240 #endif
241 
void getFormat(unsigned int &width, unsigned int &height, double &framerate)
bool setMediaType(int mediaTypeID)
bool setFramerate(double framerate)
bool setDevice(unsigned int id)
bool setFormat(unsigned int width, unsigned int height, double framerate)
void acquire(vpImage< unsigned char > &I)
bool setImageSize(unsigned int width, unsigned int height)
unsigned int getDeviceNumber()