idet.sh: An alternative to ildetect.sh.

This script uses ffmpeg's "idet" filter for interlace detection. In the
long run this should replace ildetect.sh+ildetect.sh.
manpage: document write_watch_later_config command
video: better handling for (very) broken timestamps

Sometimes, Matroska files store monotonic PTS for h264 tracks with
b-frames, which means the decoder actually returns non-monotonic PTS.

Handle this with an evil trick: if DTS is missing, set it to the PTS.
Then the existing logic, which deals with falling back to DTS if PTS is
broken. Actually, this trick is not so evil at all, because usually, PTS
has no errors, and DTS is either always set, or always unset. So this
_should_ provoke no regressions (famous last words).

libavformat actually does something similar: it derives DTS from PTS in
ways unknown to me. The result is very broken, but it causes the DTS
fallback to become active, and thus happens to work.

Also, prevent the heuristic from being active if PTS is merely monotonic
instead of strictly-monotonic. Non-unique PTS is broken, but we can't
fallback to DTS anyway in these cases.

The specific mkv file that is fixed with this commit had the following
fields set:

  Muxing application: libebml v1.3.0 + libmatroska v1.4.1
  Writing application: mkvmerge v6.7.0 ('Back to the Ground') [...]

But I know that this should also fix playback of mencoder produced mkv
files.
stream: unbreak writeable streams

So, basically this worked only with streams that were not local files,
because stream_dvd.c "intercepts" local files to check whether they
point to DVD images. This means if a stream is not writeable, we have to
try the next stream implementation.

Unbreaks 2-pass encoding.
osc: extend hitbox of seekbars to include gap

should make usage a bit easy

Fixes #810
osc: correct calculation of slider position

calculation the mouse position on the slider relied on how the
hitbox is positioned, change it according to new hitbox size.
vo_vaapi: cleanup error handling on init

Close the X connection if initializing vaapi fails.
video: warn if an emulated hwdec API is used

mpv supports two hardware decoding APIs on Linux: vdpau and vaapi. Each
of these has emulation wrappers. The wrappers are usually slower and
have fewer features than their native opposites. In particular the libva
vdpau driver is practically unmaintained.

Check the vendor string and print a warning if emulation is detected.
Checking vendor strings is a very stupid thing to do, but I find the
thought of people using an emulated API for no reason worse.

Also, make --hwdec=auto never use an API that is detected as emulated.
This doesn't work quite right yet, because once one API is loaded,
vo_opengl doesn't unload it, so no hardware decoding will be used if the
first probed API (usually vdpau) is rejected. But good enough.
vaapi: fix destruction with --hwdec=haapi-copy

This is incomplete; the video chain will still hold some vaapi objects
after destroying the decoder and thus the vaapi context. This is very
bad. Fixing it would require something like refcounting the vaapi
context, but I don't really want to.
i_bps: change values from bytes-per-second to bits-per-second

The i_bps members of the sh_audio and dev_video structs are mostly used
for displaying the average audio and video bitrates. Keeping them in
bits-per-second avoids truncating them to bytes-per-second and changing
them back lateron.
i_bps: rename to 'bitrate' to avoid confusion

Since i_bps now contains bits/sec, rename it to reflect this change.
af_fmt2bits: change to af_fmt2bps (bytes/sample) where appropriate

In most places where af_fmt2bits is called to get the bits/sample, the
result is immediately converted to bytes/sample. Avoid this by getting
bytes/sample directly by introducing af_fmt2bps.
wasapi: simplify nAvgBytesPerSec calculation

Calculate nBlockAlign seperately to reuse in the calculation of
nAvgBytesPerSec.
va_lavc: set video bitrate if available

Set the bitrate of dec_video if it is available in avcodec.
ad_lavc: don't overwrite lavc bitrate

If the bitrate is already known in avcodec there is no need to overwrite
it again with the value from sh_audio.