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.
vo_opengl_cb: parse renderer parameters

Now it accepts the same renderer arguments as vo_opengl. This also
disables debug checks by default, and reverts the background color
override. Both can now be controlled by the host application.
demux_mkv: support embedded coverart

The code could as well be in demux.c, but it's better to avoid
accidental clashes with demux_lavf.c.

FFmpeg provides no way yet to map a mime type to a codec, so do it
manually. (It _can_ map a mime type to an "input format", but not a
codec.)

Fixes #1374.
demux_mf: add probing by mime type

Reuses the mime type table introduced in the previous commit.
vo_opengl: make use of newer OpenGL logging API

GL_ARB_debug_output provides a logging callback, which can be used to
diagnose problems etc. in case the driver supports it. It's enabled only
if the vo_opengl "debug" suboption is set.
vo_opengl: don't allow setting 3D LUT if unsupported

The code was always uploading the 3D LUT (even of unused), as long as
vo_opengl was setting a icc-profile. This could crash with GLES 2.
demux_mkv: use attachment filename as coverart title
vo_opengl: fix build on OSX

Missing modern OpenGL symbols again.