vo_direct3d: fix texture-memory sub-option, extend it

This sub-option was turned into a flag when the sub-option parser was
changed to the generic one (probably accidentally). Turn it into a
proper choice-option.

Also, adjust what the options do. Though none of this probably makes
much sense; the default should work, and if it doesn't, the GPU/driver
is probably beyond help.
ao/wasapi: only retry resizing the buffer once

like the MSDN example:

http://msdn.microsoft.com/en-us/library/windows/desktop/dd370875%28v=vs.85%29.aspx
ao/wasapi: actually only retry once (not twice)

oops
command: improve A-B loop behavior

If the B point is set, then loop back to A.

Also, update the OSD bar if necessary.
command: add an ab_loop command

As suggested in #1241; to make using the feature easier.

Also add better OSD-formatting for the ab-loop-a/b properties.
manpage: document vo_cmdline command
demux_mkv: add an option for compatibility with Haali

This was requested on IRC.
manpage: fix typo
lua: add youtube-dl hook script

This merely adds the file without using it, for the sake of retaining
authorship information.

Signed-off-by: wm4 <wm4@nowhere>
player: integrate ytdl_hook.lua
input.conf: add some additional bindings
manpage: changes.rst: add youtube-dl script
options: add --ytdl-format option for youtube-dl format

It's passed with the '--format' option to youtube-dl.

If it isn't set, we don't pass '--format best' so that youtube-dl can
use the options from its configuration file.

Signed-off-by: wm4 <wm4@nowhere>
vd_lavc: flush frames before uninitializing hw decoder

This way, no surfaces are in use when uninitializing the hw decoders,
which might help with -copy hw decoders (normal hw decoding is not
affected).
Catch SIGPIPE

Avoids a crash if OpenSSL tries to write to a broken connection with
write().

Obviously OpenSSL really should use send() with MSG_NOSIGNAL, but for
some reason it doesn't. This should probably be considered an OpenSSL
bug, but since in this case we "own" the process, there is no harm in
ignoring the signal.

This is not done with libmpv, because as a library we don't want to mess
with global state. It's also not done if terminal handling is disabled -
this is a bit arbitrary, but I don't care much.
demux_mkv: haali hack: add last frame duration to video length too

From what I can see, only the blockduration of the packet needs to be
added, never the "default duration".
command: add drop_buffers

This command was actually requested on IRC ages ago, but I forgot about
it.

The main purpose is that the decoding state can be reset without issuing
a seek, in particular in situations where you can't seek.

This restarts decoding from the middle of the packet stream; since it
discards the packet buffer intentionally, and the decoder will typically
not output "incomplete" frames until it has recovered, it can skip a
large amount of data.

It doesn't clear the byte stream cache - I'm not sure if it should.
command: dvd: better audio/video recovery on angle switching

Does the same thing as the drop_buffers command. When implementing that
command, it turned out that resetting the higher level playback state
was more effective for achieving smooth recovery.

Untested; I don't even have any DVDs or DVD images with multiple angles.
input: add a prefix to make any binding act on key repeat

The fact that it's a generic command prefix that is parsed even when
using the client API is a bit unclean (because this flag makes sense
for actual key-bindings only), but it's less code this way.
lua: add a way to add repeatable key bindings

For these, autorepeat is enabled.