MythTV master
channelinfo.h
Go to the documentation of this file.
1#ifndef DB_CHANNEL_INFO_H_
2#define DB_CHANNEL_INFO_H_
3
4// C++ headers
5#include <cstdint>
6#include <utility>
7#include <vector>
8
9// Qt headers
10#include <QString>
11#include <QImage>
12#include <QVariant>
13#include <QDateTime>
14
15// MythTV headers
18#include "libmythtv/mythtvexp.h"
19
20enum ChannelVisibleType : std::int8_t
21{
26};
27MTV_PUBLIC QString toString(ChannelVisibleType /*type*/);
30
32{
33 public:
34 ChannelInfo() = default;
35 ChannelInfo(const ChannelInfo &other);
36 ChannelInfo(QString _channum, QString _callsign,
37 uint _chanid, uint _major_chan, uint _minor_chan,
38 uint _mplexid, ChannelVisibleType _visible,
39 QString _name, QString _icon,
40 uint _sourceid);
41
42 ChannelInfo& operator=(const ChannelInfo &other);
43
44 bool operator == (uint chanid) const
45 { return m_chanId == chanid; }
46
47 bool Load(uint lchanid = -1);
48
49 enum ChannelFormat : std::uint8_t { kChannelShort, kChannelLong };
50 QString GetFormatted(ChannelFormat format) const;
51 void ToMap(InfoMap &infoMap);
52
53 QString GetSourceName();
54 void SetSourceName(const QString &lname) { m_sourceName = lname; }
55
56
57 QList<uint> GetGroupIds() const { return m_groupIdList; }
58 void LoadGroupIds();
59 void AddGroupId(uint lgroupid)
60 {
61 if (!m_groupIdList.contains(lgroupid))
62 m_groupIdList.push_back(lgroupid);
63 }
64 void RemoveGroupId(uint lgroupid) { m_groupIdList.removeOne(lgroupid); }
65
66
67 QList<uint> GetInputIds() const { return m_inputIdList; }
68 void LoadInputIds();
69 // Since inputids must only appear once in a list, protect access
70 // to it
71 void AddInputId(uint linputid)
72 {
73 if (!m_inputIdList.contains(linputid))
74 m_inputIdList.push_back(linputid);
75 }
76 void RemoveInputId(uint linputid) { m_inputIdList.removeOne(linputid); }
77
78
79 private:
80 void Init();
81
82 public:
83
84 // Ordered to match channel table
85 uint m_chanId {0};
86 QString m_chanNum;
87 QString m_freqId; // May be overloaded to a
88 // non-frequency identifier
89 uint m_sourceId {0};
90
91 QString m_callSign;
92 QString m_name;
93 QString m_icon;
94
95 int m_fineTune {0};
97 QString m_xmltvId;
98 int m_recPriority {0};
99
100 uint m_contrast {32768};
101 uint m_brightness {32768};
102 uint m_colour {32768};
103 uint m_hue {32768};
104
105 QString m_tvFormat;
108 bool m_useOnAirGuide {false};
109
110 uint m_mplexId {0};
111 uint m_serviceId {0};
112 uint m_serviceType {0};
113 uint m_atscMajorChan {0};
114 uint m_atscMinorChan {0};
115
116 QDateTime m_lastRecord;
117
119 int m_commMethod {-1};
120 int m_tmOffset {0};
121 uint m_iptvId {0};
122
123 QString m_oldXmltvId; // Used by mythfilldatabase when updating the xmltvid
124
125 private:
126 QString m_sourceName; // Cache here rather than looking up each time
127 // Following not in database - Cached
128 QList<uint> m_groupIdList;
129 QList<uint> m_inputIdList;
130};
131using ChannelInfoList = std::vector<ChannelInfo>;
132
134{
135 public:
136 ChannelInsertInfo(void) = default;
138 uint _db_mplexid, uint _source_id,
139 uint _channel_id, QString _callsign,
140 QString _service_name, QString _chan_num,
141 uint _service_id,
142
143 uint _atsc_major_channel, uint _atsc_minor_channel,
144 bool _use_on_air_guide, bool _hidden,
145 bool _hidden_in_guide,
146
147 QString _freqid, QString _icon,
148 QString _format, QString _xmltvid,
149
150 uint _pat_tsid, uint _vct_tsid,
151 uint _vct_chan_tsid, uint _sdt_tsid,
152
153 uint _orig_netid, uint _netid,
154
155 QString _si_standard,
156
157 bool _in_channels_conf, bool _in_pat,
158 bool _in_pmt, bool _in_vct,
159 bool _in_nit, bool _in_sdt,
160
161 bool _is_encrypted, bool _is_data_service,
162 bool _is_audio_service, bool _is_opencable,
163 bool _could_be_opencable, int _decryption_status,
164 QString _default_authority, uint _service_type,
165 uint _logical_channel, uint _simulcast_channel ) :
166 m_dbMplexId(_db_mplexid),
167 m_sourceId(_source_id),
168 m_channelId(_channel_id),
169 m_callSign(std::move(_callsign)),
170 m_serviceName(std::move(_service_name)),
171 m_chanNum(std::move(_chan_num)),
172 m_serviceId(_service_id),
173 m_serviceType(_service_type),
174 m_atscMajorChannel(_atsc_major_channel),
175 m_atscMinorChannel(_atsc_minor_channel),
176 m_useOnAirGuide(_use_on_air_guide),
177 m_hidden(_hidden),
178 m_hiddenInGuide(_hidden_in_guide),
179 m_freqId(std::move(_freqid)),
180 m_icon(std::move(_icon)),
181 m_format(std::move(_format)),
182 m_xmltvId(std::move(_xmltvid)),
183 m_defaultAuthority(std::move(_default_authority)),
184 m_patTsId(_pat_tsid),
185 m_vctTsId(_vct_tsid),
186 m_vctChanTsId(_vct_chan_tsid),
187 m_sdtTsId(_sdt_tsid),
188 m_origNetId(_orig_netid),
189 m_netId(_netid),
190 m_siStandard(std::move(_si_standard)),
191 m_inChannelsConf(_in_channels_conf),
192 m_inPat(_in_pat),
193 m_inPmt(_in_pmt),
194 m_inVct(_in_vct),
195 m_inNit(_in_nit),
196 m_inSdt(_in_sdt),
197 m_isEncrypted(_is_encrypted),
198 m_isDataService(_is_data_service),
199 m_isAudioService(_is_audio_service),
200 m_isOpencable(_is_opencable),
201 m_couldBeOpencable(_could_be_opencable),
202 m_decryptionStatus(_decryption_status),
203 m_logicalChannel(_logical_channel),
204 m_simulcastChannel(_simulcast_channel) {}
205
206 ChannelInsertInfo(const ChannelInsertInfo &other) { (*this = other); }
208
209 bool IsSameChannel(const ChannelInsertInfo &other, int relaxed = 0) const;
210
211 bool SaveScan(uint scanid, uint transportid) const;
212
213 void ImportExtraInfo(const ChannelInsertInfo &other);
214
215 public:
216 uint m_dbMplexId {0};
217 uint m_sourceId {0};
218 uint m_channelId {0};
219 QString m_callSign;
221 QString m_chanNum;
222 uint m_serviceId {0};
223 uint m_serviceType {0};
224 uint m_atscMajorChannel {0};
225 uint m_atscMinorChannel {0};
226 bool m_useOnAirGuide {false};
227 bool m_hidden {false};
228 bool m_hiddenInGuide {false};
230 QString m_freqId;
231 QString m_icon;
232 QString m_format;
233 QString m_xmltvId;
235
236 // non-DB info
237 uint m_patTsId {0};
238 uint m_vctTsId {0};
239 uint m_vctChanTsId {0};
240 uint m_sdtTsId {0};
241 uint m_origNetId {0};
242 uint m_netId {0};
244 bool m_inChannelsConf {false};
245 bool m_inPat {false};
246 bool m_inPmt {false};
247 bool m_inVct {false};
248 bool m_inNit {false};
249 bool m_inSdt {false};
250 bool m_isEncrypted {false};
251 bool m_isDataService {false};
252 bool m_isAudioService {false};
253 bool m_isOpencable {false};
254 bool m_couldBeOpencable {false};
255 int m_decryptionStatus {0};
256 uint m_logicalChannel {0};
257 uint m_simulcastChannel {0};
258
259 // Service relocated descriptor
260 uint m_oldOrigNetId {0};
261 uint m_oldTsId {0};
262 uint m_oldServiceId {0};
263};
264using ChannelInsertInfoList = std::vector<ChannelInsertInfo>;
265
267
268#endif // DB_CHANNEL_INFO_H_
MTV_PUBLIC ChannelVisibleType channelVisibleTypeFromString(const QString &)
MTV_PUBLIC QString toRawString(ChannelVisibleType)
ChannelVisibleType
Definition: channelinfo.h:21
@ kChannelNeverVisible
Definition: channelinfo.h:25
@ kChannelNotVisible
Definition: channelinfo.h:24
@ kChannelAlwaysVisible
Definition: channelinfo.h:22
@ kChannelVisible
Definition: channelinfo.h:23
MTV_PUBLIC QString toString(ChannelVisibleType)
std::vector< ChannelInsertInfo > ChannelInsertInfoList
Definition: channelinfo.h:264
std::vector< ChannelInfo > ChannelInfoList
Definition: channelinfo.h:131
QList< uint > GetGroupIds() const
Definition: channelinfo.h:57
QString m_outputFilters
Definition: channelinfo.h:107
QString m_chanNum
Definition: channelinfo.h:86
QString m_tvFormat
Definition: channelinfo.h:105
QDateTime m_lastRecord
Definition: channelinfo.h:116
QString m_sourceName
Definition: channelinfo.h:126
QString m_name
Definition: channelinfo.h:92
QString m_icon
Definition: channelinfo.h:93
QString m_freqId
Definition: channelinfo.h:87
void SetSourceName(const QString &lname)
Definition: channelinfo.h:54
void RemoveInputId(uint linputid)
Definition: channelinfo.h:76
QList< uint > m_inputIdList
Definition: channelinfo.h:129
QList< uint > GetInputIds() const
Definition: channelinfo.h:67
void RemoveGroupId(uint lgroupid)
Definition: channelinfo.h:64
void AddGroupId(uint lgroupid)
Definition: channelinfo.h:59
void AddInputId(uint linputid)
Definition: channelinfo.h:71
QString m_oldXmltvId
Definition: channelinfo.h:123
QList< uint > m_groupIdList
Definition: channelinfo.h:128
ChannelInfo()=default
QString m_defaultAuthority
Definition: channelinfo.h:118
QString m_callSign
Definition: channelinfo.h:91
QString m_xmltvId
Definition: channelinfo.h:97
QString m_videoFilters
Definition: channelinfo.h:96
ChannelInsertInfo(uint _db_mplexid, uint _source_id, uint _channel_id, QString _callsign, QString _service_name, QString _chan_num, uint _service_id, uint _atsc_major_channel, uint _atsc_minor_channel, bool _use_on_air_guide, bool _hidden, bool _hidden_in_guide, QString _freqid, QString _icon, QString _format, QString _xmltvid, uint _pat_tsid, uint _vct_tsid, uint _vct_chan_tsid, uint _sdt_tsid, uint _orig_netid, uint _netid, QString _si_standard, bool _in_channels_conf, bool _in_pat, bool _in_pmt, bool _in_vct, bool _in_nit, bool _in_sdt, bool _is_encrypted, bool _is_data_service, bool _is_audio_service, bool _is_opencable, bool _could_be_opencable, int _decryption_status, QString _default_authority, uint _service_type, uint _logical_channel, uint _simulcast_channel)
Definition: channelinfo.h:137
ChannelInsertInfo & operator=(const ChannelInsertInfo &)=default
QString m_serviceName
Definition: channelinfo.h:220
ChannelInsertInfo(void)=default
ChannelInsertInfo(const ChannelInsertInfo &other)
Definition: channelinfo.h:206
QString m_defaultAuthority
Definition: channelinfo.h:234
QString m_siStandard
Definition: channelinfo.h:243
unsigned int uint
Definition: freesurround.h:24
static HostComboBoxSetting * ChannelFormat()
bool operator==(MusicMetadata &a, MusicMetadata &b)
Q_DECLARE_METATYPE(std::chrono::seconds)
#define MTV_PUBLIC
Definition: mythtvexp.h:15
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
STL namespace.
uint SaveScan(const ScanDTVTransportList &scan)
Definition: scaninfo.cpp:22