lavf: introduce AVFMT_TS_NEGATIVE

Most formats do not support negative timestamps, shift them to avoid
unexpected behaviour and a number of bad crashes.

CC:libav-stable@libav.org

Signed-off-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
x86: Rename dsputil_rnd_template.c to rnd_template.c

This makes it less confusing when this template is shared both by
dsputil and by hpeldsp.

Signed-off-by: Martin Storsjö <martin@martin.st>
Merge commit 'c2cb01d418dd18e1cf997c038d37378d773121be'

* commit 'c2cb01d418dd18e1cf997c038d37378d773121be':
  lavf: introduce AVFMT_TS_NEGATIVE

Conflicts:
	libavformat/avformat.h
	libavformat/mux.c
	tests/ref/lavf/asf
	tests/ref/lavf/mkv
	tests/ref/lavf/mpg
	tests/ref/lavf/ts
	tests/ref/seek/lavf-asf
	tests/ref/seek/lavf-mkv
	tests/ref/seek/lavf-mpg
	tests/ref/seek/lavf-ts

This commit does not change the default ts behaviour, such
change will, if its done, be done separately.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Merge remote-tracking branch 'qatar/master'

* commit '74685f6783e77f2545d48bd2124945ad5be39982':
  x86: Rename dsputil_rnd_template.c to rnd_template.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
lavfi: support timeline for colorbalance and colorchannelmixer

Signed-off-by: Paul B Mahol <onemda@gmail.com>
lavfi/curves: add support for more rgb formats

Signed-off-by: Paul B Mahol <onemda@gmail.com>
doc/filters: fix afade 2nd example

Signed-off-by: Paul B Mahol <onemda@gmail.com>
lavfi/afade: fix AVOptions descriptions

Signed-off-by: Paul B Mahol <onemda@gmail.com>
lavfi/stereo3d: avoid division when changing aspect ratio

Signed-off-by: Paul B Mahol <onemda@gmail.com>
dcaenc: silence address sanitizer warning

Signed-off-by: Paul B Mahol <onemda@gmail.com>
avformat/mux: change avoid_negative_ts code to support later addition of AVStreams

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avformat/mux: use a local variable for offset

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avformat/mux: assert that timestamps are positive after offsetting them

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avformat/movenc: mov/mp4 should support negative timestamps through edit lists

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
avformat/mux: set avoid_negative_ts based on flags if not overridden by user or muxer

This changes the default to avoid negative timestamps.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>