msg: fix printing of module header

The code to set root->header was moved before the point where it's used,
which broke the logic.
terminal-unix: fix terminfo/termcap name for cursor up

"ku" is for input, not output. This happened to work on urxvt, but broke
on xterm (and probably a dozen of other terminals).
msg: don't clear term OSD lines that are not used
demux_mkv: avoid skipping too much data in corrupted files

Until now, corrupted files were detected if the size of an element (that
should be skipped) was larger than the remaining file. This still could
skip larger regions of the file itself if the broken size happened to be
within the file.

Change it so that it's never allowed to skip outside the parent's
element.
demux_mkv: improve robustness by explicitly checking for level 1 elements

Matroska makes it pretty hard to resync correctly on broken files:
random data returns "valid" EBML IDs with a high probability, and when
trying to skip them it's likely that you skip a random amount of data
(instead of considering the element length invalid).

Improve upon this by skipping known level 1 elements only. Consider
everything else invalid and call the resync code. This might result in
annoying behavior when Matroska adds new level 1 elements, although it
won't be particularly harmful. Matroska doesn't really allow us to do
better (even mkvtoolnix explicitly checks for known level 1 elements).

Since we now don't always want to combine EBML element skipping and
resyncing, remove ebml_read_skip_or_resync_cluster(), and make
ebml_read_skip() more tolerant against skipping broken elements.

Also, don't resync when reading sub-elements, and instead do resyncing
when reading them results in an error.
demux_mkv: remove unused macros
ebml: remove unused functions

These were mostly replaced by ebml_read_element().
ebml: remove length parameters from read functions

Many ebml_read_* functions have a length int pointer parameter, which
returns the number of bytes skipped. Nothing actually needed this
(anymore), and code using it was rather hard to understand, so get rid
of them.
cocoa: add application icon to the Dock when run from CLI

Application icon was added to the Dock only when run inside of a bundle. That
was handled automatically by OS X using the Info.plist definition.

To add the Application icon when run as a CLI program, I used the samme
approach in the X11 code and loaded the icon as a static binary blob inside
of mpv's binary. This is the simplest approach as it avoid headackes when
relocating the binary and such.
player: avoid stalling when starting a network stream

Starting a network stream could stall by executing uncacheable stream
control requests (STREAM_CTRL_GET_LANG and STREAM_CTRL_GET_DVD_INFO).
Being uncacheable means the player has to wait until the cache is done
reading the current block of data. These requests can't be cached
because they're too complicated, so the only way to avoid them is
special casing the DVD and Bluray streams (which are the only things
which need these requests), and not doing them in other cases.

(This is kind of inelegant, but so is the rest of the DVD/BD code.)
player: don't print status in --idle mode

Apparently this annoys certain users. Restores old behavior.
Detect Lua on FreeBSD
w32_common: prevent decoding certain keys twice

This is a bit of a hack, but in order to prevent TranslateMessage from
seeing WM_KEYDOWN messages that we already know how to decode, move the
decoding logic to the event loop. This should fix #476, since it stops
the generation of extraneous WM_CHAR messages that were triggering more
than one action on keydown.
msg: terminal OSD uses stderr, not stdout

This is more correct. E.g. if you do "mpv file.mkv > /dev/null", stdout
will not be a terminal, but stderr (used by terminal OSD and status
line) is.
msg: update comment
bstr: add function for splitting UTF-8
player: add --term-osd-bar, which shows a status bar on the terminal

Feature request from github issue #451. Disabled by default, will
probably stay this way.
w32_common: add extended keys

Also VK_APPS/MP_KEY_MENU was missing.
command: if playback position is unknown, make percent-pos unavailable

Before that, it just returned -1.

The print case is inconsistent with that, but I'll leave it for now,
because it's consistent with status line / show_progress behavior.
osc: check for availabillity of percent-pos instead of length

... to decide wether the seekbar should be enabled or not.