MythTV
master
mythtv
libs
libmythtv
channelscan
hdhrchannelfetcher.h
Go to the documentation of this file.
1
#ifndef HDHRCHANNELFETCHER_H
2
#define HDHRCHANNELFETCHER_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
"
16
#include "
libmythtv/iptvtuningdata.h
"
17
18
#include "
channelscantypes.h
"
19
20
class
ScanMonitor
;
21
class
HDHRChannelFetcher
;
22
23
class
HDHRChannelInfo
24
{
25
Q_DECLARE_TR_FUNCTIONS(
HDHRChannelInfo
)
26
27
public
:
28
HDHRChannelInfo
() =
default
;
29
HDHRChannelInfo
(QString name,
30
QString number,
31
const
QString& url,
32
QString modulation,
33
QString videoCodec,
34
QString audioCodec,
35
uint
frequency,
36
uint
serviceID,
37
uint
networkID,
38
uint
transportID):
39
m_name
(std::move(name)),
40
m_number
(std::move(number)),
41
m_tuning
(url,
IPTVTuningData
::http_ts),
42
m_modulation
(std::move(modulation)),
43
m_videoCodec
(std::move(videoCodec)),
44
m_audioCodec
(std::move(audioCodec)),
45
m_frequency
(frequency),
46
m_serviceID
(serviceID),
47
m_networkID
(networkID),
48
m_transportID
(transportID)
49
{
50
// Determine channel type from presence of audio and video codecs
51
if
(
m_videoCodec
.isEmpty())
52
{
53
if
(
m_audioCodec
.isEmpty())
54
{
55
// No video, no audio, then it is Data
56
m_channelType
=
"Data"
;
57
}
58
else
59
{
60
// Only audio channel then it is Radio
61
m_channelType
=
"Radio"
;
62
}
63
}
64
else
65
{
66
// Video with or without audio is always TV
67
m_channelType
=
"TV"
;
68
}
69
}
70
71
bool
IsValid
(
void
)
const
72
{
73
return
!
m_name
.isEmpty() &&
m_tuning
.
IsValid
();
74
}
75
76
public
:
77
QString
m_name
;
78
QString
m_number
;
79
IPTVTuningData
m_tuning
;
80
QString
m_channelType
;
// TV/Radio/Data
81
QString
m_modulation
;
82
QString
m_videoCodec
;
83
QString
m_audioCodec
;
84
uint
m_frequency
{0};
85
uint
m_serviceID
{0};
86
uint
m_networkID
{0};
87
uint
m_transportID
{0};
88
bool
m_fta
{
true
};
89
};
90
using
hdhr_chan_map_t
= QMap<QString,HDHRChannelInfo>;
91
92
class
HDHRChannelFetcher
:
public
QRunnable
93
{
94
Q_DECLARE_TR_FUNCTIONS
(
HDHRChannelFetcher
);
95
96
public
:
97
HDHRChannelFetcher
(
uint
cardid, QString inputname,
uint
sourceid,
98
ServiceRequirements
serviceType,
ScanMonitor
*monitor =
nullptr
);
99
~HDHRChannelFetcher
()
override
;
100
101
void
Scan
(
void
);
102
void
Stop
(
void
);
103
hdhr_chan_map_t
GetChannels
(
void
);
104
105
private
:
106
void
SetTotalNumChannels
(
uint
val) {
m_chanCnt
= (val) ? val : 1; }
107
void
SetNumChannelsInserted
(
uint
val);
108
109
protected
:
110
void
run
(
void
)
override
;
// QRunnable
111
112
private
:
113
ScanMonitor
*
m_scanMonitor
{
nullptr
};
114
uint
m_cardId
;
115
QString
m_inputName
;
116
uint
m_sourceId
;
117
ServiceRequirements
m_serviceType
;
118
hdhr_chan_map_t
*
m_channels
{
nullptr
};
119
uint
m_chanCnt
{1};
120
bool
m_threadRunning
{
false
};
121
bool
m_stopNow
{
false
};
122
MThread
*
m_thread
{
nullptr
};
123
QMutex
m_lock
;
124
};
125
126
#endif // HDHRCHANNELFETCHER_H
HDHRChannelInfo
Definition:
hdhrchannelfetcher.h:23
HDHRChannelInfo::m_transportID
uint m_transportID
Definition:
hdhrchannelfetcher.h:87
HDHRChannelFetcher::GetChannels
hdhr_chan_map_t GetChannels(void)
Definition:
hdhrchannelfetcher.cpp:289
HDHRChannelInfo::m_serviceID
uint m_serviceID
Definition:
hdhrchannelfetcher.h:85
HDHRChannelFetcher::m_cardId
uint m_cardId
Definition:
hdhrchannelfetcher.h:114
HDHRChannelFetcher::m_chanCnt
uint m_chanCnt
Definition:
hdhrchannelfetcher.h:119
HDHRChannelInfo::HDHRChannelInfo
HDHRChannelInfo(QString name, QString number, const QString &url, QString modulation, QString videoCodec, QString audioCodec, uint frequency, uint serviceID, uint networkID, uint transportID)
Definition:
hdhrchannelfetcher.h:29
HDHRChannelFetcher::m_thread
MThread * m_thread
Definition:
hdhrchannelfetcher.h:122
HDHRChannelFetcher::m_scanMonitor
ScanMonitor * m_scanMonitor
Definition:
hdhrchannelfetcher.h:113
HDHRChannelInfo::m_fta
bool m_fta
Definition:
hdhrchannelfetcher.h:88
HDHRChannelInfo::HDHRChannelInfo
HDHRChannelInfo()=default
HDHRChannelInfo::m_audioCodec
QString m_audioCodec
Definition:
hdhrchannelfetcher.h:83
HDHRChannelFetcher::HDHRChannelFetcher
HDHRChannelFetcher(uint cardid, QString inputname, uint sourceid, ServiceRequirements serviceType, ScanMonitor *monitor=nullptr)
Definition:
hdhrchannelfetcher.cpp:247
HDHRChannelFetcher::m_threadRunning
bool m_threadRunning
Definition:
hdhrchannelfetcher.h:120
HDHRChannelFetcher::m_sourceId
uint m_sourceId
Definition:
hdhrchannelfetcher.h:116
HDHRChannelFetcher
Definition:
hdhrchannelfetcher.h:92
HDHRChannelInfo::m_frequency
uint m_frequency
Definition:
hdhrchannelfetcher.h:84
channelscantypes.h
HDHRChannelFetcher::Scan
void Scan(void)
Definition:
hdhrchannelfetcher.cpp:299
HDHRChannelFetcher::Q_DECLARE_TR_FUNCTIONS
Q_DECLARE_TR_FUNCTIONS(HDHRChannelFetcher)
HDHRChannelFetcher::m_stopNow
bool m_stopNow
Definition:
hdhrchannelfetcher.h:121
HDHRChannelFetcher::Stop
void Stop(void)
Stops the scanning thread running.
Definition:
hdhrchannelfetcher.cpp:272
ServiceRequirements
ServiceRequirements
Definition:
channelscantypes.h:4
HDHRChannelInfo::m_modulation
QString m_modulation
Definition:
hdhrchannelfetcher.h:81
HDHRChannelInfo::m_name
QString m_name
Definition:
hdhrchannelfetcher.h:77
IPTVTuningData
Definition:
iptvtuningdata.h:21
HDHRChannelInfo::m_networkID
uint m_networkID
Definition:
hdhrchannelfetcher.h:86
iptvtuningdata.h
uint
unsigned int uint
Definition:
compat.h:81
hdhr_chan_map_t
QMap< QString, HDHRChannelInfo > hdhr_chan_map_t
Definition:
hdhrchannelfetcher.h:90
HDHRChannelInfo::IsValid
bool IsValid(void) const
Definition:
hdhrchannelfetcher.h:71
HDHRChannelInfo::m_videoCodec
QString m_videoCodec
Definition:
hdhrchannelfetcher.h:82
HDHRChannelFetcher::SetTotalNumChannels
void SetTotalNumChannels(uint val)
Definition:
hdhrchannelfetcher.h:106
HDHRChannelFetcher::SetNumChannelsInserted
void SetNumChannelsInserted(uint val)
Definition:
hdhrchannelfetcher.cpp:488
MThread
This is a wrapper around QThread that does several additional things.
Definition:
mthread.h:48
mthread.h
IPTVTuningData::IsValid
bool IsValid(void) const
Definition:
iptvtuningdata.h:172
HDHRChannelFetcher::~HDHRChannelFetcher
~HDHRChannelFetcher() override
Definition:
hdhrchannelfetcher.cpp:260
HDHRChannelFetcher::m_serviceType
ServiceRequirements m_serviceType
Definition:
hdhrchannelfetcher.h:117
HDHRChannelFetcher::m_inputName
QString m_inputName
Definition:
hdhrchannelfetcher.h:115
HDHRChannelFetcher::run
void run(void) override
Definition:
hdhrchannelfetcher.cpp:306
HDHRChannelInfo::m_tuning
IPTVTuningData m_tuning
Definition:
hdhrchannelfetcher.h:79
HDHRChannelFetcher::m_channels
hdhr_chan_map_t * m_channels
Definition:
hdhrchannelfetcher.h:118
HDHRChannelInfo::m_number
QString m_number
Definition:
hdhrchannelfetcher.h:78
ScanMonitor
Definition:
scanmonitor.h:44
HDHRChannelFetcher::m_lock
QMutex m_lock
Definition:
hdhrchannelfetcher.h:123
HDHRChannelInfo::m_channelType
QString m_channelType
Definition:
hdhrchannelfetcher.h:80
Generated on Mon Nov 25 2024 03:16:06 for MythTV by
1.8.17