ao_coreaudio: add more layout debug outputs

Should help remote debugging #1367 with --msg-level=ao=debug
ao_coreaudio: move some code to make output readable
ao_coreaudio: fix typo
ao_coreaudio: fix channel mapping

There where 3 major errors in the previous code:

1) The kAudioDevicePropertyPreferredChannelLayout selector returns a single
   layout not an array.
2) The check for AudioChannelLayout allocation size was wrong (didn't account
   for variable sized struct).
3) Didn't query the kAudioDevicePropertyPreferredChannelsForStereo selector
   since I didn't know about it's existence.

All of these are fixed.

Might help with #1367
player: cosmetics: rename a function

Something which has this many important sideffects shouldn't start have
a "get" prefix.
player: fix random crashes on uninitialization

On uninitialization, the player will unselect all subtitles, and then
destroy the subtitle decoder. But it didn't correctly remove the
subtitle decoder from the OSD state, so it could happen that it would
access it after the decoder was destroyed.

Could lead to random crashes when switching files often.

Fixes #1389.
player: force stereo as default when encoding

I think the new default for this option might be rather bad in encoding
mode. For starters, we don't even know what layers an encoder supports
at all.
ao_coreaudio: fix some naming conventions
ao_coreaudio: remove useless guard

useless after 069016fd6c
stream: always make stream dumping/capturing append to output file

Partially fixes #1393 (but not really).
command: stip path from playlist OSD display

But only if it's not e.g. a http URL.

Fixes #1388.
manpage: document new --stream-dump behavior

That's probably a good idea.
Add Javascript scripting support using MuJS

Almost identical API to the Lua support, except:
- The global mp, mp.msg and mp.utils are always available
- On errors returning undefined and the error is at mp.last_error_string
- Timers are JS "standard" global set/clear Timeout/Interval/Immediate
- Supports CommonJS style module/require
- At mp.utils: read_file (any), and load_file, run_file for js files
- Global print and dump functions
- mp.options currently unsupported

Required Mujs (clone, make, make install):
- http://mujs.com/ - git://git.ghostscript.com/mujs.git
- Mirror - https://github.com/ccxvii/mujs
JS: 'reqire' was broken for scripts
JS: minor cleanups

- Stray printf's
- Remove names from anonymous functions which are unlikely
  to show on stack traces to reduce clutter
javascript: C style cleanups
options: allows javascript also when Lua is not configured
js: replace lua-opts for script-opts
pr1351: simplified file functions
pr1351: cleanups (except for unused/legacy stuff)