player: properly resume playlists loaded at runtime

If a playlist is loaded from the internal playlist (like
"mpv playlist.m3u"), then attempt to resume from it.

CC: @mpv-player/stable
player: add --media-title option

Requested by ChrisK2.
demux: allow increasing filepos only

The last demuxed file position (demuxer->filepos) is used to estimate
the total playback percentage in files with possible timestamp resets
(like MPEG-PS). Until know, reading from any stream set this position
freely. This makes the position jump around.

Fix this by allowing icnreasing file position only. Reset it on seeking.
With crazy formats, this still could go wrong, but there's only so much
you can do.
path: remove XDG bullshit

Don't worry, your ~/.config/... paths are safe. This merely removes
handling of $XDG_CONFIG_DIRS for global paths.

Maybe there is a better solution for this, like still including the
"traditional" config dir. But I will leave the fine reading of this
(crappy) spec and fixing the code accordingly to someone else. So, if
anyone has interest in getting this behavior back, you will have to
write a patch. This patch should _also_ not break expected behavior.

Fixes #1060.
x11: add rewind and forward keys

Signed-off-by: wm4 <wm4@nowhere>
wayland: only save current mode of outputs

Other ones are not needed.
wayland: print some useful outptu info

Prints output informations, useful for finding out if we detect the right mode
and for debugging.
build: add a check_program check

This wraps waf's find_program in our own check boilerplate code so that it
can be used in the declarative dependencies section of the wscript.

Can be used like this:

    }, {
        'name': 'sed',
        'desc': 'sed program',
        'func': check_program('sed', 'SED'),
    }, {

First argument is the program name, and the second is the waf variable name
where the program path will be stored. In this example we will be able to
refer to sed with ${{SED}} when creating waf Tasks in wscript_build.

/cc @giselher: I think you need this for wayland-scanner.
wayland: switch to xdg interface

The xdg_shell interface replaces the old wl_shell interface. It provides more
features and is simpler to use.

The protocol file is distributed by mpv and the header and binding code is
generated from the protocol file. This is for some reason recommended.

If no xdg_shell is avaible the window won't show up.
wayland_common: rework state handling & fullscreen

Remove vo_wayland_{fullscreen,ontop,border} functions.

Fullscreen handling is done in window_set_fullscreen and the other 2 are not
implemented and used.
waf: add check for wayland-scanner
wayland/shm: use wl_viewport

Lets the compositor scale the video. This relies on the compositors scaling
mechanism and efficiency. But should by far more efficient than ffmpeg scaling
which burns CPU.

In my tests mpv went from 66 % cpu load to 9 %. But the scaling wasn't as nice
as ffmpegs.
wayland_common: remove debug printf
vo_wayland: only use viewport when available

Falls back to software scaling if the compositor dosen't advertise the
wl_scaler interface.