Ticket #5228: iptvchannelfetcher2.patch

File iptvchannelfetcher2.patch, 3.5 KB (added by Michaël Burtin <mburtin@…>, 16 years ago)

Fix typo in code

  • libs/libmythtv/iptv/iptvchannelfetcher.cpp

     
    1515#define LOC QString("IPTVChanFetch: ")
    1616#define LOC_ERR QString("IPTVChanFetch, Error: ")
    1717
    18 void *run_scan_thunk(void*);
    19 
    2018static bool parse_chan_info(const QString   &rawdata,
    2119                            IPTVChannelInfo &info,
    2220                            QString         &channum,
     
    2624                         QString       &channum,
    2725                         QString       &name);
    2826
     27/** \fn IPTVChannelFetcherThread::run(void)
     28*   \brief Thunk that allows iptvfetcher Qthread to
     29*         call IPTVChannelFetcher::RunScan().
     30*/
     31void IPTVChannelFetcherThread::run(void)
     32{
     33    iptvfetcher->RunScan();
     34}
     35
    2936IPTVChannelFetcher::IPTVChannelFetcher(
    3037    uint cardid, const QString &inputname, uint sourceid) :
    3138    _cardid(cardid),       _inputname(Q3DeepCopy<QString>(inputname)),
     
    5764        _stop_now = true;
    5865        _lock.unlock();
    5966
    60         pthread_join(_thread, NULL);
     67        _thread.wait();
    6168        return;
    6269    }
    6370
     
    7683
    7784    _stop_now = false;
    7885
    79     pthread_create(&_thread, NULL, run_scan_thunk, this);
     86    _thread.iptvfetcher = this;
     87    _thread.start(QThread::NormalPriority);
    8088
    8189    while (!_thread_running && !_stop_now)
    8290        usleep(5000);
     
    8694    return _thread_running;
    8795}
    8896
    89 void *run_scan_thunk(void *param)
    90 {
    91     IPTVChannelFetcher *chanscan = (IPTVChannelFetcher*) param;
    92     chanscan->RunScan();
    93 
    94     return NULL;
    95 }
    96 
    9797void IPTVChannelFetcher::RunScan(void)
    9898{
    9999    _thread_running = true;
     
    113113    emit ServiceScanPercentComplete(5);
    114114    emit ServiceScanUpdateText(tr("Downloading Playlist"));
    115115
    116     QString playlist = DownloadPlaylist(url, false);
     116    QString playlist = DownloadPlaylist(url, true);
    117117
    118118    if (_stop_now || playlist.isEmpty())
    119119    {
  • libs/libmythtv/iptv/iptvchannelfetcher.h

     
    11#ifndef _IPTVCHANNELFETCHER_H_
    22#define _IPTVCHANNELFETCHER_H_
    33
    4 // POSIX headers
    5 #include <pthread.h>
    6 
    74// Qt headers
    85#include <qobject.h>
    96#include <qmutex.h>
     7#include <qthread.h>
    108
    119// MythTV headers
    1210#include "iptvchannelinfo.h"
    1311
     12class IPTVChannelFetcher;
     13
     14class IPTVChannelFetcherThread : public QThread
     15{
     16  public:
     17    virtual void run();
     18    IPTVChannelFetcher   *iptvfetcher;
     19};
     20
    1421class IPTVChannelFetcher : public QObject
    1522{
    1623    Q_OBJECT
    1724
    18     friend void *run_scan_thunk(void *param);
     25    friend class IPTVChannelFetcherThread;
    1926
    2027  public:
    2128    IPTVChannelFetcher(uint cardid, const QString &inputname, uint sourceid);
     
    3744    /// \brief Signals that the scan is complete
    3845    void ServiceScanComplete(void);
    3946
     47  protected:
     48    void RunScan(void);
     49
    4050  private:
    4151    ~IPTVChannelFetcher();
    4252    void SetTotalNumChannels(uint val) { _chan_cnt = (val) ? val : 1; }
    4353    void SetNumChannelsParsed(uint);
    4454    void SetNumChannelsInserted(uint);
    4555    void SetMessage(const QString &status);
    46     void RunScan(void);
    4756
    4857  private:
    4958    uint      _cardid;
     
    5261    uint      _chan_cnt;
    5362    bool      _thread_running;
    5463    bool      _stop_now;
    55     pthread_t _thread;
     64    IPTVChannelFetcherThread _thread;
    5665    QMutex    _lock;
    5766};
    5867