demux_mkv: don't overflow packet queue when doing sub-preroll

Consider the cluster used for prerolling contains an insane amount of
subtitle packets. Then the demuxer packet queue would be full of
subtitle packets, and demux.c would refuse to read any further packets -
including video and audio packets, resulting in EOF. Since everything
involving Matroska and subtitles is 100% insane, this can actually
happen.

Fix this by putting a limit on the number of subtitle packets read by
preroll, and throw away any further packets if the limit is exceeded. If
this happens, the preroll mechanism will stop working, but the player's
operation is unaffected otherwise.
core: remove a minor memory leak
demux: refactor tag handling

Make the code somewhat reuseable, instead of bound to a single demuxer
instance. The plan is to add support for per-chapter tags later.
demux: retrieve per-chapter metadata

Retrieve per-chapter metadata, but don't do much with it. We just make
the metadata of the _current_ chapter available as chapter-metadata
property. Returning the full chapter list with metadata would be no
problem, except that the property interface isn't really good with
structured data, so it's not available for now.

Not sure if it's worth it, but it was requested via github issue #201.
find_subfiles: fix off-by-1 error

This could lead to a segfault, fixes #219

Signed-off-by: Gabriel Peixoto <gabrielrcp@gmail.com>
Signed-off-by: wm4 <wm4@nowhere>
Manpage: Fix formatting (mostly for PDF output)
DOCS/crosscompile-mingw.txt: Update
demux_mkv: support V_PRORES

Why not...

Code for demangling Matroska-style prores video packets inspired by
libavformat's Matroska demuxer.
demux: keep title chapter tag in uppercase

This is generally more uniform.

Do the same for the file global title in demux_mkv.c, although that is
not strictly related to chapters.
Add PDF manual target

This builds a PDF version of the manpage using rst2latex
and pdflatex, and installs it to PREFIX/share/doc/mpv by
default.
wayland/shm: version detection that also works

The previous method would break on the next release. Because I am stupid.
wayland: update license headers
manpage: various improvements

Took a superficial look at the manpage, and fixed whatever I spotted.
Makefile: restore manpage dependency rules

Broken by commit 0054073.

Also add them to the pdf target.
mplayer: mentioned --list-options in --help output

It's annoying for users if you can't get a list of options with --help,
but on the other hand, printing all options would be overkill. So just
mentioned --list-options.
stream: force demuxer of cached stream, fixes cdda:// + cache
command: make title property unavailable if there's no support

Instead of returning 0 if the stream doesn't have title info, make the
property unavailable.
stream_bluray: return number of titles

So that the "titles" property returns the number of titles.
quvi: coerce libquvi 0.4 support into allowing format switching

libquvi 0.4 doesn't allow us listing the formats supported by a
streaming site without doing additional network accesses, so switching
formats was not supported with it. (It's different with libquvi 0.9.)

But the most important case is switching between SD and HD. Usually,
--quvi-format=default will get SD, while --quvi-format=best gives HD.
Use this, and pretend that an URL supported by libquvi 0.4 supports both
of these. "cycle quvi-format" will switch between these. If the user
specifies something else via --quvi-format, this is included in the list
of switchable formats additionally to "default" and "best".
quvi: restore playback position when switching formats

This simply issues a seek after reloading.