00001 // -*- Mode: c++ -*- 00002 #ifndef EITSCANNER_H 00003 #define EITSCANNER_H 00004 00005 // Qt includes 00006 #include <qmutex.h> 00007 #include <qobject.h> 00008 #include <qdatetime.h> 00009 #include <qstringlist.h> 00010 #include <qwaitcondition.h> 00011 #include <qthread.h> 00012 00013 class TVRec; 00014 class ChannelBase; 00015 class DVBSIParser; 00016 class EITHelper; 00017 class ProgramMapTable; 00018 00019 class EITSource 00020 { 00021 protected: 00022 virtual ~EITSource() {} 00023 public: 00024 virtual void SetEITHelper(EITHelper*) = 0; 00025 virtual void SetEITRate(float rate) = 0; 00026 }; 00027 00028 class EITScanner; 00029 00030 class EITThread : public QThread 00031 { 00032 public: 00033 virtual void run(); 00034 EITScanner *scanner; 00035 }; 00036 00037 class EITScanner 00038 { 00039 friend class EITThread; 00040 00041 public: 00042 EITScanner(uint cardnum); 00043 ~EITScanner() { TeardownAll(); } 00044 00045 void StartPassiveScan(ChannelBase*, EITSource*, bool ignore_source); 00046 void StopPassiveScan(void); 00047 00048 void StartActiveScan(TVRec*, uint max_seconds_per_source, 00049 bool ignore_source); 00050 00051 void StopActiveScan(void); 00052 00053 protected: 00054 void RunEventLoop(void); 00055 00056 private: 00057 void TeardownAll(void); 00058 static void *SpawnEventLoop(void*); 00059 static void RescheduleRecordings(void); 00060 00061 QMutex lock; 00062 ChannelBase *channel; 00063 EITSource *eitSource; 00064 00065 EITHelper *eitHelper; 00066 EITThread eventThread; 00067 bool exitThread; 00068 QWaitCondition exitThreadCond; 00069 00070 TVRec *rec; 00071 bool activeScan; 00072 QDateTime activeScanNextTrig; 00073 uint activeScanTrigTime; 00074 QStringList activeScanChannels; 00075 QStringList::iterator activeScanNextChan; 00076 00077 bool ignore_source; 00078 00079 uint cardnum; 00080 00081 static QMutex resched_lock; 00082 static QDateTime resched_next_time; 00083 00085 static const uint kMinRescheduleInterval; 00086 }; 00087 00088 #endif // EITSCANNER_H
1.5.5