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
16 #include "libmythbase/mythtypes.h"
18 #include "libmythtv/mythtvexp.h"
19 
21 {
26 };
27 MTV_PUBLIC QString toString(ChannelVisibleType /*type*/);
28 MTV_PUBLIC QString toRawString(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 { 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};
96  QString m_videoFilters;
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 };
131 using 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  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 
203  ChannelInsertInfo(const ChannelInsertInfo &other) { (*this = other); }
204  ChannelInsertInfo &operator=(const ChannelInsertInfo&) = default;
205 
206  bool IsSameChannel(const ChannelInsertInfo &other, int relaxed = 0) const;
207 
208  bool SaveScan(uint scanid, uint transportid) const;
209 
210  void ImportExtraInfo(const ChannelInsertInfo &other);
211 
212  public:
213  uint m_dbMplexId {0};
214  uint m_sourceId {0};
215  uint m_channelId {0};
216  QString m_callSign;
217  QString m_serviceName;
218  QString m_chanNum;
219  uint m_serviceId {0};
220  uint m_serviceType {0};
221  uint m_atscMajorChannel {0};
222  uint m_atscMinorChannel {0};
223  bool m_useOnAirGuide {false};
224  bool m_hidden {false};
225  bool m_hiddenInGuide {false};
227  QString m_freqId;
228  QString m_icon;
229  QString m_format;
230  QString m_xmltvId;
232 
233  // non-DB info
234  uint m_patTsId {0};
235  uint m_vctTsId {0};
236  uint m_vctChanTsId {0};
237  uint m_sdtTsId {0};
238  uint m_origNetId {0};
239  uint m_netId {0};
240  QString m_siStandard;
241  bool m_inChannelsConf {false};
242  bool m_inPat {false};
243  bool m_inPmt {false};
244  bool m_inVct {false};
245  bool m_inNit {false};
246  bool m_inSdt {false};
247  bool m_isEncrypted {false};
248  bool m_isDataService {false};
249  bool m_isAudioService {false};
250  bool m_isOpencable {false};
251  bool m_couldBeOpencable {false};
252  int m_decryptionStatus {0};
253 
254  // Service relocated descriptor
255  uint m_oldOrigNetId {0};
256  uint m_oldTsId {0};
257  uint m_oldServiceId {0};
258 };
259 using ChannelInsertInfoList = std::vector<ChannelInsertInfo>;
260 
262 
263 #endif // DB_CHANNEL_INFO_H_
ChannelInfo
Definition: channelinfo.h:31
ChannelInfo::m_groupIdList
QList< uint > m_groupIdList
Definition: channelinfo.h:128
toString
MTV_PUBLIC QString toString(ChannelVisibleType)
Definition: channelinfo.cpp:505
ChannelInfo::RemoveInputId
void RemoveInputId(uint linputid)
Definition: channelinfo.h:76
ChannelInfo::m_outputFilters
QString m_outputFilters
Definition: channelinfo.h:107
ChannelInsertInfo::m_chanNum
QString m_chanNum
Definition: channelinfo.h:218
SaveScan
uint SaveScan(const ScanDTVTransportList &scan)
Definition: scaninfo.cpp:22
ChannelInfo::kChannelShort
@ kChannelShort
Definition: channelinfo.h:49
ChannelInsertInfo::m_freqId
QString m_freqId
Definition: channelinfo.h:227
kChannelNeverVisible
@ kChannelNeverVisible
Definition: channelinfo.h:25
ChannelInfo::m_freqId
QString m_freqId
Definition: channelinfo.h:87
mythtvexp.h
ChannelInsertInfoList
std::vector< ChannelInsertInfo > ChannelInsertInfoList
Definition: channelinfo.h:259
ChannelInsertInfo::ChannelInsertInfo
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)
Definition: channelinfo.h:137
ChannelInfo::AddInputId
void AddInputId(uint linputid)
Definition: channelinfo.h:71
ChannelInsertInfo::m_defaultAuthority
QString m_defaultAuthority
Definition: channelinfo.h:231
ChannelInfo::m_name
QString m_name
Definition: channelinfo.h:92
kChannelAlwaysVisible
@ kChannelAlwaysVisible
Definition: channelinfo.h:22
ChannelInfo::m_icon
QString m_icon
Definition: channelinfo.h:93
Q_DECLARE_METATYPE
Q_DECLARE_METATYPE(StandardSetting *)
programtypes.h
ChannelInsertInfo
Definition: channelinfo.h:133
InfoMap
QHash< QString, QString > InfoMap
Definition: mythtypes.h:15
ChannelInfo::GetGroupIds
QList< uint > GetGroupIds() const
Definition: channelinfo.h:57
operator==
bool operator==(MusicMetadata &a, MusicMetadata &b)
Definition: musicmetadata.cpp:40
ChannelInfo::m_oldXmltvId
QString m_oldXmltvId
Definition: channelinfo.h:123
ChannelInsertInfo::ChannelInsertInfo
ChannelInsertInfo(const ChannelInsertInfo &other)
Definition: channelinfo.h:203
ChannelInfo::ChannelFormat
ChannelFormat
Definition: channelinfo.h:49
ChannelInfo::m_chanNum
QString m_chanNum
Definition: channelinfo.h:86
ChannelInfo::m_inputIdList
QList< uint > m_inputIdList
Definition: channelinfo.h:129
mythtypes.h
ChannelInfo::RemoveGroupId
void RemoveGroupId(uint lgroupid)
Definition: channelinfo.h:64
ChannelVisibleType
ChannelVisibleType
Definition: channelinfo.h:20
uint
unsigned int uint
Definition: compat.h:81
ChannelInfo::AddGroupId
void AddGroupId(uint lgroupid)
Definition: channelinfo.h:59
ChannelInsertInfo::m_callSign
QString m_callSign
Definition: channelinfo.h:216
ChannelInsertInfo::m_format
QString m_format
Definition: channelinfo.h:229
MTV_PUBLIC
#define MTV_PUBLIC
Definition: mythtvexp.h:15
ChannelInsertInfo::m_serviceName
QString m_serviceName
Definition: channelinfo.h:217
kChannelVisible
@ kChannelVisible
Definition: channelinfo.h:23
std
Definition: mythchrono.h:23
ChannelInfo::m_tvFormat
QString m_tvFormat
Definition: channelinfo.h:105
ChannelInfo::m_xmltvId
QString m_xmltvId
Definition: channelinfo.h:97
toRawString
MTV_PUBLIC QString toRawString(ChannelVisibleType)
Definition: channelinfo.cpp:522
ChannelFormat
static HostComboBoxSetting * ChannelFormat()
Definition: globalsettings.cpp:2861
ChannelInfo::m_videoFilters
QString m_videoFilters
Definition: channelinfo.h:96
channelVisibleTypeFromString
MTV_PUBLIC ChannelVisibleType channelVisibleTypeFromString(const QString &)
Definition: channelinfo.cpp:539
ChannelInfo::GetInputIds
QList< uint > GetInputIds() const
Definition: channelinfo.h:67
ChannelInsertInfo::m_xmltvId
QString m_xmltvId
Definition: channelinfo.h:230
ChannelInfo::m_lastRecord
QDateTime m_lastRecord
Definition: channelinfo.h:116
ChannelInsertInfo::m_icon
QString m_icon
Definition: channelinfo.h:228
ChannelInfo::SetSourceName
void SetSourceName(const QString &lname)
Definition: channelinfo.h:54
ChannelInfo::m_sourceName
QString m_sourceName
Definition: channelinfo.h:126
ChannelInsertInfo::m_siStandard
QString m_siStandard
Definition: channelinfo.h:240
ChannelInfo::m_defaultAuthority
QString m_defaultAuthority
Definition: channelinfo.h:118
ChannelInfo::m_callSign
QString m_callSign
Definition: channelinfo.h:91
kChannelNotVisible
@ kChannelNotVisible
Definition: channelinfo.h:24
ChannelInfoList
std::vector< ChannelInfo > ChannelInfoList
Definition: channelinfo.h:131