avcodec/pngdsp: fix (un)signed type in end comparission

Fixes out of array accesses
Fixes Ticket2919

Found_by: ami_stuff
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 86736f59d6a527d8bc807d09b93f971c0fe0bb07)
avformat/avidec: match first index and first packet size=0 handling

Fixes Ticket2861

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 227a0eb5a92409572f2cecde6137529b83e7d495)

Conflicts:
	libavformat/avidec.c
avcodec/h264: set er.ref_count earlier

Fixes Ticket2910

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 93cf7b01950b9d8e1646227752b522d0275d32df)
avformat/lxfdec: use a parser to parse video frame headers

lxf needs a parser (or would need to set a few fields explicitly).
Fixes Ticket2917

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 8349be852be7f68fe0590584fd46c4d5f1c16b3d)
Avoid a deadlock when decoding wma.

Fixes ticket #2925.
(cherry picked from commit ec8a4841f7e81040f9a2757f23e70dff5e6b33a4)
w64dec: fix skipping of unknown guids

Regression since 14d50c1.
Fixes #2932.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit 79b70e47a463057a3a48353ee1dd58671c11f86c)
w64dec: fix end position of summarylist guid

Noticed-by: James Almer

Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit 3e36dc8626f4721ea749286dae40169ee5cb7d04)
Read h264 headers from v4l2 to allow stream-copying.

Fixes ticket #2882.
Analyzed and tested by William C Bonner.
(cherry picked from commit e337c9d56408dc00a15887309488a1ff5cb06ba3)
avformat/matroskaenc: remove bogus prores tag

Fixes: ffmpeg -i input -c:v prores output.mkv

Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit 14851ca5f5a3af140085e82589e28e06c7cdefdc)

Conflicts:
	libavformat/matroskaenc.c
avformat/vobsub: fix seeking.

(cherry picked from commit f8678dcef3c5b0ea82e898e1f419863409fa135f)
avformat/subtitles: check lower bound for duration overlap seeking.

(cherry picked from commit 1ca4bf930bab681a79fb591330043675c7cfd798)
Store the video bit_rate in the context when muxing mxf.

This will allow using rc_max_rate if no bit_rate is specified (on remuxing).

Reviewed-by: Matthieu Bouron
(cherry picked from commit 52cf08b4c8859f7cac010a7a59f7aa369384ad85)
Use rc_max_rate if no video bit_rate was specified when muxing mxf_d10.

Fixes ticket #2945.

Reviewed-by: Matthieu Bouron
(cherry picked from commit d73565d5ddf41d4b7805327cdb271c59d8c3fc59)
avformat/srtdec: skip initial random line breaks.

I found a bunch of (recent) SRT files in the wild with 3 to 10 line
breaks at the beginning.

(cherry picked from commit cfcd55db164e0acc0c30b2cf084e6eebe9741d34)

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
avformat/subtitles: add a next line jumper and use it.

This fixes a bunch of possible overread in avformat with the idiom p +=
strcspn(p, "\n") + 1 (strcspn() can focus on the trailing '\0' if no
'\n' is found, so the +1 leads to an overread).

Note on lavf/matroskaenc: no extra subtitles.o Makefile dependency is
added because only the header is required for ff_subtitles_next_line().

Note on lavf/mpsubdec: code gets slightly complex to avoid an infinite
loop in the probing since there is no more forced increment.

NOTE:
Code of function ff_subtitles_next_line fixed by Alexander Strasser.

The original code from master did test the wrong character, but was
corrected by a subsequent commit. That commit however is not backported,
so it had to be fixed in this commit for the backport.

Conflicts:
	libavformat/mpl2dec.c

(cherry picked from commit 90fc00a623de44e137fe1601b91356e8cd8bdd54)

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
avcodec/srtdec: fix potential overread.

(cherry picked from commit 3a54c221d574ec944db1eddf9df895808f32bf9e)

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
doc/encoders: reformat libmp3lame doc

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
(cherry picked from commit 40b8350b57adaa9aaf6731bac5130d4fec1639c3)

Conflicts:
	doc/encoders.texi
doc/encoders: reformat and add some clarification in libtwolame doc

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Stefano Sabatini <stefasab@gmail.com>
(cherry picked from commit e45e72f5f89ef5a5791562cfcb935028b46ecd0a)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
doc/encoders: Remove options that were not there when branch was cut from master

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
doc/ffmpeg-formats: Add documentation for 3 parameters that have been missing

Signed-off-by: Timothy Gu <timothygu99@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b7dd4598630fb1f890ae060f21a9ec92a103f22d)

Signed-off-by: Timothy Gu <timothygu99@gmail.com>

Conflicts:
	doc/formats.texi