osdep: shorten thread name on glibc only

Instead of affecting every platform, do this for glibc only (where it's
known to be a problem), and only if the right error is returned.
command: allow sub_add at an earlier stage
command: remove hook cancellation mechanism

I doubt anyone will actually use this correctly. Also, there was a bug
(a typo) which prevented it from working at all.
command: extend sub_add command
lua: add convenience function for hooks

So the user doesn't have to care about the awkward low-level details.
command: add field-dominance property
TOOLS/lua: add autodeint.lua

This isn't quite as robust as idet.sh as the default detection
interval is only 4 seconds vs 35 for idet.sh. idet.sh can have such a
large sample time since it turns off the vo and uses --untimed, which
is currently not possible from lua.
TOOLS/lua: remove tabs from some lua scripts
TOOLS/lua: update README.md
json: handle >\\"< fragments correctly

It assumed that any >\"< sequence was an escape for >"<, but that is not
the case with JSON such as >{"ducks":"\\"}<. In this case, the second
>\< is obviously not starting an escape.
sd_lavc: strictly letter-box PGS subtitles

Getting subtitle scaling and positioning right even if there are video
filters, which completely change the image (like cropping), doesn't seem
to have a single, correct solution. To some degree, the results are
arbitrary, so we may as well do what is most useful to the user.

In this case, if the PGS resolution aspect ratio and the video output
aspect ratio mismatch, letter-box it, instead of stretching the subs
over the video frame. (This will require additional fixes, should it
turn out that there are PGS subtitles which are stretched by design.)

Fixes #1205.
player: add stream selection by ffmpeg index

Apparently using the stream index is the best way to refer to the same
streams across multiple FFmpeg-using programs, even if the stream index
itself is rarely meaningful in any way.

For Matroska, there are some possible problems, depending how FFmpeg
actually adds streams. Normally they seem to match though.
options: allow selecting track ID 0 too

Blergh. Now needed for --ff-aid and friends.
command: add video-rotate property
command: add playback-abort property

Now this is obscure.
command: add cursor-autohide property

Allows properly changing/updating the cursor state. Useful for client
API window embedding, because the host application may not want the mpv
window to grab mouse input, and this has to manually handle the cursor.
Changing the cursor of foreign windows is usually not sane.

It might make sense to allow changing the cursor icon, but that would be
much more complicated, so I won't add it unless someone actually
requests it.
lua: don't use "output" as identifier

I suspect this clashes with libcs,w hich define "stdout" as macro.
Hopefully fixes #1206.
command: fix video-rotate update when paused

Due to the way video-rotate currently works, the state will be
automatically updated once new video is decoded. So the filter chain
doesn't need to be reinitialized automatically, but there is a need to
trigger the video instant refresh code path instead.

Also move the support function closer to an annoying similar yet
different function. They probably can be unified next time major changes
are done to this code.
command: make reverse cycle_values match up with forward one

The behavior of reverse cycling (with the "!reverse" magic value) was a
bit weird and acted with a "delay". This was because the command set the
value the _next_ command should use. Change this and make each command
invocation select and use the next command directly. This requires an
"uninitialized" special index in the counter, but that is no problem at
all.
osdep: NetBSD pthread_setname_np()

From: bugmen0t on github

Fixes #1207.