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