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

Update to PVR API 5.6.0 #56

Merged
merged 3 commits into from Aug 14, 2017
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
2 changes: 1 addition & 1 deletion pvr.hdhomerun/addon.xml.in
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="pvr.hdhomerun"
version="3.1.2"
version="3.1.3"
name="PVR HDHomeRun Client"
provider-name="Zoltan Csizmadia (zcsizmadia@gmail.com)">
<requires>@ADDON_DEPENDS@</requires>
Expand Down
6 changes: 6 additions & 0 deletions pvr.hdhomerun/changelog.txt
@@ -1,3 +1,9 @@
v3.1.3
- Update to PVR API 5.6.0 dependency
- Replace GetLiveStreamURL() with new API GetChannelStreamProperties()
- Stub new unused API GetRecordingStreamProperties()
- Fix channel change not working

v3.1.2
- Replace CStdString with std::string

Expand Down
4 changes: 2 additions & 2 deletions src/HDHomeRunTuners.cpp
Expand Up @@ -424,7 +424,7 @@ PVR_ERROR HDHomeRunTuners::PvrGetChannelGroupMembers(ADDON_HANDLE handle, const
return PVR_ERROR_NO_ERROR;
}

std::string HDHomeRunTuners::_GetLiveStreamURL(const PVR_CHANNEL &channel)
std::string HDHomeRunTuners::_GetChannelStreamURL(int iUniqueId)
{
Json::Value::ArrayIndex nIndex;

Expand All @@ -436,7 +436,7 @@ std::string HDHomeRunTuners::_GetLiveStreamURL(const PVR_CHANNEL &channel)
{
const Json::Value& jsonChannel = iterTuner->LineUp[nIndex];

if (jsonChannel["_UID"].asUInt() == channel.iUniqueId)
if (jsonChannel["_UID"].asUInt() == iUniqueId)
{
std::string url = jsonChannel["URL"].asString();
return url;
Expand Down
2 changes: 1 addition & 1 deletion src/HDHomeRunTuners.h
Expand Up @@ -76,7 +76,7 @@ class HDHomeRunTuners
int PvrGetChannelGroupsAmount(void);
PVR_ERROR PvrGetChannelGroups(ADDON_HANDLE handle, bool bRadio);
PVR_ERROR PvrGetChannelGroupMembers(ADDON_HANDLE handle, const PVR_CHANNEL_GROUP &group);
std::string _GetLiveStreamURL(const PVR_CHANNEL &channel);
std::string _GetChannelStreamURL(int iUniqueId);

protected:
unsigned int PvrCalculateUniqueId(const String& str);
Expand Down
21 changes: 15 additions & 6 deletions src/client.cpp
Expand Up @@ -300,12 +300,20 @@ bool CanSeekStream(void)
{
return true;
}

const char * GetLiveStreamURL(const PVR_CHANNEL &channel)
{
static std::string urlreturn = g.Tuners->_GetLiveStreamURL(channel);
return urlreturn.c_str();
}

PVR_ERROR GetChannelStreamProperties(const PVR_CHANNEL* channel, PVR_NAMED_VALUE* properties, unsigned int* iPropertiesCount)
{
std::string strUrl = g.Tuners->_GetChannelStreamURL(channel->iUniqueId);
if (strUrl.empty()) {
return PVR_ERROR_FAILED;
}
strncpy(properties[0].strName, PVR_STREAM_PROPERTY_STREAMURL, sizeof(properties[0].strName) - 1);
strncpy(properties[0].strValue, strUrl.c_str(), sizeof(properties[0].strValue) - 1);

*iPropertiesCount = 1;

return PVR_ERROR_NO_ERROR;
}

/* UNUSED API FUNCTIONS */
PVR_ERROR CallMenuHook(const PVR_MENUHOOK &menuhook, const PVR_MENUHOOK_DATA &item) { return PVR_ERROR_NOT_IMPLEMENTED; }
Expand Down Expand Up @@ -358,4 +366,5 @@ 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 *times) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR GetRecordingStreamProperties(const PVR_RECORDING* recording, PVR_NAMED_VALUE* properties, unsigned int* iPropertiesCount) { return PVR_ERROR_NOT_IMPLEMENTED; }
}