cocoa: mark window for redraw after title change

This used to work correctly without the call to displayIfNeeded. I think this
may only be needed for Yosemite.

Fixes #1330
audio: fix fallback if audio API does not support mono

This makes it fallback to stereo properly.
audio: fix previous commit

This would have always forced mono first (if supported by the AO),
instead of stereo.
ao_alsa: remove some dead code

This was only added recently (c1e97161) as an attempt to minimize the
bad impact of channel layout device aliases. But use of these was
removed in commit 49df0132. Now this code does pretty much nothing, and
shouldn't be needed anymore. It does something when using spdif, but
this fallback won't work anyway.
ao_alsa: fix setting mono channel map

When setting the ALSA channel map, we never actually set the map we got
from ALSA directly, but convert it to mpv's, and then back to ALSA's.
mpv and ALSA use different conventions for mono, and there is already an
exception for ALSA->mpv, but not mpv->ALSA.
player: don't show "0%" percentage in infinite streams
vo_opengl_old: fix OSD regression

Commit 0e8fbdbd removed the rg_texture requirement from vo_opengl;
commit 541f6731 changed to a more convenient method. Both commits broke
vo_opengl_old in some ways. vo_opengl_old always requires GL_ALPHA for
single-channel texture, because it draws the OSD without shaders and by
using certain blend modes.

So we need to explicitly distinguish between vo_opengl and vo_opengl_old
in the OSD renderer, and force fixed texture formats for vo_opengl_old.
The other logic is specific to the internals of vo_opengl. (Although it
might be possible to get the same result by playing with the old GL
fixed-function functions in vo_opengl_old. But seems like a waste of
time.)

Fixes #1370.
vo_opengl: GLES does not support GL_BGRA

Apparently GLES 2 and 3 do not support this. (The implementations I
tested with were derived from desktop OpenGL and were not overly strict
with this.)

This is no problem; just use GL_RGBA and mangle the channels in the
shader.

Also disable direct support for image formats like IMGFMT_RGB555 with
GLES; at least some of them are not supported in this form, and the
formats aren't important anyway.
vo_opengl: silence an INVALID_ENUM error with GLES2

Signed-off-by: wm4 <wm4@nowhere>
vo_opengl: improve fallback handling with GLES

Whether we have texture_rg doesn't matter much anymore; the scaler
should be fine with this. But on ES 2.0, 1st class arrays are missing,
so even if filterable float textures should be available, it won't work.

Dithering (at least the "fruit" variant) will not work either, because
it uses floats.
old-configure: fix disabling VAAPI GLX with --disable-gl

waf handles this correctly.
player: cosmetics: move code around

Separate commit to reduce noise in the following one.
sub: reset sub decoder correctly when cycling subtitles

reset_subtitles() works in mpctx->d_sub[], which is set to NULL before
calling it from uninit_sub(). This fixes resetting the subtitle when
cycling subtitle tracks.

Actually, this was probably a feature, because it's annoying if
subtitles don't show up when cycling them. But it also can have
unintended consequences, so get rid of it.
sd_lavc: compensate for a stupid libavcodec API issue

The libavcodec PGS decoder sets end_display_time to UINT32_MAX, in an
attempt to signal unknown end time (the API does not allow to signal
this properly, and this was a backwards compatible hack).

While we have no issues with the large value, our code wants to
distinguish between known and unknown end time explicitly.
sd_lavc: ignore image subtitles with unknown duration after 1 minute

Most image subtitle formats implicitly terminate the current subtitle
event with the next event (e.g. a new packet read from the demuxer will
instruct the subtitle render to stop display). If the subtitle event is
just trailing, it will be displayed forever. So there's no proper way
of doing this and we just apply an heuristic to avoid annoyances.
client API: fix mpv_wakeup()

Of course this was going to get stuck in the retry loop.

Fixes #1372.
vo_opengl: fix feature detection

Fixes #1373.
vo_opengl_cb: free context on exit

Minor memory leak.

Actually, this also exposes some problems in the QtQuick example. This
will have to be fixed in the example.
client API: fix compiler warning if openglcb API is disabled

The function is void, and of course you can't return anything from it.
(Why does C or gcc even allow this?)
vo_opengl, vo_opengl_cb: check GL version in renderer

vo_opengl actually checks this in the context creation code already, but
it still increases robustness in case the requirements are changed
later.