00001 #ifndef _IPTVCHANNELFETCHER_H_ 00002 #define _IPTVCHANNELFETCHER_H_ 00003 00004 // Qt headers 00005 #include <QRunnable> 00006 #include <QObject> 00007 #include <QMutex> 00008 00009 // MythTV headers 00010 #include "iptvchannelinfo.h" 00011 #include "mthread.h" 00012 00013 class ScanMonitor; 00014 class IPTVChannelFetcher; 00015 00016 class IPTVChannelFetcher : public QRunnable 00017 { 00018 public: 00019 IPTVChannelFetcher(uint cardid, const QString &inputname, uint sourceid, 00020 ScanMonitor *monitor = NULL); 00021 ~IPTVChannelFetcher(); 00022 00023 bool Scan(void); 00024 void Stop(void); 00025 00026 static QString DownloadPlaylist(const QString &url, bool inQtThread); 00027 static fbox_chan_map_t ParsePlaylist( 00028 const QString &rawdata, IPTVChannelFetcher *fetcher = NULL); 00029 00030 private: 00031 void SetTotalNumChannels(uint val) { _chan_cnt = (val) ? val : 1; } 00032 void SetNumChannelsParsed(uint); 00033 void SetNumChannelsInserted(uint); 00034 void SetMessage(const QString &status); 00035 00036 protected: 00037 virtual void run(void); // QRunnable 00038 00039 private: 00040 ScanMonitor *_scan_monitor; 00041 uint _cardid; 00042 QString _inputname; 00043 uint _sourceid; 00044 uint _chan_cnt; 00045 bool _thread_running; 00046 bool _stop_now; 00047 MThread *_thread; 00048 QMutex _lock; 00049 }; 00050 00051 #endif // _IPTVCHANNELFETCHER_H_ 00052 00053 /* vim: set expandtab tabstop=4 shiftwidth=4: */
1.6.3