MythTV master
vboxchannelfetcher.h
Go to the documentation of this file.
1#ifndef VBOXCHANNELFETCHER_H
2#define VBOXCHANNELFETCHER_H
3
4#include <utility>
5
6// Qt headers
7#include <QCoreApplication>
8#include <QMap>
9#include <QMutex>
10#include <QObject>
11#include <QRunnable>
12#include <QString>
13
14// MythTV headers
15#include "libmythbase/mthread.h"
17
18#include "channelscantypes.h"
19
20class ScanMonitor;
22
24{
25 Q_DECLARE_TR_FUNCTIONS(VBoxChannelInfo)
26
27 public:
28 VBoxChannelInfo() = default;
29 VBoxChannelInfo(QString name,
30 QString xmltvid,
31 const QString &data_url,
32 bool fta,
33 QString chanType,
34 QString transType,
35 uint serviceID,
36 uint networkID,
37 uint transportID):
38 m_name(std::move(name)), m_xmltvid(std::move(xmltvid)),
39 m_serviceID(serviceID), m_fta(fta), m_channelType(std::move(chanType)),
40 m_transType(std::move(transType)),
41 m_tuning(data_url, IPTVTuningData::http_ts), m_networkID(networkID),
42 m_transportID(transportID)
43 {
44 }
45
46 bool IsValid(void) const
47 {
48 return !m_name.isEmpty() && m_tuning.IsValid();
49 }
50
51 public:
52 QString m_name;
53 QString m_xmltvid;
55 bool m_fta {false};
56 QString m_channelType; // TV/Radio
57 QString m_transType; // T/T2/S/S2/C/A
59 uint m_networkID {0}; // Network ID from triplet
60 uint m_transportID {0}; // Transport ID from triplet
61};
62using vbox_chan_map_t = QMap<QString,VBoxChannelInfo>;
63
64class VBoxChannelFetcher : public QRunnable
65{
67
68 public:
69 VBoxChannelFetcher(uint cardid, QString inputname, uint sourceid,
70 bool ftaOnly, ServiceRequirements serviceType,
71 ScanMonitor *monitor = nullptr);
72 ~VBoxChannelFetcher() override;
73
74 void Scan(void);
75 void Stop(void);
77
78 private:
79 void SetTotalNumChannels(uint val) { m_chanCnt = (val) ? val : 1; }
81 bool SupportedTransmission(const QString &transType);
82
83 protected:
84 void run(void) override; // QRunnable
85
86 private:
89 QString m_inputName;
93 QString m_transType {"UNKNOWN"};
96 bool m_threadRunning {false};
97 bool m_stopNow {false};
98 MThread *m_thread {nullptr};
99 QMutex m_lock;
100};
101
102#endif // VBOXCHANNELFETCHER_H
ServiceRequirements
bool IsValid(void) const
This is a wrapper around QThread that does several additional things.
Definition: mthread.h:49
bool SupportedTransmission(const QString &transType)
ScanMonitor * m_scanMonitor
Q_DECLARE_TR_FUNCTIONS(VBoxChannelFetcher)
void run(void) override
void SetTotalNumChannels(uint val)
vbox_chan_map_t GetChannels(void)
void Stop(void)
Stops the scanning thread running.
void SetNumChannelsInserted(uint val)
vbox_chan_map_t * m_channels
VBoxChannelFetcher(uint cardid, QString inputname, uint sourceid, bool ftaOnly, ServiceRequirements serviceType, ScanMonitor *monitor=nullptr)
ServiceRequirements m_serviceType
VBoxChannelInfo(QString name, QString xmltvid, const QString &data_url, bool fta, QString chanType, QString transType, uint serviceID, uint networkID, uint transportID)
VBoxChannelInfo()=default
IPTVTuningData m_tuning
bool IsValid(void) const
unsigned int uint
Definition: freesurround.h:24
STL namespace.
QMap< QString, VBoxChannelInfo > vbox_chan_map_t