00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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