[fix] can use one global draw_bmp cache

The mp_draw_sub_bitmaps() cache is supposed to work like VO caches, and
thus can deal with multiple sub_bitmaps.
sub: make OSD size per-OSD-object

Because subtitles may be rendered at different resolution (consider
non-OSD subtitle rendering with vf_ass).

It may be a bit confusing that non-OSD subtitle rendering reuses the
OSD code path and that not all OSD objects have the same size as
consequence. But on the other hand, the OSD resolution can be considered
part of the renderer cache state. Additionally, at least the "old"
(OSDTYPE_SUBTITLE) subtitle renderer is not separate from the OSD code,
as well as the indexed-to-RGBA conversion.

Also, include display_par/video_par in resolution change detection too.
VO, sub: refactor

Remove VOCTRL_DRAW_EOSD, VOCTRL_GET_EOSD_RES, VOCTRL_QUERY_EOSD_FORMAT,
and VFCAP_EOSD. Remove draw_osd_with_eosd(), which rendered the OSD by
calling VOCTRL_DRAW_EOSD. Change VOs to call osd_draw() directly, which
takes a callback as argument. (This basically works like the old OSD
API, except multiple OSD bitmap formats are supported and caching is
possible.)

Remove all mentions of "eosd". It's simply "osd" now.

Fix the issue with margin borders in vo_corevideo.
osd_libass: fix stupid dangling pointer crash

append_utf8_buffer() reallocates the buffer passed to it, and returns
the new pointer.

This bug was originally introduced in mplayer2 when that project merged
mpv's osd_libass.c. That merge changed some minor things, including ASS
escape handling. When mpv used this better method of escape handling too
(commit 0ff7dd992fb0), the bug was duplicated.
osd_libass: increase robustness when handling internal OSD escapes

The \xFF escape is used internally to insert special OSD symbols (which
need a font change to the internal OSD font). There was potential for
breakage when \xFF was followed by \0, because then "in" would be
advanced past the string's end.

Normally this can't happen, as it would require invalid UTF-8 input
data. But we don't check input for UTF-8 validness, so there's a
potential issue here. Garbled output is ok on invalid UTF-8 input,
but crashing is not.

Make it more robust by checking for this.
vo_corevideo: uninitialize CoreVideo objects before OpenGL
screenshot: allow taking screenshots with subtitles

This adds a new screenshot mode "subtitles", which basically takes the
video frame as decoded, and renders subtitles into it.

This may fail for some pixel formats, because libswscale sucks. If this
becomes ever a real problem, the code could be changed to convert the
image to RGBA first (or whatever the image writer wants), and then
render the subtitles into it. This would avoid the additional image
copy needed with vo_xv too. But for now, it seems better to go with the
current method in the common case: vo_opengl creates an image copy
anyway, and drawing bitmaps to yv12 is better, as no color space
conversion is involved in draw_bmp.c's up/downsampling conversion.
draw_bmp: don't be an asshole if image format not supported
screenshot: change "screenshot" input command

"screenshot" now maps to "screenshot subtitles" by default, instead of
"screenshot video". Swap the argument order: the more useful argument
should come first. Remove the compatibility aliases for numeric choices
(e.g. "screenshot 1 0" won't work anymore).
draw_bmp: make compile on osx
vo_corevideo: fix EOSD artifacts

The new EOSD code suffered from artifacts due to missing setup of a projection
matrix. This commit fixes the problem and uniforms the resize code to the one
driving vo_opengl_old.
vo_corevideo: add screenshot capability

Added screenshot capability to the corevideo VO by sending back the raw data
from the CVPixelBuffer.

Also added "screenshot window" functionality from the other OpenGL based VOs,
which uses glReadPixels to read image data back. This was moved to gl_common to
avoid duplication.