diff options
author | Lars Op den Kamp <lars@opdenkamp.eu> | 2012-10-09 21:07:35 +0200 |
---|---|---|
committer | Lars Op den Kamp <lars@opdenkamp.eu> | 2012-10-09 22:29:14 +0200 |
commit | 099ff6536eec4fa5eaca39ef918812d3ce2487a5 (patch) | |
tree | 14d215aa0f96460757ff7ede0e9bde017c9a218a | |
parent | ef1d99651f65dcd693db896331d8b71e73002671 (diff) |
[pvr] added TriggerEpgUpdate to the PVR interface, so an add-on can force an EPG update for a channel
-rw-r--r-- | addons/library.xbmc.pvr/libXBMC_pvr.h | 10 | ||||
-rw-r--r-- | lib/addons/library.xbmc.pvr/libXBMC_pvr.cpp | 8 | ||||
-rw-r--r-- | xbmc/addons/AddonCallbacks.h | 2 | ||||
-rw-r--r-- | xbmc/addons/AddonCallbacksPVR.cpp | 25 | ||||
-rw-r--r-- | xbmc/addons/AddonCallbacksPVR.h | 7 |
5 files changed, 52 insertions, 0 deletions
diff --git a/addons/library.xbmc.pvr/libXBMC_pvr.h b/addons/library.xbmc.pvr/libXBMC_pvr.h index 8b8e7d3c6f..868328feb0 100644 --- a/addons/library.xbmc.pvr/libXBMC_pvr.h +++ b/addons/library.xbmc.pvr/libXBMC_pvr.h @@ -117,6 +117,10 @@ public: dlsym(m_libXBMC_pvr, "PVR_trigger_channel_groups_update"); if (PVR_trigger_channel_groups_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + PVR_trigger_epg_update = (void (*)(void* HANDLE, void* CB, unsigned int iChannelUid)) + dlsym(m_libXBMC_pvr, "PVR_trigger_epg_update"); + if (PVR_trigger_epg_update == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } + PVR_transfer_channel_group = (void (*)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP *group)) dlsym(m_libXBMC_pvr, "PVR_transfer_channel_group"); if (PVR_transfer_channel_group == NULL) { fprintf(stderr, "Unable to assign function %s\n", dlerror()); return false; } @@ -184,6 +188,11 @@ public: return PVR_trigger_channel_update(m_Handle, m_Callbacks); } + void TriggerEpgUpdate(unsigned int iChannelUid) + { + return PVR_trigger_epg_update(m_Handle, m_Callbacks, iChannelUid); + } + void TriggerChannelGroupsUpdate() { return PVR_trigger_channel_groups_update(m_Handle, m_Callbacks); @@ -224,6 +233,7 @@ protected: void (*PVR_trigger_channel_groups_update)(void* HANDLE, void* CB); void (*PVR_trigger_timer_update)(void* HANDLE, void* CB); void (*PVR_trigger_recording_update)(void* HANDLE, void* CB); + void (*PVR_trigger_epg_update)(void* HANDLE, void* CB, unsigned int iChannelUid); void (*PVR_transfer_channel_group)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP *group); void (*PVR_transfer_channel_group_member)(void* HANDLE, void* CB, const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP_MEMBER *member); #ifdef USE_DEMUX diff --git a/lib/addons/library.xbmc.pvr/libXBMC_pvr.cpp b/lib/addons/library.xbmc.pvr/libXBMC_pvr.cpp index 3c2db2f998..10f0056aac 100644 --- a/lib/addons/library.xbmc.pvr/libXBMC_pvr.cpp +++ b/lib/addons/library.xbmc.pvr/libXBMC_pvr.cpp @@ -141,6 +141,14 @@ DLLEXPORT void PVR_trigger_recording_update(void *hdl, void* cb) ((CB_PVRLib*)cb)->TriggerRecordingUpdate(((AddonCB*)hdl)->addonData); } +DLLEXPORT void PVR_trigger_epg_update(void* hdl, void* cb, unsigned int iChannelUid) +{ + if (cb == NULL) + return; + + ((CB_PVRLib*)cb)->TriggerEpgUpdate(((AddonCB*)hdl)->addonData, iChannelUid); +} + DLLEXPORT void PVR_free_demux_packet(void *hdl, void* cb, DemuxPacket* pPacket) { if (cb == NULL) diff --git a/xbmc/addons/AddonCallbacks.h b/xbmc/addons/AddonCallbacks.h index 29363a5a53..a5e1b819da 100644 --- a/xbmc/addons/AddonCallbacks.h +++ b/xbmc/addons/AddonCallbacks.h @@ -223,6 +223,7 @@ typedef void (*PVRTriggerChannelUpdate)(void *addonData); typedef void (*PVRTriggerTimerUpdate)(void *addonData); typedef void (*PVRTriggerRecordingUpdate)(void *addonData); typedef void (*PVRTriggerChannelGroupsUpdate)(void *addonData); +typedef void (*PVRTriggerEpgUpdate)(void *addonData, unsigned int iChannelUid); typedef void (*PVRTransferChannelGroup)(void *addonData, const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP *group); typedef void (*PVRTransferChannelGroupMember)(void *addonData, const ADDON_HANDLE handle, const PVR_CHANNEL_GROUP_MEMBER *member); @@ -242,6 +243,7 @@ typedef struct CB_PVRLib PVRTriggerTimerUpdate TriggerTimerUpdate; PVRTriggerRecordingUpdate TriggerRecordingUpdate; PVRTriggerChannelGroupsUpdate TriggerChannelGroupsUpdate; + PVRTriggerEpgUpdate TriggerEpgUpdate; PVRFreeDemuxPacket FreeDemuxPacket; PVRAllocateDemuxPacket AllocateDemuxPacket; PVRTransferChannelGroup TransferChannelGroup; diff --git a/xbmc/addons/AddonCallbacksPVR.cpp b/xbmc/addons/AddonCallbacksPVR.cpp index c78f52cffc..6aad7bfde5 100644 --- a/xbmc/addons/AddonCallbacksPVR.cpp +++ b/xbmc/addons/AddonCallbacksPVR.cpp @@ -55,6 +55,7 @@ CAddonCallbacksPVR::CAddonCallbacksPVR(CAddon* addon) m_callbacks->TriggerChannelGroupsUpdate = PVRTriggerChannelGroupsUpdate; m_callbacks->TriggerTimerUpdate = PVRTriggerTimerUpdate; m_callbacks->TriggerRecordingUpdate = PVRTriggerRecordingUpdate; + m_callbacks->TriggerEpgUpdate = PVRTriggerEpgUpdate; m_callbacks->FreeDemuxPacket = PVRFreeDemuxPacket; m_callbacks->AllocateDemuxPacket = PVRAllocateDemuxPacket; m_callbacks->TransferChannelGroup = PVRTransferChannelGroup; @@ -295,6 +296,30 @@ void CAddonCallbacksPVR::PVRTriggerChannelGroupsUpdate(void *addonData) g_PVRManager.TriggerChannelGroupsUpdate(); } +void CAddonCallbacksPVR::PVRTriggerEpgUpdate(void *addonData, unsigned int iChannelUid) +{ + // get the client + CPVRClient *client = GetPVRClient(addonData); + if (!client) + { + CLog::Log(LOGERROR, "PVR - %s - invalid handler data", __FUNCTION__); + return; + } + + // get the channel + CPVRChannelPtr channel = g_PVRChannelGroups->GetByUniqueID(iChannelUid, client->GetID()); + CEpg* epg(NULL); + // get the EPG for the channel + if (!channel || (epg = channel->GetEPG()) == NULL) + { + CLog::Log(LOGERROR, "PVR - %s - invalid channel or channel doesn't have an EPG", __FUNCTION__); + return; + } + + // force an update + epg->ForceUpdate(); +} + void CAddonCallbacksPVR::PVRFreeDemuxPacket(void *addonData, DemuxPacket* pPacket) { CDVDDemuxUtils::FreeDemuxPacket(pPacket); diff --git a/xbmc/addons/AddonCallbacksPVR.h b/xbmc/addons/AddonCallbacksPVR.h index e2ee7bec13..0a4171d9b0 100644 --- a/xbmc/addons/AddonCallbacksPVR.h +++ b/xbmc/addons/AddonCallbacksPVR.h @@ -135,6 +135,13 @@ public: static void PVRTriggerChannelGroupsUpdate(void *addonData); /*! + * @brief Schedule an EPG update for the given channel channel + * @param addonData A pointer to the add-on + * @param iChannelUid The channel to update the EPG for + */ + static void PVRTriggerEpgUpdate(void *addonData, unsigned int iChannelUid); + + /*! * @brief Free an allocated demux packet. * @param addonData A pointer to the add-on. * @param pPacket The packet to free. |