I was playing with it a little and using some workarounds and hacks I managed to insert chapters into bookmarks dialog. I was just checking what will be needed to get it working.
When I'll finish my other stuff I'd like to produce acceptable solution to include this feature to XBMC and so I'd like to ask devs some questions:
Propably not everyone would like to automaticly import chapters into bookmarks. What do You think about using DVD menu button (it would be available if video has chapters) to activate Bookmark Dialog (but filled only with chapters)?
How it should be done? In my solution chapters are retrieved from CDVDffmpegDemuxer (or smth similiarly named) in BookmarkDialog on update (in method that populates the bookmark list). Thumbs are extracted (and cached) there too (I have some glitches with thumb extraction there - I suspect that this can be related to the fact that extractthumb method is opening file again that is already opened (for playback), but I won't try to solve it as I don't want to use this solution anyway).
Few propositions as to where to place chapters info and thumbs extraction code:
- in videoinfoscanner and insert chapters as bookmark (with new type) to database (users may want to add chapters to MKVs if this feature would be included and this will require to refresh movie info to import chapters - not user friendly IMO). This would also require alteration of database to include chapter name (or using hack and use one of text column: playerState f.e. to store chapter name)
- when starting video playback (chapters info - in form of bookmark array or vector - could be stored as additional object in VideoInfoTag in FileItem that is returned by g_application.CurrentFileStream() - that is if we can assume that this fileitem is one and the same object from start of playback to end of playback) - this solution won't store any data in database and will allow of adding/removing/editing chapters in mkv videos without losing sync with Chapter Bookmark Dialog in xbmc
Question: is CApplication:layFile() the main method that handles start of (video) playback?
Possible difficulties:
Handling chapters in stacked files - are there any videos (containing chapter info) splitted to multiple files? If we deal with single video file we could just use inputstream that is created to play file to extract chapter info and thumbs. If video is made from stacked files then we have to open each file, retrieve chapter info and thumbs to build complete chapter info for entire video item.
PS. I wonder if present chapter support - displaying current chapter number/chapter count have some special handling of stacked files or it simply display info from currently played file?
@
snoxbox, mika91 and others - could You provide me some sample MKVs with chapters (and maybe other containers that have chapters, if there are any??)? I have only few MKVs with chapters and they seem to be working, but more testing won't hurt.