00001
00002
00003
00004
00005
00006
00007
00008 #ifndef DVBCHANNEL_H
00009 #define DVBCHANNEL_H
00010
00011 #include <qobject.h>
00012 #include <qstring.h>
00013 #include <qmap.h>
00014
00015 #include "mythcontext.h"
00016 #include "mythdbcon.h"
00017 #include "dtvchannel.h"
00018 #include "streamlisteners.h"
00019 #include "diseqc.h"
00020
00021 class TVRec;
00022 class DVBCam;
00023 class DVBRecorder;
00024 class DVBChannel;
00025
00026 typedef QMap<const DVBChannel*,bool> IsOpenMap;
00027
00028 class DVBChannel : public DTVChannel
00029 {
00030 public:
00031 DVBChannel(int cardnum, TVRec *parent = NULL);
00032 ~DVBChannel();
00033
00034 bool Open(void) { return Open(this); }
00035 void Close(void) { Close(this); }
00036
00037 bool Init(QString &inputname, QString &startchannel, bool setchan);
00038
00039
00040 void SetPMT(const ProgramMapTable*);
00041 void SetTimeOffset(double offset);
00042 void SetSlowTuning(uint how_slow_in_ms)
00043 { tuning_delay = how_slow_in_ms; }
00044
00045
00046 bool IsOpen(void) const;
00047 int GetFd(void) const { return fd_frontend; }
00048 bool IsTuningParamsProbeSupported(void) const;
00049
00050 QString GetDevice(void) const { return QString::number(GetCardNum()); }
00052 int GetCardNum(void) const { return cardnum; };
00054 QString GetFrontendName(void) const;
00055 DTVTunerType GetCardType(void) const { return card_type; }
00056 bool IsMaster(void) const { return master == NULL; }
00058 bool HasCRCBug(void) const { return has_crc_bug; }
00059 uint GetMinSignalMonitorDelay(void) const { return sigmon_delay; }
00061 const DiSEqCDevRotor *GetRotor(void) const;
00062
00064 bool HasLock(bool *ok = NULL) const;
00066 double GetSignalStrength(bool *ok = NULL) const;
00074 double GetSNR(bool *ok = NULL) const;
00076 double GetBitErrorRate(bool *ok = NULL) const;
00078 double GetUncorrectedBlockCount(bool *ok = NULL) const;
00079
00080
00081 bool SwitchToInput(const QString &inputname, const QString &chan);
00082 bool SwitchToInput(int newcapchannel, bool setstarting);
00083 bool SetChannelByString(const QString &chan);
00084 bool Tune(const DTVMultiplex &tuning, QString inputname);
00085 bool Tune(const DTVMultiplex &tuning, uint inputid,
00086 bool force_reset = false, bool same_input = false);
00087 bool TuneMultiplex(uint mplexid, QString inputname);
00088 bool Retune(void);
00089
00090 bool ProbeTuningParams(DTVMultiplex &tuning) const;
00091
00092
00093 void SaveCachedPids(const pid_cache_t&) const;
00094 void GetCachedPids(pid_cache_t&) const;
00095
00096 private:
00097 bool Open(DVBChannel*);
00098 void Close(DVBChannel*);
00099
00100 int GetChanID(void) const;
00101
00102 void CheckOptions(DTVMultiplex &t) const;
00103 bool CheckModulation(DTVModulation modulation) const;
00104 bool CheckCodeRate(DTVCodeRate rate) const;
00105
00106 private:
00107 DVBChannel *master;
00108 IsOpenMap is_open;
00109
00110
00111 DiSEqCDev diseqc_dev;
00112 DiSEqCDevSettings diseqc_settings;
00113 DiSEqCDevTree *diseqc_tree;
00114 DVBCam *dvbcam;
00115
00116
00117 QString frontend_name;
00118 DTVTunerType card_type;
00119 uint64_t capabilities;
00120 uint64_t ext_modulations;
00121 uint64_t frequency_minimum;
00122 uint64_t frequency_maximum;
00123 uint symbol_rate_minimum;
00124 uint symbol_rate_maximum;
00125
00126
00127 mutable QMutex tune_lock;
00128 mutable QMutex hw_lock;
00130 DTVMultiplex desired_tuning;
00132 DTVMultiplex prev_tuning;
00133
00134 uint last_lnb_dev_id;
00135
00136 uint tuning_delay;
00137 uint sigmon_delay;
00138 bool first_tune;
00139
00140
00141 int fd_frontend;
00142 int cardnum;
00143 bool has_crc_bug;
00144 int nextInputID;
00145 };
00146
00147 #endif