aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Sommerfeld <kai.sommerfeld@gmx.com>2018-08-24 14:47:48 +0200
committerKai Sommerfeld <kai.sommerfeld@gmx.com>2018-08-25 15:58:32 +0200
commit869cdc1ea7030db913fdd20694708691bca16e22 (patch)
tree2f52d060253cee1b864b9960b5d606d3c3e7822b
parentacf50badddbffdaadec3c722146cf6d3f104de81 (diff)
[pvr] PVRGUIInfo: refactor gui times code.
-rw-r--r--xbmc/pvr/CMakeLists.txt6
-rw-r--r--xbmc/pvr/PVRGUIInfo.cpp381
-rw-r--r--xbmc/pvr/PVRGUIInfo.h50
-rw-r--r--xbmc/pvr/PVRGUITimesInfo.cpp395
-rw-r--r--xbmc/pvr/PVRGUITimesInfo.h83
-rw-r--r--xbmc/pvr/PVRManager.cpp7
-rw-r--r--xbmc/pvr/PVRManager.h5
-rw-r--r--xbmc/pvr/epg/Epg.cpp6
8 files changed, 523 insertions, 410 deletions
diff --git a/xbmc/pvr/CMakeLists.txt b/xbmc/pvr/CMakeLists.txt
index a1098e7a1e..37e22a1fca 100644
--- a/xbmc/pvr/CMakeLists.txt
+++ b/xbmc/pvr/CMakeLists.txt
@@ -10,7 +10,8 @@ set(SOURCES PVRActionListener.cpp
PVRJobs.cpp
PVRGUIChannelNavigator.cpp
PVRGUIProgressHandler.cpp
- PVRGUITimerInfo.cpp)
+ PVRGUITimerInfo.cpp
+ PVRGUITimesInfo.cpp)
set(HEADERS PVRActionListener.h
PVRDatabase.h
@@ -26,6 +27,7 @@ set(HEADERS PVRActionListener.h
PVRJobs.h
PVRGUIChannelNavigator.h
PVRGUIProgressHandler.h
- PVRGUITimerInfo.h)
+ PVRGUITimerInfo.h
+ PVRGUITimesInfo.h)
core_add_library(pvr)
diff --git a/xbmc/pvr/PVRGUIInfo.cpp b/xbmc/pvr/PVRGUIInfo.cpp
index 3359b57886..1907a27671 100644
--- a/xbmc/pvr/PVRGUIInfo.cpp
+++ b/xbmc/pvr/PVRGUIInfo.cpp
@@ -14,7 +14,6 @@
#include "Application.h"
#include "GUIInfoManager.h"
#include "ServiceBroker.h"
-#include "cores/DataCacheCore.h"
#include "guilib/GUIComponent.h"
#include "guilib/LocalizeStrings.h"
#include "guilib/guiinfo/GUIInfo.h"
@@ -56,6 +55,7 @@ void CPVRGUIInfo::ResetProperties(void)
m_anyTimersInfo.ResetProperties();
m_tvTimersInfo.ResetProperties();
m_radioTimersInfo.ResetProperties();
+ m_timesInfo.Reset();
m_bHasTVRecordings = false;
m_bHasRadioRecordings = false;
m_iCurrentActiveClient = 0;
@@ -69,7 +69,6 @@ void CPVRGUIInfo::ResetProperties(void)
m_strBackendChannels .clear();
m_iBackendDiskTotal = 0;
m_iBackendDiskUsed = 0;
- m_iDuration = 0;
m_bIsPlayingTV = false;
m_bIsPlayingRadio = false;
m_bIsPlayingRecording = false;
@@ -80,8 +79,6 @@ void CPVRGUIInfo::ResetProperties(void)
m_bHasTVChannels = false;
m_bHasRadioChannels = false;
- ResetTimeshiftData();
- ResetPlayingTag();
ClearQualityInfo(m_qualityInfo);
ClearDescrambleInfo(m_descrambleInfo);
@@ -89,20 +86,6 @@ void CPVRGUIInfo::ResetProperties(void)
m_bRegistered = false;
}
-void CPVRGUIInfo::ResetTimeshiftData()
-{
- CSingleLock lock(m_critSection);
-
- m_iStartTime = 0;
- m_iTimeshiftStartTime = 0;
- m_iTimeshiftEndTime = 0;
- m_iTimeshiftPlayTime = 0;
- m_iTimeshiftOffset = 0;
- m_iTimeshiftProgressStartTime = 0;
- m_iTimeshiftProgressEndTime = 0;
- m_iTimeshiftProgressDuration = 0;
-}
-
void CPVRGUIInfo::ClearQualityInfo(PVR_SIGNAL_STATUS &qualityInfo)
{
memset(&qualityInfo, 0, sizeof(qualityInfo));
@@ -178,10 +161,6 @@ void CPVRGUIInfo::Process(void)
Sleep(0);
if (!m_bStop)
- UpdatePlayingTag();
- Sleep(0);
-
- if (!m_bStop)
UpdateTimeshiftData();
Sleep(0);
@@ -203,9 +182,6 @@ void CPVRGUIInfo::Process(void)
if (!m_bStop)
Sleep(1000);
}
-
- if (!m_bStop)
- ResetPlayingTag();
}
void CPVRGUIInfo::UpdateQualityData(void)
@@ -281,116 +257,9 @@ void CPVRGUIInfo::UpdateMisc(void)
m_bIsRecordingPlayingChannel = bIsRecordingPlayingChannel;
}
-void CPVRGUIInfo::UpdateTimeshiftProgressData()
-{
- // Note: General idea of the ts progress is always to be able to visualise both the complete
- // ts buffer and the complete playing epg event (if any) side by side with the same time
- // scale. Ts progress start and end times will be calculated accordingly.
- // + Start is usually ts buffer start, except if start time of playing epg event is
- // before ts buffer start, then progress start is epg event start.
- // + End is usually ts buffer end, except if end time of playing epg event is
- // after ts buffer end, then progress end is epg event end.
-
- CSingleLock lock(m_critSection);
-
- //////////////////////////////////////////////////////////////////////////////////////
- // start time
- //////////////////////////////////////////////////////////////////////////////////////
- bool bUpdatedStartTime = false;
- if (m_playingEpgTag)
- {
- time_t start = 0;
- m_playingEpgTag->StartAsUTC().GetAsTime(start);
- if (start < m_iTimeshiftStartTime)
- {
- // playing event started before start of ts buffer
- m_iTimeshiftProgressStartTime = start;
- bUpdatedStartTime = true;
- }
- }
-
- if (!bUpdatedStartTime)
- {
- // default to ts buffer start
- m_iTimeshiftProgressStartTime = m_iTimeshiftStartTime;
- }
-
- //////////////////////////////////////////////////////////////////////////////////////
- // end time
- //////////////////////////////////////////////////////////////////////////////////////
- bool bUpdatedEndTime = false;
- if (m_playingEpgTag)
- {
- time_t end = 0;
- m_playingEpgTag->EndAsUTC().GetAsTime(end);
- if (end > m_iTimeshiftEndTime)
- {
- // playing event will end after end of ts buffer
- m_iTimeshiftProgressEndTime = end;
- bUpdatedEndTime = true;
- }
- }
-
- if (!bUpdatedEndTime)
- {
- // default to ts buffer end
- m_iTimeshiftProgressEndTime = m_iTimeshiftEndTime;
- }
-
- //////////////////////////////////////////////////////////////////////////////////////
- // duration
- //////////////////////////////////////////////////////////////////////////////////////
- m_iTimeshiftProgressDuration = m_iTimeshiftProgressEndTime - m_iTimeshiftProgressStartTime;
-}
-
void CPVRGUIInfo::UpdateTimeshiftData(void)
{
- if (!CServiceBroker::GetPVRManager().IsPlayingTV() && !CServiceBroker::GetPVRManager().IsPlayingRadio())
- {
- // If nothing is playing (anymore), there is no need to poll the timeshift values from the clients.
- ResetTimeshiftData();
- return;
- }
-
- time_t now = std::time(nullptr);
- time_t iStartTime;
- int64_t iPlayTime, iMinTime, iMaxTime;
- CServiceBroker::GetDataCacheCore().GetPlayTimes(iStartTime, iPlayTime, iMinTime, iMaxTime);
- bool bPlaying = CServiceBroker::GetDataCacheCore().GetSpeed() == 1.0;
-
- CSingleLock lock(m_critSection);
-
- if (!iStartTime)
- {
- if (m_iStartTime == 0)
- iStartTime = now;
- else
- iStartTime = m_iStartTime;
-
- iMinTime = iPlayTime;
- iMaxTime = iPlayTime;
- }
-
- m_iStartTime = iStartTime;
- m_iTimeshiftStartTime = iStartTime + iMinTime / 1000;
- m_iTimeshiftEndTime = iStartTime + iMaxTime / 1000;
-
- if (m_iTimeshiftEndTime > m_iTimeshiftStartTime)
- {
- // timeshifting supported
- m_iTimeshiftPlayTime = iStartTime + iPlayTime / 1000;
- m_iTimeshiftOffset = (iMaxTime - iPlayTime) / 1000;
- }
- else
- {
- // timeshifting not supported
- if (bPlaying)
- m_iTimeshiftPlayTime = now - m_iTimeshiftOffset;
-
- m_iTimeshiftOffset = now - m_iTimeshiftPlayTime;
- }
-
- UpdateTimeshiftProgressData();
+ m_timesInfo.Update();
}
bool CPVRGUIInfo::InitCurrentItem(CFileItem *item)
@@ -761,41 +630,53 @@ bool CPVRGUIInfo::GetPVRLabel(const CFileItem *item, const CGUIInfo &info, std::
switch (info.m_info)
{
case PVR_EPG_EVENT_DURATION:
- CharInfoEpgEventDuration(item, static_cast<TIME_FORMAT>(info.GetData1()), strValue);
+ {
+ const CPVREpgInfoTagPtr epgTag = (item->IsPVRChannel() || item->IsEPG()) ? CPVRItem(item).GetEpgInfoTag() : nullptr;
+ strValue = m_timesInfo.GetEpgEventDuration(epgTag, static_cast<TIME_FORMAT>(info.GetData1()));
return true;
+ }
case PVR_EPG_EVENT_ELAPSED_TIME:
- CharInfoEpgEventElapsedTime(item, static_cast<TIME_FORMAT>(info.GetData1()), strValue);
+ {
+ const CPVREpgInfoTagPtr epgTag = (item->IsPVRChannel() || item->IsEPG()) ? CPVRItem(item).GetEpgInfoTag() : nullptr;
+ strValue = m_timesInfo.GetEpgEventElapsedTime(epgTag, static_cast<TIME_FORMAT>(info.GetData1()));
return true;
+ }
case PVR_EPG_EVENT_REMAINING_TIME:
- CharInfoEpgEventRemainingTime(item, static_cast<TIME_FORMAT>(info.GetData1()), strValue);
+ {
+ const CPVREpgInfoTagPtr epgTag = (item->IsPVRChannel() || item->IsEPG()) ? CPVRItem(item).GetEpgInfoTag() : nullptr;
+ strValue = m_timesInfo.GetEpgEventRemainingTime(epgTag, static_cast<TIME_FORMAT>(info.GetData1()));
return true;
+ }
case PVR_EPG_EVENT_FINISH_TIME:
- CharInfoEpgEventFinishTime(item, static_cast<TIME_FORMAT>(info.GetData1()), strValue);
+ {
+ const CPVREpgInfoTagPtr epgTag = (item->IsPVRChannel() || item->IsEPG()) ? CPVRItem(item).GetEpgInfoTag() : nullptr;
+ strValue = m_timesInfo.GetEpgEventFinishTime(epgTag, static_cast<TIME_FORMAT>(info.GetData1()));
return true;
+ }
case PVR_TIMESHIFT_START_TIME:
- CharInfoTimeshiftStartTime(static_cast<TIME_FORMAT>(info.GetData1()), strValue);
+ strValue = m_timesInfo.GetTimeshiftStartTime(static_cast<TIME_FORMAT>(info.GetData1()));
return true;
case PVR_TIMESHIFT_END_TIME:
- CharInfoTimeshiftEndTime(static_cast<TIME_FORMAT>(info.GetData1()), strValue);
+ strValue = m_timesInfo.GetTimeshiftEndTime(static_cast<TIME_FORMAT>(info.GetData1()));
return true;
case PVR_TIMESHIFT_PLAY_TIME:
- CharInfoTimeshiftPlayTime(static_cast<TIME_FORMAT>(info.GetData1()), strValue);
+ strValue = m_timesInfo.GetTimeshiftPlayTime(static_cast<TIME_FORMAT>(info.GetData1()));
return true;
case PVR_TIMESHIFT_OFFSET:
- CharInfoTimeshiftOffset(static_cast<TIME_FORMAT>(info.GetData1()), strValue);
+ strValue = m_timesInfo.GetTimeshiftOffset(static_cast<TIME_FORMAT>(info.GetData1()));
return true;
case PVR_TIMESHIFT_PROGRESS_DURATION:
- CharInfoTimeshiftProgressDuration(static_cast<TIME_FORMAT>(info.GetData1()), strValue);
+ strValue = m_timesInfo.GetTimeshiftProgressDuration(static_cast<TIME_FORMAT>(info.GetData1()));
return true;
case PVR_TIMESHIFT_PROGRESS_START_TIME:
- CharInfoTimeshiftProgressStartTime(static_cast<TIME_FORMAT>(info.GetData1()), strValue);
+ strValue = m_timesInfo.GetTimeshiftProgressStartTime(static_cast<TIME_FORMAT>(info.GetData1()));
return true;
case PVR_TIMESHIFT_PROGRESS_END_TIME:
- CharInfoTimeshiftProgressEndTime(static_cast<TIME_FORMAT>(info.GetData1()), strValue);
+ strValue = m_timesInfo.GetTimeshiftProgressEndTime(static_cast<TIME_FORMAT>(info.GetData1()));
return true;
case PVR_EPG_EVENT_SEEK_TIME:
- strValue = StringUtils::SecondsToTimeString(GetElapsedTime() + g_application.GetAppPlayer().GetSeekHandler().GetSeekSize(),
- static_cast<TIME_FORMAT>(info.GetData1())).c_str();
+ strValue = m_timesInfo.GetEpgEventSeekTime(g_application.GetAppPlayer().GetSeekHandler().GetSeekSize(),
+ static_cast<TIME_FORMAT>(info.GetData1()));
return true;
case PVR_NOW_RECORDING_TITLE:
strValue = m_anyTimersInfo.GetActiveTimerTitle();
@@ -1159,53 +1040,35 @@ bool CPVRGUIInfo::GetPVRInt(const CFileItem *item, const CGUIInfo &info, int& iV
case PVR_EPG_EVENT_DURATION:
{
const CPVREpgInfoTagPtr epgTag = (item->IsPVRChannel() || item->IsEPG()) ? CPVRItem(item).GetEpgInfoTag() : nullptr;
- if (epgTag && epgTag != m_playingEpgTag)
- iValue = epgTag->GetDuration();
- else
- iValue = m_iDuration;
+ iValue = m_timesInfo.GetEpgEventDuration(epgTag);
return true;
}
case PVR_EPG_EVENT_PROGRESS:
{
const CPVREpgInfoTagPtr epgTag = (item->IsPVRChannel() || item->IsEPG()) ? CPVRItem(item).GetEpgInfoTag() : nullptr;
- if (epgTag && epgTag != m_playingEpgTag)
- iValue = std::lrintf(epgTag->ProgressPercentage());
- else
- iValue = std::lrintf(static_cast<float>(GetElapsedTime()) / m_iDuration * 100);
+ iValue = m_timesInfo.GetEpgEventProgress(epgTag);
return true;
}
case PVR_TIMESHIFT_PROGRESS:
- iValue = std::lrintf(static_cast<float>(m_iTimeshiftPlayTime - m_iTimeshiftStartTime) / (m_iTimeshiftEndTime - m_iTimeshiftStartTime) * 100);
+ iValue = m_timesInfo.GetTimeshiftProgress();
return true;
case PVR_TIMESHIFT_PROGRESS_DURATION:
- iValue = m_iTimeshiftProgressDuration;
+ iValue = m_timesInfo.GetTimeshiftProgressDuration();
return true;
case PVR_TIMESHIFT_PROGRESS_PLAY_POS:
- iValue = std::lrintf(static_cast<float>(m_iTimeshiftPlayTime - m_iTimeshiftProgressStartTime) / m_iTimeshiftProgressDuration * 100);
+ iValue = m_timesInfo.GetTimeshiftProgressPlayPosition();
return true;
case PVR_TIMESHIFT_PROGRESS_EPG_START:
- iValue = 0;
- if (m_playingEpgTag)
- {
- time_t epgStart = 0;
- m_playingEpgTag->StartAsUTC().GetAsTime(epgStart);
- iValue = std::lrintf(static_cast<float>(epgStart - m_iTimeshiftProgressStartTime) / m_iTimeshiftProgressDuration * 100);
- }
+ iValue = m_timesInfo.GetTimeshiftProgressEpgStart();
return true;
case PVR_TIMESHIFT_PROGRESS_EPG_END:
- iValue = 0;
- if (m_playingEpgTag)
- {
- time_t epgEnd = 0;
- m_playingEpgTag->EndAsUTC().GetAsTime(epgEnd);
- iValue = std::lrintf(static_cast<float>(epgEnd - m_iTimeshiftProgressStartTime) / m_iTimeshiftProgressDuration * 100);
- }
+ iValue = m_timesInfo.GetTimeshiftProgressEpgEnd();
return true;
case PVR_TIMESHIFT_PROGRESS_BUFFER_START:
- iValue = std::lrintf(static_cast<float>(m_iTimeshiftStartTime - m_iTimeshiftProgressStartTime) / m_iTimeshiftProgressDuration * 100);
+ iValue = m_timesInfo.GetTimeshiftProgressBufferStart();
return true;
case PVR_TIMESHIFT_PROGRESS_BUFFER_END:
- iValue = std::lrintf(static_cast<float>(m_iTimeshiftEndTime - m_iTimeshiftProgressStartTime) / m_iTimeshiftProgressDuration * 100);
+ iValue = m_timesInfo.GetTimeshiftProgressBufferEnd();
return true;
case PVR_ACTUAL_STREAM_SIG_PROGR:
iValue = std::lrintf(static_cast<float>(m_qualityInfo.iSignal) / 0xFFFF * 100);
@@ -1443,7 +1306,7 @@ bool CPVRGUIInfo::GetPVRBool(const CFileItem *item, const CGUIInfo &info, bool&
bValue = m_bIsPlayingEncryptedStream;
return true;
case PVR_IS_TIMESHIFTING:
- bValue = (m_iTimeshiftOffset > static_cast<unsigned int>(g_advancedSettings.m_iPVRTimeshiftThreshold));
+ bValue = m_timesInfo.IsTimeshifting();
return true;
case PVR_CAN_RECORD_PLAYING_CHANNEL:
bValue = m_bCanRecordPlayingChannel;
@@ -1487,99 +1350,6 @@ bool CPVRGUIInfo::GetRadioRDSBool(const CFileItem *item, const CGUIInfo &info, b
return false;
}
-namespace
-{
- std::string TimeToTimeString(time_t datetime, TIME_FORMAT format, bool withSeconds)
- {
- CDateTime time;
- time.SetFromUTCDateTime(datetime);
- return time.GetAsLocalizedTime(format, withSeconds);
- }
-} // unnamed namespace
-
-void CPVRGUIInfo::CharInfoTimeshiftStartTime(TIME_FORMAT format, std::string &strValue) const
-{
- strValue = TimeToTimeString(m_iTimeshiftStartTime, format, false);
-}
-
-void CPVRGUIInfo::CharInfoTimeshiftEndTime(TIME_FORMAT format, std::string &strValue) const
-{
- strValue = TimeToTimeString(m_iTimeshiftEndTime, format, false);
-}
-
-void CPVRGUIInfo::CharInfoTimeshiftPlayTime(TIME_FORMAT format, std::string &strValue) const
-{
- strValue = TimeToTimeString(m_iTimeshiftPlayTime, format, true);
-}
-
-void CPVRGUIInfo::CharInfoTimeshiftOffset(TIME_FORMAT format, std::string &strValue) const
-{
- strValue = StringUtils::SecondsToTimeString(m_iTimeshiftOffset, format).c_str();
-}
-
-void CPVRGUIInfo::CharInfoTimeshiftProgressDuration(TIME_FORMAT format, std::string &strValue) const
-{
- strValue = StringUtils::SecondsToTimeString(m_iTimeshiftProgressDuration, format).c_str();
-}
-
-void CPVRGUIInfo::CharInfoTimeshiftProgressStartTime(TIME_FORMAT format, std::string &strValue) const
-{
- strValue = TimeToTimeString(m_iTimeshiftProgressStartTime, format, false);
-}
-
-void CPVRGUIInfo::CharInfoTimeshiftProgressEndTime(TIME_FORMAT format, std::string &strValue) const
-{
- strValue = TimeToTimeString(m_iTimeshiftProgressEndTime, format, false);
-}
-
-void CPVRGUIInfo::CharInfoEpgEventDuration(const CFileItem *item, TIME_FORMAT format, std::string &strValue) const
-{
- int iDuration = 0;
- const CPVREpgInfoTagPtr epgTag = (item->IsPVRChannel() || item->IsEPG()) ? CPVRItem(item).GetEpgInfoTag() : nullptr;
- if (epgTag && epgTag != m_playingEpgTag)
- iDuration = epgTag->GetDuration();
- else
- iDuration = m_iDuration;
-
- strValue = StringUtils::SecondsToTimeString(iDuration, format).c_str();
-}
-
-void CPVRGUIInfo::CharInfoEpgEventElapsedTime(const CFileItem *item, TIME_FORMAT format, std::string &strValue) const
-{
- int iElapsed = 0;
- const CPVREpgInfoTagPtr epgTag = (item->IsPVRChannel() || item->IsEPG()) ? CPVRItem(item).GetEpgInfoTag() : nullptr;
- if (epgTag && epgTag != m_playingEpgTag)
- iElapsed = epgTag->Progress();
- else
- iElapsed = GetElapsedTime();
-
- strValue = StringUtils::SecondsToTimeString(iElapsed, format).c_str();
-}
-
-int CPVRGUIInfo::GetRemainingTime(const CFileItem *item) const
-{
- int iRemaining = 0;
- const CPVREpgInfoTagPtr epgTag = (item->IsPVRChannel() || item->IsEPG()) ? CPVRItem(item).GetEpgInfoTag() : nullptr;
- if (epgTag && epgTag != m_playingEpgTag)
- iRemaining = epgTag->GetDuration() - epgTag->Progress();
- else
- iRemaining = m_iDuration - GetElapsedTime();
-
- return iRemaining;
-}
-
-void CPVRGUIInfo::CharInfoEpgEventRemainingTime(const CFileItem *item, TIME_FORMAT format, std::string &strValue) const
-{
- strValue = StringUtils::SecondsToTimeString(GetRemainingTime(item), format).c_str();
-}
-
-void CPVRGUIInfo::CharInfoEpgEventFinishTime(const CFileItem *item, TIME_FORMAT format, std::string &strValue) const
-{
- CDateTime finish = CDateTime::GetCurrentDateTime();
- finish += CDateTimeSpan(0, 0, 0, GetRemainingTime(item));
- strValue = finish.GetAsLocalizedTime(format);
-}
-
void CPVRGUIInfo::CharInfoBackendNumber(std::string &strValue) const
{
size_t numBackends = m_backendProperties.size();
@@ -1822,80 +1592,3 @@ void CPVRGUIInfo::UpdateNextTimer(void)
m_tvTimersInfo.UpdateNextTimer();
m_radioTimersInfo.UpdateNextTimer();
}
-
-int CPVRGUIInfo::GetElapsedTime(void) const
-{
- CSingleLock lock(m_critSection);
-
- if (m_playingEpgTag || m_iTimeshiftStartTime)
- {
- CDateTime current(m_iTimeshiftPlayTime);
- CDateTime start = m_playingEpgTag ? m_playingEpgTag->StartAsUTC()
- : CDateTime(m_iTimeshiftStartTime);
- CDateTimeSpan time = current > start ? current - start : CDateTimeSpan(0, 0, 0, 0);
- return time.GetSecondsTotal();
- }
- else
- {
- return 0;
- }
-}
-
-void CPVRGUIInfo::ResetPlayingTag(void)
-{
- CSingleLock lock(m_critSection);
- m_playingEpgTag.reset();
- m_iDuration = 0;
-}
-
-CPVREpgInfoTagPtr CPVRGUIInfo::GetPlayingTag() const
-{
- CSingleLock lock(m_critSection);
- return m_playingEpgTag;
-}
-
-void CPVRGUIInfo::UpdatePlayingTag(void)
-{
- const CPVRChannelPtr currentChannel(CServiceBroker::GetPVRManager().GetPlayingChannel());
- const CPVREpgInfoTagPtr currentTag(CServiceBroker::GetPVRManager().GetPlayingEpgTag());
- if (currentChannel || currentTag)
- {
- CPVREpgInfoTagPtr epgTag(GetPlayingTag());
- CPVRChannelPtr channel;
- if (epgTag)
- channel = epgTag->Channel();
-
- if (!epgTag || !epgTag->IsActive() ||
- !channel || !currentChannel || *channel != *currentChannel)
- {
- const CPVREpgInfoTagPtr newTag(currentTag ? currentTag : currentChannel->GetEPGNow());
-
- CSingleLock lock(m_critSection);
- if (newTag)
- {
- m_playingEpgTag = newTag;
- m_iDuration = m_playingEpgTag->GetDuration();
- }
- else if (m_iTimeshiftEndTime > m_iTimeshiftStartTime)
- {
- m_playingEpgTag.reset();
- m_iDuration = m_iTimeshiftEndTime - m_iTimeshiftStartTime;
- }
- else
- {
- m_playingEpgTag.reset();
- m_iDuration = 0;
- }
- }
- }
- else
- {
- const CPVRRecordingPtr recording(CServiceBroker::GetPVRManager().GetPlayingRecording());
- if (recording)
- {
- CSingleLock lock(m_critSection);
- m_playingEpgTag.reset();
- m_iDuration = recording->GetDuration();
- }
- }
-}
diff --git a/xbmc/pvr/PVRGUIInfo.h b/xbmc/pvr/PVRGUIInfo.h
index 7b0fdb5ea3..9d3e05ab59 100644
--- a/xbmc/pvr/PVRGUIInfo.h
+++ b/xbmc/pvr/PVRGUIInfo.h
@@ -19,6 +19,7 @@
#include "utils/Observer.h"
#include "pvr/PVRGUITimerInfo.h"
+#include "pvr/PVRGUITimesInfo.h"
#include "pvr/PVRTypes.h"
#include "pvr/addons/PVRClients.h"
@@ -52,20 +53,13 @@ namespace PVR
bool GetInt(int& value, const CGUIListItem *item, int contextWindow, const KODI::GUILIB::GUIINFO::CGUIInfo &info) const override;
bool GetBool(bool& value, const CGUIListItem *item, int contextWindow, const KODI::GUILIB::GUIINFO::CGUIInfo &info) const override;
- /*!
- * @brief Clear the playing EPG tag.
- */
- void ResetPlayingTag(void);
-
private:
void ResetProperties(void);
void ClearQualityInfo(PVR_SIGNAL_STATUS &qualityInfo);
void ClearDescrambleInfo(PVR_DESCRAMBLE_INFO &descrambleInfo);
- void ResetTimeshiftData();
void Process(void) override;
- void UpdatePlayingTag(void);
void UpdateTimersCache(void);
void UpdateBackendCache(void);
void UpdateQualityData(void);
@@ -88,10 +82,6 @@ namespace PVR
bool GetPVRBool(const CFileItem *item, const KODI::GUILIB::GUIINFO::CGUIInfo &info, bool& bValue) const;
bool GetRadioRDSBool(const CFileItem *item, const KODI::GUILIB::GUIINFO::CGUIInfo &info, bool &bValue) const;
- void CharInfoEpgEventDuration(const CFileItem *item, TIME_FORMAT format, std::string &strValue) const;
- void CharInfoEpgEventElapsedTime(const CFileItem *item, TIME_FORMAT format, std::string &strValue) const;
- void CharInfoEpgEventRemainingTime(const CFileItem *item, TIME_FORMAT format, std::string &strValue) const;
- void CharInfoEpgEventFinishTime(const CFileItem *item, TIME_FORMAT format, std::string &strValue) const;
void CharInfoBackendNumber(std::string &strValue) const;
void CharInfoTotalDiskSpace(std::string &strValue) const;
void CharInfoSignal(std::string &strValue) const;
@@ -113,28 +103,6 @@ namespace PVR
void CharInfoService(std::string &strValue) const;
void CharInfoMux(std::string &strValue) const;
void CharInfoProvider(std::string &strValue) const;
- void CharInfoTimeshiftStartTime(TIME_FORMAT format, std::string &strValue) const;
- void CharInfoTimeshiftEndTime(TIME_FORMAT format, std::string &strValue) const;
- void CharInfoTimeshiftPlayTime(TIME_FORMAT format, std::string &strValue) const;
- void CharInfoTimeshiftOffset(TIME_FORMAT format, std::string &strValue) const;
- void CharInfoTimeshiftProgressDuration(TIME_FORMAT format, std::string &strValue) const;
- void CharInfoTimeshiftProgressStartTime(TIME_FORMAT format, std::string &strValue) const;
- void CharInfoTimeshiftProgressEndTime(TIME_FORMAT format, std::string &strValue) const;
-
- /*!
- * @brief Get the elapsed time since the start of the currently playing epg event or if
- * no epg is available since the start of the playback of the current Live TV stream.
- * @return The time in seconds or 0 if no channel is playing.
- */
- int GetElapsedTime(void) const;
-
- int GetRemainingTime(const CFileItem *item) const;
-
- /*!
- * @brief Get the currently playing EPG tag.
- * @return The currently playing EPG tag or NULL if no EPG tag is playing.
- */
- CPVREpgInfoTagPtr GetPlayingTag() const;
/** @name PVRGUIInfo data */
//@{
@@ -142,6 +110,8 @@ namespace PVR
CPVRGUITVTimerInfo m_tvTimersInfo;
CPVRGUIRadioTimerInfo m_radioTimersInfo;
+ CPVRGUITimesInfo m_timesInfo;
+
bool m_bHasTVRecordings;
bool m_bHasRadioRecordings;
unsigned int m_iCurrentActiveClient;
@@ -155,7 +125,6 @@ namespace PVR
std::string m_strBackendChannels;
long long m_iBackendDiskTotal;
long long m_iBackendDiskUsed;
- unsigned int m_iDuration;
bool m_bIsPlayingTV;
bool m_bIsPlayingRadio;
bool m_bIsPlayingRecording;
@@ -172,19 +141,8 @@ namespace PVR
PVR_SIGNAL_STATUS m_qualityInfo; /*!< stream quality information */
PVR_DESCRAMBLE_INFO m_descrambleInfo; /*!< stream descramble information */
- CPVREpgInfoTagPtr m_playingEpgTag;
std::vector<SBackend> m_backendProperties;
- time_t m_iStartTime;
- time_t m_iTimeshiftStartTime;
- time_t m_iTimeshiftEndTime;
- time_t m_iTimeshiftPlayTime;
- unsigned int m_iTimeshiftOffset;
-
- time_t m_iTimeshiftProgressStartTime = 0;
- time_t m_iTimeshiftProgressEndTime = 0;
- unsigned int m_iTimeshiftProgressDuration = 0;
-
mutable CCriticalSection m_critSection;
/**
@@ -193,7 +151,7 @@ namespace PVR
* backend querying when we're not displaying any of the queried
* information.
*/
- mutable std::atomic<bool> m_updateBackendCacheRequested;
+ mutable std::atomic<bool> m_updateBackendCacheRequested;
bool m_bRegistered;
};
diff --git a/xbmc/pvr/PVRGUITimesInfo.cpp b/xbmc/pvr/PVRGUITimesInfo.cpp
new file mode 100644
index 0000000000..2dbcda3567
--- /dev/null
+++ b/xbmc/pvr/PVRGUITimesInfo.cpp
@@ -0,0 +1,395 @@
+/*
+ * Copyright (C) 2012-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#include "PVRGUITimesInfo.h"
+
+#include <cmath>
+
+#include "ServiceBroker.h"
+#include "cores/DataCacheCore.h"
+#include "settings/AdvancedSettings.h"
+#include "threads/SingleLock.h"
+#include "utils/StringUtils.h"
+
+#include "pvr/PVRManager.h"
+
+using namespace PVR;
+
+CPVRGUITimesInfo::CPVRGUITimesInfo()
+{
+ Reset();
+}
+
+void CPVRGUITimesInfo::Reset()
+{
+ CSingleLock lock(m_critSection);
+
+ m_iStartTime = 0;
+ m_iDuration = 0;
+ m_iTimeshiftStartTime = 0;
+ m_iTimeshiftEndTime = 0;
+ m_iTimeshiftPlayTime = 0;
+ m_iTimeshiftOffset = 0;
+
+ m_iTimeshiftProgressStartTime = 0;
+ m_iTimeshiftProgressEndTime = 0;
+ m_iTimeshiftProgressDuration = 0;
+
+ m_playingEpgTag.reset();
+}
+
+void CPVRGUITimesInfo::UpdatePlayingTag()
+{
+ const CPVRChannelPtr currentChannel = CServiceBroker::GetPVRManager().GetPlayingChannel();
+ CPVREpgInfoTagPtr currentTag = CServiceBroker::GetPVRManager().GetPlayingEpgTag();
+
+ if (currentChannel || currentTag)
+ {
+ if (!currentTag)
+ currentTag = currentChannel->GetEPGNow();
+
+ CSingleLock lock(m_critSection);
+
+ const CPVRChannelPtr playingChannel = m_playingEpgTag ? m_playingEpgTag->Channel() : nullptr;
+ if (!m_playingEpgTag || !m_playingEpgTag->IsActive() ||
+ !playingChannel || !currentChannel || *playingChannel != *currentChannel)
+ {
+ if (currentTag)
+ {
+ m_playingEpgTag = currentTag;
+ m_iDuration = m_playingEpgTag->GetDuration();
+ }
+ else if (m_iTimeshiftEndTime > m_iTimeshiftStartTime)
+ {
+ m_playingEpgTag.reset();
+ m_iDuration = m_iTimeshiftEndTime - m_iTimeshiftStartTime;
+ }
+ else
+ {
+ m_playingEpgTag.reset();
+ m_iDuration = 0;
+ }
+ }
+ }
+ else
+ {
+ const CPVRRecordingPtr recording = CServiceBroker::GetPVRManager().GetPlayingRecording();
+ if (recording)
+ {
+ CSingleLock lock(m_critSection);
+ m_playingEpgTag.reset();
+ m_iDuration = recording->GetDuration();
+ }
+ }
+}
+
+void CPVRGUITimesInfo::UpdateTimeshiftData()
+{
+ if (!CServiceBroker::GetPVRManager().IsPlayingTV() && !CServiceBroker::GetPVRManager().IsPlayingRadio())
+ {
+ // If nothing is playing (anymore), there is no need to update data.
+ Reset();
+ return;
+ }
+
+ time_t now = std::time(nullptr);
+ time_t iStartTime;
+ int64_t iPlayTime, iMinTime, iMaxTime;
+ CServiceBroker::GetDataCacheCore().GetPlayTimes(iStartTime, iPlayTime, iMinTime, iMaxTime);
+ bool bPlaying = CServiceBroker::GetDataCacheCore().GetSpeed() == 1.0;
+
+ CSingleLock lock(m_critSection);
+
+ if (!iStartTime)
+ {
+ if (m_iStartTime == 0)
+ iStartTime = now;
+ else
+ iStartTime = m_iStartTime;
+
+ iMinTime = iPlayTime;
+ iMaxTime = iPlayTime;
+ }
+
+ m_iStartTime = iStartTime;
+ m_iTimeshiftStartTime = iStartTime + iMinTime / 1000;
+ m_iTimeshiftEndTime = iStartTime + iMaxTime / 1000;
+
+ if (m_iTimeshiftEndTime > m_iTimeshiftStartTime)
+ {
+ // timeshifting supported
+ m_iTimeshiftPlayTime = iStartTime + iPlayTime / 1000;
+ m_iTimeshiftOffset = (iMaxTime - iPlayTime) / 1000;
+ }
+ else
+ {
+ // timeshifting not supported
+ if (bPlaying)
+ m_iTimeshiftPlayTime = now - m_iTimeshiftOffset;
+
+ m_iTimeshiftOffset = now - m_iTimeshiftPlayTime;
+ }
+
+ UpdateTimeshiftProgressData();
+}
+
+void CPVRGUITimesInfo::UpdateTimeshiftProgressData()
+{
+ // Note: General idea of the ts progress is always to be able to visualise both the complete
+ // ts buffer and the complete playing epg event (if any) side by side with the same time
+ // scale. Ts progress start and end times will be calculated accordingly.
+ // + Start is usually ts buffer start, except if start time of playing epg event is
+ // before ts buffer start, then progress start is epg event start.
+ // + End is usually ts buffer end, except if end time of playing epg event is
+ // after ts buffer end, then progress end is epg event end.
+
+ CSingleLock lock(m_critSection);
+
+ //////////////////////////////////////////////////////////////////////////////////////
+ // start time
+ //////////////////////////////////////////////////////////////////////////////////////
+ bool bUpdatedStartTime = false;
+ if (m_playingEpgTag)
+ {
+ time_t start = 0;
+ m_playingEpgTag->StartAsUTC().GetAsTime(start);
+ if (start < m_iTimeshiftStartTime)
+ {
+ // playing event started before start of ts buffer
+ m_iTimeshiftProgressStartTime = start;
+ bUpdatedStartTime = true;
+ }
+ }
+
+ if (!bUpdatedStartTime)
+ {
+ // default to ts buffer start
+ m_iTimeshiftProgressStartTime = m_iTimeshiftStartTime;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////
+ // end time
+ //////////////////////////////////////////////////////////////////////////////////////
+ bool bUpdatedEndTime = false;
+ if (m_playingEpgTag)
+ {
+ time_t end = 0;
+ m_playingEpgTag->EndAsUTC().GetAsTime(end);
+ if (end > m_iTimeshiftEndTime)
+ {
+ // playing event will end after end of ts buffer
+ m_iTimeshiftProgressEndTime = end;
+ bUpdatedEndTime = true;
+ }
+ }
+
+ if (!bUpdatedEndTime)
+ {
+ // default to ts buffer end
+ m_iTimeshiftProgressEndTime = m_iTimeshiftEndTime;
+ }
+
+ //////////////////////////////////////////////////////////////////////////////////////
+ // duration
+ //////////////////////////////////////////////////////////////////////////////////////
+ m_iTimeshiftProgressDuration = m_iTimeshiftProgressEndTime - m_iTimeshiftProgressStartTime;
+}
+
+void CPVRGUITimesInfo::Update()
+{
+ UpdatePlayingTag();
+ UpdateTimeshiftData();
+}
+
+std::string CPVRGUITimesInfo::TimeToTimeString(time_t datetime, TIME_FORMAT format, bool withSeconds)
+{
+ CDateTime time;
+ time.SetFromUTCDateTime(datetime);
+ return time.GetAsLocalizedTime(format, withSeconds);
+}
+
+std::string CPVRGUITimesInfo::GetTimeshiftStartTime(TIME_FORMAT format) const
+{
+ CSingleLock lock(m_critSection);
+ return TimeToTimeString(m_iTimeshiftStartTime, format, false);
+}
+
+std::string CPVRGUITimesInfo::GetTimeshiftEndTime(TIME_FORMAT format) const
+{
+ CSingleLock lock(m_critSection);
+ return TimeToTimeString(m_iTimeshiftEndTime, format, false);
+}
+
+std::string CPVRGUITimesInfo::GetTimeshiftPlayTime(TIME_FORMAT format) const
+{
+ CSingleLock lock(m_critSection);
+ return TimeToTimeString(m_iTimeshiftPlayTime, format, true);
+}
+
+std::string CPVRGUITimesInfo::GetTimeshiftOffset(TIME_FORMAT format) const
+{
+ CSingleLock lock(m_critSection);
+ return StringUtils::SecondsToTimeString(m_iTimeshiftOffset, format);
+}
+
+std::string CPVRGUITimesInfo::GetTimeshiftProgressDuration(TIME_FORMAT format) const
+{
+ CSingleLock lock(m_critSection);
+ return StringUtils::SecondsToTimeString(m_iTimeshiftProgressDuration, format);
+}
+
+std::string CPVRGUITimesInfo::GetTimeshiftProgressStartTime(TIME_FORMAT format) const
+{
+ CSingleLock lock(m_critSection);
+ return TimeToTimeString(m_iTimeshiftProgressStartTime, format, false);
+}
+
+std::string CPVRGUITimesInfo::GetTimeshiftProgressEndTime(TIME_FORMAT format) const
+{
+ CSingleLock lock(m_critSection);
+ return TimeToTimeString(m_iTimeshiftProgressEndTime, format, false);
+}
+
+std::string CPVRGUITimesInfo::GetEpgEventDuration(const CPVREpgInfoTagPtr& epgTag, TIME_FORMAT format) const
+{
+ CSingleLock lock(m_critSection);
+ return StringUtils::SecondsToTimeString(GetEpgEventDuration(epgTag), format);
+}
+
+std::string CPVRGUITimesInfo::GetEpgEventElapsedTime(const CPVREpgInfoTagPtr& epgTag, TIME_FORMAT format) const
+{
+ int iElapsed = 0;
+ CSingleLock lock(m_critSection);
+ if (epgTag && epgTag != m_playingEpgTag)
+ iElapsed = epgTag->Progress();
+ else
+ iElapsed = GetElapsedTime();
+
+ return StringUtils::SecondsToTimeString(iElapsed, format);
+}
+
+std::string CPVRGUITimesInfo::GetEpgEventRemainingTime(const CPVREpgInfoTagPtr& epgTag, TIME_FORMAT format) const
+{
+ CSingleLock lock(m_critSection);
+ return StringUtils::SecondsToTimeString(GetRemainingTime(epgTag), format);
+}
+
+std::string CPVRGUITimesInfo::GetEpgEventFinishTime(const CPVREpgInfoTagPtr& epgTag, TIME_FORMAT format) const
+{
+ CDateTime finish = CDateTime::GetCurrentDateTime();
+ finish += CDateTimeSpan(0, 0, 0, GetRemainingTime(epgTag));
+ return finish.GetAsLocalizedTime(format);
+}
+
+std::string CPVRGUITimesInfo::GetEpgEventSeekTime(int iSeekSize, TIME_FORMAT format) const
+{
+ return StringUtils::SecondsToTimeString(GetElapsedTime() + iSeekSize, format);
+}
+
+int CPVRGUITimesInfo::GetElapsedTime() const
+{
+ CSingleLock lock(m_critSection);
+ if (m_playingEpgTag || m_iTimeshiftStartTime)
+ {
+ CDateTime current(m_iTimeshiftPlayTime);
+ CDateTime start = m_playingEpgTag ? m_playingEpgTag->StartAsUTC() : CDateTime(m_iTimeshiftStartTime);
+ CDateTimeSpan time = current > start ? current - start : CDateTimeSpan(0, 0, 0, 0);
+ return time.GetSecondsTotal();
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+int CPVRGUITimesInfo::GetRemainingTime(const CPVREpgInfoTagPtr& epgTag) const
+{
+ CSingleLock lock(m_critSection);
+ if (epgTag && epgTag != m_playingEpgTag)
+ return epgTag->GetDuration() - epgTag->Progress();
+ else
+ return m_iDuration - GetElapsedTime();
+}
+
+int CPVRGUITimesInfo::GetTimeshiftProgress() const
+{
+ CSingleLock lock(m_critSection);
+ return std::lrintf(static_cast<float>(m_iTimeshiftPlayTime - m_iTimeshiftStartTime) / (m_iTimeshiftEndTime - m_iTimeshiftStartTime) * 100);
+}
+
+int CPVRGUITimesInfo::GetTimeshiftProgressDuration() const
+{
+ CSingleLock lock(m_critSection);
+ return m_iTimeshiftProgressDuration;
+}
+
+int CPVRGUITimesInfo::GetTimeshiftProgressPlayPosition() const
+{
+ CSingleLock lock(m_critSection);
+ return std::lrintf(static_cast<float>(m_iTimeshiftPlayTime - m_iTimeshiftProgressStartTime) / m_iTimeshiftProgressDuration * 100);
+}
+
+int CPVRGUITimesInfo::GetTimeshiftProgressEpgStart() const
+{
+ CSingleLock lock(m_critSection);
+ if (m_playingEpgTag)
+ {
+ time_t epgStart = 0;
+ m_playingEpgTag->StartAsUTC().GetAsTime(epgStart);
+ return std::lrintf(static_cast<float>(epgStart - m_iTimeshiftProgressStartTime) / m_iTimeshiftProgressDuration * 100);
+ }
+ return 0;
+}
+
+int CPVRGUITimesInfo::GetTimeshiftProgressEpgEnd() const
+{
+ CSingleLock lock(m_critSection);
+ if (m_playingEpgTag)
+ {
+ time_t epgEnd = 0;
+ m_playingEpgTag->EndAsUTC().GetAsTime(epgEnd);
+ return std::lrintf(static_cast<float>(epgEnd - m_iTimeshiftProgressStartTime) / m_iTimeshiftProgressDuration * 100);
+ }
+ return 0;
+}
+
+int CPVRGUITimesInfo::GetTimeshiftProgressBufferStart() const
+{
+ CSingleLock lock(m_critSection);
+ return std::lrintf(static_cast<float>(m_iTimeshiftStartTime - m_iTimeshiftProgressStartTime) / m_iTimeshiftProgressDuration * 100);
+}
+
+int CPVRGUITimesInfo::GetTimeshiftProgressBufferEnd() const
+{
+ CSingleLock lock(m_critSection);
+ return std::lrintf(static_cast<float>(m_iTimeshiftEndTime - m_iTimeshiftProgressStartTime) / m_iTimeshiftProgressDuration * 100);
+}
+
+int CPVRGUITimesInfo::GetEpgEventDuration(const CPVREpgInfoTagPtr& epgTag) const
+{
+ CSingleLock lock(m_critSection);
+ if (epgTag && epgTag != m_playingEpgTag)
+ return epgTag->GetDuration();
+ else
+ return m_iDuration;
+}
+
+int CPVRGUITimesInfo::GetEpgEventProgress(const CPVREpgInfoTagPtr& epgTag) const
+{
+ CSingleLock lock(m_critSection);
+ if (epgTag && epgTag != m_playingEpgTag)
+ return std::lrintf(epgTag->ProgressPercentage());
+ else
+ return std::lrintf(static_cast<float>(GetElapsedTime()) / m_iDuration * 100);
+}
+
+bool CPVRGUITimesInfo::IsTimeshifting() const
+{
+ CSingleLock lock(m_critSection);
+ return (m_iTimeshiftOffset > static_cast<unsigned int>(g_advancedSettings.m_iPVRTimeshiftThreshold));
+}
diff --git a/xbmc/pvr/PVRGUITimesInfo.h b/xbmc/pvr/PVRGUITimesInfo.h
new file mode 100644
index 0000000000..479bdce5f9
--- /dev/null
+++ b/xbmc/pvr/PVRGUITimesInfo.h
@@ -0,0 +1,83 @@
+/*
+ * Copyright (C) 2012-2018 Team Kodi
+ * This file is part of Kodi - https://kodi.tv
+ *
+ * SPDX-License-Identifier: GPL-2.0-or-later
+ * See LICENSES/README.md for more information.
+ */
+
+#pragma once
+
+#include "XBDateTime.h"
+#include "threads/CriticalSection.h"
+
+#include "pvr/PVRTypes.h"
+
+namespace PVR
+{
+ class CPVRGUITimesInfo
+ {
+ public:
+ CPVRGUITimesInfo();
+ virtual ~CPVRGUITimesInfo() = default;
+
+ void Reset();
+ void Update();
+
+ // GUI info labels
+ std::string GetTimeshiftStartTime(TIME_FORMAT format) const;
+ std::string GetTimeshiftEndTime(TIME_FORMAT format) const;
+ std::string GetTimeshiftPlayTime(TIME_FORMAT format) const;
+ std::string GetTimeshiftOffset(TIME_FORMAT format) const;
+ std::string GetTimeshiftProgressDuration(TIME_FORMAT format) const;
+ std::string GetTimeshiftProgressStartTime(TIME_FORMAT format) const;
+ std::string GetTimeshiftProgressEndTime(TIME_FORMAT format) const;
+
+ std::string GetEpgEventDuration(const CPVREpgInfoTagPtr& epgTag, TIME_FORMAT format) const;
+ std::string GetEpgEventElapsedTime(const CPVREpgInfoTagPtr& epgTag, TIME_FORMAT format) const;
+ std::string GetEpgEventRemainingTime(const CPVREpgInfoTagPtr& epgTag, TIME_FORMAT format) const;
+ std::string GetEpgEventFinishTime(const CPVREpgInfoTagPtr& epgTag, TIME_FORMAT format) const;
+ std::string GetEpgEventSeekTime(int iSeekSize, TIME_FORMAT format) const;
+
+ // GUI info ints
+ int GetTimeshiftProgress() const;
+ int GetTimeshiftProgressDuration() const;
+ int GetTimeshiftProgressPlayPosition() const;
+ int GetTimeshiftProgressEpgStart() const;
+ int GetTimeshiftProgressEpgEnd() const;
+ int GetTimeshiftProgressBufferStart() const;
+ int GetTimeshiftProgressBufferEnd() const;
+
+ int GetEpgEventDuration(const CPVREpgInfoTagPtr& epgTag) const;
+ int GetEpgEventProgress(const CPVREpgInfoTagPtr& epgTag) const;
+
+ // GUI info bools
+ bool IsTimeshifting() const;
+
+ private:
+ void UpdatePlayingTag();
+ void UpdateTimeshiftData();
+ void UpdateTimeshiftProgressData();
+
+ static std::string TimeToTimeString(time_t datetime, TIME_FORMAT format, bool withSeconds);
+
+ int GetElapsedTime() const;
+ int GetRemainingTime(const CPVREpgInfoTagPtr& epgTag) const;
+
+ mutable CCriticalSection m_critSection;
+
+ CPVREpgInfoTagPtr m_playingEpgTag;
+
+ time_t m_iStartTime;
+ unsigned int m_iDuration;
+ time_t m_iTimeshiftStartTime;
+ time_t m_iTimeshiftEndTime;
+ time_t m_iTimeshiftPlayTime;
+ unsigned int m_iTimeshiftOffset;
+
+ time_t m_iTimeshiftProgressStartTime;
+ time_t m_iTimeshiftProgressEndTime;
+ unsigned int m_iTimeshiftProgressDuration;
+ };
+
+} // namespace PVR
diff --git a/xbmc/pvr/PVRManager.cpp b/xbmc/pvr/PVRManager.cpp
index 5c731e5641..a26c0e0e1f 100644
--- a/xbmc/pvr/PVRManager.cpp
+++ b/xbmc/pvr/PVRManager.cpp
@@ -673,13 +673,6 @@ bool CPVRManager::CanRecordOnPlayingChannel(void) const
return currentChannel && currentChannel->CanRecord();
}
-void CPVRManager::ResetPlayingTag(void)
-{
- CSingleLock lock(m_critSection);
- if (m_guiInfo)
- m_guiInfo->ResetPlayingTag();
-}
-
void CPVRManager::RestartParentalTimer()
{
if (m_parentalTimer)
diff --git a/xbmc/pvr/PVRManager.h b/xbmc/pvr/PVRManager.h
index 53154e7f90..a1c7094db2 100644
--- a/xbmc/pvr/PVRManager.h
+++ b/xbmc/pvr/PVRManager.h
@@ -275,11 +275,6 @@ namespace PVR
bool EpgsCreated(void) const;
/*!
- * @brief Reset the playing EPG tag.
- */
- void ResetPlayingTag(void);
-
- /*!
* @brief Inform PVR manager that playback of an item just started.
* @param item The item that started to play.
*/
diff --git a/xbmc/pvr/epg/Epg.cpp b/xbmc/pvr/epg/Epg.cpp
index 4e7ae97fe2..a6724421bd 100644
--- a/xbmc/pvr/epg/Epg.cpp
+++ b/xbmc/pvr/epg/Epg.cpp
@@ -501,13 +501,7 @@ bool CPVREpg::Update(const time_t start, const time_t end, int iUpdateTime, bool
bGrabSuccess = LoadFromClients(start, end);
if (bGrabSuccess)
- {
- CPVRChannelPtr channel(CServiceBroker::GetPVRManager().GetPlayingChannel());
- if (channel &&
- channel->EpgID() == m_iEpgID)
- CServiceBroker::GetPVRManager().ResetPlayingTag();
m_bLoaded = true;
- }
else
CLog::LogF(LOGERROR, "Failed to update table '%s'", Name().c_str());