Kodi Development 22.0
for Binary and Script based Add-Ons
 
Loading...
Searching...
No Matches
Channels.h
1/*
2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
4 *
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
7 */
8
9#pragma once
10
11#include "../../AddonBase.h"
12#include "../../c-api/addon-instance/pvr.h"
13
14//¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
15// "C++" Definitions group 2 - PVR channel
16#ifdef __cplusplus
17
18namespace kodi
19{
20namespace addon
21{
22
23//==============================================================================
38class PVRChannel : public DynamicCStructHdl<PVRChannel, PVR_CHANNEL>
39{
40 friend class CInstancePVRClient;
41
42public:
44 PVRChannel() { m_cStructure->iClientProviderUid = PVR_PROVIDER_INVALID_UID; }
45 PVRChannel(const PVRChannel& channel) : DynamicCStructHdl(channel) {}
67
70
73 void SetUniqueId(unsigned int uniqueId) { m_cStructure->iUniqueId = uniqueId; }
74
76 unsigned int GetUniqueId() const { return m_cStructure->iUniqueId; }
77
80 void SetIsRadio(bool isRadio) { m_cStructure->bIsRadio = isRadio; }
81
83 bool GetIsRadio() const { return m_cStructure->bIsRadio; }
84
87 void SetChannelNumber(unsigned int channelNumber)
88 {
89 m_cStructure->iChannelNumber = channelNumber;
90 }
91
93 unsigned int GetChannelNumber() const { return m_cStructure->iChannelNumber; }
94
97 void SetSubChannelNumber(unsigned int subChannelNumber)
98 {
99 m_cStructure->iSubChannelNumber = subChannelNumber;
100 }
101
103 unsigned int GetSubChannelNumber() const { return m_cStructure->iSubChannelNumber; }
104
107 void SetChannelName(const std::string& channelName)
108 {
109 ReallocAndCopyString(&m_cStructure->strChannelName, channelName.c_str());
110 }
111
113 std::string GetChannelName() const
114 {
115 return m_cStructure->strChannelName ? m_cStructure->strChannelName : "";
116 }
117
124 void SetMimeType(const std::string& inputFormat)
125 {
126 ReallocAndCopyString(&m_cStructure->strMimeType, inputFormat.c_str());
127 }
128
130 std::string GetMimeType() const
131 {
132 return m_cStructure->strMimeType ? m_cStructure->strMimeType : "";
133 }
134
142 void SetEncryptionSystem(unsigned int encryptionSystem)
143 {
144 m_cStructure->iEncryptionSystem = encryptionSystem;
145 }
146
148 unsigned int GetEncryptionSystem() const { return m_cStructure->iEncryptionSystem; }
149
152 void SetIconPath(const std::string& iconPath)
153 {
154 ReallocAndCopyString(&m_cStructure->strIconPath, iconPath.c_str());
155 }
156
158 std::string GetIconPath() const
159 {
160 return m_cStructure->strIconPath ? m_cStructure->strIconPath : "";
161 }
162
165 void SetIsHidden(bool isHidden) { m_cStructure->bIsHidden = isHidden; }
166
168 bool GetIsHidden() const { return m_cStructure->bIsHidden; }
169
172 void SetHasArchive(bool hasArchive) { m_cStructure->bHasArchive = hasArchive; }
173
175 bool GetHasArchive() const { return m_cStructure->bHasArchive; }
176
179 void SetOrder(bool order) { m_cStructure->iOrder = order; }
180
182 bool GetOrder() const { return m_cStructure->iOrder; }
184
189 void SetClientProviderUid(int iClientProviderUid)
190 {
191 m_cStructure->iClientProviderUid = iClientProviderUid;
192 }
193
195 int GetClientProviderUid() const { return m_cStructure->iClientProviderUid; }
196
197 static void AllocResources(const PVR_CHANNEL* source, PVR_CHANNEL* target)
198 {
199 target->strChannelName = AllocAndCopyString(source->strChannelName);
200 target->strMimeType = AllocAndCopyString(source->strMimeType);
201 target->strIconPath = AllocAndCopyString(source->strIconPath);
202 }
203
204 static void FreeResources(PVR_CHANNEL* target)
205 {
206 FreeString(target->strChannelName);
207 FreeString(target->strMimeType);
208 FreeString(target->strIconPath);
209 }
210
211private:
212 PVRChannel(const PVR_CHANNEL* channel) : DynamicCStructHdl(channel) {}
213 PVRChannel(PVR_CHANNEL* channel) : DynamicCStructHdl(channel) {}
214};
216//------------------------------------------------------------------------------
217
218//==============================================================================
226{
227public:
229 PVRChannelsResultSet() = delete;
230 PVRChannelsResultSet(const AddonInstance_PVR* instance, PVR_HANDLE handle)
231 : m_instance(instance), m_handle(handle)
232 {
233 }
238
243 {
244 m_instance->toKodi->TransferChannelEntry(m_instance->toKodi->kodiInstance, m_handle, tag);
245 }
246
248
249private:
250 const AddonInstance_PVR* m_instance = nullptr;
251 const PVR_HANDLE m_handle;
252};
254//------------------------------------------------------------------------------
255
256//==============================================================================
270class PVRSignalStatus : public DynamicCStructHdl<PVRSignalStatus, PVR_SIGNAL_STATUS>
271{
272 friend class CInstancePVRClient;
273
274public:
276 PVRSignalStatus() = default;
277 PVRSignalStatus(const PVRSignalStatus& status) : DynamicCStructHdl(status) {}
296
299
302 void SetAdapterName(const std::string& adapterName)
303 {
304 ReallocAndCopyString(&m_cStructure->strAdapterName, adapterName.c_str());
305 }
306
308 std::string GetAdapterName() const
309 {
310 return m_cStructure->strAdapterName ? m_cStructure->strAdapterName : "";
311 }
312
315 void SetAdapterStatus(const std::string& adapterStatus)
316 {
317 ReallocAndCopyString(&m_cStructure->strAdapterStatus, adapterStatus.c_str());
318 }
319
321 std::string GetAdapterStatus() const
322 {
323 return m_cStructure->strAdapterStatus ? m_cStructure->strAdapterStatus : "";
324 }
325
328 void SetServiceName(const std::string& serviceName)
329 {
330 ReallocAndCopyString(&m_cStructure->strServiceName, serviceName.c_str());
331 }
332
334 std::string GetServiceName() const
335 {
336 return m_cStructure->strServiceName ? m_cStructure->strServiceName : "";
337 }
338
341 void SetProviderName(const std::string& providerName)
342 {
343 ReallocAndCopyString(&m_cStructure->strProviderName, providerName.c_str());
344 }
345
347 std::string GetProviderName() const
348 {
349 return m_cStructure->strProviderName ? m_cStructure->strProviderName : "";
350 }
351
354 void SetMuxName(const std::string& muxName)
355 {
356 ReallocAndCopyString(&m_cStructure->strMuxName, muxName.c_str());
357 }
358
360 std::string GetMuxName() const
361 {
362 return m_cStructure->strMuxName ? m_cStructure->strMuxName : "";
363 }
364
369 void SetSNR(int snr) { m_cStructure->iSNR = snr; }
370
372 int GetSNR() const { return m_cStructure->iSNR; }
373
378 void SetSignal(int signal) { m_cStructure->iSignal = signal; }
379
381 int GetSignal() const { return m_cStructure->iSignal; }
382
385 void SetBER(long ber) { m_cStructure->iBER = ber; }
386
388 long GetBER() const { return m_cStructure->iBER; }
389
392 void SetUNC(long unc) { m_cStructure->iUNC = unc; }
393
395 long GetUNC() const { return m_cStructure->iUNC; }
397
398 static void AllocResources(const PVR_SIGNAL_STATUS* source, PVR_SIGNAL_STATUS* target)
399 {
400 target->strAdapterName = AllocAndCopyString(source->strAdapterName);
401 target->strAdapterStatus = AllocAndCopyString(source->strAdapterStatus);
402 target->strServiceName = AllocAndCopyString(source->strServiceName);
403 target->strProviderName = AllocAndCopyString(source->strProviderName);
404 target->strMuxName = AllocAndCopyString(source->strMuxName);
405 }
406
407 static void FreeResources(PVR_SIGNAL_STATUS* target)
408 {
409 FreeString(target->strAdapterName);
410 FreeString(target->strAdapterStatus);
411 FreeString(target->strServiceName);
412 FreeString(target->strProviderName);
413 FreeString(target->strMuxName);
414 }
415
416private:
417 PVRSignalStatus(const PVR_SIGNAL_STATUS* status) : DynamicCStructHdl(status) {}
418 PVRSignalStatus(PVR_SIGNAL_STATUS* status) : DynamicCStructHdl(status) {}
419};
421//------------------------------------------------------------------------------
422
423//==============================================================================
438class PVRDescrambleInfo : public DynamicCStructHdl<PVRDescrambleInfo, PVR_DESCRAMBLE_INFO>
439{
440 friend class CInstancePVRClient;
441
442public:
445 {
446 m_cStructure->iPid = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE;
447 m_cStructure->iCaid = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE;
448 m_cStructure->iProvid = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE;
449 m_cStructure->iEcmTime = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE;
450 m_cStructure->iHops = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE;
451 }
471
474
482 void SetPID(int pid) { m_cStructure->iPid = pid; }
483
485 int GetPID() const { return m_cStructure->iPid; }
486
497 void SetCAID(int iCaid) { m_cStructure->iCaid = iCaid; }
498
500 int GetCAID() const { return m_cStructure->iCaid; }
501
506 void SetProviderID(int provid) { m_cStructure->iProvid = provid; }
507
509 int GetProviderID() const { return m_cStructure->iProvid; }
510
515 void SetECMTime(int ecmTime) { m_cStructure->iEcmTime = ecmTime; }
516
518 int GetECMTime() const { return m_cStructure->iEcmTime; }
519
524 void SetHops(int hops) { m_cStructure->iHops = hops; }
525
527 int GetHops() const { return m_cStructure->iHops; }
528
531 void SetCardSystem(const std::string& cardSystem)
532 {
533 ReallocAndCopyString(&m_cStructure->strCardSystem, cardSystem.c_str());
534 }
535
537 std::string GetCardSystem() const
538 {
539 return m_cStructure->strCardSystem ? m_cStructure->strCardSystem : "";
540 }
541
544 void SetReader(const std::string& reader)
545 {
546 ReallocAndCopyString(&m_cStructure->strReader, reader.c_str());
547 }
548
550 std::string GetReader() const { return m_cStructure->strReader ? m_cStructure->strReader : ""; }
551
554 void SetFrom(const std::string& from)
555 {
556 ReallocAndCopyString(&m_cStructure->strFrom, from.c_str());
557 }
558
560 std::string GetFrom() const { return m_cStructure->strFrom ? m_cStructure->strFrom : ""; }
561
564 void SetProtocol(const std::string& protocol)
565 {
566 ReallocAndCopyString(&m_cStructure->strProtocol, protocol.c_str());
567 }
568
570 std::string GetProtocol() const
571 {
572 return m_cStructure->strProtocol ? m_cStructure->strProtocol : "";
573 }
575
576 static void AllocResources(const PVR_DESCRAMBLE_INFO* source, PVR_DESCRAMBLE_INFO* target)
577 {
578 target->strCardSystem = AllocAndCopyString(source->strCardSystem);
579 target->strReader = AllocAndCopyString(source->strReader);
580 target->strFrom = AllocAndCopyString(source->strFrom);
581 target->strProtocol = AllocAndCopyString(source->strProtocol);
582 }
583
584 static void FreeResources(PVR_DESCRAMBLE_INFO* target)
585 {
586 FreeString(target->strCardSystem);
587 FreeString(target->strReader);
588 FreeString(target->strFrom);
589 FreeString(target->strProtocol);
590 }
591
592private:
593 PVRDescrambleInfo(const PVR_DESCRAMBLE_INFO* info) : DynamicCStructHdl(info) {}
594 PVRDescrambleInfo(PVR_DESCRAMBLE_INFO* info) : DynamicCStructHdl(info) {}
595};
597//------------------------------------------------------------------------------
598
599} /* namespace addon */
600} /* namespace kodi */
601
602#endif /* __cplusplus */
Definition AddonBase.h:288
Definition Channels.h:39
void SetClientProviderUid(int iClientProviderUid)
optional Unique identifier of the provider this channel belongs to.
Definition Channels.h:189
int GetClientProviderUid() const
To get with SetClientProviderUid changed values.
Definition Channels.h:195
Definition Channels.h:226
Definition Channels.h:439
Definition Channels.h:271
unsigned int GetEncryptionSystem() const
To get with SetEncryptionSystem changed values.
Definition Channels.h:148
void SetChannelName(const std::string &channelName)
optional Channel name given to this channel.
Definition Channels.h:107
std::string GetMimeType() const
To get with SetMimeType changed values.
Definition Channels.h:130
void SetOrder(bool order)
optional The value denoting the order of this channel in the 'All channels' group.
Definition Channels.h:179
bool GetHasArchive() const
To get with GetIsRadio changed values.
Definition Channels.h:175
std::string GetChannelName() const
To get with SetChannelName changed values.
Definition Channels.h:113
unsigned int GetSubChannelNumber() const
To get with SetSubChannelNumber changed values.
Definition Channels.h:103
void SetChannelNumber(unsigned int channelNumber)
optional Channel number of this channel on the backend.
Definition Channels.h:87
void SetIconPath(const std::string &iconPath)
optional Path to the channel icon (if present).
Definition Channels.h:152
void SetSubChannelNumber(unsigned int subChannelNumber)
optional Sub channel number of this channel on the backend (ATSC).
Definition Channels.h:97
void SetIsRadio(bool isRadio)
required true if this is a radio channel, false if it's a TV channel.
Definition Channels.h:80
void SetMimeType(const std::string &inputFormat)
optional Input format mime type.
Definition Channels.h:124
bool GetIsHidden() const
To get with GetIsRadio changed values.
Definition Channels.h:168
void SetEncryptionSystem(unsigned int encryptionSystem)
optional The encryption ID or CaID of this channel (Conditional access systems).
Definition Channels.h:142
bool GetIsRadio() const
To get with SetIsRadio changed values.
Definition Channels.h:83
std::string GetIconPath() const
To get with SetIconPath changed values.
Definition Channels.h:158
void SetIsHidden(bool isHidden)
optional true if this channel is marked as hidden.
Definition Channels.h:165
unsigned int GetChannelNumber() const
To get with SetChannelNumber changed values.
Definition Channels.h:93
void SetHasArchive(bool hasArchive)
optional true if this channel has a server-side back buffer.
Definition Channels.h:172
void SetUniqueId(unsigned int uniqueId)
required Unique identifier for this channel.
Definition Channels.h:73
bool GetOrder() const
To get with SetOrder changed values.
Definition Channels.h:182
unsigned int GetUniqueId() const
To get with SetUniqueId changed values.
Definition Channels.h:76
void Add(const kodi::addon::PVRChannel &tag)
To add and give content from addon to Kodi on related call.
Definition Channels.h:242
void SetCAID(int iCaid)
optional Conditional access identifier.
Definition Channels.h:497
std::string GetFrom() const
To get with SetFrom changed values.
Definition Channels.h:560
void SetCardSystem(const std::string &cardSystem)
optional Empty string if not available.
Definition Channels.h:531
int GetECMTime() const
To get with SetECMTime changed values.
Definition Channels.h:518
int GetHops() const
To get with SetHops changed values.
Definition Channels.h:527
int GetProviderID() const
To get with SetProviderID changed values.
Definition Channels.h:509
std::string GetReader() const
To get with SetReader changed values.
Definition Channels.h:550
std::string GetProtocol() const
To get with SetProtocol changed values.
Definition Channels.h:570
void SetReader(const std::string &reader)
optional Empty string if not available.
Definition Channels.h:544
std::string GetCardSystem() const
To get with SetCardSystem changed values.
Definition Channels.h:537
void SetPID(int pid)
optional Packet identifier.
Definition Channels.h:482
#define PVR_DESCRAMBLE_INFO_NOT_AVAILABLE
Special class PVRDescrambleInfo value to indicate that a struct member's value is not available.
Definition pvr_channels.h:81
void SetHops(int hops)
optional Hops.
Definition Channels.h:524
int GetPID() const
To get with SetPID changed values.
Definition Channels.h:485
void SetECMTime(int ecmTime)
optional ECM time.
Definition Channels.h:515
void SetFrom(const std::string &from)
optional Empty string if not available.
Definition Channels.h:554
int GetCAID() const
To get with SetCAID changed values.
Definition Channels.h:500
void SetProtocol(const std::string &protocol)
optional Empty string if not available.
Definition Channels.h:564
void SetProviderID(int provid)
optional Provider-ID.
Definition Channels.h:506
std::string GetProviderName() const
To get with SetProviderName changed values.
Definition Channels.h:347
std::string GetAdapterName() const
To get with SetAdapterName changed values.
Definition Channels.h:308
void SetSNR(int snr)
optional Signal/noise ratio.
Definition Channels.h:369
int GetSNR() const
To get with SetSNR changed values.
Definition Channels.h:372
void SetMuxName(const std::string &muxName)
optional Name of the current mux.
Definition Channels.h:354
long GetBER() const
To get with SetBER changed values.
Definition Channels.h:388
int GetSignal() const
To get with SetSignal changed values.
Definition Channels.h:381
std::string GetServiceName() const
To get with SetServiceName changed values.
Definition Channels.h:334
void SetProviderName(const std::string &providerName)
optional Name of the current service's provider.
Definition Channels.h:341
long GetUNC() const
To get with SetBER changed values.
Definition Channels.h:395
void SetUNC(long unc)
optional Uncorrected blocks:
Definition Channels.h:392
void SetBER(long ber)
optional Bit error rate.
Definition Channels.h:385
std::string GetMuxName() const
To get with SetMuxName changed values.
Definition Channels.h:360
void SetServiceName(const std::string &serviceName)
optional Name of the current service.
Definition Channels.h:328
void SetSignal(int signal)
optional Signal strength.
Definition Channels.h:378
std::string GetAdapterStatus() const
To get with SetAdapterStatus changed values.
Definition Channels.h:321
void SetAdapterStatus(const std::string &adapterStatus)
optional Status of the adapter that's being used.
Definition Channels.h:315
void SetAdapterName(const std::string &adapterName)
optional Name of the adapter that's being used.
Definition Channels.h:302
#define PVR_PROVIDER_INVALID_UID
Denotes that no provider uid is available.
Definition pvr_providers.h:28
Definition pvr.h:362
"C" PVR add-on channel.
Definition pvr_channels.h:41
"C" PVR add-on descramble information.
Definition pvr_channels.h:92
"C" PVR add-on signal status information.
Definition pvr_channels.h:64