Skip to content
Browse files

Merge pull request #175 from adamsutton/pvr-hts-keep_opdenkamp_happy

webroot fix and updated seek support
  • Loading branch information...
2 parents 44824b8 + b424e25 commit a64dd9e148aec12e9f001582d3bafb7a20e6a394 @opdenkamp committed
View
2 addons/pvr.hts/addon/addon.xml.in
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="pvr.hts"
- version="1.6.18"
+ version="1.6.19"
name="Tvheadend HTSP Client"
provider-name="Lars Op den Kamp, Team XBMC">
<requires>
View
5 addons/pvr.hts/addon/changelog.txt
@@ -1,3 +1,8 @@
+1.6.19
+
+- add timeshift skip support (FF/RW still not working)
+- fix bug in tvh webroot processing
+
1.6.18
- ensure channel count is not cleared after succesful sub
View
5 addons/pvr.hts/src/HTSPConnection.cpp
@@ -495,9 +495,10 @@ bool CHTSPConnection::SendGreeting(void)
if (f->hmf_type == HMF_STR)
{
if (!strcmp("timeshift", f->hmf_str))
+ {
m_bTimeshiftSupport = true;
- else if (!strcmp("timeshiftseek", f->hmf_str))
m_bTimeshiftSeekSupport = true;
+ }
else if (!strcmp("transcoding", f->hmf_str))
m_bTranscodingSupport = true;
}
@@ -507,7 +508,7 @@ bool CHTSPConnection::SendGreeting(void)
m_strServerName = server;
m_strVersion = version;
m_iProtocol = proto;
- m_strWebroot = webroot ? webroot : "/";
+ m_strWebroot = webroot ? webroot : "";
if(chall && chall_len)
{
View
2 addons/pvr.hts/src/HTSPData.cpp
@@ -324,7 +324,7 @@ PVR_ERROR CHTSPData::GetRecordings(ADDON_HANDLE handle)
/* HTSPv6- - use HTTP */
else
- strStreamURL = m_session->GetWebURL("dvrfile/%i", recording.id);
+ strStreamURL = m_session->GetWebURL("/dvrfile/%i", recording.id);
}
strRecordingId.Format("%i", recording.id);
View
71 addons/pvr.hts/src/HTSPDemux.cpp
@@ -27,6 +27,7 @@
#define READ_TIMEOUT 20000
using namespace ADDON;
+using namespace PLATFORM;
CHTSPDemux::CHTSPDemux(CHTSPConnection* connection) :
m_session(connection),
@@ -36,6 +37,8 @@ CHTSPDemux::CHTSPDemux(CHTSPConnection* connection) :
m_tag(0),
m_bIsOpen(false)
{
+ m_seekEvent = new CEvent;
+ m_seekTime = -1;
for (unsigned int i = 0; i < PVR_STREAM_MAX_STREAMS; i++)
m_Streams.stream[i].iCodecType = AVMEDIA_TYPE_UNKNOWN;
m_Streams.iStreamCount = 0;
@@ -148,10 +151,16 @@ bool CHTSPDemux::ProcessMessage(htsmsg* msg)
ParseSubscriptionStop(msg);
else if(strcmp("subscriptionStatus", method) == 0)
ParseSubscriptionStatus(msg);
+ else if(strcmp("subscriptionSkip" , method) == 0)
+ ParseSubscriptionSkip(msg);
+ else if(strcmp("subscriptionSpeed" , method) == 0)
+ ParseSubscriptionSpeed(msg);
else if(strcmp("queueStatus" , method) == 0)
ParseQueueStatus(msg);
else if(strcmp("signalStatus" , method) == 0)
ParseSignalStatus(msg);
+ else if(strcmp("timeshiftStatus" , method) == 0)
+ ParseTimeshiftStatus(msg);
else if(strcmp("muxpkt" , method) == 0)
ParseMuxPacket(msg);
else
@@ -576,6 +585,30 @@ void CHTSPDemux::ParseSubscriptionStatus(htsmsg_t *m)
}
}
+void CHTSPDemux::ParseSubscriptionSkip(htsmsg_t *m)
+{
+ int64_t s64;
+ uint32_t u32;
+ if (!htsmsg_get_u32(m, "error", &u32) ||
+ htsmsg_get_u32(m, "absolute", &u32) ||
+ htsmsg_get_s64(m, "time", &s64)) {
+ m_seekTime = -1;
+ } else {
+ m_seekTime = (double)s64;
+ }
+ XBMC->Log(LOG_DEBUG, "HTSP::ParseSubscriptionSkip - skip = %lf\n", m_seekTime);
+ m_seekEvent->Broadcast();
+}
+
+void CHTSPDemux::ParseSubscriptionSpeed(htsmsg_t *m)
+{
+ uint32_t u32;
+ if (!htsmsg_get_u32(m, "speed", &u32)) {
+ XBMC->Log(LOG_INFO, "%s - speed = %u", __FUNCTION__, u32);
+ // TODO: need a way to pass this to player core
+ }
+}
+
bool CHTSPDemux::SendUnsubscribe(int subscription)
{
XBMC->Log(LOG_INFO, "%s - unsubscribe from subscription %d", __FUNCTION__, subscription);
@@ -680,15 +713,31 @@ bool CHTSPDemux::SendSpeed(int subscription, int speed)
bool CHTSPDemux::SendSeek(int subscription, int time, bool backward, double *startpts)
{
- XBMC->Log(LOG_DEBUG, "%s(%d, %d, %d)", __FUNCTION__, subscription, time, backward ? 1:0);
htsmsg_t *m = htsmsg_create_map();
- htsmsg_add_str(m, "method" , "subscriptionSeek");
+ int64_t seek;
+
+ // Note: time is in MSEC not DVD_TIME_BASE, TVH requires 1MHz (us) input
+ seek = time * 1000;
+ XBMC->Log(LOG_DEBUG, "%s(time=%d, seek=%ld)", __FUNCTION__, time, seek);
+
+ htsmsg_add_str(m, "method" , "subscriptionSkip");
htsmsg_add_s32(m, "subscriptionId", subscription);
- htsmsg_add_s32(m, "time" , time);
- htsmsg_add_u32(m, "backward" , backward);
- htsmsg_add_float(m, "startpts" , *startpts);
+ htsmsg_add_s64(m, "time" , seek);
+ htsmsg_add_u32(m, "absolute" , 1);
- return m_session->ReadSuccess(m, "seek subscription");
+ if (!m_session->ReadSuccess(m, "seek subscription"))
+ return false;
+
+ if (!m_seekEvent->Wait(g_iResponseTimeout * 1000))
+ return false;
+
+ if (m_seekTime < 0)
+ return false;
+
+ // Note: return value is in DVD_TIME_BASE not MSEC
+ *startpts = m_seekTime * DVD_TIME_BASE / 1000000;
+ XBMC->Log(LOG_DEBUG, "%s(%ld) = %lf", __FUNCTION__, seek, *startpts);
+ return true;
}
bool CHTSPDemux::ParseQueueStatus(htsmsg_t* msg)
@@ -734,6 +783,16 @@ bool CHTSPDemux::ParseSignalStatus(htsmsg_t* msg)
return true;
}
+bool CHTSPDemux::ParseTimeshiftStatus(htsmsg_t *msg)
+{
+ // TODO: placeholder for processing timeshiftStatus message when
+ // we're ready to use the information.
+ //
+ // For now this just ensures we don't spam logs with unecessary
+ // info about unhandled messages.
+ return true;
+}
+
bool CHTSPDemux::ParseSourceInfo(htsmsg_t* msg)
{
htsmsg_t *sourceinfo;
View
6 addons/pvr.hts/src/HTSPDemux.h
@@ -24,6 +24,7 @@
#include "client.h"
#include "HTSPConnection.h"
#include "platform/util/buffer.h"
+#include "platform/threads/mutex.h"
class CHTSPDemux : public CHTSPConnectionCallback
{
@@ -49,6 +50,8 @@ class CHTSPDemux : public CHTSPConnectionCallback
void ParseSubscriptionStart (htsmsg_t *m);
void ParseSubscriptionStop (htsmsg_t *m);
void ParseSubscriptionStatus(htsmsg_t *m);
+ void ParseSubscriptionSkip (htsmsg_t *m);
+ void ParseSubscriptionSpeed (htsmsg_t *m);
bool SendSubscribe (int subscription, int channel);
bool SendUnsubscribe(int subscription);
bool SendSpeed (int subscription, int speed);
@@ -56,6 +59,7 @@ class CHTSPDemux : public CHTSPConnectionCallback
void ParseMuxPacket(htsmsg_t *m);
bool ParseQueueStatus(htsmsg_t* msg);
bool ParseSignalStatus(htsmsg_t* msg);
+ bool ParseTimeshiftStatus(htsmsg_t* msg);
bool ParseSourceInfo(htsmsg_t* msg);
CHTSPConnection* m_session;
@@ -72,4 +76,6 @@ class CHTSPDemux : public CHTSPConnectionCallback
std::map<int, unsigned int> m_StreamIndex;
PLATFORM::SyncedBuffer<DemuxPacket*> m_demuxPacketBuffer;
bool m_bIsOpen;
+ PLATFORM::CEvent* m_seekEvent;
+ double m_seekTime;
};

0 comments on commit a64dd9e

Please sign in to comment.
Something went wrong with that request. Please try again.