audio: skip samples and adjust timestamps ourselves

This gets rid of this warning:

  Could not update timestamps for skipped samples.

This required an API addition to FFmpeg (otherwise it would instead
doing arithmetic on the timestamps itself), so whether it works depends
on the FFmpeg version.
ao_pulse: refuse to start suspended

Sometimes, ao_pulse starts in suspended mode, which means playback is
essentially paused in pulseaudio. This gives the impression that mpv is
hanging, since it times video against the audio playback progress, and
audio never makes progress in this state.

I'm not sure if this will help - possibly it does with mixed
pulseaudio/alsa setups. However, if the alsa setup has the pulseaudio
plugin, alsa will hang too. But there's still a chance we get less
blame for pulseaudio messes.
player: remove central uninit_player() function and flags mess

Each subsystem (or similar thing) had an INITIALIZED_ flag assigned. The
main use of this was that you could pass a bitmask of these flags to
uninit_player(). Except in some situations where you wanted to
uninitialize nearly everything, this wasn't really useful. Moreover, it
was quite annoying that subsystems had most of the code in a specific
file, but the uninit code in loadfile.c (because that's where
uninit_player() was implemented).

Simplify all this. Remove the flags; e.g. instead of testing for the
INITIALIZED_AO flag, test whether mpctx->ao is set. Move uninit code
to separate functions, e.g. uninit_audio_out().
video: return responsibility of video redraw back to playloop

When the VO was moved it its own thread, responsibility for redrawing
was given to the VO thread itself. So if there was a condition that
indicated that redrawing was required, like expose events or certain
VOCTRLs, the VO thread was redrawing itself.

This worked fine, but there are some corner cases where this works
rather badly. E.g. if I fullscreen the player and hit panscan controls
with mpv's default autorepeat rate, playback stops. This happens because
the VO redraws itself after every panscan change command. Running each
(repeated) command takes so long due to redrawing and (involuntary)
waiting on vsync, that it never leaves the input processing loop while
the key is held down. I suspect that in my case, redrawing in fullscreen
mode just gets slow enough that it takes 2 vsyncs instead of 1 on
average, and the processing time gets larger than the autorepeat delay.

Fix this by taking redraw control from the VO, and instead let the
playloop issue a "real" redraw command to the VO if needed. This
basically reverts redraw handling to what it was before moving the VO to
a thread.

CC: @mpv-player/stable
player: properly wakeup when delaying OSD

Not sure in which situations this could make a difference; probably
none in practice, but it's more correct.

CC: @mpv-player/stable
player: move some libass setup code to sub.c

Also recreate ASS_Library on every file played. This means we can move
the code out of main.c as well.

Recreating the ASS_Library object has no disadvantages, because it
literally stores only the message callback, the (per-file) font
attachment as byte arrays, and the set of style overrides. Hopefully
this thing can be removed from the libass API entirely at some point.

The only reason why the player core creates the ASS_Renderer, instead
of the subtitle renderer, is because we want to cache the loaded fonts
across ordered chapter transitions, so this probably still has to stay
around for now.
manpage: improve consistency with new ~/.config/mpv default

Signed-off-by: wm4 <wm4@nowhere>
build: allow to compile the cocoabasic.m example
build: fix examples target paths

I 'broke' it in 78c362b. Sorry!
cocoa: move to a simpler threading model

Unfortunately using dispatch_sync for synchronization turned out to be really
bad for us. It caused a wide array of race conditions, deadlocks, etc.

Moving to a very simple mutex. It's not clear to me how to do liveresizing
with this, for now it just flickers with is unacceptable (maybe I'll draw
black instead).

This should fix all the threading cocoa bugs. Reopen if it's not the case!

Fixes #751
Fixes #1129
ad_lavc: avoid warning messages on older FFmpeg or Libav

If the flag doesn't exist, the av_opt_set() API will print warning
messages.
x11: stupid workaround for XMonad

--x11-netwm=yes now forces NetWM fullscreen, while --x11-netwm=auto
(detect whether NetWM fullsctreen support is available) is the old
behavior and still the default.

See #888.
manpage: refactor MPlayer -> mpv changes section

Merge duplicate entries, organize entries in subsections, reword some entries.
vf_stereo3d: fix "auto" input format with libav
cocoa: remove dead code
cocoa: make resizing wake the vo thread
cocoa: make fullscreening look like an atomic operation

At the moment when you fullscreen mpv there is a very small time interval
where the fullscreen windows is semi-transparent. Apparently whem moving the
view to another parent it's better to make Cocoa not draw anything globally.

An Apple engineer said it, so it must be correct:
http://www.cocoabuilder.com/archive/cocoa/142020-preventing-flicker-on-moving-nsview-to-different-superview.html

I know I will regret this in the future.
cocoa: remove pointless drawRect

Apparently it causes deadlocks, and at the moment it does nothing.

Fixes #778
cocoa: only call resize for view changing frame
cocoa: don't reset presentation options on uninit

This doesn't look to be needed anymore. Fullscreening with both the NSView
and the NSWindow API works correctly. I guess this was forgotten in from older
code which changed presentation options directly for going fullscreen.