lavd/v4l2: do not fail when VIDIOC_ENUMSTD returns EINVAL without a valid match

With some (buggy) drivers, the VIDIOC_G_STD ioctl returns a std_id that cannot
be matched with any of the enumerated v4l2_standard structures (for example
std_id = 0 or std_id = 0xffffff). Do not fail when we reach the end of the
enumeration without a valid match.

Fixes ticket #2370

Note: This commit message has been modified by Giorgio Vazzana, the original
commit message was:

"Fixed regression for mandatory VIDIOC_ENUMSTD support by v4l2"

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ed72542539fb61dc3a6d6280d8a6a956ac04a071)
avcodec/h264_refs: modify key frame detection heuristic to detect more cases

Fixes Ticket2968

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5ac6b6028f17b64723884c9fa72cfcbd369a1ba2)
avformat/wavdec: Dont trust the fact chunk for PCM

Fixes Ticket3033

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 83fc6c822b06688e572333299927d93eb3c6c426)
avformat/matroskadec: only set r_frame_rate if the value is within reasonable limits

Fixes Ticket2451

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6853e40106cac769f0641183ea0bdd530ae9a0a1)
avformat/gifdec: make GIF_APP_EXT_LABEL parsing more robust

Fixes Ticket3021

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e1f8184a1a973fd7de1bf53578d09661ec7bad75)
avformat/mov: force parsing of headers if stts is absent

Fixes Ticket2991

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e41ea866fc26f38d770bbc1ad67703e7f4400ae1)
doc/Makefile: fix man pages uninstall path

Fix trac ticket #3054.
(cherry picked from commit af1c5388501e80e6d92704bb70610998226e5e51)
avcodec/h264: do not trust last_pic_droppable when marking pictures as done

This simplifies the code and fixes a deadlock

Fixes Ticket2927
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 29ffeef5e73b8f41ff3a3f2242d356759c66f91f)
avformat/wavdec: Fix smv packet interleaving

This strips the relative timestamp "flag" off.

Fixes Ticket2849

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6abb9eb525239f954ec12e52fc209e6dfce2a6d4)
avformat/mp3dec: perform seek resync in the correct direction

Fixes seeking to the last frame in CBR files
Fixes Ticket2773

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ba8716df7fb541fb690d1a898cda0e12f9011faf)
avcodec/h264: reduce noisiness of "mmco: unref short failure"

Do not consider it an error if we have no frames and should discard one.
This condition can easily happen when decoding is started from an I frame

Fixes Ticket2811

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 08a89761964bdd0a023eff6d37a1131fb7e1d7a0)
h264: make flush_change() set mmco_reset

This ensures that frames do not get mixed on context reinits

Fixes Ticket2836

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3c9dd93faa9f3c250428dd0548c075583aa07cc3)
avformat/utils: do not override pts in h264 when they are provided from the demuxer

Fixes Ticket2143

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1e5271a9fd6ddcceb083f2185a4bbd8d44c9a813)
ffmpeg_filter: Fix non jpeg yuv in jpeg support

This is a regression, did not bisect so dont know what caused it but
likely some changes to the command line handling code.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d9bc251d3978cf0b9722991f7c23edebca7abb18)
avcodec/bink: fix seeking to frame 0

Fixes Ticket3088

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

Conflicts:
	libavcodec/bink.c
avformat/utils: dont count attached pics toward the probesize

Such pics behave more like headers which we also dont count.
Fixes Ticket3146

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a8dec360c5db15e8da4b44ff3c0f02a6c57e8ac0)
build: avoid stdin stall with GNU AS probing.

a758c5e added probing for various tools, such as AS. Unfortunately, GNU
AS is reading stdin with -v, and thus configure is stalled with
configure arguments such as --as=as.

Fixes Ticket #1898.
(cherry picked from commit dbb41f93c16cbc65a899a75723c95da51c851cd5)
avformat/image2: allow muxing gif files.

Fixes Ticket #2936.
(cherry picked from commit f70db22999d713da3306bf29ec763d670b9bf1ea)

Conflicts:
	libavformat/img2enc.c
lavd/lavfi: support unknown channel layouts.
(cherry picked from commit 863fb11f63f7f60feec390f3c54dd13606e07d05)
lavfi/avfiltergraph: suggest a solution when format selection fails.

Format selection can fail if unknown channel layouts are used
with filters that do not support it.
(cherry picked from commit f775eb3fb4c7b716107355e428e40cb63f71ee7a)