Skip to content

Commit

Permalink
Merge pull request #43 from mlburgett/master
Browse files Browse the repository at this point in the history
Changes for 5.7.0 PVR API
  • Loading branch information
ksooo committed Sep 20, 2017
2 parents 99874de + 189a59d commit cc1cb56
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pvr.njoy/addon.xml.in
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="pvr.njoy"
version="3.1.1"
version="3.2.0"
name="Njoy N7 PVR Client"
provider-name="Team Kodi">
<requires>@ADDON_DEPENDS@</requires>
Expand Down
3 changes: 3 additions & 0 deletions pvr.njoy/changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
v3.2.0
- Updated to PVR addon API v5.7.0

v3.1.0
- Updated to PVR addon API v5.3.0

Expand Down
26 changes: 25 additions & 1 deletion src/N7Xml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ PVR_ERROR N7Xml::requestChannelList(ADDON_HANDLE handle, bool bRadio)
tag.iUniqueId = channel.iUniqueId;
tag.iChannelNumber = channel.iChannelNumber;
strncpy(tag.strChannelName, channel.strChannelName.c_str(), sizeof(tag.strChannelName) - 1);
strncpy(tag.strStreamURL, channel.strStreamURL.c_str(), sizeof(tag.strStreamURL) - 1);
strncpy(tag.strIconPath, channel.strIconPath.c_str(), sizeof(tag.strIconPath) - 1);

XBMC->Log(LOG_DEBUG, "N7Xml - Loaded channel - %s.", tag.strChannelName);
Expand All @@ -123,3 +122,28 @@ PVR_ERROR N7Xml::requestChannelList(ADDON_HANDLE handle, bool bRadio)

return PVR_ERROR_NO_ERROR;
}

PVR_ERROR N7Xml::GetChannelStreamProperties(const PVR_CHANNEL* channel, PVR_NAMED_VALUE* props, unsigned int* prop_size)
{
if (!m_channels.empty())
{
std::vector<PVRChannel>::const_iterator item;
for (item = m_channels.begin(); item != m_channels.end(); ++item)
{
const PVRChannel& chan = *item;
if (chan.iUniqueId == channel->iUniqueId)
{
strncpy(props[0].strName, PVR_STREAM_PROPERTY_STREAMURL,
sizeof(props[0].strName)-1);
props[0].strName[sizeof(props[0].strName)-1] = '\0';
strncpy(props[0].strValue, chan.strStreamURL.c_str(),
sizeof(props[0].strValue)-1);
props[0].strValue[sizeof(props[0].strValue)-1] = '\0';
*prop_size = 1;
return PVR_ERROR_NO_ERROR;
}
}
}
return PVR_ERROR_UNKNOWN;
}

1 change: 1 addition & 0 deletions src/N7Xml.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class N7Xml
~N7Xml(void);
int getChannelsAmount(void);
PVR_ERROR requestChannelList(ADDON_HANDLE handle, bool bRadio);
PVR_ERROR GetChannelStreamProperties(const PVR_CHANNEL*, PVR_NAMED_VALUE*, unsigned int*);
void list_channels(void);
private:
std::vector<PVRChannel> m_channels;
Expand Down
14 changes: 11 additions & 3 deletions src/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,9 +212,13 @@ PVR_ERROR GetChannels(ADDON_HANDLE handle, bool bRadio)
return m_data->requestChannelList(handle, bRadio);
}

unsigned int GetChannelSwitchDelay(void)
PVR_ERROR GetChannelStreamProperties(const PVR_CHANNEL* channel, PVR_NAMED_VALUE* props, unsigned int* prop_size)
{
return 2000;
if ((!channel) || (!props) || (!prop_size))
return PVR_ERROR_FAILED;
if (m_data)
return m_data->GetChannelStreamProperties(channel, props, prop_size);
return PVR_ERROR_SERVER_ERROR;
}

/** UNUSED API FUNCTIONS */
Expand All @@ -232,7 +236,6 @@ PVR_ERROR OpenDialogChannelSettings(const PVR_CHANNEL &channel) { return PVR_ERR
PVR_ERROR OpenDialogChannelAdd(const PVR_CHANNEL &channel) { return PVR_ERROR_NOT_IMPLEMENTED; }
bool OpenLiveStream(const PVR_CHANNEL &channel) { return false; }
void CloseLiveStream(void) {}
bool SwitchChannel(const PVR_CHANNEL &channelinfo) { return false; }
PVR_ERROR SignalStatus(PVR_SIGNAL_STATUS &signalStatus) { return PVR_ERROR_NOT_IMPLEMENTED; }bool OpenRecordedStream(const PVR_RECORDING &recording) { return false; }
void CloseRecordedStream(void) {}
int ReadRecordedStream(unsigned char *pBuffer, unsigned int iBufferSize) { return 0; }
Expand Down Expand Up @@ -277,4 +280,9 @@ PVR_ERROR DeleteAllRecordingsFromTrash() { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR SetEPGTimeFrame(int) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR GetDescrambleInfo(PVR_DESCRAMBLE_INFO*) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR SetRecordingLifetime(const PVR_RECORDING*) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR GetStreamTimes(PVR_STREAM_TIMES *) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR GetRecordingStreamProperties(const PVR_RECORDING*, PVR_NAMED_VALUE*, unsigned int*) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR IsEPGTagRecordable(const EPG_TAG*, bool*) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR IsEPGTagPlayable(const EPG_TAG*, bool*) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR GetEPGTagStreamProperties(const EPG_TAG*, PVR_NAMED_VALUE*, unsigned int*) { return PVR_ERROR_NOT_IMPLEMENTED; }
} //end extern "C"

0 comments on commit cc1cb56

Please sign in to comment.