vd: remove some dead code

As of now, this function is called only after decoding a full, valid
video frame, so the image parameters should be reliable.
vd: move aspect calculation to a function

This function would probably be useful in other places too.

I'm not sure why vd.c doesn't apply the aspect if it changes size by
less than 4 pixels. Maybe it's supposed to avoid ugly results with bad
scalers if the difference is too small to be noticed normally.
video: let sh_video->aspect always be container aspect ratio

Now writing -1 to the 'aspect' property resets the video to the auto
aspect ratio. Returning the aspect from the property becomes a bit more
complicated, because we still try to return the container aspect ratio
if no frame has been decoded yet.
video: let sh_video->disp_w/h always be container size

Nothing really accesses it. Subtitle initialization actually does in a
somewhat meaningful way, but there container size is probably fine, as
subtitles were always initialized before the first video frame was
decoded.
osd_libass: add "Default" dummy style

This is pretty much a hack for the OSC. It will allow it to rely on a
somewhat predictable style, instead of having to overwrite all user
OSD settings manually with override tags.
matroska: fix uninitialized memory accesses with ordered chapters

There is uninitialized memory access if the actual size isn't passed
along. In the worst case, this can cause a source to be loaded against
the uninitialized memory, causing a false count of found versus required
sources, preventing the "Failed to find ordered chapter part" message.
osc: Prevent OSD style options from messing with the OSC styles

Should fix #259
matroska: prevent uids from being dereferenced when NULL

The old code prevented it since uids being NULL makes a 0 talloc length.
Now that we're iterating over a specific length, NULL can be
dereferenced.
input: more mp_msg conversion

It appears the last run missed all mp_tmsg().

Since the command parser also prints messages, it needs a new parameter
to pass a log context. We go the easy way and just require the input_ctx
to be passed, and use its mp_log.
input: handle MOUSE_LEAVE specially

Do this so that MOUSE_LEAVE can't be combined with other keys. (E.g.
keep 'w' pressed, then move the mouse outside of the mpv window; it will
print a warning what w-MOUSE_LEAVE is not mapped.)
input: translate mouse position to OSD space early

Until now, mouse positions were just passed to the core as-is, even if
the mouse coordinates didn't map to any useful coordinate space, like
OSD coordinates. Lua scripting (used by the OSC, the only current user
of mouse input) had to translate mouse coordinates manually to OSD space
using mp_get_osd_mouse_pos(). This actually didn't work correctly in
cases mouse coordinates didn't map to OSD (like vo_xv): the mouse
coordinates the OSC got were correct, but input.c was still expecting
"real" mosue coordinates for mouse areas.

Fix this by converting to OSD coordinates before passing the mouse
position to the core.
vaapi: potentially make reading surfaces back to system RAM faster

Don't allocate a VAImage and a mp_image every time. VAImage are cached
in the surfaces themselves, and for mp_image an explicit pool is
created. The retry loop runs only once for each surface now.

This also makes use of vaDeriveImage() if possible.
vaapi: check image format in va_surface_upload()

Just for robustness. Also print a warning in vo_vaapi if this happens.
vaapi: make vaDeriveImage() less verbose

This can just be not supported, so making it look like a real error
doesn't make much sense.
network: add options to control TLS verification
osx: fix build

Or at least I hope it fixes it, since I can't test.

Broken by commit 0d90dd0.
osc: add options to show OSC only when FS/windowed

The boolean-options showWindowed and showFullscreen can now be set in plugin_osc.conf to control the behaviour.

enhancement for #262
cocoa_common: split the code, refactoring and cleanups

Split the code to several files. The GUI elements now each have they own files
and private state. The original code was a mess to respect the retarded mplayer
convention of having everything in a single file.

This commit also seems to fix the long running bug of artifacts showing
randomly when going fullscreen using nVidia GPUs.
cocoa_common: report pixels instead of points during mouse movement

This fixes the position reporting on retina displays. Doesn't make any
difference on normal displays where 1px = 1pt.

Fixes: #260
cocoa_common: fix deadlock

After rebasing my dev branch it turned out that  the code deadlocked on
recursive calls of `vo_control`. Make the locking code a little bit smarter
by making always skip locking/unlocking if we are executing a chunck of
code that is already synchronized with `dispatch_sync`.