mpegvideo: fix loop condition in draw_line()

The loop condition `x = ex' is incorrect.  It should be `x <= ex'.

This bug was introduced in commit c65dfac4 "mpegvideo.c: K&R formatting
and cosmetics."

CC:libav-stable@libav.org

(cherry picked from commit 992b03183819553a73b4f870a710ef500b4eb6d0)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
get_bits: change the failure condition in init_get_bits

Too much code relies in having init_get_bits fed with a valid
buffer and set its dimension to 0.

Check for NULL buffer instead.
(cherry picked from commit 4603ec85ed620e585fc6e2e072c99858ed421855)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
videodsp_armv5te: remove #if HAVE_ARMV5TE_EXTERNAL

libavutil/arm/asm.S sets '.arch' depending on HAVE_ARMV5TE so that
assembling armv5te code will always succeed even if the default -march
flag does not support it. HAVE_ARMV5TE_EXTERNAL tests assembling code
with the default arch.
Fixes the missing symbol ff_prefetch_arm with --cpu= not including
armv5te.

CC: libav-stable@libav.org
rtp: Make sure priv_data is set before reading it

This fixes crashes with muxing H263 into RTSP.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit e90820d4f815c15796e642467cdddbad755212a2)

Signed-off-by: Martin Storsjö <martin@martin.st>
rtp: Make sure the output format pointer is set

Not sure if this actually happens, but we do the same check when
checking payload_type further above in the function, so it might
be needed.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 932117171f32fc3160f3d92943290238945fcb28)

Signed-off-by: Martin Storsjö <martin@martin.st>
rtpenc_chain: Use the original AVFormatContext for getting payload type

In ff_rtp_get_payload_type, the AVFormatContext is used for checking
whether the payload_type or rtpflags options are set. In rtpenc_chain,
the rtpctx struct is a newly initialized struct where no options have
been set yet, so no options can be fetched from there.

All muxers that internally chain rtp muxers have the "rtpflags" field
that allows passing such options on (which is how this worked before
8034130e06), so this works just as intended.

This makes it possible to produce H263 in RFC2190 format with chained
RTP muxers.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 4a4a7e138c92901e04db46a6b05cc6948023e5f5)

Signed-off-by: Martin Storsjö <martin@martin.st>
lavr: call mix_function_init() in ff_audio_mix_set_matrix()

This is needed if a custom matrix is set by the user after opening the
AVAudioResampleContext because the matrix channel count can change if
different mixing coefficients are used.

CC:libav-stable@libav.org
(cherry picked from commit f07ef2d9c9e9d1e84c532e9102594834e88a5c83)

Conflicts:

	libavresample/audio_mix.c
Prepare for 9.2 Release
arm: vp8: Fix the plain-armv6 version of vp8_luma_dc_wht

This makes the plain-armv6 version use the same registers as the
armv6t2 version above.

This fixes fate-vp8 on plain-armv6 devices.

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 2026eb1408a718c37835eb4b258c63714ab3205e)

Signed-off-by: Martin Storsjö <martin@martin.st>
doc/muxers.texi: Fix mp3 picture attachment documentation.
(cherry picked from commit 99eedfc40086972987aa27df8b1259c8bf15b20c)
ffmpeg: fix broken channel_layout option

Fixes ticket #2163.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5a67e30b1c71dc0a84779b543d95ca20faa8cbed)
Do not change codec in flv streams if the user has forced a codec.

Fixes ticket #2218.
(cherry picked from commit 6a50e8a190bc1329fd3e76e8497bb7f870b6e69b)
Merge commit '62de693a17f9b107be7867d822d5accacd4be544' into release/1.1

* commit '62de693a17f9b107be7867d822d5accacd4be544':
  rtp: Make sure priv_data is set before reading it
  videodsp_armv5te: remove #if HAVE_ARMV5TE_EXTERNAL
  get_bits: change the failure condition in init_get_bits
  mpegvideo: fix loop condition in draw_line()

Conflicts:
	libavcodec/get_bits.h
	libavcodec/mpegvideo.c

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

* qatar/release/9:
  arm: vp8: Fix the plain-armv6 version of vp8_luma_dc_wht
  Prepare for 9.2 Release
  lavr: call mix_function_init() in ff_audio_mix_set_matrix()
  rtpenc_chain: Use the original AVFormatContext for getting payload type
  rtp: Make sure the output format pointer is set

Conflicts:
	RELEASE

Merged-by: Michael Niedermayer <michaelni@gmx.at>
aasc: fix 16bpp on big-endian

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
huffyuvdec: Check init_vlc() return codes.

Prevents out of array writes

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f67a0d115254461649470452058fa3c28c0df294)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
huffyuvdec: Skip len==0 cases

Fixes vlc decoding for hypothetical files that would contain such cases.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Use proper "" quotes for local header #includes
(cherry picked from commit 6c1a7d07eb41b4cf36e48ebb560fecd9504fd968)

Conflicts:

	libavcodec/kbdwin.c
sanm: Check decoded_size.

This prevents a buffer overflow in rle_decode()

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7357ca900efcf829de4cce4cec6ddc286526d417)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
gifdec: gif_copy_img_rect: Fix end pointer

Fixes out of array accesses

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c10350358da58600884292c08a8690289b81de29)

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