Revert "encode: make the central lock recursive"

This reverts commit 231c6672140f019257edd26db20fbcfc2554258f.
encode: get rid of the recursion that led to a deadlock.

Instead, the recursive call has been flattened away by instead
overwriting a parameter and continuing.
demux: simplify packet resizing

Actually we don't need to resize packets; we just need to make them
shorter.
demux: use av_malloc for packets

Probably "needed" to get the correct alignment, although I'm not aware
of actual breakages or performance issues.

In fact we should probably always just allocate AVPackets, but for now
use the simple fix.
input.conf: make ESC quit when encoding
vd_lavc: use option parser for skip suboptions
options: turn --idx, --forceidx into --index

Also clarify the semantics.

It seems --idx didn't do anything. Possibly it used to change how the
now removed legacy demuxers like demux_avi used to behave. Or maybe
it was accidental.

--forceidx basically becomes --index=force. It's possible that new
index modes will be added in the future, so I'm keeping it
extensible, instead of e.g. creating --force-index.
options: remove use of an inverted option value

Now MPOpts.sub_fix_timing corresponds to the commandline switch
directly, instead of storing the inverted value.
options: remove OPT_FLAG_CONSTANTS

This means use of the min/max fields can be dropped for the flag option
type, which makes some things slightly easier. I'm also not sure if the
client API handled the case of flag not being 0 or 1 correctly, and this
change gets rid of this concern.
command: redo the property type

Instead of absuing m_option to store the property list, introduce a
separate type for properties. m_option is still used to handle data
types. The property declaration itself now never contains the option
type, and instead it's always queried with M_PROPERTY_GET_TYPE. (This
was already done with some properties, now all properties use it.)

This also fixes that the function signatures did not match the function
type with which these functions were called. They were called as:

   int (*)(const m_option_t*, int, void*, void*)

but the actual function signatures were:

   int (*)(m_option_t*, int, void*, MPContext *)

Two arguments were mismatched.

This adds one line per property implementation. With additional the
reordering of the parameters, this makes most of the changes in this
commit.
options: remove some unneeded stuff

No options pointing to global variables are in use anymore, so that part
can be removed.
options: remove some more stuff

The "classic" sub-option stuff is not really needed anymore. The only
remaining use can be emulated in a simpler way. But note that this
breaks the --screenshot option (instead of the "flat" options like
--screenshot-...). This was undocumented and discouraged, so it
shouldn't affect anyone.
tv: add missing header for clock_gettime

Not sure how this symbol becomes visible in glibc (probably accidental
or mandatory recursive inclusion via the other standard or Linux-
specific headers), but normally this include file is needed to get the
symbol.
build: fix generation of zsh completion

The Perl script must be run *after* the mpv executable is generated. Also use
an absolute path to it.
video: automatically strip "le" and "be" suffix from pixle format names

These suffixes are annoying when they're redundant, so strip them
automatically. On little endian machines, always strip the "le" suffix,
and on big endian machines vice versa (although I don't think anyone
ever tried to run mpv on a big endian machine).

Since pixel format strings are returned by a certain function and we
can't just change static strings, use a trick to pass a stack buffer
transparently. But this also means the string can't be permanently
stored by the caller, so vf_dlopen.c has to be updated. There seems
to be no other case where this is done, though.
video: synchronize mpv rgb pixel format names with ffmpeg names

This affects packed RGB formats up to 16 bits per pixel. The old mplayer
names used LSB-to-MSB order, while FFmpeg (and some other libraries) use
MSB-to-LSB.

Nothing should change with this commit, i.e. no bit order or endian bugs
should be added or fixed. In some cases, the name stays the same, even
though the byte order changes, e.g. RGB8->BGR8 and BGR8->RGB8, and this
affects the user-visible names too; this might cause confusion.
video: cosmetics: reformat image format names table
build: version string as native str type for each Python version

Should resolve the "mpv b'...'" issue on Python 3 without breaking
things on Python 2.

Also, remove redundant wait for process.
gl_w32: remove unused variable
sub: add --sub-scale-with-window option

Implements the feature requested in #839 and #186.