Check if an mp3 header is using a reserved sample rate.

Fixes an invalid read past the end of avpriv_mpa_freq_tab.
Fixes divide-by-zero due to sample_rate being set to 0.

Bug-Id: 705

CC:libav-stable@libav.org

Conflicts:
	libavcodec/mpegaudiodecheader.c
Check mp3 header before calling avpriv_mpegaudio_decode_header().

As indicated in the function documentation, the header MUST be
checked prior to calling it because no consistency check is done
there.

CC:libav-stable@libav.org
(cherry picked from commit f2f2e7627f0c878d13275af5d166ec5932665e28)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
adpcm: Avoid reading out of bounds in the IMA QT trellis encoder

This was broken in 095be4fb - samples+ch (for the previous
non-planar case) equals &samples_p[ch][0]. The confusion
probably stemmed from the IMA WAV case where it originally
was &samples[avctx->channels + ch], which was correctly
changed into &samples_p[ch][1].

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 3d79d0c93e5b37a35b1b22d6c18699c233aad1ba)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
adpcm: Write the proper predictor in trellis mode in IMA QT

The actual predictor value, set by the trellis code, never
was written back into the variable that was written into
the block header. This was accidentally removed in b304244b.

This significantly improves the audio quality of the trellis
case, which was plain broken since b304244b.

Encoding IMA QT with trellis still actually gives a slightly
worse quality than without trellis, since the trellis encoder
doesn't use the exact same way of rounding as in
adpcm_ima_qt_compress_sample and adpcm_ima_qt_expand_nibble.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 0776e0ef6ba4160281ef3fabea43e670f3792b4a)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Prepare for 9.14 Release
Update Changelog for v9.14
eamad: use the bytestream2 API instead of AV_RL

This is safer and possibly fixes invalid reads on truncated data.
(cherry-picked from commit 541427ab4d5b4b6f5a90a687a06decdb78e7bc3c)

CC:libav-stable@libav.org

Conflicts:
	libavcodec/eamad.c

(cherry picked from commit f9204ec56a4cf73843d1e5b8563d3584c2c05b47)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
Merge commit '7997acee0542f6e0bb9ea42ff783f80b70878a2f' into release/1.1

* commit '7997acee0542f6e0bb9ea42ff783f80b70878a2f':
  Check if an mp3 header is using a reserved sample rate.

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Merge commit 'd7dbc687e312a91ef2ccf797d57b95c61d0e8a2f' into release/1.1

* commit 'd7dbc687e312a91ef2ccf797d57b95c61d0e8a2f':
  Check mp3 header before calling avpriv_mpegaudio_decode_header().

Conflicts:
	libavformat/mp3enc.c

See: See: 2dd0da787ce5008d4d1b8f461fbd1288c32e2c38
Merged-by: Michael Niedermayer <michaelni@gmx.at>
Merge commit '744e7eea5d815efea777b6179d96e8d94b63ccfa' into release/1.1

* commit '744e7eea5d815efea777b6179d96e8d94b63ccfa':
  adpcm: Avoid reading out of bounds in the IMA QT trellis encoder

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Merge commit '21d3e0ac9e1719d8444b3f5466983587ac0ad240' into release/1.1

* commit '21d3e0ac9e1719d8444b3f5466983587ac0ad240':
  adpcm: Write the proper predictor in trellis mode in IMA QT

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Merge commit '3ecbd911ff9177097820e5d00401c9bf29e5d167' into release/1.1

* commit '3ecbd911ff9177097820e5d00401c9bf29e5d167':
  Update Changelog for v9.14
  Prepare for 9.14 Release

Conflicts:
	Changelog
	RELEASE

Not merged as this doesnt apply 1:1 to our releases

Merged-by: Michael Niedermayer <michaelni@gmx.at>
Merge commit 'e8ff7972064631afbdf240ec6bfd9dec30cf2ce8' into release/1.1

* commit 'e8ff7972064631afbdf240ec6bfd9dec30cf2ce8':
  eamad: use the bytestream2 API instead of AV_RL

Conflicts:
	libavcodec/eamad.c

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