xbmc/xbmc — pull request #4296 by Voyager1 (2014-02-28 20:33:58+00:00)
Title: DVD various fixes related to libdvdnav issues and skip to menu

- first commit is to make the "skip to DVD menu" setting an expert setting with a default value of true:
See: http://forum.xbmc.org/showthread.php?tid=187379
- second commit is to align the skip to DVD menu functionality with VLC code. Essentially they also try to fallback to the root menu if title menu wasn't found.
See: https://github.com/videolan/vlc/blob/master/modules/access/dvdnav.c#L324
- third commit is to attempt a fix for http://trac.xbmc.org/ticket/14957 - not so much the fact that that DVD doesn't play, but rather that it blocks/freezes XBMC. The root cause is a badly authored dvd and libdvdnav can't properly handle it, but down the road it causes an endless cycle between NAVRESULT_NOP type actions *inside* DVDInputStreamNavigator.
It constantly cycles between
DVDNAV_SPU_STREAM_CHANGE
DVDNAV_AUDIO_STREAM_CHANGE
DVDNAV_NAV_PACKET
DVDNAV_CELL_CHANGE
DVDNAV_SPU_CLUT_CHANGE
DVDNAV_SPU_STREAM_CHANGE
...
and never returns. The brute-force solution is to put a limit to the amount we can cycle through the "while(true)" loop and allow this Read() method to return back to ffmpeg and yield control back to xbmc so that it can process keystrokes (e.g. to press STOP).
I chose an arbitrary of 1000 NOPs before the brute force return, but I'm open to alternative suggestions.

@elupus, I'd appreciate your input on these.