00001
00002
00003 #ifndef CHANNEL_H
00004 #define CHANNEL_H
00005
00006 #include "dtvchannel.h"
00007 #include "videodev_myth.h"
00008
00009 using namespace std;
00010
00011 #define FAKE_VIDEO 0
00012
00013 class TVRec;
00014
00015 typedef QMap<int,int> VidModV4L1;
00016 typedef QMap<int,v4l2_std_id> VidModV4L2;
00017
00028 class Channel : public DTVChannel
00029 {
00030 public:
00031 Channel(TVRec *parent, const QString &videodevice);
00032 virtual ~Channel(void);
00033
00034 bool Init(QString &inputname, QString &startchannel, bool setchan);
00035
00036 bool Open(void);
00037 void Close(void);
00038
00039
00040 void SetFd(int fd);
00041 void SetFormat(const QString &format);
00042 int SetDefaultFreqTable(const QString &name);
00043 bool SetChannelByString(const QString &chan);
00044
00045
00046 bool IsOpen(void) const { return GetFd() >= 0; }
00047 int GetFd(void) const { return videofd; }
00048 QString GetDevice(void) const { return device; }
00049 QString GetSIStandard(void) const { return "atsc"; }
00050
00051
00052 bool SwitchToInput(int newcapchannel, bool setstarting);
00053 bool Retune(void);
00054
00055
00056 bool InitPictureAttributes(void);
00057 int GetPictureAttribute(PictureAttribute) const;
00058 int ChangePictureAttribute(PictureAdjustType, PictureAttribute, bool up);
00059
00060
00061 void SaveCachedPids(const pid_cache_t&) const;
00062 void GetCachedPids(pid_cache_t&) const;
00063
00064
00065 bool TuneMultiplex(uint mplexid, QString inputname);
00066 bool Tune(const DTVMultiplex &tuning, QString inputname);
00067
00068
00069 bool Tune(uint frequency, QString inputname,
00070 QString modulation, QString si_std);
00071
00072 private:
00073
00074 void SetFreqTable(const int index);
00075 int SetFreqTable(const QString &name);
00076 bool SetInputAndFormat(int newcapchannel, QString newFmt);
00077
00078
00079 int GetCurrentChannelNum(const QString &channame);
00080 QString GetFormatForChannel(QString channum,
00081 QString inputname);
00082
00083
00084 bool InitPictureAttribute(const QString db_col_name);
00085 bool TuneTo(const QString &chan, int finetune);
00086 bool InitializeInputs(void);
00087
00088 private:
00089
00090 QString device;
00091 int videofd;
00092 QString device_name;
00093 QString driver_name;
00094 QMap<QString,int> pict_attr_default;
00095
00096 struct CHANLIST *curList;
00097 int totalChannels;
00098
00099 QString currentFormat;
00100 bool is_dtv;
00101 bool usingv4l2;
00102 VidModV4L1 videomode_v4l1;
00103 VidModV4L2 videomode_v4l2;
00104
00105 int defaultFreqTable;
00106 };
00107
00108 #endif