change to new C++ addon interface

This commit is contained in:
Alwin Esch
2020-06-07 19:06:40 +02:00
parent fc5b149f2c
commit e7449d9537
12 changed files with 373 additions and 513 deletions

View File

@@ -10,10 +10,9 @@
#pragma once
#include "client.h"
#include "p8-platform/threads/threads.h"
#include <atomic>
#include <kodi/addon-instance/PVR.h>
#include <thread>
#include <vector>
struct OctonetEpgEntry
@@ -44,25 +43,45 @@ struct OctonetGroup
std::vector<int> members;
};
class OctonetData : public P8PLATFORM::CThread
class ATTRIBUTE_HIDDEN OctonetData : public kodi::addon::CInstancePVRClient
{
public:
OctonetData(void);
virtual ~OctonetData(void);
OctonetData(const std::string& octonetAddress,
KODI_HANDLE instance,
const std::string& kodiVersion);
~OctonetData() override;
virtual int getChannelCount(void);
virtual PVR_ERROR getChannels(ADDON_HANDLE handle, bool bRadio);
PVR_ERROR GetCapabilities(kodi::addon::PVRCapabilities& capabilities) override;
PVR_ERROR GetBackendName(std::string& name) override;
PVR_ERROR GetBackendVersion(std::string& version) override;
PVR_ERROR GetConnectionString(std::string& connection) override;
PVR_ERROR GetBackendHostname(std::string& hostname) override;
virtual int getGroupCount(void);
virtual PVR_ERROR getGroups(ADDON_HANDLE handle, bool bRadio);
virtual PVR_ERROR getGroupMembers(ADDON_HANDLE handle, const PVR_CHANNEL_GROUP& group);
PVR_ERROR OnSystemSleep() override;
PVR_ERROR OnSystemWake() override;
virtual PVR_ERROR getEPG(ADDON_HANDLE handle, int iChannelUid, time_t start, time_t end);
const std::string& GetUrl(int id) const;
const std::string& GetName(int id) const;
PVR_ERROR GetChannelsAmount(int& amount) override;
PVR_ERROR GetChannels(bool radio, kodi::addon::PVRChannelsResultSet& results) override;
PVR_ERROR GetChannelGroupsAmount(int& amount) override;
PVR_ERROR GetChannelGroups(bool radio, kodi::addon::PVRChannelGroupsResultSet& results) override;
PVR_ERROR GetChannelGroupMembers(const kodi::addon::PVRChannelGroup& group,
kodi::addon::PVRChannelGroupMembersResultSet& results) override;
PVR_ERROR GetEPGForChannel(int channelUid,
time_t start,
time_t end,
kodi::addon::PVREPGTagsResultSet& results) override;
bool OpenLiveStream(const kodi::addon::PVRChannel& channelinfo) override;
int ReadLiveStream(unsigned char* buffer, unsigned int size) override;
void CloseLiveStream() override;
protected:
void* Process(void) override;
void Process();
const std::string& GetUrl(int id) const;
const std::string& GetName(int id) const;
bool LoadChannelList(void);
bool LoadEPG(void);
@@ -77,4 +96,7 @@ private:
std::vector<OctonetGroup> m_groups;
time_t m_lastEpgLoad;
std::atomic<bool> m_running = {false};
std::thread m_thread;
};