11#include "../c-api/addon-instance/pvr.h"
12#include "pvr/ChannelGroups.h"
13#include "pvr/Channels.h"
16#include "pvr/General.h"
17#include "pvr/MenuHook.h"
18#include "pvr/Recordings.h"
19#include "pvr/Stream.h"
20#include "pvr/Timers.h"
444 if (CAddonBase::m_interface->globalSingleInstance !=
nullptr)
445 throw std::logic_error(
"kodi::addon::CInstancePVRClient: Creation of more as one in single "
446 "instance way is not allowed!");
448 SetAddonStruct(CAddonBase::m_interface->firstKodiInstance, m_kodiVersion);
449 CAddonBase::m_interface->globalSingleInstance =
this;
497 if (CAddonBase::m_interface->globalSingleInstance !=
nullptr)
498 throw std::logic_error(
"kodi::addon::CInstancePVRClient: Creation of multiple together with "
499 "single instance way is not allowed!");
501 SetAddonStruct(instance, m_kodiVersion);
734 m_instanceData->toKodi->AddMenuHook(m_instanceData->toKodi->kodiInstance, hook);
768 const std::string& message)
770 m_instanceData->toKodi->ConnectionStateChange(
771 m_instanceData->toKodi->kodiInstance, connectionString.c_str(), newState, message.c_str());
785 inline std::string
UserPath()
const {
return m_instanceData->props->strUserPath; }
798 inline std::string
ClientPath()
const {
return m_instanceData->props->strClientPath; }
930 std::vector<kodi::addon::PVRStreamProperty>& properties)
1012 m_instanceData->toKodi->TriggerChannelUpdate(m_instanceData->toKodi->kodiInstance);
1173 m_instanceData->toKodi->TriggerChannelGroupsUpdate(m_instanceData->toKodi->kodiInstance);
1432 std::vector<kodi::addon::PVREDLEntry>& edl)
1572 m_instanceData->toKodi->TriggerEpgUpdate(m_instanceData->toKodi->kodiInstance, channelUid);
1610 m_instanceData->toKodi->EpgEventStateChange(m_instanceData->toKodi->kodiInstance, tag.GetTag(),
1807 int lastplayedposition)
1845 std::vector<kodi::addon::PVREDLEntry>& edl)
1905 std::vector<kodi::addon::PVRStreamProperty>& properties)
1944 const std::string& fileName,
1947 m_instanceData->toKodi->RecordingNotification(m_instanceData->toKodi->kodiInstance,
1948 recordingName.c_str(), fileName.c_str(), on);
1960 m_instanceData->toKodi->TriggerRecordingUpdate(m_instanceData->toKodi->kodiInstance);
2143 m_instanceData->toKodi->TriggerTimerUpdate(m_instanceData->toKodi->kodiInstance);
2418 virtual bool SeekTime(
double time,
bool backwards,
double& startpts) {
return false; }
2432 return PVRCodec(m_instanceData->toKodi->GetCodecByName(m_instanceData->toKodi->kodiInstance,
2433 codecName.c_str()));
2448 return m_instanceData->toKodi->AllocateDemuxPacket(m_instanceData->toKodi->kodiInstance,
2463 m_instanceData->toKodi->FreeDemuxPacket(m_instanceData->toKodi->kodiInstance, pPacket);
2656 void SetAddonStruct(KODI_HANDLE instance,
const std::string& kodiVersion)
2658 if (instance ==
nullptr)
2659 throw std::logic_error(
"kodi::addon::CInstancePVRClient: Creation with empty addon "
2660 "structure not allowed, table must be given from Kodi!");
2663 m_instanceData->toAddon->addonInstance =
this;
2665 m_instanceData->toAddon->GetCapabilities = ADDON_GetCapabilities;
2666 m_instanceData->toAddon->GetConnectionString = ADDON_GetConnectionString;
2667 m_instanceData->toAddon->GetBackendName = ADDON_GetBackendName;
2668 m_instanceData->toAddon->GetBackendVersion = ADDON_GetBackendVersion;
2669 m_instanceData->toAddon->GetBackendHostname = ADDON_GetBackendHostname;
2670 m_instanceData->toAddon->GetDriveSpace = ADDON_GetDriveSpace;
2671 m_instanceData->toAddon->CallSettingsMenuHook = ADDON_CallSettingsMenuHook;
2673 m_instanceData->toAddon->GetChannelsAmount = ADDON_GetChannelsAmount;
2674 m_instanceData->toAddon->GetChannels = ADDON_GetChannels;
2675 m_instanceData->toAddon->GetChannelStreamProperties = ADDON_GetChannelStreamProperties;
2676 m_instanceData->toAddon->GetSignalStatus = ADDON_GetSignalStatus;
2677 m_instanceData->toAddon->GetDescrambleInfo = ADDON_GetDescrambleInfo;
2679 m_instanceData->toAddon->GetChannelGroupsAmount = ADDON_GetChannelGroupsAmount;
2680 m_instanceData->toAddon->GetChannelGroups = ADDON_GetChannelGroups;
2681 m_instanceData->toAddon->GetChannelGroupMembers = ADDON_GetChannelGroupMembers;
2683 m_instanceData->toAddon->DeleteChannel = ADDON_DeleteChannel;
2684 m_instanceData->toAddon->RenameChannel = ADDON_RenameChannel;
2685 m_instanceData->toAddon->OpenDialogChannelSettings = ADDON_OpenDialogChannelSettings;
2686 m_instanceData->toAddon->OpenDialogChannelAdd = ADDON_OpenDialogChannelAdd;
2687 m_instanceData->toAddon->OpenDialogChannelScan = ADDON_OpenDialogChannelScan;
2688 m_instanceData->toAddon->CallChannelMenuHook = ADDON_CallChannelMenuHook;
2690 m_instanceData->toAddon->GetEPGForChannel = ADDON_GetEPGForChannel;
2691 m_instanceData->toAddon->IsEPGTagRecordable = ADDON_IsEPGTagRecordable;
2692 m_instanceData->toAddon->IsEPGTagPlayable = ADDON_IsEPGTagPlayable;
2693 m_instanceData->toAddon->GetEPGTagEdl = ADDON_GetEPGTagEdl;
2694 m_instanceData->toAddon->GetEPGTagStreamProperties = ADDON_GetEPGTagStreamProperties;
2695 m_instanceData->toAddon->SetEPGMaxPastDays = ADDON_SetEPGMaxPastDays;
2696 m_instanceData->toAddon->SetEPGMaxFutureDays = ADDON_SetEPGMaxFutureDays;
2697 m_instanceData->toAddon->CallEPGMenuHook = ADDON_CallEPGMenuHook;
2699 m_instanceData->toAddon->GetRecordingsAmount = ADDON_GetRecordingsAmount;
2700 m_instanceData->toAddon->GetRecordings = ADDON_GetRecordings;
2701 m_instanceData->toAddon->DeleteRecording = ADDON_DeleteRecording;
2702 m_instanceData->toAddon->UndeleteRecording = ADDON_UndeleteRecording;
2703 m_instanceData->toAddon->DeleteAllRecordingsFromTrash = ADDON_DeleteAllRecordingsFromTrash;
2704 m_instanceData->toAddon->RenameRecording = ADDON_RenameRecording;
2705 m_instanceData->toAddon->SetRecordingLifetime = ADDON_SetRecordingLifetime;
2706 m_instanceData->toAddon->SetRecordingPlayCount = ADDON_SetRecordingPlayCount;
2707 m_instanceData->toAddon->SetRecordingLastPlayedPosition = ADDON_SetRecordingLastPlayedPosition;
2708 m_instanceData->toAddon->GetRecordingLastPlayedPosition = ADDON_GetRecordingLastPlayedPosition;
2709 m_instanceData->toAddon->GetRecordingEdl = ADDON_GetRecordingEdl;
2710 m_instanceData->toAddon->GetRecordingSize = ADDON_GetRecordingSize;
2711 m_instanceData->toAddon->GetRecordingStreamProperties = ADDON_GetRecordingStreamProperties;
2712 m_instanceData->toAddon->CallRecordingMenuHook = ADDON_CallRecordingMenuHook;
2714 m_instanceData->toAddon->GetTimerTypes = ADDON_GetTimerTypes;
2715 m_instanceData->toAddon->GetTimersAmount = ADDON_GetTimersAmount;
2716 m_instanceData->toAddon->GetTimers = ADDON_GetTimers;
2717 m_instanceData->toAddon->AddTimer = ADDON_AddTimer;
2718 m_instanceData->toAddon->DeleteTimer = ADDON_DeleteTimer;
2719 m_instanceData->toAddon->UpdateTimer = ADDON_UpdateTimer;
2720 m_instanceData->toAddon->CallTimerMenuHook = ADDON_CallTimerMenuHook;
2722 m_instanceData->toAddon->OnSystemSleep = ADDON_OnSystemSleep;
2723 m_instanceData->toAddon->OnSystemWake = ADDON_OnSystemWake;
2724 m_instanceData->toAddon->OnPowerSavingActivated = ADDON_OnPowerSavingActivated;
2725 m_instanceData->toAddon->OnPowerSavingDeactivated = ADDON_OnPowerSavingDeactivated;
2727 m_instanceData->toAddon->OpenLiveStream = ADDON_OpenLiveStream;
2728 m_instanceData->toAddon->CloseLiveStream = ADDON_CloseLiveStream;
2729 m_instanceData->toAddon->ReadLiveStream = ADDON_ReadLiveStream;
2730 m_instanceData->toAddon->SeekLiveStream = ADDON_SeekLiveStream;
2731 m_instanceData->toAddon->LengthLiveStream = ADDON_LengthLiveStream;
2732 m_instanceData->toAddon->GetStreamProperties = ADDON_GetStreamProperties;
2733 m_instanceData->toAddon->GetStreamReadChunkSize = ADDON_GetStreamReadChunkSize;
2734 m_instanceData->toAddon->IsRealTimeStream = ADDON_IsRealTimeStream;
2736 m_instanceData->toAddon->OpenRecordedStream = ADDON_OpenRecordedStream;
2737 m_instanceData->toAddon->CloseRecordedStream = ADDON_CloseRecordedStream;
2738 m_instanceData->toAddon->ReadRecordedStream = ADDON_ReadRecordedStream;
2739 m_instanceData->toAddon->SeekRecordedStream = ADDON_SeekRecordedStream;
2740 m_instanceData->toAddon->LengthRecordedStream = ADDON_LengthRecordedStream;
2742 m_instanceData->toAddon->DemuxReset = ADDON_DemuxReset;
2743 m_instanceData->toAddon->DemuxAbort = ADDON_DemuxAbort;
2744 m_instanceData->toAddon->DemuxFlush = ADDON_DemuxFlush;
2745 m_instanceData->toAddon->DemuxRead = ADDON_DemuxRead;
2747 m_instanceData->toAddon->CanPauseStream = ADDON_CanPauseStream;
2748 m_instanceData->toAddon->PauseStream = ADDON_PauseStream;
2749 m_instanceData->toAddon->CanSeekStream = ADDON_CanSeekStream;
2750 m_instanceData->toAddon->SeekTime = ADDON_SeekTime;
2751 m_instanceData->toAddon->SetSpeed = ADDON_SetSpeed;
2752 m_instanceData->toAddon->FillBuffer = ADDON_FillBuffer;
2753 m_instanceData->toAddon->GetStreamTimes = ADDON_GetStreamTimes;
2759 PVRCapabilities cppCapabilities(capabilities);
2760 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2761 ->GetCapabilities(cppCapabilities);
2768 std::string backendName;
2769 PVR_ERROR err =
static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2770 ->GetBackendName(backendName);
2772 strncpy(str, backendName.c_str(), memSize);
2780 std::string backendVersion;
2781 PVR_ERROR err =
static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2782 ->GetBackendVersion(backendVersion);
2784 strncpy(str, backendVersion.c_str(), memSize);
2792 std::string backendHostname;
2793 PVR_ERROR err =
static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2794 ->GetBackendHostname(backendHostname);
2796 strncpy(str, backendHostname.c_str(), memSize);
2804 std::string connectionString;
2805 PVR_ERROR err =
static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2806 ->GetConnectionString(connectionString);
2808 strncpy(str, connectionString.c_str(), memSize);
2816 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2817 ->GetDriveSpace(*total, *used);
2823 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2824 ->CallSettingsMenuHook(menuhook);
2831 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2832 ->GetChannelsAmount(*amount);
2836 ADDON_HANDLE handle,
2839 PVRChannelsResultSet result(instance, handle);
2840 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2841 ->GetChannels(radio, result);
2847 unsigned int* propertiesCount)
2849 *propertiesCount = 0;
2850 std::vector<PVRStreamProperty> propertiesList;
2851 PVR_ERROR error =
static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2852 ->GetChannelStreamProperties(channel, propertiesList);
2855 for (
const auto& property : propertiesList)
2857 strncpy(properties[*propertiesCount].strName, property.GetCStructure()->strName,
2858 sizeof(properties[*propertiesCount].strName) - 1);
2859 strncpy(properties[*propertiesCount].strValue, property.GetCStructure()->strValue,
2860 sizeof(properties[*propertiesCount].strValue) - 1);
2873 PVRSignalStatus cppSignalStatus(signalStatus);
2874 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2875 ->GetSignalStatus(channelUid, cppSignalStatus);
2882 PVRDescrambleInfo cppDescrambleInfo(descrambleInfo);
2883 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2884 ->GetDescrambleInfo(channelUid, cppDescrambleInfo);
2892 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2893 ->GetChannelGroupsAmount(*amount);
2897 ADDON_HANDLE handle,
2900 PVRChannelGroupsResultSet result(instance, handle);
2901 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2902 ->GetChannelGroups(radio, result);
2906 ADDON_HANDLE handle,
2909 PVRChannelGroupMembersResultSet result(instance, handle);
2910 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2911 ->GetChannelGroupMembers(group, result);
2919 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2920 ->DeleteChannel(channel);
2926 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2927 ->RenameChannel(channel);
2933 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2934 ->OpenDialogChannelSettings(channel);
2940 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2941 ->OpenDialogChannelAdd(channel);
2946 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2947 ->OpenDialogChannelScan();
2954 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2955 ->CallChannelMenuHook(menuhook, channel);
2961 ADDON_HANDLE handle,
2966 PVREPGTagsResultSet result(instance, handle);
2967 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2968 ->GetEPGForChannel(channelUid, start, end, result);
2975 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2976 ->IsEPGTagRecordable(tag, *isRecordable);
2983 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2984 ->IsEPGTagPlayable(tag, *isPlayable);
2993 std::vector<PVREDLEntry> edlList;
2994 PVR_ERROR error =
static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2995 ->GetEPGTagEdl(tag, edlList);
2998 for (
const auto& edlEntry : edlList)
3000 edl[*size] = *edlEntry;
3010 unsigned int* propertiesCount)
3012 *propertiesCount = 0;
3013 std::vector<PVRStreamProperty> propertiesList;
3014 PVR_ERROR error =
static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3015 ->GetEPGTagStreamProperties(tag, propertiesList);
3018 for (
const auto& property : propertiesList)
3020 strncpy(properties[*propertiesCount].strName, property.GetCStructure()->strName,
3021 sizeof(properties[*propertiesCount].strName) - 1);
3022 strncpy(properties[*propertiesCount].strValue, property.GetCStructure()->strValue,
3023 sizeof(properties[*propertiesCount].strValue) - 1);
3034 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3035 ->SetEPGMaxPastDays(pastDays);
3041 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3042 ->SetEPGMaxFutureDays(futureDays);
3049 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3050 ->CallEPGMenuHook(menuhook, tag);
3059 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3060 ->GetRecordingsAmount(deleted, *amount);
3064 ADDON_HANDLE handle,
3067 PVRRecordingsResultSet result(instance, handle);
3068 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3069 ->GetRecordings(deleted, result);
3075 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3076 ->DeleteRecording(recording);
3082 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3083 ->UndeleteRecording(recording);
3088 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3089 ->DeleteAllRecordingsFromTrash();
3095 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3096 ->RenameRecording(recording);
3102 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3103 ->SetRecordingLifetime(recording);
3110 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3111 ->SetRecordingPlayCount(recording, count);
3116 int lastplayedposition)
3118 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3119 ->SetRecordingLastPlayedPosition(recording, lastplayedposition);
3126 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3127 ->GetRecordingLastPlayedPosition(recording, *position);
3136 std::vector<PVREDLEntry> edlList;
3137 PVR_ERROR error =
static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3138 ->GetRecordingEdl(recording, edlList);
3141 for (
const auto& edlEntry : edlList)
3143 edl[*size] = *edlEntry;
3154 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3155 ->GetRecordingSize(recording, *size);
3161 unsigned int* propertiesCount)
3163 *propertiesCount = 0;
3164 std::vector<PVRStreamProperty> propertiesList;
3165 PVR_ERROR error =
static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3166 ->GetRecordingStreamProperties(recording, propertiesList);
3169 for (
const auto& property : propertiesList)
3171 strncpy(properties[*propertiesCount].strName, property.GetCStructure()->strName,
3172 sizeof(properties[*propertiesCount].strName) - 1);
3173 strncpy(properties[*propertiesCount].strValue, property.GetCStructure()->strValue,
3174 sizeof(properties[*propertiesCount].strValue) - 1);
3187 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3188 ->CallRecordingMenuHook(menuhook, recording);
3199 std::vector<PVRTimerType> timerTypes;
3200 PVR_ERROR error =
static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3201 ->GetTimerTypes(timerTypes);
3204 for (
const auto& timerType : timerTypes)
3206 types[*typesCount] = *timerType;
3208 if (*typesCount >= PVR_ADDON_TIMERTYPE_ARRAY_SIZE)
3217 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3218 ->GetTimersAmount(*amount);
3223 PVRTimersResultSet result(instance, handle);
3224 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->GetTimers(result);
3229 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->AddTimer(timer);
3236 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3237 ->DeleteTimer(timer, forceDelete);
3243 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->UpdateTimer(timer);
3250 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3251 ->CallTimerMenuHook(menuhook, timer);
3258 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->OnSystemSleep();
3263 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->OnSystemWake();
3268 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3269 ->OnPowerSavingActivated();
3274 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3275 ->OnPowerSavingDeactivated();
3284 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3285 ->OpenLiveStream(channel);
3290 static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->CloseLiveStream();
3294 unsigned char* buffer,
3297 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3298 ->ReadLiveStream(buffer, size);
3305 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3306 ->SeekLiveStream(position, whence);
3311 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->LengthLiveStream();
3317 properties->iStreamCount = 0;
3318 std::vector<PVRStreamProperties> cppProperties;
3319 PVR_ERROR err =
static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3320 ->GetStreamProperties(cppProperties);
3323 for (
unsigned int i = 0; i < cppProperties.size(); ++i)
3325 memcpy(&properties->stream[i],
3328 ++properties->iStreamCount;
3334 "CInstancePVRClient::%s: Addon given with '%li' more allowed streams where '%i'",
3347 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3348 ->GetStreamReadChunkSize(*chunksize);
3353 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->IsRealTimeStream();
3359 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3360 ->OpenRecordedStream(recording);
3365 static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->CloseRecordedStream();
3369 unsigned char* buffer,
3372 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3373 ->ReadRecordedStream(buffer, size);
3376 inline static int64_t ADDON_SeekRecordedStream(
const AddonInstance_PVR* instance,
3380 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3381 ->SeekRecordedStream(position, whence);
3384 inline static int64_t ADDON_LengthRecordedStream(
const AddonInstance_PVR* instance)
3386 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3387 ->LengthRecordedStream();
3392 static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->DemuxReset();
3397 static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->DemuxAbort();
3402 static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->DemuxFlush();
3407 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->DemuxRead();
3412 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->CanPauseStream();
3417 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->CanSeekStream();
3420 inline static void ADDON_PauseStream(
const AddonInstance_PVR* instance,
bool bPaused)
3422 static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->PauseStream(bPaused);
3430 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3431 ->SeekTime(time, backwards, *startpts);
3436 static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->SetSpeed(speed);
3439 inline static void ADDON_FillBuffer(
const AddonInstance_PVR* instance,
bool mode)
3441 static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->FillBuffer(mode);
3447 PVRStreamTimes cppTimes(times);
3448 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3449 ->GetStreamTimes(cppTimes);
Definition: AddonBase.h:186
Definition: General.h:116
Definition: ChannelGroups.h:38
Definition: ChannelGroups.h:238
Definition: ChannelGroups.h:103
Definition: Channels.h:39
Definition: Channels.h:191
Definition: Channels.h:376
Definition: Recordings.h:39
Definition: Recordings.h:487
Definition: Channels.h:236
@ ADDON_LOG_ERROR
3 : To report error messages in the log file.
Definition: addon_base.h:160
@ ADDON_INSTANCE_PVR
Game instance, see kodi::addon::CInstancePVRClient.
Definition: versions.h:231
virtual PVR_ERROR GetBackendHostname(std::string &hostname)
Get the hostname of the pvr backend server.
Definition: PVR.h:606
std::string ClientPath() const
Callback to Kodi Function Get main client path of the PVR addon.
Definition: PVR.h:798
void AddMenuHook(const kodi::addon::PVRMenuhook &hook)
Callback to Kodi Function\nAdd or replace a menu hook for the context menu for this add-on
Definition: PVR.h:732
virtual PVR_ERROR GetBackendVersion(std::string &version)=0
Get the version string reported by the backend that will be displayed in the UI.
~CInstancePVRClient() override=default
Destructor.
virtual PVR_ERROR CallSettingsMenuHook(const kodi::addon::PVRMenuhook &menuhook)
Call one of the settings related menu hooks (if supported).
Definition: PVR.h:677
virtual PVR_ERROR GetConnectionString(std::string &connection)
To get the connection string reported by the backend that will be displayed in the UI.
Definition: PVR.h:617
virtual PVR_ERROR GetDriveSpace(uint64_t &total, uint64_t &used)
Get the disk space reported by the backend (if supported).
Definition: PVR.h:644
void ConnectionStateChange(const std::string &connectionString, PVR_CONNECTION_STATE newState, const std::string &message)
Callback to Kodi Function Notify a state change for a PVR backend connection.
Definition: PVR.h:766
CInstancePVRClient(KODI_HANDLE instance, const std::string &kodiVersion="")
PVR client class constructor used to support multiple instance types.
Definition: PVR.h:493
virtual PVR_ERROR GetCapabilities(kodi::addon::PVRCapabilities &capabilities)=0
Get the list of features that this add-on provides.
virtual PVR_ERROR GetBackendName(std::string &name)=0
Get the name reported by the backend that will be displayed in the UI.
std::string UserPath() const
Callback to Kodi Function Get user data path of the PVR addon.
Definition: PVR.h:785
CInstancePVRClient()
PVR client class constructor.
Definition: PVR.h:442
virtual PVR_ERROR GetSignalStatus(int channelUid, kodi::addon::PVRSignalStatus &signalStatus)
Get the signal status of the stream that's currently open.
Definition: PVR.h:977
virtual PVR_ERROR GetChannelStreamProperties(const kodi::addon::PVRChannel &channel, std::vector< kodi::addon::PVRStreamProperty > &properties)
Get the stream properties for a channel from the backend.
Definition: PVR.h:928
virtual PVR_ERROR GetDescrambleInfo(int channelUid, kodi::addon::PVRDescrambleInfo &descrambleInfo)
Get the descramble information of the stream that's currently open.
Definition: PVR.h:997
void TriggerChannelUpdate()
Callback to Kodi Function Request Kodi to update it's list of channels.
Definition: PVR.h:1010
virtual PVR_ERROR GetChannels(bool radio, kodi::addon::PVRChannelsResultSet &results)
Request the list of all channels from the backend.
Definition: PVR.h:886
virtual PVR_ERROR GetChannelsAmount(int &amount)
The total amount of channels on the backend.
Definition: PVR.h:837
PVR_CONNECTION_STATE
Definition: pvr_general.h:82
PVR_ERROR
Definition: pvr_general.h:35
@ PVR_ERROR_NOT_IMPLEMENTED
-2 : The method that Kodi called is not implemented by the add-on.
Definition: pvr_general.h:43
@ PVR_ERROR_NO_ERROR
0 : No error occurred.
Definition: pvr_general.h:37
#define PVR_STREAM_MAX_STREAMS
Maximum of allowed streams.
Definition: pvr_stream.h:30
EPG_EVENT_STATE
Definition: pvr_epg.h:602
virtual PVR_ERROR GetEPGForChannel(int channelUid, time_t start, time_t end, kodi::addon::PVREPGTagsResultSet &results)
Request the EPG for a channel from the backend.
Definition: PVR.h:1374
void TriggerEpgUpdate(unsigned int channelUid)
Callback to Kodi Function Schedule an EPG update for the given channel channel.
Definition: PVR.h:1570
virtual PVR_ERROR SetEPGMaxPastDays(int pastDays)
Tell the client the past time frame to use when notifying epg events back to Kodi.
Definition: PVR.h:1494
virtual PVR_ERROR IsEPGTagPlayable(const kodi::addon::PVREPGTag &tag, bool &isPlayable)
Check if the given EPG tag can be played.
Definition: PVR.h:1407
virtual PVR_ERROR SetEPGMaxFutureDays(int futureDays)
Tell the client the future time frame to use when notifying epg events back to Kodi.
Definition: PVR.h:1512
virtual PVR_ERROR GetEPGTagStreamProperties(const kodi::addon::PVREPGTag &tag, std::vector< kodi::addon::PVRStreamProperty > &properties)
Get the stream properties for an epg tag from the backend.
Definition: PVR.h:1472
int EpgMaxPastDays() const
Callback to Kodi Function Get the Max past days handled by Kodi.
Definition: PVR.h:1546
virtual PVR_ERROR CallEPGMenuHook(const kodi::addon::PVRMenuhook &menuhook, const kodi::addon::PVREPGTag &tag)
Call one of the EPG related menu hooks (if supported).
Definition: PVR.h:1529
virtual PVR_ERROR GetEPGTagEdl(const kodi::addon::PVREPGTag &tag, std::vector< kodi::addon::PVREDLEntry > &edl)
Retrieve the edit decision list (EDL) of an EPG tag on the backend.
Definition: PVR.h:1431
virtual PVR_ERROR IsEPGTagRecordable(const kodi::addon::PVREPGTag &tag, bool &isRecordable)
Check if the given EPG tag can be recorded.
Definition: PVR.h:1392
int EpgMaxFutureDays() const
Callback to Kodi Function Get the Max future days handled by Kodi.
Definition: PVR.h:1559
void EpgEventStateChange(kodi::addon::PVREPGTag &tag, EPG_EVENT_STATE newState)
Callback to Kodi Function Notify a state change for an EPG event.
Definition: PVR.h:1608
virtual PVR_ERROR OnPowerSavingDeactivated()
To notify addon power saving on system is deactivated.
Definition: PVR.h:2197
virtual PVR_ERROR OnPowerSavingActivated()
To notify addon power saving on system is activated.
Definition: PVR.h:2189
virtual PVR_ERROR OnSystemSleep()
To notify addon about system sleep.
Definition: PVR.h:2173
virtual PVR_ERROR OnSystemWake()
To notify addon about system wake up.
Definition: PVR.h:2181
virtual PVR_ERROR CallRecordingMenuHook(const kodi::addon::PVRMenuhook &menuhook, const kodi::addon::PVRRecording &item)
Call one of the recording related menu hooks (if supported).
Definition: PVR.h:1925
virtual PVR_ERROR GetRecordings(bool deleted, kodi::addon::PVRRecordingsResultSet &results)
Request the list of all recordings from the backend, if supported.
Definition: PVR.h:1700
virtual PVR_ERROR RenameRecording(const kodi::addon::PVRRecording &recording)
Rename a recording on the backend.
Definition: PVR.h:1754
virtual PVR_ERROR GetRecordingSize(const kodi::addon::PVRRecording &recording, int64_t &size)
Retrieve the size of a recording on the backend.
Definition: PVR.h:1861
virtual PVR_ERROR SetRecordingLastPlayedPosition(const kodi::addon::PVRRecording &recording, int lastplayedposition)
Set the last watched position of a recording on the backend.
Definition: PVR.h:1806
void RecordingNotification(const std::string &recordingName, const std::string &fileName, bool on)
Callback to Kodi Function Display a notification in Kodi that a recording started or stopped on the s...
Definition: PVR.h:1943
virtual PVR_ERROR GetRecordingEdl(const kodi::addon::PVRRecording &recording, std::vector< kodi::addon::PVREDLEntry > &edl)
Retrieve the edit decision list (EDL) of a recording on the backend.
Definition: PVR.h:1844
void TriggerRecordingUpdate()
Callback to Kodi Function Request Kodi to update it's list of recordings.
Definition: PVR.h:1958
virtual PVR_ERROR GetRecordingStreamProperties(const kodi::addon::PVRRecording &recording, std::vector< kodi::addon::PVRStreamProperty > &properties)
Get the stream properties for a recording from the backend.
Definition: PVR.h:1903
virtual PVR_ERROR GetRecordingsAmount(bool deleted, int &amount)
To get amount of recording present on backend.
Definition: PVR.h:1653
virtual PVR_ERROR SetRecordingLifetime(const kodi::addon::PVRRecording &recording)
Set the lifetime of a recording on the backend.
Definition: PVR.h:1772
virtual PVR_ERROR SetRecordingPlayCount(const kodi::addon::PVRRecording &recording, int count)
Set the play count of a recording on the backend.
Definition: PVR.h:1790
virtual PVR_ERROR UndeleteRecording(const kodi::addon::PVRRecording &recording)
Undelete a recording on the backend.
Definition: PVR.h:1730
virtual PVR_ERROR GetRecordingLastPlayedPosition(const kodi::addon::PVRRecording &recording, int &position)
Retrieve the last watched position of a recording on the backend.
Definition: PVR.h:1823
virtual PVR_ERROR DeleteAllRecordingsFromTrash()
Delete all recordings permanent which in the deleted folder on the backend.
Definition: PVR.h:1741
virtual PVR_ERROR DeleteRecording(const kodi::addon::PVRRecording &recording)
Delete a recording on the backend.
Definition: PVR.h:1715
virtual int ReadRecordedStream(unsigned char *buffer, unsigned int size)
Read from a recording.
Definition: PVR.h:2523
virtual bool OpenRecordedStream(const kodi::addon::PVRRecording &recording)
Open a stream to a recording on the backend.
Definition: PVR.h:2501
virtual int64_t LengthRecordedStream()
Obtain the length of a recorded stream.
Definition: PVR.h:2554
virtual void CloseRecordedStream()
Close an open stream from a recording.
Definition: PVR.h:2510
virtual int64_t SeekRecordedStream(int64_t position, int whence)
Seek in a recorded stream.
Definition: PVR.h:2543
virtual PVR_ERROR GetStreamProperties(std::vector< kodi::addon::PVRStreamProperties > &properties)
Get the stream properties of the stream that's currently being read.
Definition: PVR.h:2337
virtual void DemuxReset()
Reset the demultiplexer in the add-on.
Definition: PVR.h:2365
PVRCodec GetCodecByName(const std::string &codecName) const
Callback to Kodi Function Get the codec id used by Kodi.
Definition: PVR.h:2430
DEMUX_PACKET * AllocateDemuxPacket(int iDataSize)
Callback to Kodi Function Allocate a demux packet. Free with FreeDemuxPacket().
Definition: PVR.h:2446
void FreeDemuxPacket(DEMUX_PACKET *pPacket)
Callback to Kodi Function Free a packet that was allocated with AllocateDemuxPacket().
Definition: PVR.h:2461
virtual DEMUX_PACKET * DemuxRead()
Read the next packet from the demultiplexer, if there is one.
Definition: PVR.h:2357
virtual void DemuxAbort()
Abort the demultiplexer thread in the add-on.
Definition: PVR.h:2373
virtual void DemuxFlush()
Flush all data that's currently in the demultiplexer buffer in the add-on.
Definition: PVR.h:2382
virtual bool SeekTime(double time, bool backwards, double &startpts)
Notify the pvr addon/demuxer that Kodi wishes to seek the stream by time.
Definition: PVR.h:2418
virtual void SetSpeed(int speed)
Notify the pvr addon/demuxer that Kodi wishes to change playback speed.
Definition: PVR.h:2393
virtual void FillBuffer(bool mode)
Notify the pvr addon/demuxer that Kodi wishes to fill demux queue.
Definition: PVR.h:2403
virtual void CloseLiveStream()
Close an open live stream.
Definition: PVR.h:2261
virtual bool OpenLiveStream(const kodi::addon::PVRChannel &channel)
Open a live stream on the backend.
Definition: PVR.h:2252
virtual int64_t SeekLiveStream(int64_t position, int whence)
Seek in a live stream on a backend that supports timeshifting.
Definition: PVR.h:2294
virtual int ReadLiveStream(unsigned char *buffer, unsigned int size)
Read from an open live stream.
Definition: PVR.h:2274
virtual int64_t LengthLiveStream()
Obtain the length of a live stream.
Definition: PVR.h:2305
virtual PVR_ERROR GetStreamTimes(kodi::addon::PVRStreamTimes ×)
Get stream times.
Definition: PVR.h:2632
virtual bool CanPauseStream()
Check if the backend support pausing the currently playing stream.
Definition: PVR.h:2589
virtual bool IsRealTimeStream()
Check for real-time streaming.
Definition: PVR.h:2622
virtual void PauseStream(bool paused)
Notify the pvr addon that Kodi (un)paused the currently playing stream.
Definition: PVR.h:2613
virtual PVR_ERROR GetStreamReadChunkSize(int &chunksize)
Obtain the chunk size to use when reading streams.
Definition: PVR.h:2649
virtual bool CanSeekStream()
Check if the backend supports seeking for the currently playing stream.
Definition: PVR.h:2603
void TriggerTimerUpdate()
Callback to Kodi Function Request Kodi to update it's list of timers.
Definition: PVR.h:2141
virtual PVR_ERROR UpdateTimer(const kodi::addon::PVRTimer &timer)
Update the timer information on the backend.
Definition: PVR.h:2107
virtual PVR_ERROR DeleteTimer(const kodi::addon::PVRTimer &timer, bool forceDelete)
Delete a timer on the backend.
Definition: PVR.h:2092
virtual PVR_ERROR CallTimerMenuHook(const kodi::addon::PVRMenuhook &menuhook, const kodi::addon::PVRTimer &item)
Call one of the timer related menu hooks (if supported).
Definition: PVR.h:2128
virtual PVR_ERROR AddTimer(const kodi::addon::PVRTimer &timer)
Add a timer on the backend.
Definition: PVR.h:2075
virtual PVR_ERROR GetTimers(kodi::addon::PVRTimersResultSet &results)
Request the list of all timers from the backend if supported.
Definition: PVR.h:2060
virtual PVR_ERROR GetTimersAmount(int &amount)
To get total amount of timers on the backend or -1 on error.
Definition: PVR.h:2020
virtual PVR_ERROR GetTimerTypes(std::vector< kodi::addon::PVRTimerType > &types)
Retrieve the timer types supported by the backend.
Definition: PVR.h:2005
virtual PVR_ERROR OpenDialogChannelAdd(const kodi::addon::PVRChannel &channel)
Show the dialog to add a channel on the backend, if supported by the backend.
Definition: PVR.h:1260
virtual PVR_ERROR RenameChannel(const kodi::addon::PVRChannel &channel)
Rename a channel on the backend.
Definition: PVR.h:1230
virtual PVR_ERROR OpenDialogChannelScan()
Show the channel scan dialog if this backend supports it.
Definition: PVR.h:1274
virtual PVR_ERROR OpenDialogChannelSettings(const kodi::addon::PVRChannel &channel)
Show the channel settings dialog, if supported by the backend.
Definition: PVR.h:1245
virtual PVR_ERROR DeleteChannel(const kodi::addon::PVRChannel &channel)
Delete a channel from the backend.
Definition: PVR.h:1208
virtual PVR_ERROR CallChannelMenuHook(const kodi::addon::PVRMenuhook &menuhook, const kodi::addon::PVRChannel &item)
Call one of the channel related menu hooks (if supported).
Definition: PVR.h:1291
virtual PVR_ERROR GetChannelGroupMembers(const kodi::addon::PVRChannelGroup &group, kodi::addon::PVRChannelGroupMembersResultSet &results)
Get a list of members on a group.
Definition: PVR.h:1158
virtual PVR_ERROR GetChannelGroupsAmount(int &amount)
Get the total amount of channel groups on the backend if it supports channel groups.
Definition: PVR.h:1047
void TriggerChannelGroupsUpdate()
Callback to Kodi Function Request Kodi to update it's list of channel groups.
Definition: PVR.h:1171
virtual PVR_ERROR GetChannelGroups(bool radio, kodi::addon::PVRChannelGroupsResultSet &results)
Get a list of available channel groups on addon.
Definition: PVR.h:1095
std::string ATTRIBUTE_HIDDEN GetKodiTypeVersion(int type)
To get used version inside Kodi itself about asked type.
Definition: AddonBase.h:630
void ATTRIBUTE_HIDDEN Log(const AddonLog loglevel, const char *format,...)
Add a message to Kodi's log.
Definition: AddonBase.h:749
"C" PVR add-on channel group member.
Definition: pvr_epg.h:623
"C" PVR add-on capabilities.
Definition: pvr_general.h:258
"C" PVR add-on channel group.
Definition: pvr_channel_groups.h:31
"C" PVR add-on channel.
Definition: pvr_channels.h:41
"C" PVR add-on descramble information.
Definition: pvr_channels.h:91
"C" Edit definition list entry.
Definition: pvr_edl.h:55
"C" PVR add-on menu hook.
Definition: pvr_menu_hook.h:65
"C" Representation of a named value.
Definition: pvr_defines.h:55
"C" PVR add-on recording.
Definition: pvr_recordings.h:110
"C" PVR add-on signal status information.
Definition: pvr_channels.h:63
"C" Stream properties
Definition: pvr_stream.h:112
Definition: pvr_stream.h:115
"C" Times of playing stream (Live TV and recordings)
Definition: pvr_stream.h:142
"C" PVR add-on timer event type.
Definition: pvr_timers.h:380
"C" PVR add-on timer event.
Definition: pvr_timers.h:341