options: remove --no-vsync

Latest nvidia drivers ignore the application setting, so this switch
makes even less sense than before. It's still possible to control this
with VO specific suboptions.
options: fix panscan controls

The value range was set to 1-99 instead of 0-1. This broke panscan
control with the 'w' and 'e' keybindings.

Broken by commit 1198c03.
vo_sdl: we don't want to minize the window when losing focus

Because: this makes multi-monitor use entirely useless (as soon as
pointer leaves left screen, mpv gets auto minimized).
core: make more robust against missing libavcodec AVCodecDescriptor entries

Missing entries cause avcodec_descriptor_get() to return NULL, and in
turn mp_codec_from_av_codec_id() will return NULL. This shouldn't
happen, and avcodec_descriptor_get() returning NULL for a valid codec is
clearly a bug.

But make it more robust anyway, and use the decoder's name if this
happens, because I doubt maintainance of the AVCodecDescriptor table
in ffmpeg/Libav will always be perfect and reliable.
core: remove a number of global variables

Move them into per-instance structs. This should get rid of all global
variables in mplayer.c (not counting those referenced by cfg-mplayer.h).

In core/input/ar.c, just remove checking the slave_mode variable. I'm
not sure what this code was supposed to achieve, but slave mode is
broken, slave mode is actually infeasible on OSX (ar.c is completely OSX
specific), and the correct way of doing this would be to disable this
input device per command line switch.
cocoa_common: fix window position when bigger than display

Fix a regression introduced in commit 979ce46c64 causing a window to take up
more space than what the display allows.

Add keepCentered:YES, so that the video area is always clipped to the current
visible frame (even when using scale).

Fixes #38.
vo_opengl: insert a magical glFlush call

Helps a little bit with stuttering with pans and "heavy" subtitles
covering the screen.
configure: remove -fomit-frame-pointer and -ffast-math from CFLAGS

-fomit-frame-pointer is enabled by default with recent gcc and clang
compilers if -O2 is used. It also breaks debugging when optimization is
disabled, so it makes absolutely no sense to have -fomit-frame-pointer
explicitly in the CFLAGS.

Get rid of -ffast-math too. It's little more than cargo-culting, and
might actually break NaN handling and such things.
configure: add _GNU_SOURCE to CFLAGS by default

In theory, projects have to define feature test macros to enable various
system functionality in system headers. (This is done so to ensure new
identifiers can be added to system headers, without breaking old
programs by causing name conflicts.) This includes macros like
_GNU_SOURCE, _BSD_SOURCE, _POSIX_C_SOURCE etc.

Traditionally, gcc as well as glibc headers implicitly assumed
_GNU_SOURCE if no feature test macros were defined by the user.
clang did this too to ensure compatibility with gcc centric programs
(which in practice includes most Linux programs).

However, it appears recent clang versions started to prefer BSD
traditional function over the POSIX, which switches the definition
of a function used by mp_msg.c:

       pid_t getpgrp(void);                 /* POSIX.1 version */
       pid_t getpgrp(pid_t pid);            /* BSD version */

mp_msg.c expects the POSIX version, while clang gives us the BSD
version, resulting in a compilation failure.

Solve this by defining _GNU_SOURCE. This requests most features from
system headers, and explicitly prefers POSIX definitions over BSD,
which should fix the compilation issue.
wayland: move window by grabing it

Because the are no server-side-decorations in the available wayland compositors
use grabbing the surface to move it.
wayland: use the cursor_autohide_delay option

In the previous implemention the backend always assumed 1 second
instead of honoring the cursor_autohide_delay option
wayland: simplify egl_create_window

Removes the local ret because it was only in an assert statement and also
removes the window size assignments, because they are already done in
config_wnidow_wayland.
wayland: remove asserts from egl_create_context

Instead of assert return false on most check.
Removes the redundant second inclusion of the assert header.
af_lavcac3enc: switch to avcodec_encode_audio2()

avcodec_encode_audio() was deprecated, and was finally removed from
Libav and FFmpeg git.

This appears to work. I get heavy A/V desync with -ao alsa and -ao pcm,
but this was already so before this change.
image_writer: switch to avcodec_encode_video2()

avcodec_encode_video() was deprecated, and was finally removed from
Libav and FFmpeg git.

This change breaks compatibility with Libav 0.8.x. Thank the Libav
developers, not me.
Prefix CODEC_ID_ with AV_

The old names have been deprecated a while ago, but were needed for
supporting older ffmpeg/libav versions. The deprecated identifiers
have been removed from recent Libav and FFmpeg git.

This change breaks compatibility with Libav 0.8.x and equivalent
FFmpeg releases.
demux_lavf: use avg_frame_rate instead of r_frame_rate

r_frame_rate was deprecated and was finally removed from Libav and
FFmpeg git.

Not sure what's the correct replacement. avg_frame_rate may or may not
be worse than the fallback of using the time_base as guess. The
framerate is mostly unused, but needed for frame-based subtitles and for
encoding. (It appears encoding guesses a timebase based on the FPS, and
I'm not sure why we don't just use the source timebase.)
video: prepare for libavcodec refcounting

Some minor refactoring and moving code around.
There should be no functional changes.
video: make use of libavcodec refcounting

Now lavc_dr1.c is not used anymore if libavcodec is recent enough.
af_lavrresample: add new resampling filter to replace the old ones

Remove `af_resample` and `af_lavcresample`. The former is a mess while the
latter uses an API that was long deprecated in libavcodec and is now removed.

`af_lavrresample` rougly has the same features and structure of
`af_lavcresample`.

libswresample fallback by wm4.