include/avcap/windows/DS_Control.h

Go to the documentation of this file.
00001 /*
00002  * (c) 2005, 2008 Nico Pranke <Nico.Pranke@googlemail.com>, Robin Luedtke <RobinLu@gmx.de> 
00003  *
00004  * This file is part of avcap.
00005  *
00006  * avcap is free software: you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License as published by
00008  * the Free Software Foundation, either version 3 of the License, or
00009  * (at your option) any later version.
00010  *
00011  * avcap is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with avcap.  If not, see <http://www.gnu.org/licenses/>.
00018  */
00019 
00020 /* avcap is free for non-commercial use.
00021  * To use it in commercial endeavors, please contact Nico Pranke <Nico.Pranke@googlemail.com>.
00022  */
00023 
00024 
00025 #ifndef DSCONTROL_H_
00026 #define DSCONTROL_H_
00027 
00028 #include <string>
00029 
00030 #include "Control_avcap.h"
00031 #include "Interval.h"
00032 #include "avcap-export.h"
00033 
00034 namespace avcap
00035 {
00036 class DS_DeviceDescriptor;
00037 
00039 
00040         class AVCAP_Export DS_Control
00041         {
00042         public:
00043                 enum Ctrl_Type
00044                 {
00045                         CTRL_TYPE_INTEGER = 1,
00046                         CTRL_TYPE_BOOLEAN = 2,
00047                 };
00048         
00049                 enum DShowInterface
00050                 {
00051                         IAM_VIDEOPROCAMP = 1,
00052                         IAM_CAMERACONTROL = 2,
00053                 };
00054         
00056                 
00057                 struct Query_Ctrl
00058                 {
00059                         unsigned int    id;
00060                         Ctrl_Type               type;
00061                         std::string     name;
00062                         
00063                         long minimum;
00064                         long maximum;
00065                         long step;
00066                         long default_value;
00067                         long flags;
00068                         long property;
00069         
00070                         DS_Control::DShowInterface DShowInterfaceType;
00071                 };
00072         
00073         private:
00074                 DShowInterface  mDShowInterfaceType;
00075                 long                    mProperty;
00076                 int                     mId;
00077                 int                     mValue;
00078                 std::string     mName;
00079                 int                     mDefaultValue;
00080                 int                     mFlags;
00081                 bool                    mInitialized;
00082         
00083         protected:
00084                 DS_DeviceDescriptor* mDSDeviceDescriptor;
00085         
00086         public:
00087                 DS_Control(DS_DeviceDescriptor *dd, Query_Ctrl* query);
00088                 virtual ~DS_Control();
00089         
00090                 inline int getId() const
00091                         { return mId; }
00092         
00093                 inline int getDefaultValue() const
00094                         { return mDefaultValue; }
00095         
00096                 inline const std::string& getName() const
00097                         { return mName; }
00098         
00099                 int setValue(int val);
00100         
00101                 int getValue() const;
00102         
00103                 int reset();
00104                 
00105         private:
00106                 int update();
00107 
00108                 int retrieveValue();
00109         };
00110         
00112         
00113         class DS_IntControl : public IntegerControl
00114         {
00115         private:
00116                 Interval        mInterval;
00117                 DS_Control      mControlBase;
00118                 
00119         public:
00120                 inline DS_IntControl(DS_DeviceDescriptor *dd, struct DS_Control::Query_Ctrl* query) :
00121                         mInterval(query->minimum, query->maximum, query->step),
00122                         mControlBase(dd, query)
00123                         {}
00124         
00125                 virtual inline ~DS_IntControl()
00126                         {}
00127         
00128                 inline const Interval& getInterval() const 
00129                         { return mInterval; }
00130 
00131                 virtual inline int getId() const
00132                         { return mControlBase.getId(); }
00133         
00134                 virtual inline int getDefaultValue() const
00135                         { return mControlBase.getDefaultValue(); }
00136         
00137                 virtual inline const std::string& getName() const
00138                         { return mControlBase.getName(); }
00139         
00140                 virtual inline int setValue(int val)
00141                         { return mControlBase.setValue(val); }
00142         
00143                 virtual inline int getValue() const
00144                         { return mControlBase.getValue(); }
00145                 
00146                 virtual inline int reset() 
00147                         { return mControlBase.reset(); }
00148         };
00149         
00151 
00152         class DS_BoolControl : public BoolControl
00153         {
00154         private:
00155                 DS_Control      mControlBase;
00156 
00157         public:
00158                 inline DS_BoolControl(DS_DeviceDescriptor *dd, struct DS_Control::Query_Ctrl* query) :
00159                         mControlBase(dd, query)
00160                         {}
00161         
00162                 virtual inline ~DS_BoolControl()
00163                         {}
00164                 
00165                 virtual inline int getId() const
00166                         { return mControlBase.getId(); }
00167         
00168                 virtual inline int getDefaultValue() const
00169                         { return mControlBase.getDefaultValue(); }
00170         
00171                 virtual inline const std::string& getName() const
00172                         { return mControlBase.getName(); }
00173         
00174                 virtual inline int setValue(int val)
00175                         { return mControlBase.setValue(val); }
00176         
00177                 virtual inline int getValue() const
00178                         { return mControlBase.getValue(); }
00179                 
00180                 virtual inline int reset() 
00181                         { return mControlBase.reset(); }
00182         };
00183 }
00184 
00185 #endif // DSCONTROL_H_

Generated on Mon Nov 30 11:10:30 2009 for avcap-0.1 by  doxygen 1.5.1