vo_x11/vo_xv: fix build when using --disable-xext
cocoa: sanitize window title string and guard against NULL

If the utf8 string used to create the NSString for title was invalid utf8,
-stringWithUTF8String returned nil and triggered an assertion in Cocoa's
framework code.

Sanitize the utf8 string and if the sanitation wasn't enough just avoid
crashing by not setting a title.

Fixes #406
build: hide duplicate options from `--help`

Hide --enable variants from [autodetect]'ed options and --enable/--disable
variants for [enable]'d/[disable]'d options. The hidden options are still
usable, just hidden for more readability.
input: split off some code from input.c to separate files

This is mostly just moving code around.
input: cosmetics: move code around

Rearrange the code in an attempt to make its organization more logical.
options: simplify handling of some help options
mpv.desktop: add KDE file handlers

Currently KDE will copy a media file into a temporary folder instead of
trying to stream it if a KIO slave location file is started. This change
will tell KDE to make mpv try to directly play the file. Perhaps the
proper flags should be added according to the individual enabled
features of the build but I suggest that be for the future.

Signed-off-by: wm4 <wm4@nowhere>
build: support multiple headers in check_statement

This feature will be used in the next commit.
build: fix shm detection on OpenBSD

Fixes #427
corevideo: fix video initialization when not using VDA

query_format was setting state even if wasn't the correct thing to do. Somehow
it worked by pure luck (until commit e6e6b88b6da).

Fix the initialization by setting state inside of reconfig.
Revert "cocoa: unlock on uninit"

Not sure why but this doesn't seem to be needed anymore.

This reverts commit 6ead6aa005f1c78a117bde58e48f106cfd1e9806.
demux_mkv: handle TrueHD properly

Apparently, Matroska packs TrueHD packets in a way lavc doesn't expect.
This broke decoding of some files [1] completely. A short look at the
libavcodec parser shows that parsing this ourselves would probably be
too much work, so make use of the libavcodec parser API.

[1] http://www.cccp-project.net/beta/test_files/mzero_truehd_sample.mkv
Revert "x11: don't set global error handler"

This reverts commit 877303aaa9111fc56a8e5edbeb439699acfe44c0.

The OpenGL 2.1 fallback for vo_opengl didn't work. Two things come
together: 1. trying to create an OpenGL 3.0 context will fail with
a GLXBadFBConfig error, and 2. X errors are fatal by default. Since
the reverted commit removed the X error handler, the mpv process was
killed, instead of continuing for the fallback.

(Note that this commit is not an exact inverse commit, since mp_msg
changed, but it does about the same thing.)
input: print an error if reading input.conf fails

stream_read_complete() fails if the file is larger than the requested
maximum size. But input.c didn't check for this case, and no indication
that something went wrong was printed.
vo/x11_common: do not select motion events when --no-mouse-movements is set
player: fix buggy error condition when loading mpv.conf
Install encoding-profiles.conf by default

This is probably useful.

Note that this includes a small, stupid hack to prevent loading of the
config file if vf_lavfi is not available. The profile by default uses
vf_lavfi, and the config parser will output errors if vf_lavfi is not
available.

As another caveat, we install the example profile even if encoding is
disabled (though we don't load it, since this would print errors).
build: disable SDL by default

old-configure already behaves like this. Adapt wscript to the same default.
player: use arrays to list font mimetypes and font file extensions
player: add two more font mimetypes recognized by Haali

The Haali Matroska splitter is basically the reference implementation
for this crap, and it knows only:

    application/vnd.ms-opentype
    application/x-font-ttf
    application/x-truetype-font

Two of them were missing in our code. One of them, "application/x-font",
is probably plain incorrect, but I can't really tell.

Also see: http://www.cccp-project.net/beta/test_files/fontsample.mkv