terminal-unix: Fix initial terminal state.

When mpv is backgrounded initially (via & in the shell), do no longer
change terminal settings on startup. This fixes broken local echo after
launching a backgrounded mpv.
terminal-unix: Add some comments about FD use.
command: export mpv configure arguments as property

It seems strange that a client API user can't get this string, other
than analyzing the mpv log output.
command: fix weird stuff

Happens to fix some aspects of some properties (especially reading
"option-flags/x" as native value).
command: make sub-properties more flexible

This makes it work with all kind of types, instead of just some simple
ones.
command: rename "option-flags" property to "option-info"
command: export some option metadata

This might be interesting for GUIs and such.

It's probably still a little bit insufficient. For example, the filter
and audio/video output lists are not available through this.
command: list filters/VOs/AOs with option-info

Another special-case, but pretty simple after all.
vo_opengl: allow setting different filters for downscaling
demux_mkv: adjust subtitle preroll again (2)

Make the changes started in commit c827ae5f more eloborate, and provide
an option to control the amount of data read before the seek-target. To
achieve this, rewrite the loop that finds the lowest still acceptable
target cluster. It is now searched by time instead of file position. The
behavior (both with and without preroll option) may be different from
before this change, although it shouldn't be worse.

The change demux_mkv_read_cues() fixes a bug: when seeking after playing
normally, the code would erroneously assume that durations are set. This
doesn't happen if the first operation after loading was a seek instead
of playback.
ao/wasapi: fix leaked deviceID

thanks to Jonathan Yong <10walls@gmail.com>
ao/wasapi: reenable the reset function

the race condition that necessitated disabling
this was fixed in
e4403523131a69a92a8418bb3714090a408680c7
ao/wasapi: make calling of thread_init consistent with thread_uninit
ao/wasapi: improve error messages and add more debug statements

thanks to Jonathan Yong <10walls@gmail.com>
ao/wasapi: more consistent error codes on thread init
ao/wasapi: tidy up better on failure

Before, failures, particularly in the thread loop init, could lead to a
bad state for the duration of mpvs execution. Make sure that
everything that was initialized gets properly and safely
uninitialized.
ao/wasapi: new wasapi device monitoring interface

Implement skeleton IMMNotificationClient to watch for changes in the
sound device.  This will make recovery possible from changes shared
mode sample rate, bit depth, "enhancements"/effects and even graceful
device removal.

http://msdn.microsoft.com/en-us/library/windows/desktop/dd371417%28v=vs.85%29.aspx

Signed-off-by: Kevin Mitchell <kevmitch@gmail.com>
ao/wasapi: add guid and pkey convenience functions
ao/wasapi: request reset when device changes format

on changes to PKEY_AudioEngine_DeviceFormat or device change/removal
call ao_reload directly in the change_notify "methods"
ao/wasapi: add retry loop on AUDCLNT_E_DEVICE_IN_USE

this works around reinitializing too fast on device property changes