xbmc/xbmc — pull request #581 by Voyager-xbmc (2011-12-25 21:05:54+00:00)
Title: Fix the resume function on DVD discs after commit 1c6460362b92581f4c7147...

...f7be18c1ccbb59e961

Since commit 1c6460362b92581f4c7147f7be18c1ccbb59e961 the resume function on DVD discs didn't work anymore.

3 use cases should be tested for resume of removable DVDs :
(a) insert a disc and play it using the "Play Disc" function from the home screen. Go far enough (> 3 mins) and stop playback. Use "Play Disc" again, the disc should resume where left off.
(b) insert a disc and play it using the Videos > Files menu. When a resume point exists, the context menu on the top-level disc item should show the menu item "Resume from xx:xx". This should resume the disc where left off.
(c) insert a disc and play it through a disc stub added in the library. Eg. "Toy Story.dvd.disc". There should be first a pop-up asking to insert a disc, and next a pop up asking whether you want to resume or start over. The disc should resume where left off.

For non-removable dvd's, the bookmarks are stored using the real, non-removable path, and are not affected by the issue.

In this PR, the following problems with the code were addressed:

1) when starting a disc through a stub, the code incorrectly tried to start the disc from the path of the stub, while it should start from the path where the DVD is actually inserted. It still only works with the default DVD drive (typically the first one) because of limitations with the MediaManager class. TO DO: With multiple drives and using another than the default, it is difficult to implement, as the MediaManager uses a function IsDiscInserted that tells you only when a disc is inserted in the "default" DVD drive. Because of this, an alternative flow in CAutoRun::PlayDisc was needed to allow playing a disc using the default DVD drive.

2) after the last refactoring in the abovementioned commit, the DVD playback generally started from the \VIDEO_TS\VIDEO_TS.IFO file. This however caused the Item.IsDVD() checks to fail when looking for a stored bookmark. Therefore, no bookmark was ever loaded for the disc, only for the VIDEO_TS.IFO file (which is incorrect for removeable media, and only works for files on non-removable storage).
The existing code was however smart enough to attach the correct values in the VideoInfoTag, so that we can replace the IsDVD() check with checking the VideoInfoTag strFileNameAndPath whether it starts with "removable://".
The same correction was needed in SaveFileStateJob, in order to save the bookmark for the disc instead of the VIDEO_TS.IFO file.