00001 #ifndef _IPTVCHANNELFETCHER_H_ 00002 #define _IPTVCHANNELFETCHER_H_ 00003 00004 // POSIX headers 00005 #include <pthread.h> 00006 00007 // Qt headers 00008 #include <qobject.h> 00009 #include <qmutex.h> 00010 00011 // MythTV headers 00012 #include "iptvchannelinfo.h" 00013 00014 class IPTVChannelFetcher : public QObject 00015 { 00016 Q_OBJECT 00017 00018 friend void *run_scan_thunk(void *param); 00019 00020 public: 00021 IPTVChannelFetcher(uint cardid, const QString &inputname, uint sourceid); 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 signals: 00034 void ServiceScanPercentComplete(int p); 00036 void ServiceScanUpdateText(const QString &status); 00038 void ServiceScanComplete(void); 00039 00040 private: 00041 ~IPTVChannelFetcher(); 00042 void SetTotalNumChannels(uint val) { _chan_cnt = (val) ? val : 1; } 00043 void SetNumChannelsParsed(uint); 00044 void SetNumChannelsInserted(uint); 00045 void SetMessage(const QString &status); 00046 void RunScan(void); 00047 00048 private: 00049 uint _cardid; 00050 QString _inputname; 00051 uint _sourceid; 00052 uint _chan_cnt; 00053 bool _thread_running; 00054 bool _stop_now; 00055 pthread_t _thread; 00056 QMutex _lock; 00057 }; 00058 00059 #endif // _IPTVCHANNELFETCHER_H_ 00060 00061 /* vim: set expandtab tabstop=4 shiftwidth=4: */
1.5.5