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