Fix some -Wshadow warnings

In general, this warning can hint to actual bugs. We don't enable it
yet, because it would conflict with some unmerged code, and we should
check with clang too (this commit was done by testing with gcc).
mplayer: remove dead code

Attached pictures are now handled specially and on a separate codepath,
so this hack is not needed anymore. Remove it from the normal codepath.
demux_lavf: set keyframe flag on attached pictures

Gives really funky results with PNG attachments otherwise. The main
problem is that avcodec_flush_buffers() does not fully reset the
decoder, so passing multiple PNG packets without keyframe flags will
attempt to combine the new picture with the previously decoded
contents. (Makes no sense with proper PNG - maybe this codepath is
intended for MNG or APNG.)
input: fix dangling pointer issues with multi-part commands

This didn't setup the linked list of sub-commands for multi-part
commands ("a ; b ; c") correctly. Also, the new commands were attached
to the allocation of the _old_ command instead of the new one. (Wow,
whatever the hell I was (not) thinking when I wrote this code.)
m_config: don't override profile option if not required

The --profile top-level option is handled specially in m_config.c. But
this code also broke sub-options that happened to be named "profile"
(e.g. when trying to use "-af-add=bs2b=profile=cmoy"). Handle it
specially only if it's the top-level --profile option.
mp_image: create AVBuffers for all planes when converting to AVFrame

It appears the API requires you to cover all plane data with AVBuffers
(that is, one AVBuffer per plane in the most general case), because
certain code can make certain assumptions about this. (Insert rant
about how this is barely useful and increases complexity and potential
bugs.) I don't know any cases where the current code actually fails,
but we want to follow the API, so do it anyway.

Note that we don't really know whether or not planes are from a single
memory allocation, so we have to assume the most general case and create
an AVBuffer for each plane. We simply assume that the data is padded to
the full stride in the last image line. All these extra dummy references
are stupid, but the code might become much simpler once we only support
libavcodec versions with refcounting and can use AVFrame directly.
demux_libass: actually set priv context

This was a memory leak: the ASS_Track was never deallocated.
mp_msg: Support colors on cygwin

A cygwin mpv will usually run inside mintty, and even if it were to be run
in a regular console window, the cygwin dll emulates ANSI escapes.
getch2: Refactor/rewrite

Still uses termcap, but uses terminfo for loading the termcap database if
possible. Adds configure test to find terminfo; skips the termcap test
if terminfo is found since terminfo provides termcap.

Use termcap completely for special keys; if we can't get it from termcap
and it isn't one of the known fallbacks, we ignore its specialness and
treat as a sequence of UTF-8 codes.

Further hardcoded fallbacks can be added by calling keys_push_once in
load_termcap; there is no limit to the amount of keys pushed.

Uses the "ke" and "ks" capabilities to start / exit application mode, which
is necessary on vt100 emulators (including screen, xterm and all terminals
that emulate either of those) to correctly receive arrow keys.

It's now possible to compile getch2 even without termcap, though it won't
be of much use since it'll be unable to detect special keys.

Converted to 4 spaces per tab, prettified some statements.
getch2: Remove unused function, fix possible crash

If we still haven't read the full key from the input but it's regardless a
unique match in the database, we could receive a NULL keycode from
keys_search (it's not a full match after all) and proceed to use it.

Don't disable the keycode matching code if we don't have termcap as we can
still match against the hardcoded sequences.
getch2, mplayer: Always call load_termcap

getch2 now deals with the cases where we don't have termcap. Add a dummy
load_termcap to getch2-win so we don't get linking errors on mingw.
configure: Fix bad variable assignment

Bourne shell hates having spaces before or after the = sign.
Merge branch 'getch2/refactor'

* getch2/refactor:
  configure: Fix bad variable assignment
  getch2, mplayer: Always call load_termcap
  getch2: Remove unused function, fix possible crash
  getch2: Refactor/rewrite
getch2: Avoid possible infinite loop

If the first character is not a valid UTF-8 start code nor is in termcap,
getch2 would enter an infinite loop. Always walk 1 byte in the UTF-8 case
unless it's a valid start code.
Revert "getch2: Avoid possible infinite loop"

This reverts commit ba95aed6f1067dc577d8813625233982157167d9.
getch2: Doing it right this time

getch2_pos should be set to 1, not 0, when backtracking. Avoids the
possible infinite loop but correctly.
w32_common: Track when the mouse leaves the window

Windows doesn't send WM_MOUSELEAVE by default unless you ask it to;
request tracking for leave events when the mouse enters the window (or is
moved).

Tracking is automatically de-activated once the mouse leaves the window,
so we have to re-request it every time the mouse re-enters the window.
w32_common: Don't use globals for TRACKMOUSEEVENT

It seems working on getch2 gave me some brain damage.
video: support setting libswscale chroma position
m_property: fix non-sense code

Undefined behavior.