opdenkamp/xbmc — pull request #536 by Red-F (2012-06-01 10:22:56+00:00)
Title: PVR API Extenstion: Get/SetRecordingLastPlayedPosition

This supersedes PR #513

Lars, as we discussed, this is the pvr api extension to get / set last watched position for a recording from / to the backend. I've added stubs in all the pvr clients that were present.

The api functions have been renamed to Get/SetRecordingLastPlayedPosition, as requested in the comments on PR# 513.

The calling of the new API functions have been wired into the existing code.

GetRecordingLastPlayedPosition is called from xbmc/pvr/windows/GUIWindowPVRRecordings.cpp. The code will attempt to retrieve the last saved position from the back-end first, when successful a corresponding resume bookmark will be created in the video database since the recording may have been viewed on another device or with other software then the current XBMC. If there is no saved position on the back-end, or the functionality is not supported the code will try to fetch a resume bookmark from the video database just as it used to do.

SetRecordingLastPlayedPosition is called from xbmc/cores/dvdplayer/DVDPlayer.cpp, after much consideration. The reason for calling it there and not from xbmc/utils/SaveFileStateJob.h is that the time offset for the played file is NOT ALWAYS guaranteed to be filled in the SaveFileStateJob.

The code is working with the ForTheRecord add-on on Linux x86 and Windows (x86 and x64). I tried to build for OSX and iOS too, but the build is broken at the moment and after manually updating three of four of the makefiles I gave up. Will build and test on Linux x64 later this weekend.

Regards,
Fred