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