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/Providers.h"
19 #include "pvr/Recordings.h"
20 #include "pvr/Stream.h"
21 #include "pvr/Timers.h"
467 if (CAddonBase::m_interface->globalSingleInstance !=
nullptr)
468 throw std::logic_error(
"kodi::addon::CInstancePVRClient: Creation of more as one in single "
469 "instance way is not allowed!");
471 SetAddonStruct(CAddonBase::m_interface->firstKodiInstance, m_kodiVersion);
472 CAddonBase::m_interface->globalSingleInstance =
this;
520 if (CAddonBase::m_interface->globalSingleInstance !=
nullptr)
521 throw std::logic_error(
"kodi::addon::CInstancePVRClient: Creation of multiple together with "
522 "single instance way is not allowed!");
524 SetAddonStruct(instance, m_kodiVersion);
757 m_instanceData->toKodi->AddMenuHook(m_instanceData->toKodi->kodiInstance, hook);
791 const std::string& message)
793 m_instanceData->toKodi->ConnectionStateChange(
794 m_instanceData->toKodi->kodiInstance, connectionString.c_str(), newState, message.c_str());
808 inline std::string
UserPath()
const {
return m_instanceData->props->strUserPath; }
821 inline std::string
ClientPath()
const {
return m_instanceData->props->strClientPath; }
915 m_instanceData->toKodi->TriggerProvidersUpdate(m_instanceData->toKodi->kodiInstance);
1020 std::vector<kodi::addon::PVRStreamProperty>& properties)
1102 m_instanceData->toKodi->TriggerChannelUpdate(m_instanceData->toKodi->kodiInstance);
1263 m_instanceData->toKodi->TriggerChannelGroupsUpdate(m_instanceData->toKodi->kodiInstance);
1522 std::vector<kodi::addon::PVREDLEntry>& edl)
1662 m_instanceData->toKodi->TriggerEpgUpdate(m_instanceData->toKodi->kodiInstance, channelUid);
1700 m_instanceData->toKodi->EpgEventStateChange(m_instanceData->toKodi->kodiInstance, tag.GetTag(),
1897 int lastplayedposition)
1935 std::vector<kodi::addon::PVREDLEntry>& edl)
1995 std::vector<kodi::addon::PVRStreamProperty>& properties)
2034 const std::string& fileName,
2037 m_instanceData->toKodi->RecordingNotification(m_instanceData->toKodi->kodiInstance,
2038 recordingName.c_str(), fileName.c_str(), on);
2050 m_instanceData->toKodi->TriggerRecordingUpdate(m_instanceData->toKodi->kodiInstance);
2233 m_instanceData->toKodi->TriggerTimerUpdate(m_instanceData->toKodi->kodiInstance);
2508 virtual bool SeekTime(
double time,
bool backwards,
double& startpts) {
return false; }
2522 return PVRCodec(m_instanceData->toKodi->GetCodecByName(m_instanceData->toKodi->kodiInstance,
2523 codecName.c_str()));
2538 return m_instanceData->toKodi->AllocateDemuxPacket(m_instanceData->toKodi->kodiInstance,
2553 m_instanceData->toKodi->FreeDemuxPacket(m_instanceData->toKodi->kodiInstance, pPacket);
2746 void SetAddonStruct(KODI_HANDLE instance,
const std::string& kodiVersion)
2748 if (instance ==
nullptr)
2749 throw std::logic_error(
"kodi::addon::CInstancePVRClient: Creation with empty addon "
2750 "structure not allowed, table must be given from Kodi!");
2753 m_instanceData->toAddon->addonInstance =
this;
2755 m_instanceData->toAddon->GetCapabilities = ADDON_GetCapabilities;
2756 m_instanceData->toAddon->GetConnectionString = ADDON_GetConnectionString;
2757 m_instanceData->toAddon->GetBackendName = ADDON_GetBackendName;
2758 m_instanceData->toAddon->GetBackendVersion = ADDON_GetBackendVersion;
2759 m_instanceData->toAddon->GetBackendHostname = ADDON_GetBackendHostname;
2760 m_instanceData->toAddon->GetDriveSpace = ADDON_GetDriveSpace;
2761 m_instanceData->toAddon->CallSettingsMenuHook = ADDON_CallSettingsMenuHook;
2763 m_instanceData->toAddon->GetChannelsAmount = ADDON_GetChannelsAmount;
2764 m_instanceData->toAddon->GetChannels = ADDON_GetChannels;
2765 m_instanceData->toAddon->GetChannelStreamProperties = ADDON_GetChannelStreamProperties;
2766 m_instanceData->toAddon->GetSignalStatus = ADDON_GetSignalStatus;
2767 m_instanceData->toAddon->GetDescrambleInfo = ADDON_GetDescrambleInfo;
2769 m_instanceData->toAddon->GetProvidersAmount = ADDON_GetProvidersAmount;
2770 m_instanceData->toAddon->GetProviders = ADDON_GetProviders;
2772 m_instanceData->toAddon->GetChannelGroupsAmount = ADDON_GetChannelGroupsAmount;
2773 m_instanceData->toAddon->GetChannelGroups = ADDON_GetChannelGroups;
2774 m_instanceData->toAddon->GetChannelGroupMembers = ADDON_GetChannelGroupMembers;
2776 m_instanceData->toAddon->DeleteChannel = ADDON_DeleteChannel;
2777 m_instanceData->toAddon->RenameChannel = ADDON_RenameChannel;
2778 m_instanceData->toAddon->OpenDialogChannelSettings = ADDON_OpenDialogChannelSettings;
2779 m_instanceData->toAddon->OpenDialogChannelAdd = ADDON_OpenDialogChannelAdd;
2780 m_instanceData->toAddon->OpenDialogChannelScan = ADDON_OpenDialogChannelScan;
2781 m_instanceData->toAddon->CallChannelMenuHook = ADDON_CallChannelMenuHook;
2783 m_instanceData->toAddon->GetEPGForChannel = ADDON_GetEPGForChannel;
2784 m_instanceData->toAddon->IsEPGTagRecordable = ADDON_IsEPGTagRecordable;
2785 m_instanceData->toAddon->IsEPGTagPlayable = ADDON_IsEPGTagPlayable;
2786 m_instanceData->toAddon->GetEPGTagEdl = ADDON_GetEPGTagEdl;
2787 m_instanceData->toAddon->GetEPGTagStreamProperties = ADDON_GetEPGTagStreamProperties;
2788 m_instanceData->toAddon->SetEPGMaxPastDays = ADDON_SetEPGMaxPastDays;
2789 m_instanceData->toAddon->SetEPGMaxFutureDays = ADDON_SetEPGMaxFutureDays;
2790 m_instanceData->toAddon->CallEPGMenuHook = ADDON_CallEPGMenuHook;
2792 m_instanceData->toAddon->GetRecordingsAmount = ADDON_GetRecordingsAmount;
2793 m_instanceData->toAddon->GetRecordings = ADDON_GetRecordings;
2794 m_instanceData->toAddon->DeleteRecording = ADDON_DeleteRecording;
2795 m_instanceData->toAddon->UndeleteRecording = ADDON_UndeleteRecording;
2796 m_instanceData->toAddon->DeleteAllRecordingsFromTrash = ADDON_DeleteAllRecordingsFromTrash;
2797 m_instanceData->toAddon->RenameRecording = ADDON_RenameRecording;
2798 m_instanceData->toAddon->SetRecordingLifetime = ADDON_SetRecordingLifetime;
2799 m_instanceData->toAddon->SetRecordingPlayCount = ADDON_SetRecordingPlayCount;
2800 m_instanceData->toAddon->SetRecordingLastPlayedPosition = ADDON_SetRecordingLastPlayedPosition;
2801 m_instanceData->toAddon->GetRecordingLastPlayedPosition = ADDON_GetRecordingLastPlayedPosition;
2802 m_instanceData->toAddon->GetRecordingEdl = ADDON_GetRecordingEdl;
2803 m_instanceData->toAddon->GetRecordingSize = ADDON_GetRecordingSize;
2804 m_instanceData->toAddon->GetRecordingStreamProperties = ADDON_GetRecordingStreamProperties;
2805 m_instanceData->toAddon->CallRecordingMenuHook = ADDON_CallRecordingMenuHook;
2807 m_instanceData->toAddon->GetTimerTypes = ADDON_GetTimerTypes;
2808 m_instanceData->toAddon->GetTimersAmount = ADDON_GetTimersAmount;
2809 m_instanceData->toAddon->GetTimers = ADDON_GetTimers;
2810 m_instanceData->toAddon->AddTimer = ADDON_AddTimer;
2811 m_instanceData->toAddon->DeleteTimer = ADDON_DeleteTimer;
2812 m_instanceData->toAddon->UpdateTimer = ADDON_UpdateTimer;
2813 m_instanceData->toAddon->CallTimerMenuHook = ADDON_CallTimerMenuHook;
2815 m_instanceData->toAddon->OnSystemSleep = ADDON_OnSystemSleep;
2816 m_instanceData->toAddon->OnSystemWake = ADDON_OnSystemWake;
2817 m_instanceData->toAddon->OnPowerSavingActivated = ADDON_OnPowerSavingActivated;
2818 m_instanceData->toAddon->OnPowerSavingDeactivated = ADDON_OnPowerSavingDeactivated;
2820 m_instanceData->toAddon->OpenLiveStream = ADDON_OpenLiveStream;
2821 m_instanceData->toAddon->CloseLiveStream = ADDON_CloseLiveStream;
2822 m_instanceData->toAddon->ReadLiveStream = ADDON_ReadLiveStream;
2823 m_instanceData->toAddon->SeekLiveStream = ADDON_SeekLiveStream;
2824 m_instanceData->toAddon->LengthLiveStream = ADDON_LengthLiveStream;
2825 m_instanceData->toAddon->GetStreamProperties = ADDON_GetStreamProperties;
2826 m_instanceData->toAddon->GetStreamReadChunkSize = ADDON_GetStreamReadChunkSize;
2827 m_instanceData->toAddon->IsRealTimeStream = ADDON_IsRealTimeStream;
2829 m_instanceData->toAddon->OpenRecordedStream = ADDON_OpenRecordedStream;
2830 m_instanceData->toAddon->CloseRecordedStream = ADDON_CloseRecordedStream;
2831 m_instanceData->toAddon->ReadRecordedStream = ADDON_ReadRecordedStream;
2832 m_instanceData->toAddon->SeekRecordedStream = ADDON_SeekRecordedStream;
2833 m_instanceData->toAddon->LengthRecordedStream = ADDON_LengthRecordedStream;
2835 m_instanceData->toAddon->DemuxReset = ADDON_DemuxReset;
2836 m_instanceData->toAddon->DemuxAbort = ADDON_DemuxAbort;
2837 m_instanceData->toAddon->DemuxFlush = ADDON_DemuxFlush;
2838 m_instanceData->toAddon->DemuxRead = ADDON_DemuxRead;
2840 m_instanceData->toAddon->CanPauseStream = ADDON_CanPauseStream;
2841 m_instanceData->toAddon->PauseStream = ADDON_PauseStream;
2842 m_instanceData->toAddon->CanSeekStream = ADDON_CanSeekStream;
2843 m_instanceData->toAddon->SeekTime = ADDON_SeekTime;
2844 m_instanceData->toAddon->SetSpeed = ADDON_SetSpeed;
2845 m_instanceData->toAddon->FillBuffer = ADDON_FillBuffer;
2846 m_instanceData->toAddon->GetStreamTimes = ADDON_GetStreamTimes;
2852 PVRCapabilities cppCapabilities(capabilities);
2853 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2854 ->GetCapabilities(cppCapabilities);
2861 std::string backendName;
2862 PVR_ERROR err =
static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2863 ->GetBackendName(backendName);
2865 strncpy(str, backendName.c_str(), memSize);
2873 std::string backendVersion;
2874 PVR_ERROR err =
static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2875 ->GetBackendVersion(backendVersion);
2877 strncpy(str, backendVersion.c_str(), memSize);
2885 std::string backendHostname;
2886 PVR_ERROR err =
static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2887 ->GetBackendHostname(backendHostname);
2889 strncpy(str, backendHostname.c_str(), memSize);
2897 std::string connectionString;
2898 PVR_ERROR err =
static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2899 ->GetConnectionString(connectionString);
2901 strncpy(str, connectionString.c_str(), memSize);
2909 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2910 ->GetDriveSpace(*total, *used);
2916 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2917 ->CallSettingsMenuHook(menuhook);
2924 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2925 ->GetChannelsAmount(*amount);
2929 ADDON_HANDLE handle,
2932 PVRChannelsResultSet result(instance, handle);
2933 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2934 ->GetChannels(radio, result);
2940 unsigned int* propertiesCount)
2942 *propertiesCount = 0;
2943 std::vector<PVRStreamProperty> propertiesList;
2944 PVR_ERROR error =
static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2945 ->GetChannelStreamProperties(channel, propertiesList);
2948 for (
const auto& property : propertiesList)
2950 strncpy(properties[*propertiesCount].strName, property.GetCStructure()->strName,
2951 sizeof(properties[*propertiesCount].strName) - 1);
2952 strncpy(properties[*propertiesCount].strValue, property.GetCStructure()->strValue,
2953 sizeof(properties[*propertiesCount].strValue) - 1);
2966 PVRSignalStatus cppSignalStatus(signalStatus);
2967 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2968 ->GetSignalStatus(channelUid, cppSignalStatus);
2975 PVRDescrambleInfo cppDescrambleInfo(descrambleInfo);
2976 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2977 ->GetDescrambleInfo(channelUid, cppDescrambleInfo);
2984 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
2985 ->GetProvidersAmount(*amount);
2990 PVRProvidersResultSet result(instance, handle);
2991 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->GetProviders(result);
2999 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3000 ->GetChannelGroupsAmount(*amount);
3004 ADDON_HANDLE handle,
3007 PVRChannelGroupsResultSet result(instance, handle);
3008 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3009 ->GetChannelGroups(radio, result);
3013 ADDON_HANDLE handle,
3016 PVRChannelGroupMembersResultSet result(instance, handle);
3017 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3018 ->GetChannelGroupMembers(group, result);
3026 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3027 ->DeleteChannel(channel);
3033 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3034 ->RenameChannel(channel);
3040 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3041 ->OpenDialogChannelSettings(channel);
3047 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3048 ->OpenDialogChannelAdd(channel);
3053 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3054 ->OpenDialogChannelScan();
3061 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3062 ->CallChannelMenuHook(menuhook, channel);
3068 ADDON_HANDLE handle,
3073 PVREPGTagsResultSet result(instance, handle);
3074 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3075 ->GetEPGForChannel(channelUid, start, end, result);
3082 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3083 ->IsEPGTagRecordable(tag, *isRecordable);
3090 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3091 ->IsEPGTagPlayable(tag, *isPlayable);
3099 std::vector<PVREDLEntry> edlList;
3100 PVR_ERROR error =
static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3101 ->GetEPGTagEdl(tag, edlList);
3102 if (
static_cast<int>(edlList.size()) > *size)
3106 "CInstancePVRClient::%s: Truncating %d EDL entries from client to permitted size %d",
3107 __func__,
static_cast<int>(edlList.size()), *size);
3108 edlList.resize(*size);
3113 for (
const auto& edlEntry : edlList)
3115 edl[*size] = *edlEntry;
3125 unsigned int* propertiesCount)
3127 *propertiesCount = 0;
3128 std::vector<PVRStreamProperty> propertiesList;
3129 PVR_ERROR error =
static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3130 ->GetEPGTagStreamProperties(tag, propertiesList);
3133 for (
const auto& property : propertiesList)
3135 strncpy(properties[*propertiesCount].strName, property.GetCStructure()->strName,
3136 sizeof(properties[*propertiesCount].strName) - 1);
3137 strncpy(properties[*propertiesCount].strValue, property.GetCStructure()->strValue,
3138 sizeof(properties[*propertiesCount].strValue) - 1);
3149 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3150 ->SetEPGMaxPastDays(pastDays);
3156 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3157 ->SetEPGMaxFutureDays(futureDays);
3164 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3165 ->CallEPGMenuHook(menuhook, tag);
3174 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3175 ->GetRecordingsAmount(deleted, *amount);
3179 ADDON_HANDLE handle,
3182 PVRRecordingsResultSet result(instance, handle);
3183 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3184 ->GetRecordings(deleted, result);
3190 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3191 ->DeleteRecording(recording);
3197 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3198 ->UndeleteRecording(recording);
3203 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3204 ->DeleteAllRecordingsFromTrash();
3210 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3211 ->RenameRecording(recording);
3217 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3218 ->SetRecordingLifetime(recording);
3225 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3226 ->SetRecordingPlayCount(recording, count);
3231 int lastplayedposition)
3233 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3234 ->SetRecordingLastPlayedPosition(recording, lastplayedposition);
3241 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3242 ->GetRecordingLastPlayedPosition(recording, *position);
3250 std::vector<PVREDLEntry> edlList;
3251 PVR_ERROR error =
static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3252 ->GetRecordingEdl(recording, edlList);
3253 if (
static_cast<int>(edlList.size()) > *size)
3257 "CInstancePVRClient::%s: Truncating %d EDL entries from client to permitted size %d",
3258 __func__,
static_cast<int>(edlList.size()), *size);
3259 edlList.resize(*size);
3264 for (
const auto& edlEntry : edlList)
3266 edl[*size] = *edlEntry;
3277 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3278 ->GetRecordingSize(recording, *size);
3284 unsigned int* propertiesCount)
3286 *propertiesCount = 0;
3287 std::vector<PVRStreamProperty> propertiesList;
3288 PVR_ERROR error =
static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3289 ->GetRecordingStreamProperties(recording, propertiesList);
3292 for (
const auto& property : propertiesList)
3294 strncpy(properties[*propertiesCount].strName, property.GetCStructure()->strName,
3295 sizeof(properties[*propertiesCount].strName) - 1);
3296 strncpy(properties[*propertiesCount].strValue, property.GetCStructure()->strValue,
3297 sizeof(properties[*propertiesCount].strValue) - 1);
3310 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3311 ->CallRecordingMenuHook(menuhook, recording);
3322 std::vector<PVRTimerType> timerTypes;
3323 PVR_ERROR error =
static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3324 ->GetTimerTypes(timerTypes);
3327 for (
const auto& timerType : timerTypes)
3329 types[*typesCount] = *timerType;
3331 if (*typesCount >= PVR_ADDON_TIMERTYPE_ARRAY_SIZE)
3340 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3341 ->GetTimersAmount(*amount);
3346 PVRTimersResultSet result(instance, handle);
3347 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->GetTimers(result);
3352 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->AddTimer(timer);
3359 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3360 ->DeleteTimer(timer, forceDelete);
3366 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->UpdateTimer(timer);
3373 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3374 ->CallTimerMenuHook(menuhook, timer);
3381 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->OnSystemSleep();
3386 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->OnSystemWake();
3391 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3392 ->OnPowerSavingActivated();
3397 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3398 ->OnPowerSavingDeactivated();
3407 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3408 ->OpenLiveStream(channel);
3413 static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->CloseLiveStream();
3417 unsigned char* buffer,
3420 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3421 ->ReadLiveStream(buffer, size);
3428 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3429 ->SeekLiveStream(position, whence);
3434 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->LengthLiveStream();
3440 properties->iStreamCount = 0;
3441 std::vector<PVRStreamProperties> cppProperties;
3442 PVR_ERROR err =
static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3443 ->GetStreamProperties(cppProperties);
3446 for (
unsigned int i = 0; i < cppProperties.size(); ++i)
3448 memcpy(&properties->stream[i],
3451 ++properties->iStreamCount;
3457 "CInstancePVRClient::%s: Addon given with '%li' more allowed streams where '%i'",
3470 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3471 ->GetStreamReadChunkSize(*chunksize);
3476 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->IsRealTimeStream();
3482 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3483 ->OpenRecordedStream(recording);
3488 static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->CloseRecordedStream();
3492 unsigned char* buffer,
3495 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3496 ->ReadRecordedStream(buffer, size);
3499 inline static int64_t ADDON_SeekRecordedStream(
const AddonInstance_PVR* instance,
3503 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3504 ->SeekRecordedStream(position, whence);
3507 inline static int64_t ADDON_LengthRecordedStream(
const AddonInstance_PVR* instance)
3509 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3510 ->LengthRecordedStream();
3515 static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->DemuxReset();
3520 static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->DemuxAbort();
3525 static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->DemuxFlush();
3530 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->DemuxRead();
3535 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->CanPauseStream();
3540 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->CanSeekStream();
3543 inline static void ADDON_PauseStream(
const AddonInstance_PVR* instance,
bool bPaused)
3545 static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->PauseStream(bPaused);
3553 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3554 ->SeekTime(time, backwards, *startpts);
3559 static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->SetSpeed(speed);
3562 inline static void ADDON_FillBuffer(
const AddonInstance_PVR* instance,
bool mode)
3564 static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)->FillBuffer(mode);
3570 PVRStreamTimes cppTimes(times);
3571 return static_cast<CInstancePVRClient*
>(instance->toAddon->addonInstance)
3572 ->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:208
Definition: Channels.h:393
Definition: Providers.h:162
Definition: Recordings.h:39
Definition: Recordings.h:512
Definition: Channels.h:253
@ ADDON_LOG_WARNING
2 : To write warnings in the log file.
Definition: addon_base.h:180
@ ADDON_LOG_ERROR
3 : To report error messages in the log file.
Definition: addon_base.h:183
@ ADDON_INSTANCE_PVR
Game instance, see kodi::addon::CInstancePVRClient.
Definition: versions.h:232
virtual PVR_ERROR GetBackendHostname(std::string &hostname)
Get the hostname of the pvr backend server.
Definition: PVR.h:629
std::string ClientPath() const
Callback to Kodi Function Get main client path of the PVR addon.
Definition: PVR.h:821
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:755
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:700
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:640
virtual PVR_ERROR GetDriveSpace(uint64_t &total, uint64_t &used)
Get the disk space reported by the backend (if supported).
Definition: PVR.h:667
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:789
CInstancePVRClient(KODI_HANDLE instance, const std::string &kodiVersion="")
PVR client class constructor used to support multiple instance types.
Definition: PVR.h:516
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:808
CInstancePVRClient()
PVR client class constructor.
Definition: PVR.h:465
void TriggerProvidersUpdate()
Callback to Kodi Function Request Kodi to update it's list of providers.
Definition: PVR.h:913
virtual PVR_ERROR GetSignalStatus(int channelUid, kodi::addon::PVRSignalStatus &signalStatus)
Get the signal status of the stream that's currently open.
Definition: PVR.h:1067
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:1018
virtual PVR_ERROR GetDescrambleInfo(int channelUid, kodi::addon::PVRDescrambleInfo &descrambleInfo)
Get the descramble information of the stream that's currently open.
Definition: PVR.h:1087
void TriggerChannelUpdate()
Callback to Kodi Function Request Kodi to update it's list of channels.
Definition: PVR.h:1100
virtual PVR_ERROR GetChannels(bool radio, kodi::addon::PVRChannelsResultSet &results)
Request the list of all channels from the backend.
Definition: PVR.h:976
virtual PVR_ERROR GetProviders(kodi::addon::PVRProvidersResultSet &results)
Request the list of all providers from the backend.
Definition: PVR.h:901
virtual PVR_ERROR GetProvidersAmount(int &amount)
The total amount of providers on the backend.
Definition: PVR.h:861
virtual PVR_ERROR GetChannelsAmount(int &amount)
The total amount of channels on the backend.
Definition: PVR.h:927
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:1464
void TriggerEpgUpdate(unsigned int channelUid)
Callback to Kodi Function Schedule an EPG update for the given channel channel.
Definition: PVR.h:1660
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:1584
virtual PVR_ERROR IsEPGTagPlayable(const kodi::addon::PVREPGTag &tag, bool &isPlayable)
Check if the given EPG tag can be played.
Definition: PVR.h:1497
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:1602
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:1562
int EpgMaxPastDays() const
Callback to Kodi Function Get the Max past days handled by Kodi.
Definition: PVR.h:1636
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:1619
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:1521
virtual PVR_ERROR IsEPGTagRecordable(const kodi::addon::PVREPGTag &tag, bool &isRecordable)
Check if the given EPG tag can be recorded.
Definition: PVR.h:1482
int EpgMaxFutureDays() const
Callback to Kodi Function Get the Max future days handled by Kodi.
Definition: PVR.h:1649
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:1698
virtual PVR_ERROR OnPowerSavingDeactivated()
To notify addon power saving on system is deactivated.
Definition: PVR.h:2287
virtual PVR_ERROR OnPowerSavingActivated()
To notify addon power saving on system is activated.
Definition: PVR.h:2279
virtual PVR_ERROR OnSystemSleep()
To notify addon about system sleep.
Definition: PVR.h:2263
virtual PVR_ERROR OnSystemWake()
To notify addon about system wake up.
Definition: PVR.h:2271
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:2015
virtual PVR_ERROR GetRecordings(bool deleted, kodi::addon::PVRRecordingsResultSet &results)
Request the list of all recordings from the backend, if supported.
Definition: PVR.h:1790
virtual PVR_ERROR RenameRecording(const kodi::addon::PVRRecording &recording)
Rename a recording on the backend.
Definition: PVR.h:1844
virtual PVR_ERROR GetRecordingSize(const kodi::addon::PVRRecording &recording, int64_t &size)
Retrieve the size of a recording on the backend.
Definition: PVR.h:1951
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:1896
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:2033
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:1934
void TriggerRecordingUpdate()
Callback to Kodi Function Request Kodi to update it's list of recordings.
Definition: PVR.h:2048
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:1993
virtual PVR_ERROR GetRecordingsAmount(bool deleted, int &amount)
To get amount of recording present on backend.
Definition: PVR.h:1743
virtual PVR_ERROR SetRecordingLifetime(const kodi::addon::PVRRecording &recording)
Set the lifetime of a recording on the backend.
Definition: PVR.h:1862
virtual PVR_ERROR SetRecordingPlayCount(const kodi::addon::PVRRecording &recording, int count)
Set the play count of a recording on the backend.
Definition: PVR.h:1880
virtual PVR_ERROR UndeleteRecording(const kodi::addon::PVRRecording &recording)
Undelete a recording on the backend.
Definition: PVR.h:1820
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:1913
virtual PVR_ERROR DeleteAllRecordingsFromTrash()
Delete all recordings permanent which in the deleted folder on the backend.
Definition: PVR.h:1831
virtual PVR_ERROR DeleteRecording(const kodi::addon::PVRRecording &recording)
Delete a recording on the backend.
Definition: PVR.h:1805
virtual int ReadRecordedStream(unsigned char *buffer, unsigned int size)
Read from a recording.
Definition: PVR.h:2613
virtual bool OpenRecordedStream(const kodi::addon::PVRRecording &recording)
Open a stream to a recording on the backend.
Definition: PVR.h:2591
virtual int64_t LengthRecordedStream()
Obtain the length of a recorded stream.
Definition: PVR.h:2644
virtual void CloseRecordedStream()
Close an open stream from a recording.
Definition: PVR.h:2600
virtual int64_t SeekRecordedStream(int64_t position, int whence)
Seek in a recorded stream.
Definition: PVR.h:2633
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:2427
virtual void DemuxReset()
Reset the demultiplexer in the add-on.
Definition: PVR.h:2455
PVRCodec GetCodecByName(const std::string &codecName) const
Callback to Kodi Function Get the codec id used by Kodi.
Definition: PVR.h:2520
void FreeDemuxPacket(DEMUX_PACKET *pPacket)
Callback to Kodi Function Free a packet that was allocated with AllocateDemuxPacket().
Definition: PVR.h:2551
virtual void DemuxAbort()
Abort the demultiplexer thread in the add-on.
Definition: PVR.h:2463
virtual DEMUX_PACKET * DemuxRead()
Read the next packet from the demultiplexer, if there is one.
Definition: PVR.h:2447
virtual void DemuxFlush()
Flush all data that's currently in the demultiplexer buffer in the add-on.
Definition: PVR.h:2472
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:2508
virtual void SetSpeed(int speed)
Notify the pvr addon/demuxer that Kodi wishes to change playback speed.
Definition: PVR.h:2483
DEMUX_PACKET * AllocateDemuxPacket(int iDataSize)
Callback to Kodi Function Allocate a demux packet. Free with FreeDemuxPacket().
Definition: PVR.h:2536
virtual void FillBuffer(bool mode)
Notify the pvr addon/demuxer that Kodi wishes to fill demux queue.
Definition: PVR.h:2493
virtual void CloseLiveStream()
Close an open live stream.
Definition: PVR.h:2351
virtual bool OpenLiveStream(const kodi::addon::PVRChannel &channel)
Open a live stream on the backend.
Definition: PVR.h:2342
virtual int64_t SeekLiveStream(int64_t position, int whence)
Seek in a live stream on a backend that supports timeshifting.
Definition: PVR.h:2384
virtual int ReadLiveStream(unsigned char *buffer, unsigned int size)
Read from an open live stream.
Definition: PVR.h:2364
virtual int64_t LengthLiveStream()
Obtain the length of a live stream.
Definition: PVR.h:2395
virtual PVR_ERROR GetStreamTimes(kodi::addon::PVRStreamTimes ×)
Get stream times.
Definition: PVR.h:2722
virtual bool CanPauseStream()
Check if the backend support pausing the currently playing stream.
Definition: PVR.h:2679
virtual bool IsRealTimeStream()
Check for real-time streaming.
Definition: PVR.h:2712
virtual void PauseStream(bool paused)
Notify the pvr addon that Kodi (un)paused the currently playing stream.
Definition: PVR.h:2703
virtual PVR_ERROR GetStreamReadChunkSize(int &chunksize)
Obtain the chunk size to use when reading streams.
Definition: PVR.h:2739
virtual bool CanSeekStream()
Check if the backend supports seeking for the currently playing stream.
Definition: PVR.h:2693
void TriggerTimerUpdate()
Callback to Kodi Function Request Kodi to update it's list of timers.
Definition: PVR.h:2231
virtual PVR_ERROR UpdateTimer(const kodi::addon::PVRTimer &timer)
Update the timer information on the backend.
Definition: PVR.h:2197
virtual PVR_ERROR DeleteTimer(const kodi::addon::PVRTimer &timer, bool forceDelete)
Delete a timer on the backend.
Definition: PVR.h:2182
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:2218
virtual PVR_ERROR AddTimer(const kodi::addon::PVRTimer &timer)
Add a timer on the backend.
Definition: PVR.h:2165
virtual PVR_ERROR GetTimers(kodi::addon::PVRTimersResultSet &results)
Request the list of all timers from the backend if supported.
Definition: PVR.h:2150
virtual PVR_ERROR GetTimersAmount(int &amount)
To get total amount of timers on the backend or -1 on error.
Definition: PVR.h:2110
virtual PVR_ERROR GetTimerTypes(std::vector< kodi::addon::PVRTimerType > &types)
Retrieve the timer types supported by the backend.
Definition: PVR.h:2095
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:1350
virtual PVR_ERROR RenameChannel(const kodi::addon::PVRChannel &channel)
Rename a channel on the backend.
Definition: PVR.h:1320
virtual PVR_ERROR OpenDialogChannelScan()
Show the channel scan dialog if this backend supports it.
Definition: PVR.h:1364
virtual PVR_ERROR OpenDialogChannelSettings(const kodi::addon::PVRChannel &channel)
Show the channel settings dialog, if supported by the backend.
Definition: PVR.h:1335
virtual PVR_ERROR DeleteChannel(const kodi::addon::PVRChannel &channel)
Delete a channel from the backend.
Definition: PVR.h:1298
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:1381
virtual PVR_ERROR GetChannelGroupMembers(const kodi::addon::PVRChannelGroup &group, kodi::addon::PVRChannelGroupMembersResultSet &results)
Get a list of members on a group.
Definition: PVR.h:1248
virtual PVR_ERROR GetChannelGroupsAmount(int &amount)
Get the total amount of channel groups on the backend if it supports channel groups.
Definition: PVR.h:1137
void TriggerChannelGroupsUpdate()
Callback to Kodi Function Request Kodi to update it's list of channel groups.
Definition: PVR.h:1261
virtual PVR_ERROR GetChannelGroups(bool radio, kodi::addon::PVRChannelGroupsResultSet &results)
Get a list of available channel groups on addon.
Definition: PVR.h:1185
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:268
"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:92
"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:57
"C" PVR add-on recording.
Definition: pvr_recordings.h:110
"C" PVR add-on signal status information.
Definition: pvr_channels.h:64
"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