screenshot: change %w format to be more like %t

Instead of containing a format string within %w{...}, simply allow %w
to specify one item of a time format string. This is simpler, more like
other format specifiers (%t),  and probably easier to use too.
manpage: remove version and date fields

These would have to be updated manually all the time. Replacing them
automatically would be possible, but additional work, and would force
regeneration of the manpage way too often.

We decided that we don't need these fields.
Add mpv.desktop, let Makefile install the desktop file and the icons

The mpv.desktop file is taken from the Arch package [1]. It appears to
be based on the mplayer2 git mplayer.desktop file (e.g. very similar
MimeType field), with minor modifications applied by Arch package
maintainers.

Note that for now, this doesn't show a terminal (Terminal=false), which
might not always be ideal. For example, if the file is audio only, or
if VO initialization fails for some reason, mpv will run in the
background and play audio without showing a window. But users prefer
running it without terminal, and don't want to play audio files with
it.

Maybe a --force-window option will be added in the future, which would
always create a VO window, and compensate for these issues.

[1] https://aur.archlinux.org/packages/mpv-git/
manpage: remove bogus space in example usage
command: force video refresh when changing aspect

Pausing the player and changing the aspect would leave the VO without a
frame to display.
demux_mkv: don't add too many subtitle packets during seeking

In insane files with a very huge number of subtitle events, and if the
--demuxer-mkv-subtitle-preroll option is given, seeking can still
overflow the packet queue. Normally, the subtitle_preroll variable
specifies the maximum number of packets that can be added. But once this
number is reached, the normal seeking behavior is enabled, which will
add all subtitle packets with the right timestamps to the packet queue.
At this point the next video keyframe can still be quite far away, with
enough subtitle packets on the way to overflow the packet queue.

Fix this by always setting an upper limit of subtitle packets read
during seeking. This should provide additional robustness even if the
preroll option is not used.

This means that even with normal seeking, at most 500 subtitle packets
are demuxed. Packets after that are discarded.

One slightly questionable aspect of this commit is that subtitle_preroll
is never reset in audio-only mode, but that is probably ok.
mplayer: read subtitle packets as soon as possible

Call update_subtitles() on every iteration of the playloop, so that
subtitle packets are read as soon as possible, instead of every time a
video frame is displayed. This helps in case the packet queue is swamped
with subtitle packets, which can happen with certain insane mkv files.
The change will simply cause the subtitle queue to be emptied on each
playloop iteration.

The timestamps update_subtitles() uses for display are the same before
and after this commit. (Important for files which have subtitle packets
with timestamps or duration not set.)
gl_common: signal to GL backend whether we are probing

This is supposed to reduce the amount of useless error messages shown
during initialization of vo_opengl. If multiple backends are compiled,
usually only one of them will work. For example, on Linux both X and
Wayland backends can be compiled, but usually either Wayland or X is
running. Then, if Wayland is not running, but X is, trying to initialize
the Wayland backend should not spam the terminal with error messages.

Signed-off-by: Andreas Sinz <andreas.sinz@aon.at>
gl_common: add wayland backend before x11 backend
macosx_application: remove deprecation warning on OS X 10.9

GetCurrentProcess() is deprecated on 10.9. Make a universal solution by
checking OS version number.

get_system_version() function is the recommended Apple way of getting the
OS version, since Gestalt is also deprecated (and does pretty much the same
thing anyway)

Updating HIDRemote.m to use a similar function would allow to get rid of the
2 other warnings.
find_subfiles: fix really dumb bug causing segfaults

NULL pointer deref when a .sub file with the same filename as the video
file was present.

I was probably half asleep when writing this code.
HIDRemote: remove OS X version checks

Turns out that these checks were for versions of OS X that mpv doesn't even
support anymore. So just remove the checks since they cause a deprecation
warning.
cocoa_common: override core's cursor visibility state

This keeps the state in sync with the current state in cocoa_common. Infact the
cocoa code in mpv can decide wether it really wants to hide the cursor based on
the result of the `canHideCursor` method (this is so that the cursor is only
hidden when hovering on the video window).
cocoa_common: signal a mouse movement when changing window size

This is mainly to avoid spurious cursor states due to the mouse moving inside
or outside the window as a result of the window resize (with cmd-0/1/2).

This avoids complex logic and triggers a mouse move so that the player
recomputes the correct cursor state based on the autohide configuration of
the user.
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.