dvdnav: prevent reallocation of fake highlight buffer

Since subsizes were never updated, the bitmap buffer was always
reallocated whenever mp_nav_get_highlight() called.
dvdnav: make MP_NAV_EVENT_RESET_ALL handled properly

dvdnav.c did not handle event in regular sequence. Usually this
does not make any trouble except around MP_NAV_EVENT_RESET_ALL.
Those events should be handled in regular sequence. If they're
mixed, it can make wrong result.
For instance, MP_NAV_EVENT_HIGHLIGHT right after
MP_NAV_EVENT_RESET_ALL should not be ignored but it might be
because MP_NAV_EVENT_RESET_ALL makes the demuxer reloaded and osd
hidden.
dvdnav: check and update video resolution whenever rendering

Previous implementation updated video resolution when highlight
event was given. However, this may not work if highlight event
is given before video size is queried.
This commit adds checking routine into rendering function, too.
dvdnav: fix minor memory leak

This was usually handled at the end of the switch statement, so if
something returns from the function before that, the event has to be
freed explicitly.
stream_cdda: fix track time accuracy

Don't use an integer division to get the time, since that would round on
second boundaries. Also round up the time by sector size. Seeking rounds
down due to alignment constraints, but if we round up the time, we can
make it land on the exact destination sector.

This fixes that the track change code printed the previous track when
seeking by chapter.
stream_cdda: remove unused stuff

This cd_info_t struct was practically unused. The only thing it did was
storing the track name of the form "Track %d" in a very roundabout way.
Remove it. (It made more sense when there was still CDDB support.)
stream_cdda: print cd text header only if there are any cd text fields
player: fix unchecked access for chapter metadata

It's possible that MPContext has a chapter list, but the demuxer
doesn't. In this case, accesing the chapter-metadata property would
lead to invalid accesses.

(This fixes the out of bound access, but in theory, the returned data
can still be incorrect, since MPContext chapters don't need to map
directly to demuxer chapters.)
mf: fix operation with --cache

demux_mf.c explicitly checks for the stream type to check whether images
are opened via pattern (mf://..., i.e. stream_mf.c) or directly. Of
course the stream type is not set to STREAMTYPE_MF if the stream is
wrapped through the cache, so it tried to open the pattern directly as
file, which failed.

Fix this by disabling caching for mf://. The cache doesn't make sense
here anyway, because each file is opened and closed every frame (perhaps
to avoid memory bloat).
stream_bluray: implement event handler for libbluray

This commit brings libbluray's event queue into stream_bluray.

Signed-off-by: wm4 <wm4@nowhere>
stream_bluray: cache current playback informations

The cost of calling bd_get_title_info() is quite expensive and
requires lots of CPU usage. Using BD_EVENT_PLAYLIST and
BD_EVENT_TITLE, it's possible to cache BLURAY_TITLE_INFO object for
current title and BD_EVENT_ANGLE handler caches current angle. In
my test case, with this commit, CPU usage can be saved about 15-20%.
stream_bluray: use bd_get_playlist_info()

Use bd_get_playlist_info() instead of bd_get_title_info(). The
previous implementation couldn't query current playlist and this
made it impossible to call bd_get_playlist_info() which is more
desirable than bd_get_title_info() because, for Blu-rays, playlist
is the unit of playback not title. This commit fixes that.
stream_bluray: remove BD_EVENT_IDLE

This was actually supposed to be removed with pull reuqest #671, but
I accidentally re-added it with a rebasing mistake.

This probably also coincidentally fixes compilation with older
libbluray (issue #672).
af_volume: fix replaygain

This was accidentally broken in commit b72ba3f7. I somehow made the
wild assumption that replaygain adjusted the volume relative to 0%
instead of 100%.

The detach suboption was similarly broken.
mp_image: add missing field to mp_image_params_equals()

This is pretty obscure, so it didn't matter much. It still breaks
switching output levels at runtime, because the video output is not
reinitialized with the new params.
video/out: remove legacy colorspace stuff

Reduce most dependencies on struct mp_csp_details, which was a bad first
attempt at dealing with colorspace stuff. Instead, consistently use
mp_image_params.

Code which retrieves colorspace matrices from csputils.c still uses this
type, though.
video: Add BT.2020 colorspace and transfer function

Source: http://www.itu.int/dms_pubrec/itu-r/rec/bt/R-REC-BT.2020-0-201208-I!!PDF-E.pdf
video: Add support for non-BT.709 primaries

This add support for reading primary information from lavc, categorized
into BT.601-525, BT.601-625, BT.709 and BT.2020; and passes it on to the
vo. In vo_opengl, we always generate the 3dlut against the wider BT.2020
and transform our source into this colorspace in the shader.
options: Expose --primaries to the user
video: Support BT.2020 constant luminance system