path: fix undefined behavior

The homepath variable was static, and its value was set to a stack
buffer. This means a second invocation of the function would trigger
undefined behavior. Moreover the stack buffer always went out of scope
before homepath was used.
win32: add getenv() UTF-8 variant

This is a bit "hard", because getenv() returns a static string, and we
can't just return an allocated string. We also want getenv() to be
thread-safe if possible. (If the mpv core is going to be more threaded,
we sure do want the lower layers to be thread-safe as well.)
path, win32: redo user configfile path handling

Remove the ifdef hell from mp_find_user_config_file(). Move the win32
specific code (for MinGW and Cygwin) to path-win.c. The behavior should
be about the same, but I can't be sure due to lack of testing and
because the old path.c code was hard to follow. (I expect those who care
about windows will fix things, should issues pop up - sorry.)

One difference is that the new code will always force MPV_HOME. It looks
like the old code preferred the mpv config dir in the exe dir if it
exists.

Also, make sure MP_PATH_MAX has enough space, even if the equivalent
wchar_t string is not 0-terminated with PATH_MAX (because apparently the
winapi doesn't require this). (Actually, maybe we should just kill all
uses of PATH_MAX/MP_PATH_MAX.)
macosx: move bundle path stuff to path-macosx.m

This makes the code uniform to how stuff was handled for Windows in 1cb55ceb.
osdep/path: remove ifdefs

They're not really needed, so kill them.
Config path functions can return NULL

It's quite unlikely, but functions like mp_find_user_config_file() can
return NULL, e.g. if $HOME is unset.

Fix all the code that didn't check for this correctly yet.
osxbundle: fonts.conf: only look for fonts in ~/.mpv/fonts

This is to avoid the 30s hang while mpv caches fonts. In practice all the
fonts an average user is going to use are embedded in mkv files so there is
no reason to build fontconfig's cache on all of OS X system directories.

I might add something similar for terminal usage, but I am highly undecided.
af_export: fix compilation warning

Blargh.
mixer: minor refactoring

Let struct mixer access access MPOpts to simplify some things. Rename
some variables and functions. There should be no functional changes.
mixer, af_volume: use linear values instead of dB

Softvol always used a linear multiplier for volume control. This was
converted to dB, and then back to linear in af_volume. Remove this non-
sense. We still try to keep the command line argument to af_volume in
dB, though.
mixer: refactor, fix some aspects of --volume handling

Refactor how mixer.c does volume/mute restoration and initialization.
Move to handling of --volume and --mute to mixer.c. Simplify the
implementation of these and hopefully fix bugs/strange behavior related
to using them as file-local options (this uses a somewhat dirty trick:
the option values are reverted to "auto" after initialization). Put most
code related to initialization and volume restoring in probe_softvol()
and restore_volume(). Having this code all in one place is less
confusing.

Instead of trying to detect whether to use softvol at runtime, detect it
at initialization time using AOCONTROL_GET_VOLUME (same with mute,
AOCONTROL_GET_MUTE). This implies we expect SET_VOLUME/SET_MUTE to work
if the GET variants work. Hopefully this is always the case.

This is also preparation for being able to change volume/mute settings
if audio is disabled, and for allowing restoring value with playback
resume.
mixer: don't unmute audio when raising volume

This is rather strange behavior, away with it.
vo_opengl: blend alpha components by default

Improves display of images and video with alpha channel, especially if
the transparent regions contain (supposed to be invisible) garbage
color values.
mplayer: rename a somewhat misnamed function
wayland/common: exit properly on fd errors

Before this commit there was just an error message, but the file descriptor was
still open. Now we close the file descriptor and prevent it from calling
endlessly. Also a CLOSE_WIN event is sent which closes the window eventually if
the action of CLOSE_WIN is set to quit or quit_watch_later.
vo/x11_common: Fail init with no valid XIM

XOpenIM can fail to find a valid input method, in which case it
returns NULL. Passing a NULL pointer to XCreateIC would cause a
crash, so fail VO init before that happens.
Revert "osxbundle: fonts.conf: only look for fonts in ~/.mpv/fonts"

Commit broke text subtitles without embedded fonts. Will look for a better
solution later. Revert it for now, since I'm starting to get bug reports.

This reverts commit 4a9f618d9f3b2d964bcc819426cc3042b8e447f7.
macosx_application: fix regression causing crash

95a2151d1 introduced a crash on systems lower than 10.9 when opening files
with a single argument.
vo/x11_common: remove superfluous msg prefixes
mixer: restore volume with playback resume

Note that this is intentionally never done if the AO or softvolume is
different, or if the current volume control method is thought to control
system wide volume (such as ALSA) or otherwise user controllable (such
as PulseAudio). The intention is to keep things robust and to avoid
messing with the user's audio settings as far as possible, while still
providing the ability to resume volume if it makes sense.