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),
232 m_handle(handle)
233 {
234 }
239
244 {
245 m_instance->toKodi->TransferChannelEntry(m_instance->toKodi->kodiInstance, m_handle, tag);
246 }
247
249
250private:
251 const AddonInstance_PVR* m_instance = nullptr;
252 const PVR_HANDLE m_handle;
253};
255//------------------------------------------------------------------------------
256
257//==============================================================================
271class PVRSignalStatus : public DynamicCStructHdl<PVRSignalStatus, PVR_SIGNAL_STATUS>
272{
273 friend class CInstancePVRClient;
274
275public:
277 PVRSignalStatus() = default;
278 PVRSignalStatus(const PVRSignalStatus& status) : DynamicCStructHdl(status) {}
297
300
303 void SetAdapterName(const std::string& adapterName)
304 {
305 ReallocAndCopyString(&m_cStructure->strAdapterName, adapterName.c_str());
306 }
307
309 std::string GetAdapterName() const
310 {
311 return m_cStructure->strAdapterName ? m_cStructure->strAdapterName : "";
312 }
313
316 void SetAdapterStatus(const std::string& adapterStatus)
317 {
318 ReallocAndCopyString(&m_cStructure->strAdapterStatus, adapterStatus.c_str());
319 }
320
322 std::string GetAdapterStatus() const
323 {
324 return m_cStructure->strAdapterStatus ? m_cStructure->strAdapterStatus : "";
325 }
326
329 void SetServiceName(const std::string& serviceName)
330 {
331 ReallocAndCopyString(&m_cStructure->strServiceName, serviceName.c_str());
332 }
333
335 std::string GetServiceName() const
336 {
337 return m_cStructure->strServiceName ? m_cStructure->strServiceName : "";
338 }
339
342 void SetProviderName(const std::string& providerName)
343 {
344 ReallocAndCopyString(&m_cStructure->strProviderName, providerName.c_str());
345 }
346
348 std::string GetProviderName() const
349 {
350 return m_cStructure->strProviderName ? m_cStructure->strProviderName : "";
351 }
352
355 void SetMuxName(const std::string& muxName)
356 {
357 ReallocAndCopyString(&m_cStructure->strMuxName, muxName.c_str());
358 }
359
361 std::string GetMuxName() const
362 {
363 return m_cStructure->strMuxName ? m_cStructure->strMuxName : "";
364 }
365
370 void SetSNR(int snr) { m_cStructure->iSNR = snr; }
371
373 int GetSNR() const { return m_cStructure->iSNR; }
374
379 void SetSignal(int signal) { m_cStructure->iSignal = signal; }
380
382 int GetSignal() const { return m_cStructure->iSignal; }
383
386 void SetBER(long ber) { m_cStructure->iBER = ber; }
387
389 long GetBER() const { return m_cStructure->iBER; }
390
393 void SetUNC(long unc) { m_cStructure->iUNC = unc; }
394
396 long GetUNC() const { return m_cStructure->iUNC; }
398
399 static void AllocResources(const PVR_SIGNAL_STATUS* source, PVR_SIGNAL_STATUS* target)
400 {
401 target->strAdapterName = AllocAndCopyString(source->strAdapterName);
402 target->strAdapterStatus = AllocAndCopyString(source->strAdapterStatus);
403 target->strServiceName = AllocAndCopyString(source->strServiceName);
404 target->strProviderName = AllocAndCopyString(source->strProviderName);
405 target->strMuxName = AllocAndCopyString(source->strMuxName);
406 }
407
408 static void FreeResources(PVR_SIGNAL_STATUS* target)
409 {
410 FreeString(target->strAdapterName);
411 FreeString(target->strAdapterStatus);
412 FreeString(target->strServiceName);
413 FreeString(target->strProviderName);
414 FreeString(target->strMuxName);
415 }
416
417private:
418 PVRSignalStatus(const PVR_SIGNAL_STATUS* status) : DynamicCStructHdl(status) {}
419 PVRSignalStatus(PVR_SIGNAL_STATUS* status) : DynamicCStructHdl(status) {}
420};
422//------------------------------------------------------------------------------
423
424//==============================================================================
439class PVRDescrambleInfo : public DynamicCStructHdl<PVRDescrambleInfo, PVR_DESCRAMBLE_INFO>
440{
441 friend class CInstancePVRClient;
442
443public:
446 {
447 m_cStructure->iPid = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE;
448 m_cStructure->iCaid = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE;
449 m_cStructure->iProvid = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE;
450 m_cStructure->iEcmTime = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE;
451 m_cStructure->iHops = PVR_DESCRAMBLE_INFO_NOT_AVAILABLE;
452 }
472
475
483 void SetPID(int pid) { m_cStructure->iPid = pid; }
484
486 int GetPID() const { return m_cStructure->iPid; }
487
498 void SetCAID(int iCaid) { m_cStructure->iCaid = iCaid; }
499
501 int GetCAID() const { return m_cStructure->iCaid; }
502
507 void SetProviderID(int provid) { m_cStructure->iProvid = provid; }
508
510 int GetProviderID() const { return m_cStructure->iProvid; }
511
516 void SetECMTime(int ecmTime) { m_cStructure->iEcmTime = ecmTime; }
517
519 int GetECMTime() const { return m_cStructure->iEcmTime; }
520
525 void SetHops(int hops) { m_cStructure->iHops = hops; }
526
528 int GetHops() const { return m_cStructure->iHops; }
529
532 void SetCardSystem(const std::string& cardSystem)
533 {
534 ReallocAndCopyString(&m_cStructure->strCardSystem, cardSystem.c_str());
535 }
536
538 std::string GetCardSystem() const
539 {
540 return m_cStructure->strCardSystem ? m_cStructure->strCardSystem : "";
541 }
542
545 void SetReader(const std::string& reader)
546 {
547 ReallocAndCopyString(&m_cStructure->strReader, reader.c_str());
548 }
549
551 std::string GetReader() const { return m_cStructure->strReader ? m_cStructure->strReader : ""; }
552
555 void SetFrom(const std::string& from)
556 {
557 ReallocAndCopyString(&m_cStructure->strFrom, from.c_str());
558 }
559
561 std::string GetFrom() const { return m_cStructure->strFrom ? m_cStructure->strFrom : ""; }
562
565 void SetProtocol(const std::string& protocol)
566 {
567 ReallocAndCopyString(&m_cStructure->strProtocol, protocol.c_str());
568 }
569
571 std::string GetProtocol() const
572 {
573 return m_cStructure->strProtocol ? m_cStructure->strProtocol : "";
574 }
576
577 static void AllocResources(const PVR_DESCRAMBLE_INFO* source, PVR_DESCRAMBLE_INFO* target)
578 {
579 target->strCardSystem = AllocAndCopyString(source->strCardSystem);
580 target->strReader = AllocAndCopyString(source->strReader);
581 target->strFrom = AllocAndCopyString(source->strFrom);
582 target->strProtocol = AllocAndCopyString(source->strProtocol);
583 }
584
585 static void FreeResources(PVR_DESCRAMBLE_INFO* target)
586 {
587 FreeString(target->strCardSystem);
588 FreeString(target->strReader);
589 FreeString(target->strFrom);
590 FreeString(target->strProtocol);
591 }
592
593private:
594 PVRDescrambleInfo(const PVR_DESCRAMBLE_INFO* info) : DynamicCStructHdl(info) {}
595 PVRDescrambleInfo(PVR_DESCRAMBLE_INFO* info) : DynamicCStructHdl(info) {}
596};
598//------------------------------------------------------------------------------
599
600} /* namespace addon */
601} /* namespace kodi */
602
603#endif /* __cplusplus */
Definition AddonBase.h:290
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:440
Definition Channels.h:272
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:243
void SetCAID(int iCaid)
optional Conditional access identifier.
Definition Channels.h:498
std::string GetFrom() const
To get with SetFrom changed values.
Definition Channels.h:561
void SetCardSystem(const std::string &cardSystem)
optional Empty string if not available.
Definition Channels.h:532
int GetECMTime() const
To get with SetECMTime changed values.
Definition Channels.h:519
int GetHops() const
To get with SetHops changed values.
Definition Channels.h:528
int GetProviderID() const
To get with SetProviderID changed values.
Definition Channels.h:510
std::string GetReader() const
To get with SetReader changed values.
Definition Channels.h:551
std::string GetProtocol() const
To get with SetProtocol changed values.
Definition Channels.h:571
void SetReader(const std::string &reader)
optional Empty string if not available.
Definition Channels.h:545
std::string GetCardSystem() const
To get with SetCardSystem changed values.
Definition Channels.h:538
void SetPID(int pid)
optional Packet identifier.
Definition Channels.h:483
#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:525
int GetPID() const
To get with SetPID changed values.
Definition Channels.h:486
void SetECMTime(int ecmTime)
optional ECM time.
Definition Channels.h:516
void SetFrom(const std::string &from)
optional Empty string if not available.
Definition Channels.h:555
int GetCAID() const
To get with SetCAID changed values.
Definition Channels.h:501
void SetProtocol(const std::string &protocol)
optional Empty string if not available.
Definition Channels.h:565
void SetProviderID(int provid)
optional Provider-ID.
Definition Channels.h:507
std::string GetProviderName() const
To get with SetProviderName changed values.
Definition Channels.h:348
std::string GetAdapterName() const
To get with SetAdapterName changed values.
Definition Channels.h:309
void SetSNR(int snr)
optional Signal/noise ratio.
Definition Channels.h:370
int GetSNR() const
To get with SetSNR changed values.
Definition Channels.h:373
void SetMuxName(const std::string &muxName)
optional Name of the current mux.
Definition Channels.h:355
long GetBER() const
To get with SetBER changed values.
Definition Channels.h:389
int GetSignal() const
To get with SetSignal changed values.
Definition Channels.h:382
std::string GetServiceName() const
To get with SetServiceName changed values.
Definition Channels.h:335
void SetProviderName(const std::string &providerName)
optional Name of the current service's provider.
Definition Channels.h:342
long GetUNC() const
To get with SetBER changed values.
Definition Channels.h:396
void SetUNC(long unc)
optional Uncorrected blocks:
Definition Channels.h:393
void SetBER(long ber)
optional Bit error rate.
Definition Channels.h:386
std::string GetMuxName() const
To get with SetMuxName changed values.
Definition Channels.h:361
void SetServiceName(const std::string &serviceName)
optional Name of the current service.
Definition Channels.h:329
void SetSignal(int signal)
optional Signal strength.
Definition Channels.h:379
std::string GetAdapterStatus() const
To get with SetAdapterStatus changed values.
Definition Channels.h:322
void SetAdapterStatus(const std::string &adapterStatus)
optional Status of the adapter that's being used.
Definition Channels.h:316
void SetAdapterName(const std::string &adapterName)
optional Name of the adapter that's being used.
Definition Channels.h:303
#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