lua: expose mp_getcwd through mp.utils
x11: when using --wid, inherit event flags from parent window

When embedding a X window, it's hard to control whether it receives
mouse/keyboard input or not. It seems the X protocol itself makes this
hard (basically due to the outdated design mismatching with modern
toolkits), and we have to take care of these things explicitly.

Simply do this by manually querying and using the parent window event
flags.

This restores some MPlayer behavior (it doesn't add back exactly the
same code, but it's very similar).

This probably has some potential to interfere with libmpv embedding, so
bump the client API minor.

CC: @mpv-player/stable (if applied, client-api-changes.rst has to be
    adjusted to include the 0.5.2 release)
audio/out: prevent burning CPU when seeking while paused

The audio/video sync code in player/audio.c calls ao_reset() each time
audio decoding is entered, but the player is paused, and there would be
more than 1 sample to skip to make audio start match with video start.
This caused a wakeup feedback loop with push.c.

CC: @mpv-player/stable
video: adjust some Matroska 3D formats

There is no proper and exact spec (Matroska tradition), so we probably
have to rely on guessing for this.

Also see issue #1045.
audio: go to draining state instead of EOF if audio starts later

Probably no observable effect, but it's more correct. Setting audio to
EOF could have bad effects otherwise (anywhere the player logic for
example decides whether EOF was reached, and such).
player: always load playlists

Until now, you had to use --load-unsafe-playlists or --playlist to get
playlists loaded. Change this and always load playlists by default.

This still attempts to reject unsafe URLs. For example, trying to invoke
libavdevice pseudo-demuxer is explicitly prevented. Local paths and any
http links (and some more) are always allowed.
client API: fix memory leak with rejected events

The event was copied early, and wasn't released if it was rejected
instead of being added to the event queue. Fix by copying the event at a
point when it's certainly added to the event queue.

The dup_event_data() function is merely moved.
playlist: don't add the base path twice

Loading a playlist with --playlist from a sub-directory added the
playlist's base path twice: one time in the playlist demuxer, and then
again in playlist_parse_file(). The latter function is used only for
--playlist, so it worked when loading the playlist directly.

(This is probably a mess-up when the MPlayer playlist parsers were
replaced with newer code.)

CC: @mpv-player/stable
player: don't allow remote playlists to load local files

Because that might be a bad idea.

Note that remote playlists still can use any protocol marked with
is_safe and is_network, because the case of http-hosted playlists
containing URLs using other streaming protocols is not unusual.
man: fix a whole bunch of typos
player: reset playback-related fields right on start
command: disable some commands/properties properly in idle mode

In particular, don't allow to add any external subtitle tracks in idle
mode. This make no sense and would just lead to leaks or worse.
command: make m_property_strdup_ro with NULL mean unavailable

This catches a few cases which basically call:

    m_property_strdup_ro(..., ..., NULL)

which would return NULL strings. This should generally be avoided
(although it's allowed due to reasons), and it seems most callers
actually intend this to mean M_PROPERTY_UNAVAILABLE.
demux: get rid of old wrapper

demux_info_get() used to be central, but was turned into a wrapper, and
now there was only one caller left. Get rid of it.
command: remove broken quvi-format property

Never really worked, and libquvi is probably a lost cause anyway.
player: simplistic HLS bitrate selection

--hls-bitrate=min/max lets you select the min or max bitrate. That's it.
Something more sophisticated might be possible, but is probably not even
worth the effort.
player: show HLS bitrate as fallback for track titles

HLS streams as demuxed by libavformat have no track title metadata. So
show the HLS bitrate if no title is set. Could be useless or annoying,
so it's a bit controversial, I guess.
player: add --osd-playing-msg option
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.