Permalink
Browse files

Merge pull request #170 from fetzerch/playposition

Add iLastPlayedPosition to PVR_RECORDING
  • Loading branch information...
2 parents 5ef7f7f + 80aedb1 commit aa3a4d2c06ee62bbb842a94ac26a1c919d006cb7 Lars Op den Kamp committed Mar 7, 2013
@@ -1,5 +1,7 @@
v1.7.9
-- Bump after PVR API version bump
+- Provide EDLs if available (commercial skip data cut lists)
+ Currently only works for videos with constant frame
+- Disconnect from / reconnect to backend when XBMC goes to / resumes from standby
v1.6.9
- Added Live TV vs. recording conflict handling
@@ -524,6 +524,7 @@ PVR_ERROR PVRClientMythTV::GetRecordings(ADDON_HANDLE handle)
tag.recordingTime = it->second.StartTime();
tag.iDuration = it->second.Duration();
tag.iPlayCount = it->second.IsWatched() ? 1 : 0;
+ tag.iLastPlayedPosition = GetRecordingLastPlayedPosition(it->second);
CStdString id = it->second.UID();
CStdString title = it->second.Title();
@@ -824,32 +825,25 @@ PVR_ERROR PVRClientMythTV::SetRecordingLastPlayedPosition(const PVR_RECORDING &r
return PVR_ERROR_FAILED;
}
-int PVRClientMythTV::GetRecordingLastPlayedPosition(const PVR_RECORDING &recording)
+int PVRClientMythTV::GetRecordingLastPlayedPosition(MythProgramInfo &programInfo)
{
// MythTV provides it's bookmarks as frame offsets whereas XBMC expects a time offset.
// The bookmark in seconds is calculated by: bookmark = frameOffset / frameRate.
int bookmark = 0;
- if (g_bExtraDebug)
- {
- XBMC->Log(LOG_DEBUG, "%s - Reading Bookmark for: %s", __FUNCTION__, recording.strTitle);
- }
-
- CLockObject lock(m_recordingsLock);
- ProgramInfoMap::iterator it = m_recordings.find(recording.strRecordingId);
- if (it != m_recordings.end() && it->second.HasBookmark())
+ if (programInfo.HasBookmark())
{
- long long frameOffset = m_con.GetBookmark(it->second); // returns 0 if no bookmark was found
+ long long frameOffset = m_con.GetBookmark(programInfo); // returns 0 if no bookmark was found
if (frameOffset > 0)
{
if (g_bExtraDebug)
{
XBMC->Log(LOG_DEBUG, "%s - FrameOffset: %lld)", __FUNCTION__, frameOffset);
}
// Pin framerate value
- if (it->second.Framterate() <0)
- it->second.SetFramerate(m_db.GetRecordingFrameRate(it->second));
- float frameRate = (float)it->second.Framterate() / 1000.0f;
+ if (programInfo.Framterate() < 0)
+ programInfo.SetFramerate(m_db.GetRecordingFrameRate(programInfo));
+ float frameRate = (float)programInfo.Framterate() / 1000.0f;
if (frameRate > 0)
{
bookmark = (int)((float)frameOffset / frameRate);
@@ -862,15 +856,10 @@ int PVRClientMythTV::GetRecordingLastPlayedPosition(const PVR_RECORDING &recordi
}
else
{
- if (it == m_recordings.end())
- {
- XBMC->Log(LOG_ERROR, "%s - Recording %s does not exist", __FUNCTION__, recording.strRecordingId);
- }
- else if (!it->second.HasBookmark() && g_bExtraDebug)
+ if (g_bExtraDebug)
{
- XBMC->Log(LOG_DEBUG, "%s - Recording %s has no bookmark", __FUNCTION__, recording.strRecordingId);
+ XBMC->Log(LOG_DEBUG, "%s - Recording %s has no bookmark", __FUNCTION__, programInfo.Title().c_str());
}
- return bookmark;
}
if (bookmark < 0) bookmark = 0;
@@ -934,6 +923,27 @@ PVR_ERROR PVRClientMythTV::GetRecordingEdl(const PVR_RECORDING &recording, PVR_E
return PVR_ERROR_NO_ERROR;
}
+int PVRClientMythTV::GetRecordingLastPlayedPosition(const PVR_RECORDING &recording)
+{
+ // MythTV provides it's bookmarks as frame offsets whereas XBMC expects a time offset.
+ // The bookmark in seconds is calculated by: bookmark = frameOffset / frameRate.
+ int bookmark = 0;
+
+ if (g_bExtraDebug)
+ {
+ XBMC->Log(LOG_DEBUG, "%s - Reading Bookmark for: %s", __FUNCTION__, recording.strTitle);
+ }
+
+ CLockObject lock(m_recordingsLock);
+ ProgramInfoMap::iterator it = m_recordings.find(recording.strRecordingId);
+ if (it != m_recordings.end())
+ bookmark = GetRecordingLastPlayedPosition(it->second);
+ else
+ XBMC->Log(LOG_ERROR, "%s - Recording %s does not exist", __FUNCTION__, recording.strRecordingId);
+
+ return bookmark;
+}
+
int PVRClientMythTV::GetTimersAmount(void)
{
if (g_bExtraDebug)
@@ -149,6 +149,7 @@ class PVRClientMythTV : public MythEventObserver
void EventUpdateRecordings();
void ForceUpdateRecording(ProgramInfoMap::iterator it);
int FillRecordings();
+ int GetRecordingLastPlayedPosition(MythProgramInfo &programInfo);
// Timers
RecordingRuleList m_recordingRules;

0 comments on commit aa3a4d2

Please sign in to comment.