Skip to content
Permalink
Browse files

PVR Addon API 5.8.0

  • Loading branch information...
manuelm committed Mar 15, 2018
1 parent 05cff5b commit f1746c5a217d35072b58b712f9c36fdd330b8b49
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<addon
id="pvr.dvbviewer"
version="3.3.8"
version="3.4.0"
name="DVBViewer Client"
provider-name="A600, Manuel Mausz">
<requires>@ADDON_DEPENDS@</requires>
@@ -1,3 +1,6 @@
3.4.0
[updated] to PVR API v5.8.0

3.3.3
[fixed] Preserve whitespaces in EPG

@@ -17,7 +17,7 @@ class IStreamReader
virtual time_t TimeStart() = 0;
virtual time_t TimeEnd() = 0;
virtual bool NearEnd() = 0;
virtual bool CanTimeshift() = 0;
virtual bool IsTimeshifting() = 0;
};

#endif
@@ -4,7 +4,7 @@
using namespace ADDON;

StreamReader::StreamReader(const std::string &streamURL)
: m_start(time(NULL))
: m_start(time(nullptr))
{
m_streamHandle = XBMC->OpenFile(streamURL.c_str(), READ_NO_CACHE);
XBMC->Log(LOG_DEBUG, "StreamReader: Started; url=%s", streamURL.c_str());
@@ -49,15 +49,15 @@ time_t StreamReader::TimeStart()

time_t StreamReader::TimeEnd()
{
return time(NULL);
return time(nullptr);
}

bool StreamReader::NearEnd()
{
return true;
}

bool StreamReader::CanTimeshift()
bool StreamReader::IsTimeshifting()
{
return false;
}
@@ -19,7 +19,7 @@ class StreamReader
time_t TimeStart() override;
time_t TimeEnd() override;
bool NearEnd() override;
bool CanTimeshift() override;
bool IsTimeshifting() override;

private:
void *m_streamHandle;
@@ -49,7 +49,7 @@ bool TimeshiftBuffer::Start()
if (IsRunning())
return true;
XBMC->Log(LOG_INFO, "Timeshift: Started");
m_start = time(NULL);
m_start = time(nullptr);
CreateThread();
return true;
}
@@ -131,7 +131,7 @@ time_t TimeshiftBuffer::TimeStart()

time_t TimeshiftBuffer::TimeEnd()
{
return time(NULL);
return time(nullptr);
}

bool TimeshiftBuffer::NearEnd()
@@ -145,7 +145,7 @@ bool TimeshiftBuffer::NearEnd()
//return Length() - Position() <= 10 * 1048576;
}

bool TimeshiftBuffer::CanTimeshift()
bool TimeshiftBuffer::IsTimeshifting()
{
return true;
}
@@ -20,7 +20,7 @@ class TimeshiftBuffer
time_t TimeStart() override;
time_t TimeEnd() override;
bool NearEnd() override;
bool CanTimeshift() override;
bool IsTimeshifting() override;

private:
virtual void *Process(void) override;
@@ -504,15 +504,15 @@ bool IsRealTimeStream()
bool CanPauseStream(void)
{
if (g_timeshift != Timeshift::OFF && strReader)
return (strReader->CanTimeshift()
return (strReader->IsTimeshifting()
|| XBMC->DirectoryExists(g_timeshiftBufferPath.c_str()));
return false;
}

bool CanSeekStream(void)
{
// pause button seems to check CanSeekStream() too
//return (strReader && strReader->CanTimeshift());
//return (strReader && strReader->IsTimeshifting());
return (g_timeshift != Timeshift::OFF);
}

@@ -526,49 +526,44 @@ long long SeekLiveStream(long long position, int whence)
return (strReader) ? strReader->Seek(position, whence) : -1;
}

long long PositionLiveStream(void)
{
return (strReader) ? strReader->Position() : -1;
}

long long LengthLiveStream(void)
{
return (strReader) ? strReader->Length() : -1;
}

bool IsTimeshifting(void)
{
return (strReader && strReader->CanTimeshift());
return (strReader && strReader->IsTimeshifting());
}

time_t GetBufferTimeStart()
PVR_ERROR GetStreamTimes(PVR_STREAM_TIMES *times)
{
return (strReader) ? strReader->TimeStart() : 0;
}

time_t GetBufferTimeEnd()
{
return (strReader) ? strReader->TimeEnd() : 0;
if (!times)
return PVR_ERROR_INVALID_PARAMETERS;
if (strReader)
{
times->startTime = strReader->TimeStart();
times->ptsStart = 0;
times->ptsBegin = 0;
times->ptsEnd = (!strReader->IsTimeshifting()) ? 0
: (strReader->TimeEnd() - strReader->TimeStart()) * DVD_TIME_BASE;
return PVR_ERROR_NO_ERROR;
}
return PVR_ERROR_NOT_IMPLEMENTED;
}

void PauseStream(bool paused)
{
/* start timeshift on pause */
if (paused && g_timeshift != Timeshift::OFF
&& strReader && !strReader->CanTimeshift()
if (paused && g_timeshift == Timeshift::ON_PAUSE
&& strReader && !strReader->IsTimeshifting()
&& XBMC->DirectoryExists(g_timeshiftBufferPath.c_str()))
{
strReader = new TimeshiftBuffer(strReader, g_timeshiftBufferPath);
(void)strReader->Start();
}
}

time_t GetPlayingTime()
{
//FIXME: this should rather return the time of the *current* position
return GetBufferTimeEnd();
}

/* recording stream functions */
int GetRecordingsAmount(bool _UNUSED(deleted))
{
@@ -622,14 +617,6 @@ long long SeekRecordedStream(long long position, int whence)
return recReader->Seek(position, whence);
}

long long PositionRecordedStream(void)
{
if (!recReader)
return -1;

return recReader->Position();
}

long long LengthRecordedStream(void)
{
if (!recReader)
@@ -639,13 +626,11 @@ long long LengthRecordedStream(void)
}

/** UNUSED API FUNCTIONS */
PVR_ERROR GetStreamTimes(PVR_STREAM_TIMES*) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR GetStreamProperties(PVR_STREAM_PROPERTIES*) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR GetChannelStreamProperties(const PVR_CHANNEL*, PVR_NAMED_VALUE*, unsigned int*) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR CallMenuHook(const PVR_MENUHOOK&, const PVR_MENUHOOK_DATA&) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR DeleteChannel(const PVR_CHANNEL&) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR RenameChannel(const PVR_CHANNEL&) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR MoveChannel(const PVR_CHANNEL&) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR OpenDialogChannelScan(void) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR OpenDialogChannelSettings(const PVR_CHANNEL&) { return PVR_ERROR_NOT_IMPLEMENTED; }
PVR_ERROR OpenDialogChannelAdd(const PVR_CHANNEL&) { return PVR_ERROR_NOT_IMPLEMENTED; }

0 comments on commit f1746c5

Please sign in to comment.
You can’t perform that action at this time.