ViSP  2.8.0
vpDirectShowDevice.h
1 /****************************************************************************
2  *
3  * $Id: vpDirectShowDevice.h 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 device description.
36  *
37  * Authors:
38  * Bruno Renier
39  *
40  *****************************************************************************/
41 
42 #ifndef vpDirectShowDevice_hh
43 #define vpDirectShowDevice_hh
44 
45 #ifndef DOXYGEN_SHOULD_SKIP_THIS
46 
47 #include <visp/vpConfig.h>
48 #if ( defined(VISP_HAVE_DIRECTSHOW) )
49 
50 #include <atlbase.h>
51 #include <iostream>
52 #include <string>
53 #include <dshow.h>
54 
55 
56 
57 class VISP_EXPORT vpDirectShowDevice
58 {
59 
60  std::string name; //the device's name
61  std::string desc; //the device's description
62  std::string devPath; //the device's device path (unique)
63 
64  bool inUse; //true if the device is already used by a grabber
65 
66 public:
67  vpDirectShowDevice() : inUse(false){}
68  vpDirectShowDevice(const CComPtr<IMoniker>& moniker) : inUse(false){ init(moniker); }
69 
70  bool init(const CComPtr<IMoniker>& moniker);
71 
72  bool getState(){ return inUse; }
73  void setInUse(){ inUse=true; }
74  void resetInUse() { inUse=false; }
75 
76  std::string& getName(){ return name; }
77  std::string& getDesc(){ return desc; }
78  std::string& getDevPath(){ return devPath; }
79 
80  bool operator==(vpDirectShowDevice& dev);
81 
82  friend VISP_EXPORT std::ostream& operator<<(std::ostream& os, vpDirectShowDevice& dev)
83  {
84  return os<<dev.name<<std::endl<<dev.desc<<std::endl<<dev.devPath;
85  }
86 };
87 #endif
88 #endif
89 #endif