ipc: report some user errors better

Using the IPC with a program, it's not often obvious that a newline must
be sent to terminate a command. Print a warning if the connection is
closed while there is still uninterpreted data in the buffer.

Print the OS reported error if reading/writing the socket fails. Print
an erro if JSON parsing fails.

I considered silencing write errors if the write end is closed (EPIPE),
because a client might send a bunch of commands, and then close the
socket without wanting to read the reply. But then, mpv disconnects
without reading further commands that might still be buffered, so it's
probably a good idea to always print the error.
client API: document requirement to block SIGPIPE

I noticed that the IPC code does not use MSG_NOSIGNAL or SO_NOSIGPIPE.
The former is "only" POSIX 2008 and also requires switching to sendto(),
while the latter is even less portable.

Not going to bother with this obsolete 80ies crap, just block SIGPIPE,
and instruct client API users to do the same.
ipc: add enable_event and disable_event commands

This was requested.
stream: always disable cache for pseudo-streams

Streams which don't have a full_buffer function never return any actual
data. Slight improvement over commit 5640c195.
player: fix a typo in message output

This typo has been around for over a year. Oops.
player: hack against --keep-open misbehaving with broken files

If a file (or a demuxer) is broken, seeking close to the end of the file
doesn't work, and seek_to_last_frame() will be called over and over
again, burning CPU for no reason.

Observed with incomplete mp4 files. That this can happen was already
mentioned in commit 090f6cfc, but I guess now I'll do something against
it.

hrseek_lastframe is cleared by reset_playback_state(), so it's only set
if seek_to_last_frame() was called, and no other seek happened since
then. If finding the last frame succeeds, no EOF will happen (unless the
user unpauses, but then it will simply remain at the last frame). If it
fails, then it will return immediately, without retrying.
vo_opengl: don't use 10 bit video on Intel GPUs

vo_opengl was originally written against OpenGL 3 core, and it seems
GPUs/drivers supporting this are mostly sane. Later, it was made to work
with OpenGL 2.1 too. Lately we removed the requirement for RG textures,
and look, someone reported a problem with "lesser" Intel GPUs.

This commit does the same in vo_opengl what was added to vo_opengl_old a
long time ago.

Fixes #1383.
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
mu2duk-WIP
mu2duk - seems fully working after few short tests
mu2duk: comments and cleanups. TODO: support either via config
mu2duk: cleanups and refactoring
mu2duk: MUD_WRAPPER now use nargs at runtime
mu2duk: provide js backend info
mu2duk: fix js_Setlength, simplify error print