ao_coreaudio: fix compilation on OS X 10.7

Reverts one of the changes from 18777ecf. `kAudioObjectPropertyScopeOutput`
was introduced in the 10.8 SDK while `kAudioDevicePropertyScopeOutput` was
moved to `AudioHardwareDeprecated.h`. Since the deprecation is silent for now
(no warnings), just use the old constant.

Either way, they both evaluate to 'outp', and in the 10.8 SDK the deprecated
constant is defined in terms of the non-deprecated one.

Fixes #155
ao_coreaudio: prevent buffer underruns to output garbage

This was removed in d427b4fd. I now found a sample that causes underruns when
moving to a chapter and apparently this is also a problem when taking
screenshots.
vf: fix unintended overwriting of image info

The symptom was that "-vf scale,format=rgba" broke the vsfilter
colorspace hack in sd_ass. vf->reconfig is allowed to overwrite its
input parameter for convenience (maybe that was a bad idea).
mp_image: pass through colorspace info to libavfilter

This change affects vf_lavfi. Until recently, libavfilter was not
colorspace aware at all. This changed with the addition of colorspace
fields to AVFrame. libavfilter's vf_scale picks them up (as of recent
ffmpeg git). Since this support is still kind of wonky and not part of
the normal format negotiation, this won't set the correct output
colorspace, though.

Not adding a separate test for HAVE_AVFRAME_COLORSPACE. This is slightly
unclean, but on the other hand adding an explicit test seems like a
waste of effort.
command: mark special options as unavailable

Special options (like -v, -playlist, etc.) don't have data associated
with them, so reading them with the "options" property makes no sense.
core: make mpctx->opts a pointer

Prevents some awkwardness in a later commit, and makes the code more
uniform with other places where MPOpts is accessed.

This is a pretty annoying commit (touches tons of lines all over the
place), but it hurts only once.
m_config: refactor some things

Change how m_config is initialized. Make it more uniform; now all
m_config structs are intialized in exactly the same way. Make sure
there's only a single m_option[] array defining the options, and keep
around the pointer to the optstruct default value, and the optstruct
size as well. This will allow reconstructing the option default values
in the following commit.

In particular, stop pretending that the handling of some special options
(like --profile, --v, and some others) is in any way elegant, and make
them explicit hacks. This is really more readable and easier to
understand than what was before, and simplifies the code.
options: print default values in --list-options

Do this by recreating the m_config from scratch, which then must
contain the default values. This doesn't quite work with legacy options
using global variables: the default values get lost, so using
--list-options will print the value as set by the config file. This
also introduces a memory leak for string options backed by global
variables. All of these issues will be eventually fixed by moving all
options to structs.
m_config: hide no-* opts in --list-options, simplify positional subopts

All these --no-... options in --list-options made the output rather
unreadable, so hide them. Make the code for finding positional
parameters (which are supposed to skip these no-* options) slightly
simpler too.
m_config: try to print min/max values as integers in --list-options

This switched to exponential representation too soon, and large integer
values looked bad in the --list-options output.
mp_image: make reference counting thread-safe

This hasn't been done yet, because pthreads is still an optional
dependency, so this is a bit annoying. Now doing it anyway, because
maybe we will need this capability in the future.

We keep it as simple as possible. We (probably) don't need anything
more sophisticated, and keeping it simple avoids introducing weird
bugs. So, no atomic instructions, no fine grained locks, no cleverness.
mp_image_pool: make reference counting thread-safe

See previous commits. Also simplify this thing: 2 flags per pool image
are enough to avoid a weird central refcount and an associated shared
object keeping the refcount. We could even just store these two flags
in the mp_image itself (like in mp_image.flags or mp_image.priv), but
let's not for the sake of readability.
lavc_dr1: make reference counting thread-safe

See previous commits. This time, the lock is kept for rather long
times (e.g. for the duration of a big image memory allocation), but
this (probably) still doesn't matter at all.

This also affects legacy code only (pre-refcounting libavcodec).
vdpau: split off decoder parts, use "new" libavcodec vdpau hwaccel API

Move the decoder parts from vo_vdpau.c to a new file vdpau_old.c. This
file is named so because because it's written against the "old"
libavcodec vdpau pseudo-decoder (e.g. "h264_vdpau").

Add support for the "new" libavcodec vdpau support. This was recently
added and replaces the "old" vdpau parts. (In fact, Libav is about to
deprecate and remove the "old" API without deprecation grace period,
so we have to support it now. Moreover, there will probably be no Libav
release which supports both, so the transition is even less smooth than
we could hope, and we have to support both the old and new API.)

Whether the old or new API is used is checked by a configure test: if
the new API is found, it is used, otherwise the old API is assumed.

Some details might be handled differently. Especially display preemption
is a bit problematic with the "new" libavcodec vdpau support: it wants
to keep a pointer to a specific vdpau API function (which can be driver
specific, because preemption might switch drivers). Also, surface IDs
are now directly stored in AVFrames (and mp_images), so they can't be
forced to VDP_INVALID_HANDLE on preemption. (This changes even with
older libavcodec versions, because mp_image always uses the newer
representation to make vo_vdpau.c simpler.)

Decoder initialization in the new code tries to deal with codec
profiles, while the old code always uses the highest profile per codec.

Surface allocation changes. Since the decoder won't call config() in
vo_vdpau.c on video size change anymore, we allow allocating surfaces
of arbitrary size instead of locking it to what the VO was configured.
The non-hwdec code also has slightly different allocation behavior now.

Enabling the old vdpau special decoders via e.g. --vd=lavc:h264_vdpau
doesn't work anymore (a warning suggesting the --hwdec option is
printed instead).
TOOLS: add script for emulating "unique application" functionality on Linux

See github issue #43.

This comes with a load of caveats, so be sure to read the comments at
the start of the script.
build: fix vdpau_template.c generation
build: fix build with vdpau, simplify

Instead of generating vdpau_template.c with a Perl script, just include
the generated file in git. This is ok because it changes very rarely,
and the script is larger than the output it generates.

It also simplify the Makefile, and fixes the build. The problem was that
transitive dependencies do not work with generated files: there is no
dependency information yet when building it the first time. I overlooked
this because I didn't delete the .d files for testing (which contained
the correct dependencies, but only _after_ a first successful build).
command: silence a warning

This is unreachable code, but the compiler doesn't always determine
this. This change shuts up the warning in these cases.
ao_coreaudio: use default output unit when no device is specified

Using the default output audio unit should provide a much better user
exeperience since it changes automatically the output device based on which
becomes the default one.
Fix some warnings