include/avcap/linux/V4L2_Tuner.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 V4L2_TUNER_H_
00026 #define V4L2_TUNER_H_
00027 
00028 #include <linux/types.h>
00029 #include <linux/videodev.h>
00030 #include <sys/types.h>
00031 #include <string>
00032 
00033 #include "Tuner_avcap.h"
00034 
00035 namespace avcap
00036 {
00037         class V4L2_DeviceDescriptor;
00038         
00040         
00041         class V4L2_Tuner: public Tuner
00042         {
00043         private:
00044 
00045                 enum {
00046                         TUNER_RADIO = V4L2_TUNER_RADIO,
00047                         TUNER_ANALOG_TV = V4L2_TUNER_ANALOG_TV,
00048                 };
00049                 
00050                 enum {
00051                         TUNER_CAP_LOW = V4L2_TUNER_CAP_LOW
00052                 };
00053 
00054                 typedef __u32        uint;
00055 
00056         private:
00057                 V4L2_DeviceDescriptor*  mDeviceDescriptor;
00058                 int                     mIndex;
00059                 std::string     mName;
00060                 int                     mType;
00061                 int                     mCapabilities;
00062                 uint            mRangeHigh;
00063                 uint            mRangeLow;
00064                 double          mStep;
00065                 
00066         public:
00067                 V4L2_Tuner(V4L2_DeviceDescriptor *dd, int index, const std::string &name, int type, int caps, uint high, uint low);
00068                 virtual ~V4L2_Tuner();
00069                 
00070                 inline bool isRadioTuner() const 
00071                         { return mType & TUNER_RADIO; }
00072 
00073                 inline bool isTVTuner() const 
00074                         { return mType & TUNER_ANALOG_TV; };
00075 
00076                 int setStereo();
00077 
00078                 int setMono();
00079                 
00080                 int setSAP();
00081                 
00082                 int setLang1();
00083 
00084                 int setLang2();
00085 
00086                 double getFreq() const;
00087 
00088                 inline double getFreqStep() const 
00089                         { return mStep; }
00090                 
00091                 inline double getMinFreq() const 
00092                         { return mRangeLow*mStep; }
00093 
00094                 inline double getMaxFreq() const 
00095                         { return mRangeHigh*mStep; }
00096                 
00097                 inline const std::string getName() const
00098                         { return mName; }
00099                 
00100                 int finetune(int maxsteps);
00101                 
00102                 int getAFCValue() const;
00103                 
00104                 int getSignalStrength() const;
00105                 
00106                 int increaseFreq();
00107                 
00108                 int decreaseFreq();             
00109                 
00110                 int setFreq(double f);
00111                 
00112         private:
00113                 int setAudioMode(int mode);
00114 
00115                 int getAudioMode();
00116         };
00117 }
00118 
00119 #endif // V4L2_TUNER_H_
00120 

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