Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PVR] Addon API: Add PVR_PROPERTIES.iEpgMaxDays, PVR_RECORDING.channelType #9295

Merged
merged 3 commits into from Mar 8, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_dll.h
Expand Up @@ -639,8 +639,8 @@ extern "C"
/*!
* Tell the client the time frame to use when notifying epg events back to Kodi. The client might push epg events asynchronously
* to Kodi using the callback function EpgEventStateChange. To be able to only push events that are actually of interest for Kodi,
* client needs to know about the epg time frame Kodi uses. Kodi calls this function once after the client add-on has been sucessfully
* initialized and then everytime the time frame value changes.
* client needs to know about the epg time frame Kodi uses. Kodi supplies the current epg time frame value in PVR_PROPERTIES.iEpgMaxDays
* when creating the addon and calls SetEPGTimeFrame later whenever Kodi's epg time frame value changes.
* @param iDays number of days from "now". EPG_TIMEFRAME_UNLIMITED means that Kodi is interested in all epg events, regardless of event times.
* @return PVR_ERROR_NO_ERROR if new value was successfully set.
* @remarks Required if bSupportsEPG is set to true. Return PVR_ERROR_NOT_IMPLEMENTED if this add-on won't provide this function.
Expand Down
12 changes: 12 additions & 0 deletions xbmc/addons/kodi-addon-dev-kit/include/kodi/xbmc_pvr_types.h
Expand Up @@ -230,13 +230,24 @@ extern "C" {
PVR_CONNECTION_STATE_DISCONNECTED = 6, /*!< @brief no connection to backend server (e.g. due to network errors or client initiated disconnect)*/
} PVR_CONNECTION_STATE;

/*!
* @brief PVR recording channel types
*/
typedef enum
{
PVR_RECORDING_CHANNEL_TYPE_UNKNOWN = 0, /*!< @brief unknown */
PVR_RECORDING_CHANNEL_TYPE_TV = 1, /*!< @brief TV channel */
PVR_RECORDING_CHANNEL_TYPE_RADIO = 2, /*!< @brief radio channel */
} PVR_RECORDING_CHANNEL_TYPE;

/*!
* @brief Properties passed to the Create() method of an add-on.
*/
typedef struct PVR_PROPERTIES
{
const char* strUserPath; /*!< @brief path to the user profile */
const char* strClientPath; /*!< @brief path to this add-on */
int iEpgMaxDays; /*!< @brief if > EPG_TIMEFRAME_UNLIMITED, in async epg mode, deliver only events in the range from 'end time > now' to 'start time < now + iEpgMaxDays. EPG_TIMEFRAME_UNLIMITED, notify all events. */

This comment was marked as spam.

This comment was marked as spam.

} PVR_PROPERTIES;

/*!
Expand Down Expand Up @@ -479,6 +490,7 @@ extern "C" {
bool bIsDeleted; /*!< @brief (optional) shows this recording is deleted and can be undelete */
unsigned int iEpgEventId; /*!< @brief (optional) EPG event id associated with this recording. Valid ids must be greater than EPG_TAG_INVALID_UID. */
int iChannelUid; /*!< @brief (optional) unique identifier of the channel for this recording. PVR_CHANNEL_INVALID_UID denotes that channel uid is not available. */
PVR_RECORDING_CHANNEL_TYPE channelType; /*!< @brief (optional) channel type. Set to PVR_RECORDING_CHANNEL_TYPE_UNKNOWN if the type cannot be determined. */
} ATTRIBUTE_PACKED PVR_RECORDING;

/*!
Expand Down
20 changes: 9 additions & 11 deletions xbmc/epg/GUIEPGGridContainer.cpp
Expand Up @@ -1442,15 +1442,18 @@ bool CGUIEPGGridContainer::OnMouseWheel(char wheel, const CPoint &point)
return true;
}

CPVRChannelPtr CGUIEPGGridContainer::GetChannel(int iIndex)
CPVRChannelPtr CGUIEPGGridContainer::GetSelectedChannel()
{
if (iIndex >= 0 && (size_t) iIndex < m_channelItems.size())
CFileItemPtr fileItem;
{
CFileItemPtr fileItem = m_channelItems[iIndex];
if (fileItem->HasPVRChannelInfoTag())
return fileItem->GetPVRChannelInfoTag();
CSingleLock lock(m_critSection);
if (m_channelCursor + m_channelOffset < m_channels)
fileItem = m_channelItems[m_channelCursor + m_channelOffset];
}


if (fileItem && fileItem->HasPVRChannelInfoTag())
return fileItem->GetPVRChannelInfoTag();

return CPVRChannelPtr();
}

Expand All @@ -1474,11 +1477,6 @@ int CGUIEPGGridContainer::GetSelectedItem() const
return -1;
}

const int CGUIEPGGridContainer::GetSelectedChannel() const
{
return m_channelCursor + m_channelOffset;
}

CFileItemPtr CGUIEPGGridContainer::GetSelectedChannelItem() const
{
CFileItemPtr item;
Expand Down
3 changes: 1 addition & 2 deletions xbmc/epg/GUIEPGGridContainer.h
Expand Up @@ -65,9 +65,8 @@ namespace EPG
virtual std::string GetDescription() const;
const int GetNumChannels() { return m_channels; };
virtual int GetSelectedItem() const;
const int GetSelectedChannel() const;
CFileItemPtr GetSelectedChannelItem() const;
PVR::CPVRChannelPtr GetChannel(int iIndex);
PVR::CPVRChannelPtr GetSelectedChannel();

This comment was marked as spam.

This comment was marked as spam.

virtual EVENT_RESULT OnMouseEvent(const CPoint &point, const CMouseEvent &event);

virtual void Process(unsigned int currentTime, CDirtyRegionList &dirtyregions);
Expand Down
4 changes: 1 addition & 3 deletions xbmc/pvr/addons/PVRClient.cpp
Expand Up @@ -159,6 +159,7 @@ void CPVRClient::ResetProperties(int iClientId /* = PVR_INVALID_CLIENT_ID */)
m_pInfo->strUserPath = m_strUserPath.c_str();
m_strClientPath = CSpecialProtocol::TranslatePath(Path());
m_pInfo->strClientPath = m_strClientPath.c_str();
m_pInfo->iEpgMaxDays = CSettings::GetInstance().GetInt(CSettings::SETTING_EPG_DAYSTODISPLAY);
m_menuhooks.clear();
m_timertypes.clear();
m_bReadyToUse = false;
Expand Down Expand Up @@ -195,9 +196,6 @@ ADDON_STATUS CPVRClient::Create(int iClientId)
catch (std::exception &e) { LogException(e, __FUNCTION__); }

m_bReadyToUse = bReadyToUse;

SetEPGTimeFrame(CSettings::GetInstance().GetInt(CSettings::SETTING_EPG_DAYSTODISPLAY));

return status;

This comment was marked as spam.

This comment was marked as spam.

}

Expand Down
2 changes: 1 addition & 1 deletion xbmc/pvr/windows/GUIWindowPVRGuide.cpp
Expand Up @@ -143,7 +143,7 @@ void CGUIWindowPVRGuide::UpdateSelectedItemPath()
CGUIEPGGridContainer *epgGridContainer = (CGUIEPGGridContainer*) GetControl(m_viewControl.GetCurrentControl());
if (epgGridContainer)
{
CPVRChannelPtr channel(epgGridContainer->GetChannel(epgGridContainer->GetSelectedChannel()));
CPVRChannelPtr channel(epgGridContainer->GetSelectedChannel());
if (channel)
SetSelectedItemPath(m_bRadio, channel->Path());
}
Expand Down