w32_common: don't force topmost on fullscreen

Fixes #457, #444.
cocoa: don't reset window size when the video size doesn't change

Fixes #459
w32_common: reformat yet again

I've been told mpv prefers switch/case on the same indent level.
Sorry about the noise :P
Fix subtitle delay inversion
sub: fix previous commit

sub_seek and sub_step were broken.
Fix audio delay inversion
audio: fix previous commit
demux_lavf: fix minor memory leak
wayland: fix some memory leaks on initialization failure

This commonly happens when initializing vo_opengl on a X11-only system.

Unfortunately, most wl_*_destroy() functions appear not to accept NULL
pointers, making partial deinitialization a pain: you have to add your
own NULL checks everywhere to avoid crashes.

xkb.context is uninitialized separately, because you can initialize it
just fine, even if the rest of input initialization fails.
wayland: silence annoying libwayland-client message

libwayland-client contains the following code [1]:

	runtime_dir = getenv("XDG_RUNTIME_DIR");
	if (!runtime_dir) {
		fprintf(stderr,
			"error: XDG_RUNTIME_DIR not set in the environment.\n");

This means this message will unconditionally and unavoidably be printed
if XDG_RUNTIME_DIR is not set. Since mpv is a terminal program, and we
want to avoid unnecessary output, work it around by not attempting to
use wayland if this environment variable is not set.

[1] http://cgit.freedesktop.org/wayland/wayland/tree/src/wayland-client.c#n636
    (cd0dccd01e16fa404e03974d30ded3aebdb1c4bc)
manpage: mention how to get a list of codecs for use with --hwdec-codecs
wayland: fix fullscreen & resizing for good

I added enough logic to never set ontop or fullscreen twitce.
This commit keeps also the size of the video if multiple videos are played.
If the ratio differs the width will be kept at the same size and only the
height changes.
ao_pulse: add suboption to control buffer size
ao_pulse: lower default buffer size from 1000ms to 250ms

1000ms is a bit insane. It makes behavior on playback speed changes
worse (because the player has to catch up the dropped audio due to
audio-chain reset), and perhaps makes seeking slower.

Note that the problem of playback speed changes misbehaving will be
fixed in the future, but even then we don't want to have a buffer that
large.
terminal: don't initialize termcap etc. if stdout is not a terminal

Otherwise, it seems one of the term* libraries will write escape
sequences to stdout, for whatever reason.
Switch PDF manual generation to rst2pdf

This finally gets rid of the LaTeX dependency.

We should actually be using docultils directly here, but I didn't
do this because of all the potential Python 2/3 breakage.
wayland: use static consistently

Declare everything that is only needed inside wayland_common.c as static.
wayland: remove set_user_data from seat_listener

The user_data is passed on add_listener and can later be changed with
set_user_data. But because we don't want to change it later and because it is
the same object remove the set_user_data call.

This might be a copy&paste leftover from the initial draft for the wayland
backend.
wayland: cleanup registry_handle_global

The wl_registry object is already passed as a parameter. No need to create
a temporary variable.
waf: do not use TaskGen for PDF build rule

No longer necessary.