00001
00002
00003
00004
00005
00006
00007 #ifndef _DTVCHANNEL_H_
00008 #define _DTVCHANNEL_H_
00009
00010
00011 #include <stdint.h>
00012
00013
00014 #include <vector>
00015 using namespace std;
00016
00017
00018 #include <QReadWriteLock>
00019 #include <QString>
00020 #include <QMutex>
00021
00022
00023 #include "dtvconfparserhelpers.h"
00024 #include "channelbase.h"
00025 #include "channelutil.h"
00026
00027 class ProgramAssociationTable;
00028 class ProgramMapTable;
00029 class TVRec;
00030
00034 class DTVChannel : public ChannelBase
00035 {
00036 public:
00037 DTVChannel(TVRec *parent);
00038 virtual ~DTVChannel();
00039
00040
00041 virtual bool SetChannelByString(const QString &chan);
00042
00044 virtual bool TuneMultiplex(uint mplexid, QString inputname);
00051 virtual bool Tune(const DTVMultiplex &tuning, QString inputname) = 0;
00053 virtual bool EnterPowerSavingMode(void)
00054 {
00055 return true;
00056 }
00063 virtual bool Tune(const QString &freqid, int finetune)
00064 {
00065 (void) freqid; (void) finetune;
00066 return false;
00067 }
00068
00069 virtual bool Tune(uint64_t frequency, QString inputname)
00070 {
00071 (void) frequency; (void) inputname;
00072 return false;
00073 }
00074
00075
00076
00078 int GetProgramNumber(void) const
00079 { return currentProgramNum; };
00080
00082 uint GetMajorChannel(void) const
00083 { return currentATSCMajorChannel; };
00084
00086 uint GetMinorChannel(void) const
00087 { return currentATSCMinorChannel; };
00088
00090 uint GetOriginalNetworkID(void) const
00091 { return currentOriginalNetworkID; };
00092
00094 uint GetTransportID(void) const
00095 { return currentTransportID; };
00096
00098 QString GetSIStandard(void) const;
00099
00101 QString GetSuggestedTuningMode(bool is_live_tv) const;
00102
00104 QString GetTuningMode(void) const;
00105
00107 virtual vector<DTVTunerType> GetTunerTypes(void) const;
00108
00109 void GetCachedPids(pid_cache_t &pid_cache) const;
00110
00111 void RegisterForMaster(const QString &key);
00112 void DeregisterForMaster(const QString &key);
00113 static DTVChannel *GetMasterLock(const QString &key);
00114 typedef DTVChannel* DTVChannelP;
00115 static void ReturnMasterLock(DTVChannelP&);
00116
00118 virtual bool IsMaster(void) const { return false; }
00119
00120 virtual bool IsPIDTuningSupported(void) const { return false; }
00121
00122 bool HasGeneratedPAT(void) const { return genPAT != NULL; }
00123 bool HasGeneratedPMT(void) const { return genPMT != NULL; }
00124 const ProgramAssociationTable *GetGeneratedPAT(void) const {return genPAT;}
00125 const ProgramMapTable *GetGeneratedPMT(void) const {return genPMT;}
00126
00127
00128
00130 void SetTuningMode(const QString &tuningmode);
00131
00132 void SaveCachedPids(const pid_cache_t &pid_cache) const;
00133
00134 protected:
00136 void SetSIStandard(const QString&);
00137 void SetDTVInfo(uint atsc_major, uint atsc_minor,
00138 uint dvb_orig_netid,
00139 uint mpeg_tsid, int mpeg_pnum);
00140 void ClearDTVInfo(void) { SetDTVInfo(0, 0, 0, 0, -1); }
00142 virtual void CheckOptions(DTVMultiplex &tuning) const {}
00143 virtual void HandleScriptEnd(bool ok);
00144
00145 protected:
00146 mutable QMutex dtvinfo_lock;
00147
00148 DTVTunerType tunerType;
00149 QString sistandard;
00150 QString tuningMode;
00151 int currentProgramNum;
00152 uint currentATSCMajorChannel;
00153 uint currentATSCMinorChannel;
00154 uint currentTransportID;
00155 uint currentOriginalNetworkID;
00156
00158 ProgramAssociationTable *genPAT;
00160 ProgramMapTable *genPMT;
00161
00162 typedef QMap<QString,QList<DTVChannel*> > MasterMap;
00163 static QReadWriteLock master_map_lock;
00164 static MasterMap master_map;
00165 };
00166
00167 #endif // _DTVCHANNEL_H_