Compare commits

..

1019 Commits

Author SHA1 Message Date
Michael Niedermayer
c13b19a5bc Update for 0.10.15
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 20:44:27 +02:00
Mans Rullgard
394f4ee61e pcmenc: set correct bitrate value
This fixes a bogus bitrate value in the header of WAV files with
alaw/ulaw audio.

Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 7d7b40f48a)

Conflicts:

	libavcodec/pcm.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 20:36:47 +02:00
Michael Niedermayer
497d661262 Merge commit 'b5d7b80a7e43779ca2962ba56442579c2a7e927d' into release/0.10
* commit 'b5d7b80a7e43779ca2962ba56442579c2a7e927d':
  ffv1dec: check that global parameters do not change in version 0/1

Conflicts:
	libavcodec/ffv1.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 20:28:37 +02:00
Michael Niedermayer
8044ab94e4 Merge commit '452e343295e25f7b2cbc8529c66e9386e2ea6f55' into release/0.10
* commit '452e343295e25f7b2cbc8529c66e9386e2ea6f55':
  avcodec: Add more missing #includes for ff_get_buffer()

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 20:26:07 +02:00
Michael Niedermayer
257188acea Merge commit '5a2d1913a96bb0e029b424a4dd5b414cfb91c708' into release/0.10
* commit '5a2d1913a96bb0e029b424a4dd5b414cfb91c708':
  Prepare for 0.8.15 Release

Conflicts:
	RELEASE

Not merged

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 20:25:48 +02:00
Michael Niedermayer
80a77c0c5b avcodec/libspeexdec: fix missing header includes
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 20:13:11 +02:00
Michael Niedermayer
854fa0d1ab Merge commit 'e24d1cbc4e134e0b4448b3bc3a80f3197271b347' into release/0.10
* commit 'e24d1cbc4e134e0b4448b3bc3a80f3197271b347':
  lavf: Fix leftovers from the ff_get_buffer patch

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 20:01:58 +02:00
Michael Niedermayer
5d790cdb9e Merge commit 'c98d164a6a2c3d93bfb10d44c946bc3ed56f14e7' into release/0.10
* commit 'c98d164a6a2c3d93bfb10d44c946bc3ed56f14e7':
  configure: Check for -Werror parameters on clang

Conflicts:
	configure

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 20:01:22 +02:00
Michael Niedermayer
bb015b519e Merge commit '0ab76ddf313eeab70d06619ae0376fd7dd40761b' into release/0.10
* commit '0ab76ddf313eeab70d06619ae0376fd7dd40761b':
  avcodec: Introduce ff_get_buffer

Conflicts:
	libavcodec/8svx.c
	libavcodec/dpcm.c
	libavcodec/utils.c
	libavcodec/vmdav.c
	libavcodec/yop.c

See: 668494acd8
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 19:53:37 +02:00
Michael Niedermayer
acf7c5b8ee Merge commit '042c25f54bd25b52d2936b822be026450971a82d' into release/0.10
* commit '042c25f54bd25b52d2936b822be026450971a82d':
  Update Changelog for v0.8.14

Conflicts:
	Changelog

Not merged as the Changelog isnt correct for FFmpeg

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 19:13:07 +02:00
Michael Niedermayer
a5a2f8ac5a Merge commit 'dcc68de942f06d358192a57057adb133f7c40dd7' into release/0.10
* commit 'dcc68de942f06d358192a57057adb133f7c40dd7':
  vp3: Copy all 3 frames for thread updates

See: 247d30a7db
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 19:11:33 +02:00
Michael Niedermayer
437a0ae1a1 Merge commit 'ebe2292eafa7cac71dcdddb865e18c05635fe117' into release/0.10
* commit 'ebe2292eafa7cac71dcdddb865e18c05635fe117':
  mpegts: Do not try to write a PMT larger than SECTION_SIZE

Conflicts:
	libavformat/mpegtsenc.c

See: 68b14c044a
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 19:09:33 +02:00
Michael Niedermayer
da19bfb287 Merge commit 'd86df7dd497ead1132bd95df7c4c18d91fbe3def' into release/0.10
* commit 'd86df7dd497ead1132bd95df7c4c18d91fbe3def':
  mpegts: Define the section length with a constant

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 19:01:28 +02:00
Michael Niedermayer
a94fe0e151 Merge commit 'a79e58cdc6e46c62346d13e7ddd4da2008714200' into release/0.10
* commit 'a79e58cdc6e46c62346d13e7ddd4da2008714200':
  Update Changelog for v0.8.14
  Prepare for 0.8.14 Release

Conflicts:
	Changelog
	RELEASE

No change as this does not apply to FFmpeg 1:1

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 19:00:30 +02:00
Michael Niedermayer
688ab26604 Merge commit 'c79cf0129edafc388ba1c47cd7b6a620557e48de' into release/0.10
* commit 'c79cf0129edafc388ba1c47cd7b6a620557e48de':
  error_concealment: avoid using the picture if not fully setup

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 18:58:09 +02:00
Michael Niedermayer
a2c6cb260f avcodec/svq1dec: Fix multiple bugs from "svq1: do not modify the input packet"
Add padding, clear size, use the correct pointer.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 18:51:33 +02:00
Michael Niedermayer
aed8f48545 Merge commit '9d5f4f025304ac7c69775179044e6f69f370441a' into release/0.10
* commit '9d5f4f025304ac7c69775179044e6f69f370441a':
  svq1: do not modify the input packet

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 18:51:22 +02:00
Michael Niedermayer
6596f5c3aa Merge commit 'cf6b2a0ad2b06aabf04bec4c7b19e78a560cd904' into release/0.10
* commit 'cf6b2a0ad2b06aabf04bec4c7b19e78a560cd904':
  cdgraphics: do not return 0 from the decode function

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 18:47:24 +02:00
Michael Niedermayer
a457115f0f Merge commit '3aebdffb010df025728d6c2af89642f9634aa806' into release/0.10
* commit '3aebdffb010df025728d6c2af89642f9634aa806':
  cdgraphics: switch to bytestream2

Conflicts:
	libavcodec/cdgraphics.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-12 18:25:32 +02:00
Michael Niedermayer
b5d7b80a7e ffv1dec: check that global parameters do not change in version 0/1
Such changes are neither allowed nor supported

Found-by: ami_stuff
Bug-Id: CVE-2013-7020
CC: libav-stable@libav.org
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit da7d839a0d)
Signed-off-by: Anton Khirnov <anton@khirnov.net>

Conflicts:
	libavcodec/ffv1dec.c
2014-08-12 10:49:43 +00:00
Michael Niedermayer
90241187ce Merge commit 'a1804df66a4064aa30554a11e4fd6cdac3ed89c0' into release/0.10
* commit 'a1804df66a4064aa30554a11e4fd6cdac3ed89c0':
  huffyuvdec: check width size for yuv422p

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 20:21:22 +02:00
Michael Niedermayer
e719bfc403 Merge commit 'e17dc0a254ac8d3c33887a114a66e2b659ba0bc5' into release/0.10
* commit 'e17dc0a254ac8d3c33887a114a66e2b659ba0bc5':
  mmvideo: check horizontal coordinate too

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 20:20:02 +02:00
Michael Niedermayer
7d42ede8fe Merge commit '4a6622550a4a4bf4690ea7d9fe42210a30a67936' into release/0.10
* commit '4a6622550a4a4bf4690ea7d9fe42210a30a67936':
  huffyuv: Check and propagate function return values

Conflicts:
	libavcodec/huffyuv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 19:58:37 +02:00
Michael Niedermayer
2ec8e46550 Merge commit '50493f1f7d2235db811d2991b9e5b330baf7c05a' into release/0.10
* commit '50493f1f7d2235db811d2991b9e5b330baf7c05a':
  twinvq: fix out of bounds array access

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 19:42:46 +02:00
Michael Niedermayer
b5ae0e349a Merge commit '3e60501f311c50bf234033f206c19d34d889df01' into release/0.10
* commit '3e60501f311c50bf234033f206c19d34d889df01':
  h264: slice-mt: check master context for valid current_picture_ptr

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 19:42:15 +02:00
Michael Niedermayer
0a83007cee Merge commit '7585a6254bbb38148e4467793fc34211b79d5f7d' into release/0.10
* commit '7585a6254bbb38148e4467793fc34211b79d5f7d':
  h264: prevent theoretical infinite loop in SEI parsing

Conflicts:
	libavcodec/h264_sei.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 19:41:51 +02:00
Michael Niedermayer
330791c2ae Merge commit '184c79729d4011f33027bcdc61a63d521017ebc1' into release/0.10
* commit '184c79729d4011f33027bcdc61a63d521017ebc1':
  h264_sei: check SEI size

Conflicts:
	libavcodec/h264_sei.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 19:30:07 +02:00
Michael Niedermayer
5404bf29c3 Merge commit 'a465ed5707f5cbc9713d5e9629d424cd2d46e038' into release/0.10
* commit 'a465ed5707f5cbc9713d5e9629d424cd2d46e038':
  pgssubdec: Check RLE size before copying

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 19:29:48 +02:00
Michael Niedermayer
2c10833d5e Merge commit '976f2e0a542e47aaf68ddbe001fb70a00bf96d99' into release/0.10
* commit '976f2e0a542e47aaf68ddbe001fb70a00bf96d99':
  x86: Fix linking with some or all of yasm, mmx, optimizations disabled

Conflicts:
	libavcodec/x86/mpegaudiodec_mmx.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 19:20:25 +02:00
Michael Niedermayer
cdfd61b78b Merge commit '28f2d3c5a5a3a3c14a68cf691054f15e4f23355a' into release/0.10
* commit '28f2d3c5a5a3a3c14a68cf691054f15e4f23355a':
  cmdutils: Conditionally compile libswscale-related bits

Conflicts:
	cmdutils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 19:15:49 +02:00
Michael Niedermayer
f3ae90621e Merge commit '277103e07fbe22fc8e4361bacd5c6b48133f3ba5' into release/0.10
* commit '277103e07fbe22fc8e4361bacd5c6b48133f3ba5':
  video4linux2: Avoid a floating point exception

Conflicts:
	avconv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 19:13:54 +02:00
Michael Niedermayer
c4dabc38a3 Merge commit 'e4fdfdf65d520ce3af13a21ff8a3649e37757af8' into release/0.10
* commit 'e4fdfdf65d520ce3af13a21ff8a3649e37757af8':
  vf_select: Drop a debug av_log with an unchecked double to enum conversion

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 19:12:46 +02:00
Michael Niedermayer
d60f680fa7 Merge commit '187cfd3c13a1deb47661486824a5b8f41e158a7a' into release/0.10
* commit '187cfd3c13a1deb47661486824a5b8f41e158a7a':
  eamad: use the bytestream2 API instead of AV_RL

Conflicts:
	libavcodec/eamad.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-08-09 19:04:40 +02:00
Reinhard Tartler
452e343295 avcodec: Add more missing #includes for ff_get_buffer() 2014-08-09 08:22:11 -07:00
Reinhard Tartler
5a2d1913a9 Prepare for 0.8.15 Release 2014-08-09 09:09:24 -04:00
Luca Barbato
e24d1cbc4e lavf: Fix leftovers from the ff_get_buffer patch
The automated script did not perfectly replace all the instances nor
added internal.h in all the files requiring it.
2014-08-09 14:14:34 +02:00
Martin Storsjö
c98d164a6a configure: Check for -Werror parameters on clang
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 9eded0fe41)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-08-09 14:13:49 +02:00
Luca Barbato
0ab76ddf31 avcodec: Introduce ff_get_buffer
Validate the image size there as is done in the other release
branches.

Bug-Id: CVE-2011-3935
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
2014-08-09 04:01:15 +02:00
Reinhard Tartler
042c25f54b Update Changelog for v0.8.14 2014-08-08 20:49:45 -04:00
Michael Niedermayer
dcc68de942 vp3: Copy all 3 frames for thread updates
Fixes a double release of the current frame on deinit.

Bug-Id: CVE-2011-3934
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-08-08 15:04:18 +01:00
Luca Barbato
ebe2292eaf mpegts: Do not try to write a PMT larger than SECTION_SIZE
Prevent out of array write.

Similar to what Michael Niedermayer did to address the same issue.

Bug-Id: CVE-2014-2263
CC: libav-stable@libav.org
(cherry picked from commit addbaf1348)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-08-08 14:27:47 +02:00
Luca Barbato
d86df7dd49 mpegts: Define the section length with a constant
The specification says the value is expressed in 10 bits including
the 4-byte CRC.

(cherry picked from commit 694b7cd873)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavformat/mpegtsenc.c
2014-08-08 14:27:27 +02:00
Reinhard Tartler
a79e58cdc6 Update Changelog for v0.8.14 2014-08-06 20:24:58 -04:00
Reinhard Tartler
4709baecc9 Prepare for 0.8.14 Release 2014-08-06 20:24:58 -04:00
Michael Niedermayer
c79cf0129e error_concealment: avoid using the picture if not fully setup
Fixes state becoming inconsistent and a null pointer dereference.

CC: libav-stable@libav.org
Bug-Id: CVE-2013-0860
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-08-06 19:29:48 +00:00
Anton Khirnov
9d5f4f0253 svq1: do not modify the input packet
The input data must remain constant, make a copy instead. This is in
theory a performance hit, but since I failed to find any samples
using this feature, this should not matter in practice.

Also, check the size of the header, avoiding invalid reads on truncated
data.

CC:libav-stable@libav.org
(cherry picked from commit 7b588bb691)
Signed-off-by: Anton Khirnov <anton@khirnov.net>

Conflicts:
	libavcodec/svq1dec.c
2014-08-06 19:22:05 +00:00
Anton Khirnov
cf6b2a0ad2 cdgraphics: do not return 0 from the decode function
0 means no data consumed, so it can trigger an infinite loop in the
caller.

CC:libav-stable@libav.org
(cherry picked from commit c7d9b473e2)
Signed-off-by: Anton Khirnov <anton@khirnov.net>

Conflicts:
	libavcodec/cdgraphics.c
2014-08-06 18:52:28 +00:00
Anton Khirnov
3aebdffb01 cdgraphics: switch to bytestream2
Fixes possible invalid memory accesses on corrupted data.

CC:libav-stable@libav.org
Bug-ID: CVE-2013-3674
(cherry picked from commit a1599f3f7e)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-08-06 18:51:49 +00:00
Michael Niedermayer
a1804df66a huffyuvdec: check width size for yuv422p
Avoid out of array accesses.

CC: libav-stable@libav.org
Bug-Id: CVE-2013-0848
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit a7153444df)
Signed-off-by: Anton Khirnov <anton@khirnov.net>

Conflicts:
	libavcodec/huffyuvdec.c
2014-08-05 20:17:19 +00:00
Michael Niedermayer
e17dc0a254 mmvideo: check horizontal coordinate too
Fixes out of array accesses.

Bug-Id: CVE-2013-3672
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 70cd3b8e65)
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-08-05 19:32:56 +00:00
Diego Biurrun
4a6622550a huffyuv: Check and propagate function return values
Bug-Id: CVE-2013-0868

inspired by a patch from Michael Niedermayer <michaelni@gmx.at>
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind

(cherry picked from commit 744b406ff3)
Signed-off-by: Diego Biurrun <diego@biurrun.de>

Conflicts:
	libavcodec/huffyuvdec.c
2014-08-04 00:24:21 -07:00
Mans Rullgard
50493f1f7d twinvq: fix out of bounds array access
ModeTab.fmode has only 3 elements, so indexing it with ftype
in the initialier for 'size' is invalid when ftype == FT_PPC.

This fixes crashes with gcc 4.8.

Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 4bf2e7c5f1)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-01 07:51:18 -07:00
Janne Grunau
3e60501f31 h264: slice-mt: check master context for valid current_picture_ptr
Fixes errors in slice based multithreading introduced in 0b300daad2.

CC: libav-stable@libav.org
(cherry picked from commit 5945c7b35d)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-01 07:37:14 -07:00
Vittorio Giovara
7585a6254b h264: prevent theoretical infinite loop in SEI parsing
Properly address CVE-2011-3946 and parse bitstream as described in the spec.

CC: libav-stable@libav.org
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
2014-08-01 13:40:11 +01:00
Michael Niedermayer
184c79729d h264_sei: check SEI size
Signed-off-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
2014-08-01 13:39:51 +01:00
Michael Niedermayer
a465ed5707 pgssubdec: Check RLE size before copying
Make sure the buffer size does not exceed the expected
RLE size.

Prevent an out of array bound write.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Bug-Id: CVE-2013-0852

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 00915d3cd2)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-08-01 05:19:04 -07:00
Diego Biurrun
976f2e0a54 x86: Fix linking with some or all of yasm, mmx, optimizations disabled
Some optimized template functions reference optimized symbols, so they
must be explicitly disabled when those symbols are unavailable.

(cherry picked from commit ec36aa6944)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-07-31 18:05:34 -07:00
Diego Biurrun
28f2d3c5a5 cmdutils: Conditionally compile libswscale-related bits
This fixes compilation with libswscale disabled.

(cherry picked from commit ab79966475)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-07-31 16:44:11 -07:00
Bernhard Übelacker
277103e07f video4linux2: Avoid a floating point exception
This avoids a segfault in avconv_opt.c:opt_target when trying to
determine the norm.

(cherry picked from commit dc71f19588)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-07-30 13:09:09 -07:00
Diego Biurrun
e4fdfdf65d vf_select: Drop a debug av_log with an unchecked double to enum conversion
CC: libav-stable@libav.org
(cherry picked from commit a8d803a320)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-07-30 13:06:22 -07:00
Anton Khirnov
187cfd3c13 eamad: use the bytestream2 API instead of AV_RL
This is safer and possibly fixes invalid reads on truncated data.
(cherry-picked from commit 541427ab4d)

CC:libav-stable@libav.org

Conflicts:
	libavcodec/eamad.c

(cherry picked from commit f9204ec56a)
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-07-30 12:42:35 -07:00
Michael Niedermayer
9153b33a74 update for FFmpeg 0.10.14
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-29 03:26:12 +02:00
Michael Niedermayer
a907fc0b21 Merge commit 'e122fb594a5feb6729cce86a70aafd93d10202d8' into release/0.10
* commit 'e122fb594a5feb6729cce86a70aafd93d10202d8':
  Update Changelog for 0.8.13
  Prepare for 0.8.13 Release

Conflicts:
	Changelog
	RELEASE

merge for metadata only

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-29 03:10:10 +02:00
Michael Niedermayer
d77ad6ec2d Merge commit 'e7f5dacd55deeee8a866020b8463f829b2c5971f' into release/0.10
* commit 'e7f5dacd55deeee8a866020b8463f829b2c5971f':
  lzo: Handle integer overflow

Conflicts:
	libavutil/lzo.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-29 03:08:22 +02:00
Reinhard Tartler
e122fb594a Update Changelog for 0.8.13 2014-06-26 21:34:03 -04:00
Reinhard Tartler
359383c983 Prepare for 0.8.13 Release 2014-06-26 21:33:18 -04:00
Luca Barbato
e7f5dacd55 lzo: Handle integer overflow
get_len can overflow for specially crafted payload.

Reported-By: Don A. Baley <donb@securitymouse.com>
CC: libav-stable@libav.org
(cherry picked from commit ccda51b14c)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavutil/lzo.c
2014-06-25 14:40:56 +02:00
Michael Niedermayer
6a968073da avutil/lzo: Fix integer overflow
Embargoed-till: 2014-06-27 requested by researcher, but embargo broken by libav today (git and mailing list)

Fixes: LMS-2014-06-16-4
Found-by: "Don A. Bailey" <donb@securitymouse.com>
See: ccda51b14c
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d6af26c55c)

Conflicts:

	libavutil/lzo.c
(cherry picked from commit 7b5c706494)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-23 15:21:18 +02:00
Michael Niedermayer
c1ac5896ef Merge commit '9c7321e2b8981ec867294309e9cf3833055df78f' into release/0.10
* commit '9c7321e2b8981ec867294309e9cf3833055df78f':
  sgidec: fix an incorrect backport

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-20 01:32:33 +02:00
Sean McGovern
9c7321e2b8 sgidec: fix an incorrect backport
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2014-06-17 21:50:20 +02:00
Michael Niedermayer
da97174dcb update for 0.10.13
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-09 02:00:04 +02:00
Michael Niedermayer
6a679279f7 avcodec/mjpegdec: Fix undefined shift
Fixes CID1194388

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-09 01:50:05 +02:00
Michael Niedermayer
dd8464bc99 avformat/h263dec: Fix h263 probe
The code was missing 1 bit in the src format

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-09 01:50:05 +02:00
Michael Niedermayer
363cf196c9 avfilter/vf_deshake: fix loss of precission with odd resolutions
Fixes part of Ticket3466
Found-by: Andrey_Karpov / PVS-Studio
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 73734282e0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-09 01:50:04 +02:00
Michael Niedermayer
90b69d1d02 avcodec/diracdec: fix undefined behavior with shifts
Fixes part of Ticket3466
Found-by: Andrey_Karpov / PVS-Studio
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b8598f6ce6)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-09 01:13:58 +02:00
Michael Niedermayer
71a3ad42b8 avformat/mpegts: Remove redundant check
Fixes part of Ticket3466
Found-by: Andrey_Karpov / PVS-Studio
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ff6fa0b4b9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-09 01:13:58 +02:00
Michael Niedermayer
ec29aec618 swscale/x86/swscale_template: loose hardcoded dstw_offset
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f6759d9ad4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-09 01:13:58 +02:00
Michael Niedermayer
6cf254ea68 avcodec/wma: use av_freep(), do not leave stale pointers in memory
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d167faafe9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-09 01:13:58 +02:00
Michael Niedermayer
f24246a889 avcodec/h264_mp4toannexb_bsf: prepend global headers before any in stream parameter sets
Fixes h264_mp4toannexb_bsf_failure.mkv

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-09 01:13:58 +02:00
Dale Curtis
2facb10f70 matroska: Fix use after free
Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit ae3d416369)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-09 01:13:58 +02:00
Michael Niedermayer
3b977a6ded avcodec/alsdec: Clear MPEG4AudioConfig so that no use of uninitialized memory is possible
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6e6bd5481c)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-08 14:32:41 +02:00
Michael Niedermayer
2088340173 Merge commit '9552b37e2604552d5ff210175d6baf28ccc2bb80' into release/0.10
* commit '9552b37e2604552d5ff210175d6baf28ccc2bb80':
  Add some bug references
  Update Changelog for 0.8.12
  Prepare for 0.8.12 Release

Conflicts:
	Changelog
	RELEASE

Not merged, as these changes are not correct for FFmpeg

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 02:50:29 +02:00
Michael Niedermayer
952738d0af Merge commit '6f4404b24bcf59ab29cd4b57995d374a578f51a7' into release/0.10
* commit '6f4404b24bcf59ab29cd4b57995d374a578f51a7':
  h264: set parameters from SPS whenever it changes
  alac: Limit max_samples_per_frame

Conflicts:
	libavcodec/h264.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 02:45:10 +02:00
Michael Niedermayer
d499685d80 Merge commit '7fa72700298107fe756311ecb4dee5270ff12d35' into release/0.10
* commit '7fa72700298107fe756311ecb4dee5270ff12d35':
  swscale: Fix an undefined behaviour
  apedec: do not buffer decoded samples over AVPackets
  isom: lpcm in mov default to big endian

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 02:41:19 +02:00
Michael Niedermayer
0be41c6586 Merge commit '5463a2b0566b34b9e3847db9ceb1ef1d2a6004fc' into release/0.10
* commit '5463a2b0566b34b9e3847db9ceb1ef1d2a6004fc':
  movdec: handle 0x7fff langcode as macintosh per the specs
  avi: Improve non-interleaved detection

Conflicts:
	libavformat/avidec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 02:34:10 +02:00
Michael Niedermayer
18b233428a Merge commit '079758e49a4d6b3e7cf2e22bed71d34c46712242' into release/0.10
* commit '079758e49a4d6b3e7cf2e22bed71d34c46712242':
  h264: reset next_output_pic earlier in start_frame()

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 02:32:58 +02:00
Michael Niedermayer
c437ab3c4e Merge commit 'a0a90b1a1116250a2494021da810cc5da89ea36f' into release/0.10
* commit 'a0a90b1a1116250a2494021da810cc5da89ea36f':
  tiffdec: use bytestream2 to simplify overread/overwrite protection

Conflicts:
	libavcodec/tiff.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 02:27:34 +02:00
Michael Niedermayer
b827189c6f Merge commit 'fa60904ebd58da33abf10b05e9933d24619cf096' into release/0.10
* commit 'fa60904ebd58da33abf10b05e9933d24619cf096':
  bytestream: add bytestream2_copy_buffer() functions
  bytestream: add functions for accessing size of buffer
  movenc: allow override of "writing application" tag

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 02:23:03 +02:00
Michael Niedermayer
fe30351d52 Merge commit '330c18032464a4e1f3da907e54db2e69a6fbfcda' into release/0.10
* commit '330c18032464a4e1f3da907e54db2e69a6fbfcda':
  matroskaenc: allow override of "writing application" tag
  avfilter: Add missing emms_c when needed
  mpeg12: check scantable indices in all decode_block functions

Conflicts:
	libavformat/matroskaenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 02:18:16 +02:00
Michael Niedermayer
7c520e5cd6 Merge commit '71b8c8430cf3f7056849257324fc39b423075ba1' into release/0.10
* commit '71b8c8430cf3f7056849257324fc39b423075ba1':
  sgidec: fix buffer size check in expand_rle_row()
  adx: check that the offset is not negative
  mpegvideo: set reference/pict_type on generated reference frames

Conflicts:
	libavcodec/mpegvideo.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 02:14:02 +02:00
Michael Niedermayer
d076ee5216 Merge commit '27ac9585c97d35b809382be5634c8e5f7211243a' into release/0.10
* commit '27ac9585c97d35b809382be5634c8e5f7211243a':
  h264: reset data partitioning at the beginning of each decode call

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:47:53 +02:00
Michael Niedermayer
8d32735629 Merge commit '35ba079fbf281a066f3ac1e1271f3caa402dcd74' into release/0.10
* commit '35ba079fbf281a066f3ac1e1271f3caa402dcd74':
  h264: reset ref count if decoding the slice header fails

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:47:33 +02:00
Michael Niedermayer
0558832796 Merge commit 'a7cce9ebf3ae3b9678970236c964900393603a73' into release/0.10
* commit 'a7cce9ebf3ae3b9678970236c964900393603a73':
  h264: reset first_field if frame_start() fails for missing refs

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:47:16 +02:00
Michael Niedermayer
ced5c8e6b3 Merge commit '51ae8e26af8f5b26efb41edc0fe4812368d16ae9' into release/0.10
* commit '51ae8e26af8f5b26efb41edc0fe4812368d16ae9':
  h264: limit allowed pred modes in ff_h264_check_intra_pred_mode() to 3

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:46:59 +02:00
Michael Niedermayer
1e83191d5c Merge commit 'c4033cd4eb921a9cc8deb513efc6d6a6ba3b2163' into release/0.10
* commit 'c4033cd4eb921a9cc8deb513efc6d6a6ba3b2163':
  h264: reject mismatching luma/chroma bit depths during sps parsing

Conflicts:
	libavcodec/h264.c
	libavcodec/h264_ps.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:39:49 +02:00
Michael Niedermayer
69db5f2779 Merge commit '7f33a24e824c6d20cb941e6b20c5382becfbc923' into release/0.10
* commit '7f33a24e824c6d20cb941e6b20c5382becfbc923':
  h264: check that execute_decode_slices() is not called too many times

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:38:03 +02:00
Michael Niedermayer
97a5b4ba53 Merge commit '0f71a5df4bc913f17a53c7ac66d4957914fa1d3d' into release/0.10
* commit '0f71a5df4bc913f17a53c7ac66d4957914fa1d3d':
  h264: do not use 422 functions for monochrome

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:37:45 +02:00
Michael Niedermayer
f2275400fe Merge commit '3ee26080d6b3e777992b4b4124e62e1bf0ac0a65' into release/0.10
* commit '3ee26080d6b3e777992b4b4124e62e1bf0ac0a65':
  h264: reset data_partitioning if decoding the slice header for NAL_DPA fails

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:27:27 +02:00
Michael Niedermayer
1ab94468dd Merge commit 'e0d8a17402b934b8fba7b86c6c990abf1257901b' into release/0.10
* commit 'e0d8a17402b934b8fba7b86c6c990abf1257901b':
  h264_refs: make sure not to write over the bounds of the default ref list

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:27:12 +02:00
Michael Niedermayer
ef076d3bd6 Merge commit '2cbc8dfeddcbe00ef5f112162912bb49c1dd6623' into release/0.10
* commit '2cbc8dfeddcbe00ef5f112162912bb49c1dd6623':
  h264: check buffer size before accessing it
  configure: use utilities from /usr/xpg4/bin if it exists

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:26:51 +02:00
Michael Niedermayer
2b40afae70 Merge commit 'ecf21ab0ec798eea96f862333568336098b4610c' into release/0.10
* commit 'ecf21ab0ec798eea96f862333568336098b4610c':
  cmdutils: update copyright year to 2014.
  ituh263: reject b-frame with pp_time = 0

Conflicts:
	cmdutils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:17:01 +02:00
Michael Niedermayer
bca2ebbeee doc: switch github urls to https
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 675a66a93b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:03:53 +02:00
Michael Niedermayer
53dcd772aa Merge commit 'f1a8885ae9e7f281b597d1f9188fc16fb2ab7832' into release/0.10
* commit 'f1a8885ae9e7f281b597d1f9188fc16fb2ab7832':
  doc: Point to the correct, actually maintained gas-preprocessor repo

Conflicts:
	doc/platform.texi

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:03:19 +02:00
Michael Niedermayer
2f894deeda Merge commit 'aedf1a2996e70d322220d2704d5a615c4f7b1b23' into release/0.10
* commit 'aedf1a2996e70d322220d2704d5a615c4f7b1b23':
  Update Changelog for 0.8.11
  configure: Update freetype check to follow upstream

Conflicts:
	Changelog

Changelog not merged as it does not match for FFmpeg

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 01:01:32 +02:00
Michael Niedermayer
e771425e98 Merge commit 'ec772cca60423b9994fe00c7cef239f93eae6112' into release/0.10
* commit 'ec772cca60423b9994fe00c7cef239f93eae6112':
  drawtext: Drop pointless header
  configure: Support preprocessor macros as header names

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-06-03 00:54:37 +02:00
Reinhard Tartler
9552b37e26 Add some bug references 2014-06-01 16:12:58 -04:00
Sean McGovern
d75b149757 Update Changelog for 0.8.12 2014-06-01 14:20:46 -04:00
Reinhard Tartler
516ea2dccd Prepare for 0.8.12 Release 2014-05-31 20:09:10 -04:00
Janne Grunau
6f4404b24b h264: set parameters from SPS whenever it changes
Fixes a crash in the fuzzed sample sample_varPAR.avi_s26638 with
alternating bit depths.
2014-05-31 20:07:52 -04:00
Luca Barbato
7fa7270029 swscale: Fix an undefined behaviour
Prevent a division by zero down the codepath.

Sample-Id: 00001721-google
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
2014-05-31 20:07:52 -04:00
Martin Storsjö
110680c5a2 alac: Limit max_samples_per_frame
Otherwise buffer size calculations in allocate_buffers could
overflow later, making the code think a large enough buffer
actually was allocated.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-05-31 20:07:52 -04:00
Rafaël Carré
65c3593792 apedec: do not buffer decoded samples over AVPackets
Only consume an AVPacket when all the samples have been read.

When the rate of samples output is limited (by the default value
of max_samples), consuming the first packet immediately will cause
timing problems:

- The first packet with PTS 0 will output 4608 samples and be
consumed entirely
- The second packet with PTS 64 will output the remaining samples
(typically, a lot, that's why max_samples exist) until the decoded
samples of the first packet have been exhausted, at which point the
samples of the second packet will be decoded and output when
av_decode_frame is called with the next packet).

That means there's a PTS jump since the first packet is 'decoded'
immediately, which can be seen with avplay or mplayer: the timing
jumps immediately to 6.2s (which is the size of a packet).

Sample: http://streams.videolan.org/issues/6348/Goldwave-MAClib.ape

Bug-Debian: http://bugs.debian.org/744901
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 91d4cfb812)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-05-31 20:07:52 -04:00
Mark Himsley
b7b798a1af isom: lpcm in mov default to big endian
It is my understanding that "Unless otherwise stated, all data in a
QuickTime movie is stored in big-endian byte ordering" [1] in MOV files.

I have a couple of thousand files, which technically are invalid because
their sound sample description element 4CC is 'lpcm' but its version is
0 - and "Version 0 supports only uncompressed audio in raw ('raw ') or
twos-complement ('twos') format" [2]

Because isom.c only contains a mapping for 4CC 'lpcm' to
AV_CODEC_ID_PCM_S16LE, these files have their audio decoded as LE when
it is actually BE.

This commit adds AV_CODEC_ID_PCM_S16BE as the first match for 4CC 'lpcm'.

[1]
https://developer.apple.com/library/mac/documentation/quicktime/QTFF/qtff.pdf
page 21
[2]
https://developer.apple.com/library/mac/documentation/quicktime/QTFF/qtff.pdf
page 178

Reviewed-by: Yusuke Nakamura <muken.the.vfrmaniac@gmail.com>
2014-05-31 20:07:52 -04:00
Baptiste Coudurier
5463a2b056 movdec: handle 0x7fff langcode as macintosh per the specs
The correct point that seperates ISO and MAC language codes is 0x400
according to the current QT spec. Old QT specs did not list where this
seperation is but apparently only defined the meaning of the first 137.

(cherry picked from commit 9e71cc81f3)
(cherry picked from commit 7940306a47)
2014-05-31 20:07:51 -04:00
Anton Khirnov
079758e49a h264: reset next_output_pic earlier in start_frame()
In case start_frame() fails, this potentially invalid frame can still be
output to the caller.

Bug-Id: 672
Bug-Id: debian/741240
Bug-Id: ubuntu/1288206
2014-05-31 20:07:51 -04:00
Michael Niedermayer
42dcfe32a8 avi: Improve non-interleaved detection
Additional fixes by Nigel Touati-Evans <nigel.touatievans@gmail.com>.

Check the index for streams with a time drift of 2s or a buffer drift
of 64MB.

Bug-Id: 666
CC: libav-stable@libav.org
Sample-Id: yet-another-broken-interleaved-avi.avi

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
Signed-off-by: Diego Biurrun <diego@biurrun.de>
2014-05-31 20:07:51 -04:00
Justin Ruggles
a0a90b1a11 tiffdec: use bytestream2 to simplify overread/overwrite protection
Based on a patch by Paul B Mahol <onemda@gmail.com>

CC:libav-stable@libav.org
2014-05-31 20:05:19 -04:00
Justin Ruggles
fa60904ebd bytestream: add bytestream2_copy_buffer() functions
This is basically an overread/overwrite-safe memcpy between a
GetByteContext and a PutByteContext.

CC:libav-stable@libav.org
(cherry picked from commit 5748faf291)
2014-05-31 20:05:19 -04:00
John Stebbins
330c180324 matroskaenc: allow override of "writing application" tag
Signed-off-by: Tim Walker <tdskywalker@gmail.com>

CC: libav-stable@libav.org
(cherry picked from commit 0092c1dd8d)
2014-05-31 20:05:19 -04:00
Anton Khirnov
71b8c8430c sgidec: fix buffer size check in expand_rle_row()
Right now it will spuriously fail if the linesize is exactly equal to
the data width.

CC:libav-stable@libav.org
2014-05-31 20:05:19 -04:00
Anton Khirnov
27ac9585c9 h264: reset data partitioning at the beginning of each decode call
Prevents using GetBitContexts with data from previous calls.

Fixes access to freed memory.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-05-31 20:05:19 -04:00
Anton Khirnov
35ba079fbf h264: reset ref count if decoding the slice header fails
Otherwise the ER code might try to use some already freed references.

Fixes possible access to freed memory.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-05-31 20:05:19 -04:00
Anton Khirnov
a7cce9ebf3 h264: reset first_field if frame_start() fails for missing refs
In this case we may not have a current frame, while first_field being
set implies we do.

Fixes invalid reads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-05-31 20:05:19 -04:00
Anton Khirnov
51ae8e26af h264: limit allowed pred modes in ff_h264_check_intra_pred_mode() to 3
Higher modes are not allowed for 16x16/chroma, which is what this
function is used for. Otherwise this function would return 0 (vertical
prediction) for invalid higher modes, which could result in invalid
reads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-05-31 20:05:19 -04:00
Anton Khirnov
c4033cd4eb h264: reject mismatching luma/chroma bit depths during sps parsing
There is no point in delaying the check and it avoids bugs with a
half-initialized context.

Fixes invalid reads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-05-31 20:05:19 -04:00
Paul B Mahol
b473fdcde3 bytestream: add functions for accessing size of buffer
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>

CC:libav-stable@libav.org
(cherry picked from commit de9d2705f6)
2014-05-31 20:05:19 -04:00
Luca Barbato
1dce4a031f avfilter: Add missing emms_c when needed
Arch specific calls should have an emms_c following to keep the cpu
state consistent.

Reported-By: wm4
CC: libav-stable@libav.org
2014-05-31 20:05:19 -04:00
Anton Khirnov
d0ecfe3249 adx: check that the offset is not negative
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 5569146d48)
2014-05-31 20:05:19 -04:00
John Stebbins
db52f056c3 movenc: allow override of "writing application" tag
Signed-off-by: Tim Walker <tdskywalker@gmail.com>

CC: libav-stable@libav.org
(cherry picked from commit 565e0c6d86)
2014-05-31 20:05:19 -04:00
Janne Grunau
9938e450c8 mpeg12: check scantable indices in all decode_block functions
Add checks to the fast functions used with CODEC_FLAGS2_FAST and move
the check for all other functions to before the invalid memory is
accessed. Fixes https://trac.videolan.org/vlc/ticket/9713 with
CODEC_FLAGS2_FAST.

CC: libav-stable@libav.org
2014-05-31 20:05:19 -04:00
Anton Khirnov
07558d0b9f mpegvideo: set reference/pict_type on generated reference frames
Otherwise the generic code will unref them, which can then result in
last_picture_ptr == current_picture_ptr, which causes deadlocks at least
in rv40.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-05-31 20:05:19 -04:00
Anton Khirnov
7f33a24e82 h264: check that execute_decode_slices() is not called too many times
Fixes invalid reads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-05-31 20:05:18 -04:00
Anton Khirnov
0f71a5df4b h264: do not use 422 functions for monochrome
Fixes invalid memory access.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-05-31 20:05:18 -04:00
Anton Khirnov
3ee26080d6 h264: reset data_partitioning if decoding the slice header for NAL_DPA fails
If it was set before then we can end up trying to decode a slice without
a valid slice header, which can lead to invalid memory access.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-05-31 20:05:18 -04:00
Anton Khirnov
e0d8a17402 h264_refs: make sure not to write over the bounds of the default ref list
Fixes invalid writes.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-05-31 20:05:18 -04:00
Anton Khirnov
2cbc8dfedd h264: check buffer size before accessing it
Fixes invalid reads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
2014-05-31 20:05:18 -04:00
Johan Andersson
ecf21ab0ec cmdutils: update copyright year to 2014.
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-05-31 20:05:18 -04:00
Mans Rullgard
afab4c422b configure: use utilities from /usr/xpg4/bin if it exists
Solaris defaults to non-standard utilities (grep, sed, ...) with
proper ones being in /usr/xpg4/bin.  Prefixing PATH with this
directory when it exists ensures we get correct variants.

Signed-off-by: Mans Rullgard <mans@mansr.com>
2014-05-31 20:05:18 -04:00
Keiji Costantini
16f0f97eec ituh263: reject b-frame with pp_time = 0
Avoid a division by 0 in ff_mpeg4_set_one_direct_mv.

Sample-Id: 00000168-google
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind

Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
(cherry picked from commit 9514440337)
(cherry picked from commit 5df52b0131)
(cherry picked from commit aa2a3ca27a)
2014-05-31 20:03:35 -04:00
Martin Storsjö
f1a8885ae9 doc: Point to the correct, actually maintained gas-preprocessor repo
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit d15c536123)
Signed-off-by: Martin Storsjö <martin@martin.st>
2014-03-16 20:56:04 +02:00
Reinhard Tartler
aedf1a2996 Update Changelog for 0.8.11 2014-03-13 20:59:00 -04:00
Luca Barbato
bf0cb89a8d configure: Update freetype check to follow upstream
The freetype tutorial suggests to use #include FT_FREETYPE_H.

Bug-Id: 616
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

(cherry picked from commit e61b8fa560)

Conflicts:
	configure
2014-03-13 12:47:49 +01:00
Luca Barbato
ec772cca60 drawtext: Drop pointless header
It should be forward compatible with newer freetype.

(cherry picked from commit d68dc3c944)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-03-13 12:47:12 +01:00
Diego Biurrun
7b00340f97 configure: Support preprocessor macros as header names
New versions of FreeType have moved the location of their API
header(s) and hide the location behind a macro.

Since the location changes between versions and no other way
to know the location exists, this workaround becomes necessary.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 52ccc4a0ec)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	configure
2014-03-13 12:46:10 +01:00
Michael Niedermayer
6f9e6ac6aa update for 0.10.12
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 19:00:59 +01:00
Michael Niedermayer
43b1762ab8 avcodec/snow: split block clipping checks
Fixes out of array read
Fixes: d4476f68ca1c1c57afbc45806f581963-asan_heap-oob_2266b27_8607_cov_4044577381_snow_chroma_bug.avi
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 61d59703c9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:51:50 +01:00
Michael Niedermayer
f157f18b34 avcodec/msrle: use av_image_get_linesize() to calculate the linesize
Fixes out of array access
Fixes: 14a74a0a2dc67ede543f0e35d834fbbe-asan_heap-oob_49572c_556_cov_215466444_44_001_engine_room.mov
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c919e1ca2e)

Conflicts:

	libavcodec/msrle.c
(cherry picked from commit bc1c8ec5e6)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:51:50 +01:00
Michael Niedermayer
68b14c044a avformat/mpegtsenc: Check data array size in mpegts_write_pmt()
Prevents out of array writes

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

Conflicts:

	libavformat/mpegtsenc.c
(cherry picked from commit e87de3f50b765134588d0b048c32ed4b8acc16fb)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:51:50 +01:00
Michael Niedermayer
ae51d93983 avcodec/wmalosslessdec: fix mclms_coeffs* array size
Fixes corruption of context
Fixes: 8835659dde6a4f7dcdf341de6a45c6c8-signal_sigsegv_1dce67b_4564_cov_2504444599_classical_22_16_1_14000_v3c_0_extend_0_29.wma
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ec9578d54d)

Conflicts:

	libavcodec/wmalosslessdec.c
2014-03-10 18:51:50 +01:00
Michael Niedermayer
ca8c3ec11b wmalosslessdec: make mclms arrays big enough for whats written into them.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a0abefb0af)

Conflicts:

	libavcodec/wmalosslessdec.c
2014-03-10 18:51:50 +01:00
Michael Niedermayer
4e47ae4e71 avcodec/vc1: reset fcm/field_mode in non advanced header parsing
Fixes NULL pointer dereference
Fixes: signal_sigsegv_1ab8bf4_2847_cov_4254117347_SA10091.vc1
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b51e935477)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:51:50 +01:00
Michael Niedermayer
5cab56dc9e avcodec/vmnc: Check that rectangles are within the picture
Prevents out of array accesses with CODEC_FLAG_EMU_EDGE

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

Conflicts:

	libavcodec/vmnc.c

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:51:50 +01:00
Michael Niedermayer
98f44b24b5 dnxhdenc: fix mb_rc size
Fixes out of array access with RC_VARIANCE set to 0

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:51:50 +01:00
Michael Niedermayer
ad4963a944 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  arm: hpeldsp: fix put_pixels8_y2_{,no_rnd_}armv6
  arm: hpeldsp: prevent overreads in armv6 asm
  lagarith: reallocate rgb_planes when needed
  lagarith: avoid infinite loop in lag_rac_refill()

Conflicts:
	libavcodec/lagarith.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:48:51 +01:00
Michael Niedermayer
5640ea43d7 Merge commit '2c1d84499bfe06d75e9160b824eeffd9f5587337' into release/0.10
* commit '2c1d84499bfe06d75e9160b824eeffd9f5587337':
  lagarith: pad RGB buffer by 1 byte.
  truemotion1: check the header size
  shorten: pad the internal bitstream buffer
  samplefmt: avoid integer overflow in av_samples_get_buffer_size()
  h264: Fix a typo from the previous commit
  h264: Lower bound check for slice offsets
  rpza: limit the number of blocks to the total remaining blocks in the frame

Conflicts:
	libavcodec/lagarith.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:39:02 +01:00
Michael Niedermayer
15efd9a7c0 Merge commit '36017d49e2f797f7371dc24848a2285ca63e39ab' into release/0.10
* commit '36017d49e2f797f7371dc24848a2285ca63e39ab':
  Prepare for 0.8.11 Release
  lavf: make av_probe_input_buffer more robust
  Updated Changelog for 0.8.10
  oggparseogm: check timing variables
  mathematics: remove asserts from av_rescale_rnd()
  vc1: Always reset numref when parsing a new frame header.
  h264: reset num_reorder_frames if it is invalid

Conflicts:
	RELEASE
	libavcodec/vc1.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:31:07 +01:00
Michael Niedermayer
0d82c3a0ca Merge commit '979f77b0dc40571761999633a38d97be9a1670c8' into release/0.10
* commit '979f77b0dc40571761999633a38d97be9a1670c8':
  h264: check that an IDR NAL only contains I slices
  mov: Free an earlier allocated array if allocating a new one
  segafilm: fix leaks if reading the header fails
  h264_cavlc: check the size of the intra PCM data.
  cavs: Check for negative cbp
  avi: DV in AVI must be considered single stream
  avutil: use align == 0 for default alignment in audio sample buffer functions

Conflicts:
	libavcodec/cavsdec.c
	libavutil/avutil.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:14:20 +01:00
Michael Niedermayer
b7a750f67f Merge commit 'cb5d0ea0bec119ecbe327bd7d3834987ab42ec1a' into release/0.10
* commit 'cb5d0ea0bec119ecbe327bd7d3834987ab42ec1a':
  flashsv: Check diff_start diff_height values
  dsputil/pngdsp: fix signed/unsigned type in end comparison
  vqavideo: check chunk sizes before reading chunks
  avi: directly resync on DV in AVI read failure
  get_bits: change the failure condition in init_get_bits
  twinvq: Cope with gcc-4.8.2 miscompilation

Conflicts:
	libavcodec/dsputil.c
	libavcodec/flashsv.c
	libavcodec/get_bits.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-03-10 18:06:35 +01:00
Janne Grunau
0120e480bf arm: hpeldsp: fix put_pixels8_y2_{,no_rnd_}armv6
The overread avoidance fix in cbddee1cca
broke the computation for the last row since it prevented the safe
reading from the height+1-th row.
2014-03-09 00:31:31 +01:00
Janne Grunau
fd2fc130b2 arm: hpeldsp: prevent overreads in armv6 asm
Based on a patch by Russel King <rmk+libav@arm.linux.org.uk>

Bug-Id: 646
CC: libav-stable@libav.org
2014-03-06 09:06:39 +01:00
Anton Khirnov
3da4fdd5ac lagarith: reallocate rgb_planes when needed
Fixes invalid writes on pixel format changes.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 4c3e1956ee)
(cherry picked from commit bd57e783437f990c3ac4747eeebe20332e103980)
2014-02-28 23:07:41 -05:00
Ronald S. Bultje
2c1d84499b lagarith: pad RGB buffer by 1 byte.
For left HFYU prediction, we predict from the buffer buf+1 using 8- or
16-byte reads. This means that aligning the buffer by 16 bytes is in
itself not sufficient, because if the width itself is 16- or 8-byte
aligned, the buffer will not be padded, and thus a read of size 16 at
buf+1 will overflow boundaries at the right edge. Padding the buffer by
1 byte is sufficient to not overflow its boundaries.

Fixes bug 342.

(cherry picked from commit 98d0d19208)
2014-02-28 23:07:40 -05:00
Anton Khirnov
2fb0a52e70 lagarith: avoid infinite loop in lag_rac_refill()
range == 0 happens with corrupted files

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 8bce2c60b8)
2014-02-28 23:07:40 -05:00
Anton Khirnov
de0e442e9d truemotion1: check the header size
Fixes invalid reads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 2240e2078d)
(cherry picked from commit 76b40a9bf93e387d98aa7dc02ec7a8d13f51722f)
2014-02-28 23:07:40 -05:00
Anton Khirnov
43aa7eb38e shorten: pad the internal bitstream buffer
Fixes invalid reads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 1713eec29a)
(cherry picked from commit 5881ec0ea58a95403bd375b63f22d49905cdd8e5)
2014-02-28 23:07:40 -05:00
Justin Ruggles
9786c24bb7 samplefmt: avoid integer overflow in av_samples_get_buffer_size()
CC:libav-stable@libav.org
(cherry picked from commit 0e830094ad)
(cherry picked from commit e9b3abd49890e958c745ea46a9f4f91b6b4baa58)

Conflicts:
	libavutil/samplefmt.c
2014-02-28 23:07:40 -05:00
Luca Barbato
4279e0e8d0 h264: Fix a typo from the previous commit
f777504f64 changed a - in +

CC: libav-stable@libav.org
(cherry picked from commit d922c5a5fb)
(cherry picked from commit 3ce77e04c2ca4b9e7fa6b94b51e8d7c5f188da86)
(cherry picked from commit 8cba6f58c8acaa0ca6749110a2746bbe60ff2dab)
2014-02-28 23:07:40 -05:00
Vittorio Giovara
a6003760bd h264: Lower bound check for slice offsets
And use the value from the specification.

Sample-Id: 00000451-google
Found-by: Mateusz j00ru Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit f777504f64)
(cherry picked from commit 5bd083d0216d9ee649039c84999fb61386536ac1)

Conflicts:
	libavcodec/h264.c

(cherry picked from commit 41380e017afcca3119acb560c08a60a97d416c3c)

Conflicts:
	libavcodec/h264.c
2014-02-28 23:07:40 -05:00
Anton Khirnov
cf676c159b rpza: limit the number of blocks to the total remaining blocks in the frame
Fixes invalid writes.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 77bb0004bb)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-02-14 11:43:59 +01:00
Reinhard Tartler
36017d49e2 Prepare for 0.8.11 Release 2014-02-06 23:26:33 -05:00
Anton Khirnov
8cade1352b lavf: make av_probe_input_buffer more robust
Always use the actually read size as the offset instead of making
possibly invalid assumptions.

Addresses: CVE-2012-6618

(cherry picked from commit 2115a35974)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavformat/utils.c

Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 8575f5362f)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-06 23:01:14 -05:00
Reinhard Tartler
5522c564d4 Updated Changelog for 0.8.10 2014-02-02 12:54:52 -05:00
Anton Khirnov
b0db7a523d oggparseogm: check timing variables
Fixes a potential divide by zero.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 75647dea6f)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit bf7c240a50)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-02 12:48:58 -05:00
Anton Khirnov
e03b875c0b mathematics: remove asserts from av_rescale_rnd()
It is a public function, it must not assert on its parameters.

(cherry picked from commit 94a417acc0)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 03bfd8419f)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-02 12:48:45 -05:00
Michael Niedermayer
30c8a5e4f6 vc1: Always reset numref when parsing a new frame header.
Fixes an issue where the B-frame coding mode switches from interlaced
fields to interlaced frames, causing incorrect decisions in the motion
compensation code and resulting in visual artifacts.

CC: libav-stable@libav.org
Signed-off-by: Tim Walker <tdskywalker@gmail.com>
(cherry picked from commit dd2d0039b6)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 3cc8d9bc1f)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-02 12:48:34 -05:00
Anton Khirnov
716ee73c99 h264: reset num_reorder_frames if it is invalid
An invalid VUI is not considered a fatal error, so the SPS containing it
may still be used. Leaving an invalid value of num_reorder_frames there
can result in writing over the bounds of H264Context.delayed_pic.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 9ecabd7892)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/h264_ps.c

(cherry picked from commit 299c5dcfb0)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-02 12:48:16 -05:00
Anton Khirnov
979f77b0dc h264: check that an IDR NAL only contains I slices
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 8b2e5e42bb)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 62ed6da016)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/h264.c
2014-02-02 12:48:04 -05:00
Martin Storsjö
2f4e066d66 mov: Free an earlier allocated array if allocating a new one
It could probably also be considered an error if the pointer isn't
null at this point, but then we might risk rejecting some
slightly broken files that we might have handled so far.

Sample-Id: 00000496-google
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 2620df1310)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit a1b4d42d31)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-02 12:45:09 -05:00
Anton Khirnov
6a56d16dc1 segafilm: fix leaks if reading the header fails
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 6892d145a0)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit f728782c0d)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavformat/segafilm.c
2014-02-02 12:44:20 -05:00
Anton Khirnov
23144c5f06 h264_cavlc: check the size of the intra PCM data.
Fixes invalid reads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org

(cherry picked from commit b5275ca1a8)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-02 12:41:02 -05:00
Luca Barbato
e964207e6c cavs: Check for negative cbp
Sample-Id: 00000647-google
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit c85e5f13f6)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/cavsdec.c
2014-02-02 12:36:15 -05:00
Luca Barbato
2c0bfce4cb avi: DV in AVI must be considered single stream
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 3485a07977)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-02 12:29:54 -05:00
Justin Ruggles
b68e5b1195 avutil: use align == 0 for default alignment in audio sample buffer functions
Fixes: http://pad.lv/1264886, http://pad.lv/1241439
(cherry picked from commit 0109a09dc3)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavutil/avutil.h
2014-02-01 14:59:12 -05:00
Michael Niedermayer
cb5d0ea0be flashsv: Check diff_start diff_height values
Fix out of array accesses.

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

Adresses: CVE-2013-7015
(cherry picked from commit 57070b1468)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 10d48fe6d3)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-01 14:06:24 -05:00
Michael Niedermayer
ef6c90e102 dsputil/pngdsp: fix signed/unsigned type in end comparison
Fixes out of array accesses and integer overflows.

(cherry picked from commit d1916d13e2)
Adresses: CVE-2013-7010, CVE-2013-7014

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit af9799790d)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/pngdsp.c
2014-02-01 14:05:47 -05:00
Michael Niedermayer
d04194db45 vqavideo: check chunk sizes before reading chunks
Fixes out of array writes

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

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

CC: libav-stable@libav.org

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit f7d18deb73)

Addresses: CVE-2013-0865

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit ab434bf0d0)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-01 14:03:28 -05:00
Luca Barbato
976a7b72a3 avi: directly resync on DV in AVI read failure
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit ceec6e792e)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Adresses CVE-2013-0856
(cherry picked from commit 61057f4604)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2014-02-01 14:02:20 -05:00
Luca Barbato
a89acaa0b0 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 4603ec85ed)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-25 01:01:25 +01:00
Michael Niedermayer
41216ebb9e update for 0.10.11
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 23:37:49 +01:00
Michael Niedermayer
86a423d2b8 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  Changelog for 0.8.10
  pthread: Avoid spurious wakeups

Conflicts:
	Changelog

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 23:32:09 +01:00
Michael Niedermayer
a26bfc444d Merge commit '48d57650f121d3d9e977832e9006bb334337d921' into release/0.10
* commit '48d57650f121d3d9e977832e9006bb334337d921':
  pthread: Fix deadlock during thread initialization
  mpegvideo: Initialize chroma_*_shift and codec_tag even if the size is 0
  vc1dec: Don't decode slices when the latest slice header failed to decode

Conflicts:
	libavcodec/mpegvideo.c
	libavcodec/pthread.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 23:23:09 +01:00
Michael Niedermayer
93e3ec451c Merge commit '9925f7df0a50387ade8d83cb85b40c53e41e7041' into release/0.10
* commit '9925f7df0a50387ade8d83cb85b40c53e41e7041':
  vc1dec: Make sure last_picture is initialized in vc1_decode_skip_blocks
  r3d: Add more input value validation
  fraps: Make the input buffer size checks more strict
  svq3: Avoid a division by zero
  rmdec: Validate the fps value
  twinvqdec: Check the ibps parameter separately
  asfdec: Check the return value of asf_read_stream_properties
  mxfdec: set audio timebase to 1/samplerate
  pcx: Check the packet size before assuming it fits a palette
  rpza: Fix a buffer size check
  xxan: Disallow odd width
  xan: Only read within the data that actually was initialized

Conflicts:
	libavcodec/fraps.c
	libavformat/mxfdec.c
	tests/ref/seek/lavf_mxf
	tests/ref/seek/lavf_mxf_d10

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 22:44:32 +01:00
Michael Niedermayer
76c48a78d1 Merge commit '993977032a0adb47eb70e7fef6ce0d5370027e83' into release/0.10
* commit '993977032a0adb47eb70e7fef6ce0d5370027e83':
  xan: Use bytestream2 to limit reading to within the buffer
  pcx: Consume the whole packet if giving up due to missing palette
  pngdec: Stop trying to decode once inflate returns Z_STREAM_END
  mov: Make sure the read sample count is nonnegative
  bfi: Add some very basic sanity checks for input packet sizes

Conflicts:
	libavformat/mov.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 22:31:18 +01:00
Michael Niedermayer
6c0c799bd5 Merge commit '5e8243e843be8f71da7dde199a71d095726533eb' into release/0.10
* commit '5e8243e843be8f71da7dde199a71d095726533eb':
  bfi: Avoid divisions by zero
  electronicarts: Add more sanity checking for the number of channels
  riffdec: Add sanity checks for the sample rate
  mvi: Add sanity checking for the audio frame size
  xwma: Avoid division by zero
  avidec: Make sure a packet is large enough before reading its data
  vqf: Make sure the bitrate is in the valid range
  vqf: Make sure sample_rate is set to a valid value
  vc1dec: Undo mpegvideo initialization if unable to allocate tables

Conflicts:
	libavformat/riff.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 22:24:42 +01:00
Michael Niedermayer
d1c7a7776f Merge commit '159993acc7f4e3155510d42c543e09fe972b933c' into release/0.10
* commit '159993acc7f4e3155510d42c543e09fe972b933c':
  vc1dec: Fix leaks in ff_vc1_decode_init_alloc_tables on errors
  wnv1: Make sure the input packet is large enough
  dca: Validate the lfe parameter
  rl2: Avoid a division by zero
  wtv: Add more sanity checks for a length read from the file
  segafilm: Validate the number of audio channels
  qpeg: Add checks for running out of rows in qpeg_decode_inter
  mpegaudiodec: Validate that the number of channels fits at the given offset
  asv1: Verify the amount of extradata
  idroqdec: Make sure a video stream has been allocated before returning packets
  rv10: Validate the dimensions set from the container
  xmv: Add more sanity checks for parameters read from the bitstream
  ffv1: Make sure at least one slice context is initialized
  truemotion2: Use av_freep properly in an error path

Conflicts:
	libavcodec/qpeg.c
	libavcodec/wnv1.c
	libavformat/wtv.c
	libavformat/xmv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 22:02:02 +01:00
Michael Niedermayer
5339a9f000 Merge commit 'b19eafa2b930ee40abfde6d1f026b7fa5591c4dc' into release/0.10
* commit 'b19eafa2b930ee40abfde6d1f026b7fa5591c4dc':
  eacmv: Make sure a reference frame exists before referencing it
  mpeg4videodec: Check the width/height in mpeg4_decode_sprite_trajectory
  ivi_common: Make sure color planes have been initialized
  oggparseogm: Convert to use bytestream2
  rv34: Check the return value from ff_rv34_decode_init
  matroskadec: Verify realaudio codec parameters
  mace: Make sure that the channel count is set to a valid value
  svq3: Check for any negative return value from ff_h264_check_intra_pred_mode
  vp3: Check the framerate for validity
  cavsdec: Make sure a sequence header has been decoded before decoding pictures
  sierravmd: Do sanity checking of frame sizes
  omadec: Properly check lengths before incrementing the position
  mpc8: Make sure the first stream exists before parsing the seek table

Conflicts:
	libavcodec/eacmv.c
	libavcodec/mpeg4videodec.c
	libavformat/omadec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 21:53:50 +01:00
Michael Niedermayer
bd953f9404 Merge commit '486c45767587151b517bb6fde602d43d178da203' into release/0.10
* commit '486c45767587151b517bb6fde602d43d178da203':
  mpc8: Check the seek table size parsed from the bitstream
  zmbvdec: Check the buffer size for uncompressed data
  ape: Don't allow the seektable to be omitted
  shorten: Break out of loop looking for fmt chunk if none is found
  shorten: Use a checked bytestream reader for the wave header
  smacker: Make sure we don't fill in huffman codes out of range

Conflicts:
	libavcodec/shorten.c
	libavcodec/smacker.c
	libavcodec/zmbv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 21:50:17 +01:00
Michael Niedermayer
9e96051d5d Merge commit '68a1df13c460adb6241cfdf96aad953b5d637623' into release/0.10
* commit '68a1df13c460adb6241cfdf96aad953b5d637623':
  smacker: Avoid integer overflow when allocating packets
  smacker: Don't return packets in unallocated streams
  dsicin: Add some basic sanity checks for fields read from the file
  arm: Don't clobber callee saved registers in scalarproduct
  Prepare for 0.8.10 Release
  roqvideodec: check dimensions validity
  qdm2: check array index before use, fix out of array accesses
  alsdec: check block length

Conflicts:
	RELEASE

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 21:33:44 +01:00
Michael Niedermayer
85c02da307 cmdutils: update year
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2014-01-16 21:18:19 +01:00
Luca Barbato
8b24e17d09 twinvq: Cope with gcc-4.8.2 miscompilation
Apparently gcc-4.8.2 miscompiles enums resulting in a lucky fpe soon
after it.

Passing the enum value as integer makes the ftype == FT_PPC condition
evaluates correctly.
2014-01-07 14:21:53 +01:00
Sean McGovern
3736b13753 Changelog for 0.8.10 2014-01-07 09:43:58 +01:00
Derek Buitenhuis
48d57650f1 pthread: Fix deadlock during thread initialization
Sometimes, if pthread_create() failed, then pthread_cond_wait() could
accidentally be called in the worker threads after the uninit function
had already called pthread_cond_broadcast(), leading to a deadlock.

Don't call pthread_cond_wait() if c->done is set.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
(cherry picked from commit 1a5a6ac01b)
2014-01-07 09:43:58 +01:00
Martin Storsjö
9925f7df0a vc1dec: Make sure last_picture is initialized in vc1_decode_skip_blocks
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 5e25fdbfe0)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/vc1dec.c
(cherry picked from commit 494f2d4f9e)
2014-01-07 09:43:58 +01:00
Ben Jackson
1123870879 pthread: Avoid spurious wakeups
pthread_wait_cond can wake up unexpectedly (Wikipedia: Spurious_wakeup).

The FF_THREAD_SLICE thread mechanism could spontaneously execute
jobs or allow the caller of avctx->execute to return before all
jobs were complete.

Test both cases to ensure the wakeup is real.

Signed-off-by: Ben Jackson <ben@ben.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 311583e779)
2014-01-07 09:43:58 +01:00
Martin Storsjö
371659d1ad mpegvideo: Initialize chroma_*_shift and codec_tag even if the size is 0
This fixes breakage in a few fate tests on certain setups
(that for some reason didn't break on OS X) after the previous
commit (8812a8057). Currently, some video streams are initialized
in ff_MPV_common_init with width/height set at 0 and only changed
to a proper video size with ff_MPV_common_frame_size_change later.

The breakage was diagnosed by Anton Khirnov.

Signed-off-by: Martin Storsjö <martin@martin.st>
2014-01-07 09:43:58 +01:00
Martin Storsjö
29fa517d40 r3d: Add more input value validation
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>

Conflicts:
	libavformat/r3d.c
2014-01-07 09:43:58 +01:00
Michael Niedermayer
c00e491aeb vc1dec: Don't decode slices when the latest slice header failed to decode
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>

Conflicts:
	libavcodec/vc1dec.c
2014-01-07 09:43:58 +01:00
Martin Storsjö
fbc52044f3 fraps: Make the input buffer size checks more strict
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>

Conflicts:
	libavcodec/fraps.c
2014-01-07 09:43:58 +01:00
Martin Storsjö
49c1defee5 svq3: Avoid a division by zero
If the height is zero, the decompression will probably end up
failing due to not fitting into the allocated buffer later
anyway, so this doesn't need any more elaborate check.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 601c2015bc)
2014-01-07 09:43:58 +01:00
Martin Storsjö
871baf3127 rmdec: Validate the fps value
Abort if it is invalid if strict error checking has been requested.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 0f310a6f33)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavformat/rmdec.c
2014-01-07 09:43:58 +01:00
Martin Storsjö
591d5281f5 twinvqdec: Check the ibps parameter separately
This is required, since invalid parameters actually could
pass the switch check below.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit c77d409bf9)
(cherry picked from commit 9b9aee27f4)
2014-01-07 09:43:58 +01:00
Martin Storsjö
e972338e35 asfdec: Check the return value of asf_read_stream_properties
This makes sure errors in setting stream parameters are passed
on to the caller. This avoids successfully opening files while
some parameters aren't filled in properly.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit cc41167aed)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit fc4d11ec9b)
2014-01-07 09:43:58 +01:00
Anton Khirnov
90294e31a1 mxfdec: set audio timebase to 1/samplerate
Fixes sync in some samples (e.g. bugs 7581 and 8374 in VLC).
Based on a commit by Matthieu Bouron <matthieu.bouron@gmail.com>

Reported-by: Jean-Baptiste Kempf <jb@videolan.org>
CC: libav-stable@libav.org
(cherry picked from commit 93370d1216)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:58 +01:00
Martin Storsjö
d92c908e23 pcx: Check the packet size before assuming it fits a palette
This fixes reads out of bounds.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit d1d99e3bef)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/pcx.c
(cherry picked from commit 7e350b7ddd)
2014-01-07 09:43:58 +01:00
Martin Storsjö
cb4a101fbe rpza: Fix a buffer size check
We read 2 bytes for 15 out of 16 pixels, therefore we need to
have at least 30 bytes, not 16.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 7ba0cedbfe)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit f06e39fe6b)
2014-01-07 09:43:58 +01:00
Martin Storsjö
993977032a xan: Use bytestream2 to limit reading to within the buffer
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 30db94dc39)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 145de32896)
2014-01-07 09:43:57 +01:00
Martin Storsjö
5e8243e843 bfi: Avoid divisions by zero
If a zero-length video packet is to be returned, just return
AVERROR(EAGAIN) and switch back to the audio stream.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 9fc7184d1a)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit ad1223d6bc)
2014-01-07 09:43:57 +01:00
Martin Storsjö
159993acc7 vc1dec: Fix leaks in ff_vc1_decode_init_alloc_tables on errors
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit ede508443e)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit b62704891d)
2014-01-07 09:43:57 +01:00
Martin Storsjö
d3986f4f1b xxan: Disallow odd width
Decoded data is always written in pairs within this decoder.
This fixes writes out of bounds.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit aa0dd52434)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:57 +01:00
Martin Storsjö
5a40e4c64d pcx: Consume the whole packet if giving up due to missing palette
Previously, we returned 0, meaning successful decoding but 0
bytes consumed, leading to an infinite loop.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 9fb0de86b4)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 812955a12b)
2014-01-07 09:43:57 +01:00
Martin Storsjö
416ad3ecf2 electronicarts: Add more sanity checking for the number of channels
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit a9221e3960)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavformat/electronicarts.c
(cherry picked from commit a89868d714)
2014-01-07 09:43:57 +01:00
Martin Storsjö
b29c31c21e wnv1: Make sure the input packet is large enough
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 91be1103fd)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 0c8c6b4419)
2014-01-07 09:43:57 +01:00
Martin Storsjö
380e373267 xan: Only read within the data that actually was initialized
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit fc739b3eef)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 09ace619d6)
2014-01-07 09:43:57 +01:00
Martin Storsjö
ac1e61d559 pngdec: Stop trying to decode once inflate returns Z_STREAM_END
If the input buffer contains more data after the deflate stream,
the loop previously left running infinitely, with inflate returning
Z_STREAM_END.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit a81cad8f86)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit a63e83cd4b)
2014-01-07 09:43:57 +01:00
Martin Storsjö
7fdb915fc7 riffdec: Add sanity checks for the sample rate
This avoids a division by zero for G726.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit d07aa3f02b)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 607863acae)
2014-01-07 09:43:57 +01:00
Martin Storsjö
456a939210 dca: Validate the lfe parameter
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit a9d50bb578)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:57 +01:00
Martin Storsjö
1438181a29 mov: Make sure the read sample count is nonnegative
This avoids setting a negative number of frames, ending up with a
negative average frame rate.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit c231987662)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit c10f3fed25)
2014-01-07 09:43:57 +01:00
Martin Storsjö
35c39d2ee2 mvi: Add sanity checking for the audio frame size
This avoids a division by zero.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 28ff439efd)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 04d2f9ace3)
2014-01-07 09:43:57 +01:00
Martin Storsjö
c211ba9b59 rl2: Avoid a division by zero
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 3ca14aa596)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit ce1dacb435)
2014-01-07 09:43:57 +01:00
Martin Storsjö
213b8aa0a9 bfi: Add some very basic sanity checks for input packet sizes
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 640a2427aa)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 10f384e4f5)
2014-01-07 09:43:57 +01:00
Martin Storsjö
ea1c9424d1 xwma: Avoid division by zero
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit adc09136a4)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 2ff935a060)
2014-01-07 09:43:57 +01:00
Martin Storsjö
f23b1cc7d9 wtv: Add more sanity checks for a length read from the file
Also make sure the existing length check can't overflow.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 83c285f880)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 78dc022f6f)
2014-01-07 09:43:57 +01:00
Martin Storsjö
889bdc47f6 avidec: Make sure a packet is large enough before reading its data
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 8d07258bb6)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavformat/avidec.c
(cherry picked from commit 2e4c649b3e)
2014-01-07 09:43:57 +01:00
Martin Storsjö
e80071892b segafilm: Validate the number of audio channels
This avoids divisions by zero later.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 82e266c6d3)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 5379c5184b)
2014-01-07 09:43:57 +01:00
Martin Storsjö
efe59ad90b vqf: Make sure the bitrate is in the valid range
Even if the sample rate is valid, an invalid bitrate could
pass the mode combination test below.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 68ff998128)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 60701469ab)
2014-01-07 09:43:57 +01:00
Martin Storsjö
2c31141585 qpeg: Add checks for running out of rows in qpeg_decode_inter
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 7a5a557227)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 4d90550cf9)
2014-01-07 09:43:57 +01:00
Martin Storsjö
61d56054a9 vqf: Make sure sample_rate is set to a valid value
This avoids divisions by zero later (and possibly assertions in
time base scaling), since an invalid rate_flag combined with an
invalid bitrate below could pass the mode combination test.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 9277050e29)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 4d60ab62e0)
2014-01-07 09:43:57 +01:00
Martin Storsjö
ff8837e9c6 mpegaudiodec: Validate that the number of channels fits at the given offset
This is similar to the fix in 35cbc98b.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit e9d61de96c)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit bacf5db196)
2014-01-07 09:43:57 +01:00
Martin Storsjö
cd254e8540 vc1dec: Undo mpegvideo initialization if unable to allocate tables
Previously, s->context_initialized was left set to 1
if ff_vc1_decode_init_alloc_tables failed, skipping the
initialization completely on the next decode call.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit b772b0e28e)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:57 +01:00
Martin Storsjö
036136fa89 asv1: Verify the amount of extradata
The init function reads one byte of extradata.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit f50803354c)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:57 +01:00
Martin Storsjö
b19eafa2b9 eacmv: Make sure a reference frame exists before referencing it
This is similar to an existing check for the second-last frame
from 062421e3.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit ea78a348d8)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/eacmv.c
(cherry picked from commit 2e12af4587)
2014-01-07 09:43:56 +01:00
Martin Storsjö
486c457675 mpc8: Check the seek table size parsed from the bitstream
Limit the size to INT_MAX/2 (for simplicity) to be sure that
size + FF_INPUT_BUFFER_PADDING_SIZE won't overflow.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 459f2b393a)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit f8a72f041c)
2014-01-07 09:43:56 +01:00
Martin Storsjö
68a1df13c4 smacker: Avoid integer overflow when allocating packets
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 710b0e2702)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:56 +01:00
Martin Storsjö
75dabbff8b idroqdec: Make sure a video stream has been allocated before returning packets
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit bcbe4f3ceb)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit de75bc01cd)
2014-01-07 09:43:56 +01:00
Martin Storsjö
e3ba6ff935 mpeg4videodec: Check the width/height in mpeg4_decode_sprite_trajectory
This avoids a potential division by zero.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit f875a732e3)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit c8c93795e4)
2014-01-07 09:43:56 +01:00
Michael Niedermayer
b81d804f2a zmbvdec: Check the buffer size for uncompressed data
Also don't pointlessly set the buffer size to 1 after copying
one packet.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 0d61f26001)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:56 +01:00
Martin Storsjö
61032c577d smacker: Don't return packets in unallocated streams
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 8d928023f9)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:56 +01:00
Martin Storsjö
3b169044ca rv10: Validate the dimensions set from the container
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 5372cda671)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 0b0f1cd44e)
2014-01-07 09:43:56 +01:00
Martin Storsjö
843b330c3c ivi_common: Make sure color planes have been initialized
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit a92538b7c0)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 38bd229af9)
2014-01-07 09:43:56 +01:00
Martin Storsjö
f241d5aa1f ape: Don't allow the seektable to be omitted
The seektable is required for filling in ape->frames[i].pos
further down.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 183b9d843a)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:56 +01:00
Martin Storsjö
e01d623e01 dsicin: Add some basic sanity checks for fields read from the file
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 48d6556dd4)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:56 +01:00
Martin Storsjö
0a23055b8a xmv: Add more sanity checks for parameters read from the bitstream
Since the number of channels is multiplied by 36 and assigned to
to a uint16_t, make sure this calculation didn't overflow. (In
certain cases the calculation could overflow leaving the
truncated block_align at 0, leading to divisions by zero later.)

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit d4c2a3740f)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 00516b5491)
2014-01-07 09:43:56 +01:00
Martin Storsjö
33b88170d7 oggparseogm: Convert to use bytestream2
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 19b9659f31)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:56 +01:00
Martin Storsjö
7d8a4bb8d2 shorten: Break out of loop looking for fmt chunk if none is found
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit b26742cc30)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:56 +01:00
Martin Storsjö
2b71a78841 ffv1: Make sure at least one slice context is initialized
This avoids crashes when initializing the range coder for
the first slice context.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit b1db33159f)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:56 +01:00
Martin Storsjö
f0db793bee rv34: Check the return value from ff_rv34_decode_init
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 711c970168)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 20c8f17629)
2014-01-07 09:43:56 +01:00
Martin Storsjö
712945d21e shorten: Use a checked bytestream reader for the wave header
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 49568851bf)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:56 +01:00
Martin Storsjö
2ef84218b2 truemotion2: Use av_freep properly in an error path
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit c39f7eba01)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit eac1c3f384)
2014-01-07 09:43:56 +01:00
Martin Storsjö
75f811babc matroskadec: Verify realaudio codec parameters
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 569d18aa9d)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 9f7a8b8f8f)
2014-01-07 09:43:56 +01:00
Martin Storsjö
d5c104c1ae smacker: Make sure we don't fill in huffman codes out of range
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 0679cec6e8)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2014-01-07 09:43:56 +01:00
Martin Storsjö
48f27c854f mace: Make sure that the channel count is set to a valid value
Also return a proper error code.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit e1f3847f86)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/mace.c
2014-01-07 09:43:56 +01:00
Martin Storsjö
802deb2d13 svq3: Check for any negative return value from ff_h264_check_intra_pred_mode
Also pass on any returned error code.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 1115689d54)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/svq3.c
2014-01-07 09:43:56 +01:00
Martin Storsjö
290783b848 vp3: Check the framerate for validity
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 6fc8226e29)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit b4c479a82a)
2014-01-07 09:43:56 +01:00
Martin Storsjö
7f80928c0e cavsdec: Make sure a sequence header has been decoded before decoding pictures
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit e90a6846c2)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/cavsdec.c
2014-01-07 09:43:56 +01:00
Martin Storsjö
b9e90b36cd sierravmd: Do sanity checking of frame sizes
Limit the size to INT_MAX/2 (for simplicity) to be sure that
size + BYTES_PER_FRAME_RECORD won't overflow.

Also factorize other existing error return paths.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 0ef1660a63)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 153deed18b)
2014-01-07 09:43:56 +01:00
Martin Storsjö
7981b5c20e omadec: Properly check lengths before incrementing the position
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 342c43d154)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 9eba02d5dd)
2014-01-07 09:43:56 +01:00
Martin Storsjö
9291012d52 mpc8: Make sure the first stream exists before parsing the seek table
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 17d57848fc)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 557df77eab)
2014-01-07 09:43:56 +01:00
Martin Storsjö
594b843608 arm: Don't clobber callee saved registers in scalarproduct
q4-q7/d8-d15 are supposed to not be clobbered by the callee.

CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit d307e408d4)
2013-12-21 10:00:23 +01:00
Martin Storsjö
b6fc0127ce arm: Don't clobber callee saved registers in scalarproduct
q4-q7/d8-d15 are supposed to not be clobbered by the callee.

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

Signed-off-by: Martin Storsjö <martin@martin.st>
2013-12-20 22:09:24 +02:00
Reinhard Tartler
b997a6a86d Prepare for 0.8.10 Release 2013-12-14 14:34:28 -05:00
Michael Niedermayer
6f6cd7dbe5 roqvideodec: check dimensions validity
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3ae6104511)

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

CC: libav-stable@libav.org

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 488f87be87)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 52b18c1fde)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-12-14 14:31:29 -05:00
Michael Niedermayer
b5736759ee qdm2: check array index before use, fix out of array accesses
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

(cherry picked from commit a7ee6281f7)

CC: libav-stable@libav.org

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 39bec05ed4)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 0b2b8ab979)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-12-14 14:31:03 -05:00
Reinhard Tartler
d4a24e43ed alsdec: check block length
Fix writing over the end

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Addresses: CVE-2013-0845
(cherry picked from commit 2a0fb7286d)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 3f7d89034b)
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-12-14 14:30:24 -05:00
Michael Niedermayer
58e212c1fb avcodec/jpeglsdec: check err value for ls_get_code_runterm()
Fixes infinite loop
Fixes Ticket3086

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 20:49:49 +01:00
Michael Niedermayer
4ddbe89d40 avfilter/ff_insert_pad: fix order of operations
Fixes out of bounds access
Fixes CID732170
Fixes CID732169

No filter is known to use this function in a way so the issue can be reproduced.

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

Conflicts:

	libavfilter/avfilter.c
(cherry picked from commit 86591b244f3a27293153896813f5569b49b2f5c0)

Conflicts:

	libavfilter/avfilter.c
(cherry picked from commit 400c4f8fa3fd58951dc3f356b2b00484e3363694)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 20:49:49 +01:00
Michael Niedermayer
d83dff2e09 update for 0.10.10
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 20:07:44 +01:00
Michael Niedermayer
5e708b4de3 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  Changelog for 0.8.9

Conflicts:
	Changelog

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 19:44:53 +01:00
Michael Niedermayer
8528feb13c Merge commit 'd2f4846591727fedcc2b452b688da8da09ee8305' into release/0.10
* commit 'd2f4846591727fedcc2b452b688da8da09ee8305':
  Prepare for 0.8.7 Release
  x86: fft: Remove 3DNow! optimizations, they break FATE
  x86: ac3dsp: Drop mmx variant of ac3_max_msb_abs_int16

Conflicts:
	RELEASE
	libavcodec/x86/fft_3dn.c
	libavcodec/x86/fft_3dn2.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 19:34:04 +01:00
Michael Niedermayer
2e57d4ba24 Merge commit '2ed8a550da524434deb3b89f7ec62ed833bedac5' into release/0.10
* commit '2ed8a550da524434deb3b89f7ec62ed833bedac5':
  aac: Check init_get_bits return value
  aac: return meaningful errors
  dsicinav: K&R formatting cosmetics

Conflicts:
	libavcodec/dsicinav.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 19:20:29 +01:00
Michael Niedermayer
7c72398787 Merge commit '86d0bf0e96bf917e283d24239ce0eed08351da86' into release/0.10
* commit '86d0bf0e96bf917e283d24239ce0eed08351da86':
  mov: Seek back if overreading an individual atom
  vcr1: add sanity checks
  pictordec: pass correct context to avpriv_request_sample
  dsicinav: Clip the source size to the expected maximum
  alsdec: Clean up error paths
  ogg: Fix potential infinite discard loop
  nuv: check rtjpeg_decode_frame_yuv420 return value

Conflicts:
	libavcodec/pictordec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 19:07:21 +01:00
Michael Niedermayer
048e284201 Merge commit 'abb41f19cc10fea09fb16d9ecc9967b2a78cf7b0' into release/0.10
* commit 'abb41f19cc10fea09fb16d9ecc9967b2a78cf7b0':
  nuv: Reset the frame on resize
  nuv: Use av_fast_realloc
  nuv: return meaningful error codes.

Conflicts:
	libavcodec/nuv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 19:01:17 +01:00
Michael Niedermayer
e31518e86e Merge commit '36fc320747a768335ae4538a24a5739033b7eb74' into release/0.10
* commit '36fc320747a768335ae4538a24a5739033b7eb74':
  nuv: Pad the lzo outbuf
  nuv: Do not ignore lzo decompression failures
  oma: correctly mark and decrypt partial packets
  oma: check geob tag boundary

Conflicts:
	libavcodec/nuv.c
	libavformat/omadec.c
	tests/ref/fate/nuv

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 18:50:55 +01:00
Michael Niedermayer
1c896e865c Merge commit 'e930b112d14d7acd050d5087d11b6dd4c56a8e4e' into release/0.10
* commit 'e930b112d14d7acd050d5087d11b6dd4c56a8e4e':
  oma: refactor seek function
  8bps: Bound-check the input buffer
  rtmp: Do not misuse memcmp

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 18:04:29 +01:00
Michael Niedermayer
39d76907c9 Merge commit '067713f15989dd0b8c0888a3b43fd193819a1058' into release/0.10
* commit '067713f15989dd0b8c0888a3b43fd193819a1058':
  rtmp: rename data_size to size
  lavc: set the default rc_initial_buffer_occupancy
  4xm: Reject not a multiple of 16 dimension

Conflicts:
	avconv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 18:00:15 +01:00
Michael Niedermayer
1825d6d096 Merge commit '12dc01bb1f07112cd7eb31e183d75cb3c0fb92ca' into release/0.10
* commit '12dc01bb1f07112cd7eb31e183d75cb3c0fb92ca':
  4xm: do not overread the prestream buffer

Conflicts:
	libavcodec/4xm.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 17:51:21 +01:00
Michael Niedermayer
a5115752ca Merge commit 'cd9b0bb07a66d3299bd62922e9dfa742219abe79' into release/0.10
* commit 'cd9b0bb07a66d3299bd62922e9dfa742219abe79':
  4xm: validate the buffer size before parsing it
  indeo: Do not reference mismatched tiles
  indeo: Sanitize ff_ivi_init_planes fail paths

Conflicts:
	libavcodec/4xm.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 17:33:44 +01:00
Michael Niedermayer
cb297f6ae7 Merge commit 'a0b8f85f29883f538a32593bc3c6f712c972ff70' into release/0.10
* commit 'a0b8f85f29883f538a32593bc3c6f712c972ff70':
  indeo: Bound-check before applying motion compensation
  indeo: Bound-check before applying transform
  indeo: reject negative array indexes
  indeo: Cosmetic formatting

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 16:41:04 +01:00
Michael Niedermayer
3667874833 Merge commit 'c5da487a38f93b981c4933d4e0b09c49c319fbb7' into release/0.10
* commit 'c5da487a38f93b981c4933d4e0b09c49c319fbb7':
  indeo: Refactor ff_ivi_init_tiles and ivi_decode_blocks
  indeo: Refactor ff_ivi_dec_huff_desc

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-11-04 16:10:53 +01:00
Reinhard Tartler
ae9652605a Changelog for 0.8.9 2013-11-02 10:31:35 -04:00
Reinhard Tartler
d2f4846591 Prepare for 0.8.7 Release 2013-11-02 10:17:43 -04:00
Diego Biurrun
62c8bf00bb x86: fft: Remove 3DNow! optimizations, they break FATE 2013-10-30 19:19:44 +01:00
Diego Biurrun
a1b82c6b1c x86: ac3dsp: Drop mmx variant of ac3_max_msb_abs_int16
The function accidentally uses mmxext instructions, so it causes sigill
on mmx-only CPUs and provides no benefit on CPUs with mmxext available.

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-10-29 17:03:25 +01:00
Luca Barbato
2ed8a550da aac: Check init_get_bits return value
Some code paths can call it with invalid length.

CC: libav-stable@libav.org
(cherry picked from commit 71953ebcf9)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-10-28 14:16:37 +01:00
Martin Storsjö
86d0bf0e96 mov: Seek back if overreading an individual atom
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Cc: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 5b4eb243bc)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavformat/mov.c
2013-10-28 14:16:37 +01:00
Luca Barbato
ef67d8107e aac: return meaningful errors
(cherry picked from commit 07c52e2c7c)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/aacdec.c
2013-10-28 14:16:37 +01:00
Anton Khirnov
be8b796f55 vcr1: add sanity checks
Fixes invalid reads with corrupted files.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 8aba7968dd)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/vcr1.c
2013-10-28 14:16:37 +01:00
Luca Barbato
8119336df4 dsicinav: K&R formatting cosmetics
(cherry picked from commit fcae3ff124)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/dsicinav.c
2013-10-28 14:16:37 +01:00
Anton Khirnov
8297853917 pictordec: pass correct context to avpriv_request_sample
Fixes invalid reads.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry-picked from commit fe9bb61f9a)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/pictordec.c
2013-10-28 14:16:37 +01:00
Luca Barbato
b8ba48c725 dsicinav: Clip the source size to the expected maximum
A packet larger than cin->bitmap_size does not make sense.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit fd81899321)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/dsicinav.c
2013-10-28 14:16:37 +01:00
Luca Barbato
1682c9fb59 alsdec: Clean up error paths
Fix at least a memory leak.

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/alsdec.c
2013-10-28 14:16:37 +01:00
Reimar Döffinger
5971631d84 ogg: Fix potential infinite discard loop
Seeking in certain broken files would cause ogg_read_timestamp
to fail because ogg_packet would go into a state where all packets
of stream 1 would be discarded until the end of the stream.

Bug-Id: 553
CC: libav-stable@libav.org

Signed-off-by: Jan Gerber <j@v2v.cc>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 9a27acae9e)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavformat/oggdec.c
2013-10-28 14:16:37 +01:00
Michael Niedermayer
c08127c5e6 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 1e5271a9fd)
2013-10-27 19:53:11 +01:00
Michael Niedermayer
558c1f35fa 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 08a8976196)

Conflicts:
	libavcodec/h264_refs.c
2013-10-26 01:27:53 +02:00
Michael Niedermayer
8096691a68 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 5ac6b6028f)

Conflicts:
	libavcodec/h264_refs.c
2013-10-24 11:49:04 +02:00
Luca Barbato
abb41f19cc nuv: Reset the frame on resize
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/nuv.c
2013-10-16 23:05:51 +02:00
Luca Barbato
36fc320747 nuv: Pad the lzo outbuf
And properly update the buf_size with the correct size.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 075dbc1855)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/nuv.c
2013-10-16 23:05:51 +02:00
Luca Barbato
4a11d773f9 nuv: check rtjpeg_decode_frame_yuv420 return value
CC: libav-stable@libav.org
(cherry picked from commit 85ac12587b)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/nuv.c
2013-10-16 23:05:51 +02:00
Luca Barbato
c1ebdef01b nuv: Use av_fast_realloc
The decompressed buffer can be used after codec_reinit, so it must be
preserved.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 2df0776c22)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/nuv.c
2013-10-16 23:05:51 +02:00
Luca Barbato
cda26ab21e nuv: Do not ignore lzo decompression failures
Update the fate reference since the last broken frame is not decoded
anymore.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit aae159a7cc)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/nuv.c
2013-10-16 23:05:51 +02:00
Anton Khirnov
d2eddcfc83 nuv: return meaningful error codes.
(cherry picked from commit 3344f5cb74)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/nuv.c
2013-10-16 23:05:51 +02:00
Luca Barbato
3cc05e0d9d oma: correctly mark and decrypt partial packets
Incomplete crypted files would lead to a read after buffer boundary
otherwise.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 2219e27b5b)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavformat/omadec.c
2013-10-16 23:05:51 +02:00
Luca Barbato
b98a824c3e oma: check geob tag boundary
Prevent read after buffer boundary on corrupted tag.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 9d0b45ade8)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavformat/omadec.c
2013-10-16 23:05:51 +02:00
Luca Barbato
e930b112d1 oma: refactor seek function
Properly propagate seek errors from avio and the generic pcm seek.

(cherry picked from commit 4f03a77e52)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavformat/omadec.c
2013-10-16 23:05:50 +02:00
Luca Barbato
067713f159 rtmp: rename data_size to size
(cherry picked from commit ba5393a609)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavformat/rtmppkt.c
	libavformat/rtmpproto.c
2013-10-16 23:05:50 +02:00
Luca Barbato
5312fb8287 8bps: Bound-check the input buffer
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit bd7b4da0f4)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/8bps.c
2013-10-16 23:05:50 +02:00
Luca Barbato
a9ebc17b2d rtmp: Do not misuse memcmp
CC: libav-stable@libav.org
(cherry picked from commit 5718e3487b)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavformat/rtmppkt.h
	libavformat/rtmpproto.c
2013-10-16 23:05:50 +02:00
Luca Barbato
2da49df19e lavc: set the default rc_initial_buffer_occupancy
rc_buffer_size is not set before.

Solve the initial the rate control underflow issue reported in
bug 222.

CC: libav-stable@libav.org

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit bff3607547)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-10-16 22:54:30 +02:00
Luca Barbato
c25bbb6fdb 4xm: Reject not a multiple of 16 dimension
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 2f034f255c)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-29 22:37:12 +02:00
Luca Barbato
12dc01bb1f 4xm: do not overread the prestream buffer
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit be373cb50d)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-29 22:37:06 +02:00
Luca Barbato
cd9b0bb07a 4xm: validate the buffer size before parsing it
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit de2e5777e2)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-29 22:37:03 +02:00
Luca Barbato
53c76b6803 indeo: Do not reference mismatched tiles
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit f9e5261cab)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-29 21:48:57 +02:00
Luca Barbato
7999ff8966 indeo: Sanitize ff_ivi_init_planes fail paths
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 28dda8a691)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-29 21:48:30 +02:00
Luca Barbato
a0b8f85f29 indeo: Bound-check before applying motion compensation
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 25a6666f6c)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-29 21:41:49 +02:00
Luca Barbato
c02b9e6e63 indeo: Bound-check before applying transform
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit dc79685195)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/ivi_common.c
2013-09-29 21:41:12 +02:00
Luca Barbato
efe710f8a0 indeo: reject negative array indexes
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org

(cherry picked from commit 6a10142faa)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-29 21:39:02 +02:00
Luca Barbato
aedde1a48d indeo: Cosmetic formatting
Trim some overly long lines.

(cherry picked from commit 6dfacd7ab1)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/ivi_common.c
2013-09-29 21:38:28 +02:00
Luca Barbato
c5da487a38 indeo: Refactor ff_ivi_init_tiles and ivi_decode_blocks
Spin large and mostly self contained blocks into stand alone
functions.

(cherry picked from commit 62256010e9)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-29 21:19:17 +02:00
Luca Barbato
f21dce6044 indeo: Refactor ff_ivi_dec_huff_desc
Spare an indentation level.

(cherry picked from commit f6f36ca8ca)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-29 21:03:27 +02:00
Mashiat Sarker Shakkhar
89d56f3be1 vc1dec: Do not use random pred_flag if motion vector data is skipped
This fixes SA10143.vc1 from test-suite. Also partially fixes MC-VC1.ts
from videolan streams archive.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-27 03:03:40 +02:00
Michael Niedermayer
0d1ae06fe9 update for 0.10.9
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-27 02:52:04 +02:00
Michael Niedermayer
f66ecdb1b4 avcodec: add emuedge_linesize_type
Currently all uses of the emu edge code as well as the code itself
assume int linesize
changing some but not changing all would introduce a security issue
once all use this typedef a simple search and replace can be
done to switch them all to ptrdiff_t

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

Conflicts:

	libavcodec/mpegvideo_common.h
	libavcodec/videodsp.h
	libavcodec/videodsp_template.c
	libavcodec/x86/videodsp_init.c
2013-09-27 02:52:04 +02:00
Michael Niedermayer
f6057c5a62 avcodec/ffv1enc: update buffer check for 16bps
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3728603f18)

Conflicts:

	libavcodec/ffv1enc.c
(cherry picked from commit c900c6e5c26cd86cf34f9c8d4347cedbd01f3935)
2013-09-27 02:52:04 +02:00
Michael Niedermayer
f3dc3bef4b avcodec/truemotion2: Fix av_freep arguments
Fixes null pointer dereference
Fixes Ticket2944

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

Conflicts:

	libavcodec/truemotion2.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-27 02:52:04 +02:00
Michael Niedermayer
4a5bb426e2 avcodec/mjpegdec: Add some sanity checks to ljpeg_decode_rgb_scan()
These prevent the rgb ljpeg code from being run on parameters that it doesnt
support. No testcase available but it seems possible to trigger these.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-27 02:52:04 +02:00
Michael Niedermayer
a99aff4e4b avcodec/dsputil: fix signedness in sizeof() comparissions
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 454a11a1c9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-27 02:52:04 +02:00
Michael Niedermayer
9300b1f64e 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 86736f59d6)

Conflicts:

	libavcodec/pngdsp.c
2013-09-27 02:52:04 +02:00
Michael Niedermayer
5230f1529a matroska_read_seek: Fix used streams for subtitle index compensation
Might fix Ticket1907 (I have no testcase so i cant test)

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-27 00:35:00 +02:00
Michael Niedermayer
1a311ad99a jpeg2000: check log2_cblk dimensions
Fixes out of array access
Fixes Ticket2895

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 9a271a9368)

Conflicts:

	libavcodec/jpeg2000dec.c

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

Conflicts:

	libavcodec/j2kdec.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-27 00:35:00 +02:00
Michael Niedermayer
ef8145270f avcodec/rpza: Perform pointer advance and checks before using the pointers
Fixes out of array accesses
Fixes Ticket2850

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-27 00:18:12 +02:00
Michael Niedermayer
e288124394 avcodec/flashsv: check diff_start/height
Fixes out of array accesses
Fixes Ticket2844

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-27 00:18:12 +02:00
Michael Niedermayer
20854f9bff avcodec/parser: reset indexes on realloc failure
Fixes Ticket2982

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-26 23:24:52 +02:00
Michael Niedermayer
d8af960e7e Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  lavf: fix the comparison in an overflow check

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-26 00:27:46 +02:00
Michael Niedermayer
c8ca385676 Merge commit 'b0ca5fef09d1b1268ea0c8f89bf53cd38aaa85e7' into release/0.10
* commit 'b0ca5fef09d1b1268ea0c8f89bf53cd38aaa85e7':
  dv: Add a guard to not overread the ppcm array
  mpegvideo: Avoid 32-bit wrapping of linesize multiplications
  mjpegb: Detect changing number of planes in interlaced video
  matroskadec: Check that .lang was allocated and set before reading it
  ape demuxer: check for EOF in potentially long loops
  lavf: avoid integer overflow when estimating bitrate
  pictordec: break out of both decoding loops when y drops below 0
  ac3: Return proper error codes

Conflicts:
	libavcodec/pictordec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-26 00:18:12 +02:00
Michael Niedermayer
c6a4397410 Merge commit '37e69e2dee7c5167083bb42d669f73f038111a79' into release/0.10
* commit '37e69e2dee7c5167083bb42d669f73f038111a79':
  ac3: Clean up the error paths
  ac3: Do not clash with normal AVERROR
  dxa: Make sure the reference frame exists
  h261: check the mtype index
  segafilm: Error out on impossible packet size
  ogg: Always alloc the private context in vorbis_header
  vc1: check mb_height validity.

Conflicts:
	libavcodec/h261dec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-25 23:35:30 +02:00
Michael Niedermayer
210a437e10 Merge commit '54e03863691dcae73260f70108b3731b70773e7c' into release/0.10
* commit '54e03863691dcae73260f70108b3731b70773e7c':
  vc1: check the source buffer in vc1_mc functions
  bink: Bound check the quantization matrix.
  xl: Make sure the width is valid
  alsdec: Fix the clipping range
  dsicinav: Bound-check the source buffer when needed
  mov: Do not allow updating the time scale after it has been set
  ac3dec: Don't consume more data than the actual input packet size
  indeo: Reject impossible FRAMETYPE_NULL

Conflicts:
	libavcodec/alsdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-25 23:03:08 +02:00
Michael Niedermayer
3308b443f9 Merge commit 'e2dcb8208e8f6cffef58a85127765047f5ef8868' into release/0.10
* commit 'e2dcb8208e8f6cffef58a85127765047f5ef8868':
  indeo5: return proper error codes
  indeo4: Validate scantable dimension

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-25 22:55:03 +02:00
Michael Niedermayer
91ad27e8f5 Merge commit '06c52faef27e5bded4ceda7e6d1541f9fb20e84c' into release/0.10
* commit '06c52faef27e5bded4ceda7e6d1541f9fb20e84c':
  indeo4: Check the quantization matrix index
  indeo4: Do not access missing reference MV

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-25 22:54:14 +02:00
Anton Khirnov
9978c24abf lavf: fix the comparison in an overflow check
CC: libav-stable@libav.org

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 26f027fba1)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:54:13 -04:00
Luca Barbato
b0ca5fef09 dv: Add a guard to not overread the ppcm array
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 7ee191cab0)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavformat/dv.c
2013-09-23 19:54:02 -04:00
Martin Storsjö
5473d23ece mpegvideo: Avoid 32-bit wrapping of linesize multiplications
This makes sure that linesize * start_y doesn't overflow, so that
emulated_edge_mc can get back the original value if needed.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit a711a2cb47)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:53:02 -04:00
Michael Niedermayer
7a9af1da39 mjpegb: Detect changing number of planes in interlaced video
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit af11fa5409)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:52:45 -04:00
Martin Storsjö
068c867286 matroskadec: Check that .lang was allocated and set before reading it
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 5bcd3ae5b1)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:50:54 -04:00
Anton Khirnov
23f73fc241 ape demuxer: check for EOF in potentially long loops
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry-picked from commit 488b2984fe)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:48:52 -04:00
Anton Khirnov
8d2a86a290 lavf: avoid integer overflow when estimating bitrate
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit df33a58e53)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:47:41 -04:00
Anton Khirnov
5773065a71 pictordec: break out of both decoding loops when y drops below 0
Otherwise picmemset can get called with negative y, resulting in an
invalid write.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 5f7aecde02)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:46:49 -04:00
Luca Barbato
c225c620c6 ac3: Return proper error codes
(cherry picked from commit b1f9cdc37f)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:45:33 -04:00
Luca Barbato
37e69e2dee ac3: Clean up the error paths
(cherry picked from commit 818d1f1a3e)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:45:22 -04:00
Luca Barbato
3dff283de1 ac3: Do not clash with normal AVERROR
The parsing function return AVERROR and AAC_AC3_PARSE_ERROR values,
make sure they are not misunderstood.

(cherry picked from commit 6258d362b8)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:45:05 -04:00
Luca Barbato
86c169c5b6 dxa: Make sure the reference frame exists
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 5ef7c84a93)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/dxa.c
2013-09-23 19:43:07 -04:00
Luca Barbato
91355bec88 h261: check the mtype index
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit c59967fa7c)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/h261dec.c
2013-09-23 19:42:57 -04:00
Luca Barbato
54e0386369 vc1: check the source buffer in vc1_mc functions
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 090cd06311)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/vc1dec.c
2013-09-23 19:41:09 -04:00
Luca Barbato
896baaaad8 segafilm: Error out on impossible packet size
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 5268bd2900)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:41:09 -04:00
Luca Barbato
15620c153a ogg: Always alloc the private context in vorbis_header
It is possible to have an initial broken header and then valid packets.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 3562684db7)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:41:09 -04:00
Luca Barbato
75b1b13aff vc1: check mb_height validity.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 43bacd5b7d)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:41:09 -04:00
Luca Barbato
9c779b5dd0 bink: Bound check the quantization matrix.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 9991298f2c)
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:41:08 -04:00
Luca Barbato
8006716f21 xl: Make sure the width is valid
CC: libav-stable@libav.org
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:25:50 -04:00
Luca Barbato
246e0e2c99 alsdec: Fix the clipping range
mcc_weightings is only 32 elements.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 70ecc175c7)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:22:22 -04:00
Luca Barbato
0d24adbe8d dsicinav: Bound-check the source buffer when needed
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit dd0bfc3a6a)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:18:39 -04:00
Martin Storsjö
a593d2e92e mov: Do not allow updating the time scale after it has been set
The time scale is set in mdhd, and later validated in the
enclosing trak atom once all of its children have been parsed.

A loose mdhd atom outside of a trak atom could update the time
scale of the last stream without any validation.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Cc: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 31931520df)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:16:04 -04:00
Martin Storsjö
729143e2d2 ac3dec: Don't consume more data than the actual input packet size
This was handled properly in the normal return case at the end
of the function, but not in this special case.

Returning a value larger than the input packet size can cause
problems for certain library users.

Returning the actual input buffer size unconditionally, since
it is not guaranteed that frame_size is set to a sensible
value at this point.

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:14:14 -04:00
Luca Barbato
36921fcdd3 indeo: Reject impossible FRAMETYPE_NULL
A frame marked FRAMETYPE_NULL cannot be scalable and requires a
previous frame successfully decoded.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 5b2a29552c)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:11:37 -04:00
Luca Barbato
e2dcb8208e indeo5: return proper error codes
(cherry picked from commit b0eeb9d442)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 19:09:10 -04:00
Luca Barbato
609345cd5e indeo4: Validate scantable dimension
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit cd78e934c2)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 18:54:13 -04:00
Luca Barbato
06c52faef2 indeo4: Check the quantization matrix index
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 6255ccf7d5)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-23 18:53:01 -04:00
Luca Barbato
ba5dfc25ee indeo4: Do not access missing reference MV
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 8435bca087)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:

	libavcodec/indeo4.c
2013-09-23 18:52:16 -04:00
Michael Niedermayer
9e552b6512 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  adpcm: Unbreak ima-dk4
  ac3dec: validate channel output mode against channel count
  dca: Respect the current limits in the downmixing capabilities

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-22 13:51:05 +02:00
Michael Niedermayer
506ad68d87 Merge commit 'ce3ce08850f1690dff01d9bb4ed6a4274d52771e' into release/0.10
* commit 'ce3ce08850f1690dff01d9bb4ed6a4274d52771e':
  dca: Error out on missing DSYNC
  pcm: always use codec->id instead of codec_id
  mlpdec: Do not set invalid context in read_restart_header
  pcx: Do not overread source buffer in pcx_rle_decode
  wmavoice: conceal clearly corrupted blocks
  iff: Do not read over the source buffer
  qdm2: Conceal broken samples

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-22 13:28:52 +02:00
Luca Barbato
ef475620b5 adpcm: Unbreak ima-dk4
Was broken by commit b9dea1a085

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-22 13:20:59 +02:00
Michael Niedermayer
a88ed5a481 Merge commit 'b64bd2e18bac1bd3e3e0ae4aebcad1c33f031c66' into release/0.10
* commit 'b64bd2e18bac1bd3e3e0ae4aebcad1c33f031c66':
  qdm2: refactor joined stereo support
  adpcm: Write the correct number of samples for ima-dk4
  imc: Catch a division by zero
  atrac3: Error on impossible encoding/channel combinations

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-22 13:18:27 +02:00
Luca Barbato
f33d5af1f3 imc: Catch a division by zero
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit bbf6a4aa20)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/imc.c
2013-09-22 12:16:19 +02:00
Luca Barbato
93c524c0f0 atrac3: Error on impossible encoding/channel combinations
Joint stereo encoded mono is impossible.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 50cf5a7fb7)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/atrac3.c
2013-09-22 12:16:19 +02:00
Luca Barbato
68b1008719 adpcm: Unbreak ima-dk4
Was broken by commit b9dea1a085
2013-09-21 15:33:11 +02:00
Justin Ruggles
763519536b ac3dec: validate channel output mode against channel count
Damaged frames can lead to a mismatch, which can cause a segfault
due to using an incorrect channel mapping.

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

Conflicts:

	libavcodec/ac3dec.c
2013-09-21 15:21:54 +02:00
Luca Barbato
521cbcb7d3 dca: Respect the current limits in the downmixing capabilities
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 3802833bc1)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-21 15:19:06 +02:00
Luca Barbato
ce3ce08850 dca: Error out on missing DSYNC
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit f261e50845)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-21 15:17:28 +02:00
Luca Barbato
62c3547539 pcm: always use codec->id instead of codec_id
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit c82da343e6)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/pcm.c
2013-09-21 15:15:34 +02:00
Luca Barbato
47baf9ca87 mlpdec: Do not set invalid context in read_restart_header
The faulty values rippled further down the codepath causing a
hard-to-track segfault in the assembly code.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit e9d394f3fa)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/mlpdec.c
2013-09-21 15:14:29 +02:00
Luca Barbato
9c3c08ba98 pcx: Do not overread source buffer in pcx_rle_decode
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 3abde1a3b4)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-21 15:11:27 +02:00
Luca Barbato
9c05debdcd wmavoice: conceal clearly corrupted blocks
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit d14a26edb7)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-21 15:11:18 +02:00
Luca Barbato
195b9f290c iff: Do not read over the source buffer
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 7d65e960c7)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/iff.c
2013-09-21 15:11:07 +02:00
Luca Barbato
57efb6d94c qdm2: Conceal broken samples
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 4ecdb5ed44)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/qdm2.c
2013-09-21 15:08:50 +02:00
Luca Barbato
b64bd2e18b qdm2: refactor joined stereo support
qdm2 does support only two channels. Loop over the run once.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit adadc3f244)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-21 15:02:49 +02:00
Michael Niedermayer
cb198f945f Merge commit 'e06623c48030530b50f00cee26f1a3a33c4b4d4b' into release/0.10
* commit 'e06623c48030530b50f00cee26f1a3a33c4b4d4b':
  atrac3: set the getbits context the right buffer_end

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-14 11:30:23 +02:00
Michael Niedermayer
e27bc85b31 Merge commit '09a098fb8bc7d70a0258b3e8d658833c8d11debe' into release/0.10
* commit '09a098fb8bc7d70a0258b3e8d658833c8d11debe':
  atrac3: fix error handling
  qdm2: check and reset dithering index per channel

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-14 11:06:02 +02:00
Michael Niedermayer
3f4fb49d1b Merge commit '26589aa81028f42c763c5581a1486a271799890b' into release/0.10
* commit '26589aa81028f42c763c5581a1486a271799890b':
  westwood_vqa: do not free extradata on error in read_header
  vqavideo: check the version
  rmdec: Use the AVIOContext given as parameter in rm_read_metadata()
  avio: Handle AVERROR_EOF in the same way as the return value 0

Conflicts:
	libavcodec/vqavideo.c
	libavformat/westwood_vqa.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-14 10:59:37 +02:00
Michael Niedermayer
d06dda65b4 Merge commit '139f352daf84e005824562e0e0f36e06ac60ee36' into release/0.10
* commit '139f352daf84e005824562e0e0f36e06ac60ee36':
  wtv: Mark attachment with a negative stream id
  avidec: Let the inner dv demuxer take care of discarding

Conflicts:
	libavformat/wtv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-09-14 10:26:56 +02:00
Luca Barbato
b9dea1a085 adpcm: Write the correct number of samples for ima-dk4
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 12576afe20)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/adpcm.c
2013-09-13 15:50:41 +02:00
Luca Barbato
90acd3bfe7 imc: Catch a division by zero
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit bbf6a4aa20)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/imc.c
2013-09-13 15:49:23 +02:00
Luca Barbato
40ee4de6a6 atrac3: Error on impossible encoding/channel combinations
Joint stereo encoded mono is impossible.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 50cf5a7fb7)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/atrac3.c
2013-09-13 15:47:43 +02:00
Luca Barbato
e06623c480 atrac3: set the getbits context the right buffer_end
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 22e76ec635)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/atrac3.c
2013-09-13 15:44:49 +02:00
Luca Barbato
09a098fb8b atrac3: fix error handling
decode_tonal_components returns a proper AVERROR.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 874c8a17ac)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/atrac3.c
2013-09-13 15:42:08 +02:00
Luca Barbato
7296ee7af1 qdm2: check and reset dithering index per channel
Checking per subband would have the index exceed the
dithering noise table size.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 744a11c996)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/qdm2.c
2013-09-13 15:39:06 +02:00
Luca Barbato
26589aa810 westwood_vqa: do not free extradata on error in read_header
The extradata is already freed by avformat_open_input on
failure.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 76f5dfbfd9)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-13 15:27:55 +02:00
Luca Barbato
c6942a4b03 vqavideo: check the version
Prevent out of buffer write.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit c4abc9098c)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-13 15:26:52 +02:00
Michael Niedermayer
fe8b5a37d5 rmdec: Use the AVIOContext given as parameter in rm_read_metadata()
This fixes crashes when playing back certain RealRTSP streams.

When invoked from the RTP depacketizer, the full realmedia
demuxer isn't invoked, but only certain functions from it, where
a separate AVIOContext is passed in as parameter (for the buffer
containing the data to parse). The functions called from within
those entry points should only be using that parameter, not
s->pb. In the depacketizer case, s is the RTSP context, where ->pb
is null.

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-13 15:26:39 +02:00
Michael Niedermayer
42ad4178fd avio: Handle AVERROR_EOF in the same way as the return value 0
This makes sure the ffurl_read_complete function actually
returns the number of bytes read, as the documentation of the
function says, even if the underlying protocol uses AVERROR_EOF
instead of 0.

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-13 15:24:51 +02:00
Luca Barbato
139f352daf wtv: Mark attachment with a negative stream id
A sid 0 would be mismatched to the attachment.

Prevent NULL pointer dereference.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit f5e646a00a)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-09-13 15:24:36 +02:00
Luca Barbato
c69b4bdf58 avidec: Let the inner dv demuxer take care of discarding
(cherry picked from commit c8f0b20b4a)

CC: libav-stable@libav.org
2013-09-13 15:24:21 +02:00
Carl Eugen Hoyos
f4392277b0 Avoid a deadlock when decoding wma.
Fixes ticket #2925.
(cherry picked from commit ec8a4841f7)
2013-09-02 10:10:54 +02:00
Michael Niedermayer
49f434ce2e 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 227a0eb5a9)

Conflicts:
	libavformat/avidec.c
2013-08-31 09:34:06 +02:00
Michael Niedermayer
466911f000 wmaprodec: tighter check for num_vec_coeffs
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b21ba20cc8)

Conflicts:

	libavcodec/wmaprodec.c

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-31 02:30:56 +02:00
Michael Niedermayer
e3e2577794 ffserver: fix order of evaluation bugs
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d40c0e4a67)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-29 04:57:11 +02:00
Michael Niedermayer
5bb347a3b4 dct-test: fix order of evaluation bug
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit dd081f98dd)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-29 04:56:48 +02:00
Michael Niedermayer
4e17e9f8af update for 0.10.8
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-29 04:41:57 +02:00
Michael Niedermayer
62d9d4d9d4 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  swfdec: do better validation of tag length
  Changelog for 0.8.8
  kmvc: Clip pixel position to valid range
  kmvc: use fixed sized arrays in the context
  indeo: use a typedef for the mc function pointer
  lavc: check for overflow in init_get_bits
  indeo: check for reference when inheriting mvs
  indeo: use proper error code
  indeo: Properly forward the error codes
  wmapro: error out on impossible scale factor offsets
  wmapro: check the min_samples_per_subframe
  wmapro: return early on unsupported condition
  wmapro: check num_vec_coeffs against the actual available buffer

Conflicts:
	Changelog
	libavformat/swfdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-29 04:26:30 +02:00
Michael Niedermayer
a3539d26ec Merge commit '4ff5167ee7fdee6d35c1bb2558172329ae6ec770' into release/0.10
* commit '4ff5167ee7fdee6d35c1bb2558172329ae6ec770':
  wmapro: make sure there is room to store the current packet
  lavc: move put_bits_left in put_bits.h
  4xm: do not overread the source buffer in decode_p_block
  4xm: check bitstream_size boundary before using it
  4xm: reject frames not compatible with the declared version
  4xm: use the correct logging context
  4xm: check the return value of read_huffman_tables().
  4xm: don't rely on get_buffer() initializing the frame.
  vmdav: convert to bytestream2
  smacker: check frame size validity
  smacker: pad the extradata allocation
  smacker: check the return value of smacker_decode_tree
  smacker: fix an off by one in huff.length computation
  Prepare for 0.8.8 Release
  tiff: do not overread the source buffer
  apetag: use int64_t for filesize
  wavpack: return meaningful errors

Conflicts:
	RELEASE
	libavcodec/4xm.c
	libavcodec/vmdav.c
	libavformat/smacker.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-29 03:56:26 +02:00
Michael Niedermayer
7118358a95 Merge commit '42fed7f433e6d2167ffd4aae31905b583a53b988' into release/0.10
* commit '42fed7f433e6d2167ffd4aae31905b583a53b988':
  wavpack: check packet size early
  mjpegdec: validate parameters in mjpeg_decode_scan_progressive_ac
  mjpeg: Validate sampling factors
  ljpeg: use the correct number of components in yuv
  wavpack: validate samples size parsed in wavpack_decode_block
  jpegls: check the scan offset
  jpegls: factorize return paths
  jpegls: return meaningful errors
  mjpegdec: properly report unsupported disabled features
  update Changelog
  proresdec: support mixed interlaced/non-interlaced content
  update Changelog
  wav: Always seek to an even offset
  id3v2: check for end of file while unescaping tags
  indeo3: fix off by one in MV validity check
  aac: check the maximum number of channels
  update Changelog
  oggdec: fix faulty cleanup prototype

Conflicts:
	Changelog
	libavcodec/jpeglsdec.c
	libavcodec/mjpegdec.c
	libavformat/id3v2.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-29 03:16:38 +02:00
Michael Niedermayer
be90f0279d Merge commit '43c0a87279e717c1384314c6da7155c306ee7c60' into release/0.10
* commit '43c0a87279e717c1384314c6da7155c306ee7c60':
  qdm2: check that the FFT size is a power of 2
  indeo3: switch parsing the header to bytestream2
  indeo3: check motion vectors.
  rv10: check that extradata is large enough
  indeo3: fix data size check
  lavf: make sure stream probe data gets freed.
  dfa: check for invalid access in decode_wdlt().
  xmv: check audio track parameters validity.
  bmv: check for len being valid in bmv_decode_frame().
  xmv: do not leak memory in the error paths in xmv_read_header()
  avfiltergraph: check for sws opts being non-NULL before using them.
  oma: Validate sample rates
  Prepare for 0.8.7 Release

Conflicts:
	RELEASE
	libavcodec/indeo3.c
	libavfilter/avfiltergraph.c
	libavformat/utils.c
	libavformat/xmv.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-29 02:35:24 +02:00
Michael Niedermayer
f3c300d0a4 update all trac links to use the trac subdomain
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-07-29 01:30:08 +02:00
Justin Ruggles
e786cc3331 swfdec: do better validation of tag length
Avoids trying to read a packet with 0 or negative size.
Avoids a potential infinite loop due to seeking backwards.

Partially based on a patch by Michael Niedermayer.

(cherry picked from commit e70c5b034c)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-07-10 10:25:50 +02:00
Michael Niedermayer
f75964ad1f mpeg12dec: avoid reinitialization on PS changes when possible.
Fixes Ticket2574

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

Conflicts:
	libavcodec/mpeg12dec.c
2013-07-09 00:53:51 +02:00
Reinhard Tartler
8c62082b51 Changelog for 0.8.8 2013-07-07 21:11:35 +02:00
Luca Barbato
79edb9adf6 kmvc: Clip pixel position to valid range
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 4e7f0b082d)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/kmvc.c
2013-07-07 21:11:35 +02:00
Luca Barbato
e22a5d490d kmvc: use fixed sized arrays in the context
Avoid some boilerplate code to dynamically allocate and then free the
buffers.
(cherry picked from commit 8f68977054)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/kmvc.c
2013-07-07 21:11:35 +02:00
Luca Barbato
c9d8424395 indeo: use a typedef for the mc function pointer
(cherry picked from commit e6d8acf6a8)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-07-07 21:11:34 +02:00
Luca Barbato
e6a365b5d2 lavc: check for overflow in init_get_bits
Fix an undefined behaviour and make the function return a proper
error in case of overflow.

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 7a2ee770f5)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-07-07 21:11:34 +02:00
Michael Niedermayer
e445dc9237 avformat/mov: Fix duration of fragmented mov
Fixes Ticket2757

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

Conflicts:
	libavformat/mov.c
2013-07-07 18:58:36 +02:00
Michael Niedermayer
c25c89a530 mpegts: only reopen pmt_cb filter if its different from the previous.
Fixes Ticket2632

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b009267910)
2013-07-07 18:56:03 +02:00
Michael Niedermayer
8514e3e08e rmdec: Pass AVIOContext to rm_read_metadata()
Fix null pointer dereference
Fixes Ticket2588

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

Conflicts:
	libavformat/rmdec.c
2013-07-07 18:55:17 +02:00
Luca Barbato
0a1d02ca77 indeo: check for reference when inheriting mvs
The same is done already for qdelta.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit b36e1893ef)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-07-06 10:10:18 +02:00
Luca Barbato
7eff48029f indeo: use proper error code
(cherry picked from commit dd3754a488)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/ivi_common.c
2013-07-06 10:10:17 +02:00
Luca Barbato
7658333c17 indeo: Properly forward the error codes
If the tile data size does not match the buffer size it did not
return an AVERROR_INVALIDDATA causing futher corruption later.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 7388c0c586)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/ivi_common.c
2013-07-06 10:10:17 +02:00
Luca Barbato
f16aa5843f wmapro: error out on impossible scale factor offsets
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 02ec656af7)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-07-06 10:10:17 +02:00
Luca Barbato
bd5ff335ec wmapro: check the min_samples_per_subframe
Must be at least WMAPRO_BLOCK_MIN_SIZE.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit d4a217a408)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/wmaprodec.c
2013-07-06 10:10:17 +02:00
Luca Barbato
4ff5167ee7 wmapro: make sure there is room to store the current packet
Prevent horrid and hard to trace struct overwrite.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit e30b068ef7)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-07-06 10:06:11 +02:00
Luca Barbato
46e09894ac wmapro: return early on unsupported condition
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 6652338f43)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/wmaprodec.c
2013-07-06 10:06:11 +02:00
Reinhard Tartler
b20004b2e6 lavc: move put_bits_left in put_bits.h
(cherry picked from commit afe03092dd)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/dv.c
2013-07-06 10:06:11 +02:00
Luca Barbato
4e1999ebcb wmapro: check num_vec_coeffs against the actual available buffer
Prevent yet another buffer overwrite.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 3822936252)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-07-06 10:06:11 +02:00
Luca Barbato
0c943d1cdd 4xm: do not overread the source buffer in decode_p_block
Check for out of picture macroblocks before calling mcdc.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org

(cherry picked from commit 94aefb1932)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/4xm.c
2013-06-30 16:39:08 +02:00
Luca Barbato
6a4f1e784e 4xm: check bitstream_size boundary before using it
Prevent buffer overread.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 59d7bb99b6)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/4xm.c
2013-06-30 16:25:06 +02:00
Luca Barbato
e5679444fd 4xm: reject frames not compatible with the declared version
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 145023f572)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/4xm.c
2013-06-30 16:25:06 +02:00
Luca Barbato
284ac9191b 4xm: use the correct logging context
(cherry picked from commit 08859d19b4)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/4xm.c
2013-06-30 16:19:24 +02:00
Anton Khirnov
e797b7787b 4xm: check the return value of read_huffman_tables().
CC:libav-stable@libav.org
(cherry picked from commit 8097fc9a2d)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit bb3f1cad17)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/4xm.c
2013-06-30 16:16:46 +02:00
Anton Khirnov
078e68d261 4xm: don't rely on get_buffer() initializing the frame.
(cherry picked from commit b047c68783)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-06-30 16:15:04 +02:00
Alexandra Khirnova
9248f789d1 vmdav: convert to bytestream2
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 0afcf97e1e)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/vmdav.c
2013-06-30 16:10:46 +02:00
Kostya Shishkov
b40870e636 smacker: check frame size validity
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 07423ad7836325e03894f2f87ba46a531a1cc0b3)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-06-30 16:06:34 +02:00
Kostya Shishkov
db0c8061fe smacker: pad the extradata allocation
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 4c22baf65363433f8c20efd1022b4ba2d8cf2288)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-06-30 16:06:32 +02:00
Kostya Shishkov
d7b7b10518 smacker: check the return value of smacker_decode_tree
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit a2f9937bb04b23a341b0ec0eb1d923bbeb420277)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-06-30 16:06:30 +02:00
Kostya Shishkov
e96aaa5622 smacker: fix an off by one in huff.length computation
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit ee205588b250fe5cae0681be8eba51a5403c3272)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-06-30 16:06:26 +02:00
Hendrik Leppkes
5e6135f68d mathops/x86: work around inline asm miscompilation with GCC 4.8.1
The volatile is not required here, and prevents a miscompilation with GCC
4.8.1 when building on x86 with --cpu=i686

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 659df32a9d)
2013-06-24 08:51:25 +02:00
Anton Khirnov
e98f95670b Prepare for 0.8.8 Release 2013-06-22 08:53:39 +02:00
Luca Barbato
42fed7f433 wavpack: check packet size early
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit fd06291239)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-06-22 08:51:56 +02:00
Luca Barbato
96de1c5ed9 tiff: do not overread the source buffer
At least 2 bytes from the source are read every loop.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 9c22169769)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/tiff.c
2013-06-22 08:51:56 +02:00
Anton Khirnov
ea7ba1d871 apetag: use int64_t for filesize
CC: libav-stable@libav.org
(cherry picked from commit e816aaacd6)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-06-22 08:51:56 +02:00
Luca Barbato
5a6af4fd74 wavpack: return meaningful errors
And forward those that were already meaningful.
(cherry picked from commit 8c34558131)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/wavpack.c
2013-06-22 08:51:56 +02:00
Luca Barbato
7ca8d8223d mjpegdec: validate parameters in mjpeg_decode_scan_progressive_ac
Prevent out of buffer write when decoding broken samples.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit cfbd98abe8)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-06-22 08:48:37 +02:00
Luca Barbato
33492ad810 mjpeg: Validate sampling factors
They must be non-zero.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 8aa3500905)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/mjpegdec.c
2013-06-22 08:48:24 +02:00
Luca Barbato
da5cf7e452 ljpeg: use the correct number of components in yuv
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit a030279a67)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-06-22 08:47:16 +02:00
Luca Barbato
6711d410dc wavpack: validate samples size parsed in wavpack_decode_block
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit ed50673066)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/wavpack.c
2013-06-22 08:40:13 +02:00
Luca Barbato
d26bc6c6b6 jpegls: check the scan offset
Prevent an out of array bound write.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit abad374909)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/jpeglsdec.c
2013-06-22 08:40:02 +02:00
Reinhard Tartler
ca4a25acf8 jpegls: factorize return paths
Conflicts:
	libavcodec/jpeglsdec.c

(cherry picked from commit 4a4107b489)
2013-06-22 08:40:00 +02:00
Luca Barbato
2ebabfff48 jpegls: return meaningful errors
(cherry picked from commit a5a0ef5e13)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>

Conflicts:
	libavcodec/jpeglsdec.c
2013-06-22 08:39:58 +02:00
Luca Barbato
a03dcec364 mjpegdec: properly report unsupported disabled features
When JPEG-LS support is disabled the decoder would feed the
data to the JPEG Lossless decode_*_scan function resulting in
faulty decoding.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-06-22 08:38:31 +02:00
Michael Niedermayer
8ddc9790ed avformat/libmodplug: Reduce the probe score for small input
This ensures that theres enough data for mpeg_probe() to recognize mpeg-ps
Fixes Ticket2583

Based on code by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c605adbf56)
2013-06-21 01:18:23 +02:00
Carl Eugen Hoyos
9ea0f4522f Autodetect idcin only if audio properties allow decoding.
Fixes ticket #2688.
(cherry picked from commit 06bede95fc)
2013-06-19 23:48:28 +02:00
Michael Niedermayer
4abc8e76cb alacenc: Fix missing sign_extend()
Fixes ticket #2497

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 8aea2f05dc)
2013-06-13 00:14:25 +02:00
Claudio Freire
dfcf910569 AAC encoder: Fix rate control on twoloop.
Fixes a case where multichannel bitrate isn't accurately
targetted by psy model alone, never achieving the target bitrate.
Now fixed.

Fixes ticket #2625.

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

Conflicts:
	libavcodec/aaccoder.c

Signed-off-by: Carl Eugen Hoyos <cehoyos@ag.or.at>
2013-06-02 16:35:06 +02:00
Michael Niedermayer
02923b8c78 h264_cavlc: fix reading skip run
Fixes Ticket2606

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

Conflicts:
	libavcodec/h264_cavlc.c
2013-05-30 23:24:19 +02:00
Michael Niedermayer
c8857308f6 smacker: remove av_clip_int16()
Fixes Ticket2425

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2211c76287)
2013-05-21 00:12:50 +02:00
Michael Niedermayer
1c655c1419 avidec: dont randomly skip packets for offseting the index
Fixes Ticket2490

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 6c593f1b67)
2013-05-17 22:57:22 +02:00
Carl Eugen Hoyos
d95bb2ac2d Do not read strd chunk in avi files as H264 extradata.
Fixes ticket #2561.
(cherry picked from commit 231b331718)
2013-05-13 16:03:16 +02:00
Reinhard Tartler
e6617580e3 update Changelog 2013-05-12 08:40:56 +02:00
Michael Smith
4941dfb4f6 proresdec: support mixed interlaced/non-interlaced content
Set interlaced to false if we don't have an interlaced frame

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 0881cbf314)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 1fa37f2bfa)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-05-12 08:40:32 +02:00
Reinhard Tartler
2f61e40908 update Changelog 2013-05-11 11:58:32 +02:00
Luca Barbato
31ed79af7f wav: Always seek to an even offset
RIFF chunks are aligned to 16bit according to the specification.

Bug-Id:500
CC:libav-stable@libav.org
(cherry picked from commit ac87eaf856)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-05-07 07:15:26 +02:00
Luca Barbato
f4bb72d33d id3v2: check for end of file while unescaping tags
Prevent an out of buffer bound write.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit af4cc2605c)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-05-07 07:13:55 +02:00
Anton Khirnov
6742f0408d indeo3: fix off by one in MV validity check
CC:libav-stable@libav.org
(cherry picked from commit 95220be1fa)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-05-07 07:13:55 +02:00
Reinhard Tartler
a590979988 aac: check the maximum number of channels
Broken bitstreams could report a larger than specified number of
channels and cause outbound writes.

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

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/aacdec.c
2013-05-07 07:13:50 +02:00
Carl Eugen Hoyos
48f0a2c239 Fix type of shared flac table ff_flac_blocksize_table[].
Fixes ticket #2533.
(cherry picked from commit a07ac1f788)
2013-05-05 20:39:42 +02:00
Reinhard Tartler
7bf6a86f2e update Changelog 2013-04-24 21:02:29 +02:00
Anton Khirnov
43c0a87279 qdm2: check that the FFT size is a power of 2
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 34f87a5853)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-24 21:01:14 +02:00
Luca Barbato
d2d2ddf9a3 oggdec: fix faulty cleanup prototype
(cherry picked from commit fba8e5b608)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-24 21:01:14 +02:00
Anton Khirnov
c579d4283e indeo3: switch parsing the header to bytestream2
Also add an additional sanity check to the alt_quant table.
Fixes invalid reads with corrupted files.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 66531d634e)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-24 21:01:14 +02:00
Anton Khirnov
9b2af4d080 indeo3: check motion vectors.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit a0a872d073)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-24 21:01:14 +02:00
Anton Khirnov
c5084a1765 rv10: check that extradata is large enough
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org

(cherry picked from commit 01d376f598)

Conflicts:

	libavcodec/rv10.c
2013-04-24 21:01:14 +02:00
Anton Khirnov
74753cf1a9 indeo3: fix data size check
The data offsets are relative to the bistream header, which is 16 bytes
after the start of the data.
Fixes invalid reads with corrupted files.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC:libav-stable@libav.org
(cherry picked from commit 34e6af9e20)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-24 21:01:14 +02:00
Anton Khirnov
881526744e lavf: make sure stream probe data gets freed.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit dbb1425811)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-24 21:01:14 +02:00
Anton Khirnov
4c7f40c6df dfa: check for invalid access in decode_wdlt().
This can happen when the number of skipped lines is not consistent with
the number of coded lines.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 3623589edc)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-24 21:01:14 +02:00
Anton Khirnov
9aa2eee313 xmv: check audio track parameters validity.
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit d1016dccdc)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-24 21:01:14 +02:00
Anton Khirnov
0f6364b62b bmv: check for len being valid in bmv_decode_frame().
It can be 0 or -1 for invalid files, which may result in invalid memory
access.

Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit b88f902125)

Conflicts:

	libavcodec/bmv.c
2013-04-24 21:01:14 +02:00
Anton Khirnov
c65fb5b41b xmv: do not leak memory in the error paths in xmv_read_header()
CC: libav-stable@libav.org
(cherry picked from commit f8080bd13b)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-24 21:01:14 +02:00
Anton Khirnov
2eaf8698a3 avfiltergraph: check for sws opts being non-NULL before using them.
Avoid snprintfing a NULL pointer.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-24 21:01:14 +02:00
Luca Barbato
a563e4af9f oma: Validate sample rates
The sample rate index is 3 bits even if currently index 5, 6 and 7 are
not supported.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 0933fd1533)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-04-24 21:01:14 +02:00
Reinhard Tartler
73746237a1 Prepare for 0.8.7 Release 2013-04-24 21:01:10 +02:00
James Almer
0b81983461 lavc/bink: Chech for malloc failure
Based on commit 8ab2173ed1
2013-04-07 18:10:05 -03:00
Michael Niedermayer
6f5e1d5811 Update for 0.10.7
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 16:38:29 +02:00
Michael Niedermayer
7ab4358cda rmdec: flush audio packet on seeking
Fixes Ticket1605

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 16:38:29 +02:00
Michael Niedermayer
fdee09a19e doc/APIchanges: List merge commit hashes and version numbers
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 16:38:29 +02:00
Diego Biurrun
691017b5c3 configure: Make warnings from -Wreturn-type fatal errors
These warnings have no false positives and point to serious bugs.
(cherry picked from commit 99853cb8d4)

Conflicts:

	configure

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 16:38:29 +02:00
Michael Niedermayer
119b7a6c7c oggparsevorbis: fix vorbis_cleanup return type
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 7a6beedd3f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 16:38:29 +02:00
Michael Niedermayer
4b6b0a164c ffserver: fix return value of add_codec()
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ff814c75a3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 16:38:29 +02:00
Michael Niedermayer
25d7a33251 apichanges: fix 2 wrong hashes
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2f3bc51228)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 16:34:39 +02:00
Michael Niedermayer
5e2fadeadf apichanges: fix date
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ad6802f975)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 16:34:39 +02:00
Michael Niedermayer
566de83883 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  update Changelog
  fate: fetch samples that match the release series
  dxva2: include dxva.h if found
  iff: validate CMAP palette size
  Changelog: document msrle bugfix
  Changelog: cosmetics, remove trailing periods and sort
  msrledec: check bounds before constructing a possibly invalid pointer,

Conflicts:
	Changelog
	configure
	libavformat/iff.c
	tests/Makefile

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 15:57:13 +02:00
Michael Niedermayer
e9d5a6f1c5 Merge commit '327ff82bac3081d918dceb4931c77e25d0a1480d' into release/0.10
* commit '327ff82bac3081d918dceb4931c77e25d0a1480d':
  msrle: convert MS RLE decoding function to bytestream2.
  Update Changelog for the 0.8.6 Release
  wmaprodec: require block_align to be set.
  ivi_common: do not call MC for intra frames when dc_transform is unset
  roqvideodec: fix a potential infinite loop in roqvideo_decode_frame().
  Revert "libmp3lame: use the correct remaining buffer size when flushing"
  lzo: fix overflow checking in copy_backptr()
  flacdec: simplify bounds checking in flac_probe()
  atrac3: avoid oversized shifting in decode_bytes()
  avconv: skip attached files when selecting streams to read from.
  lavf: fix arithmetic overflows in avformat_seek_file()

Conflicts:
	Changelog
	avconv.c
	libavcodec/libmp3lame.c
	libavcodec/msrledec.c
	libavformat/utils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 15:42:45 +02:00
Michael Niedermayer
0af8ed29e4 Merge commit 'f82e127dd9c7c0d54bf6400f83c7825e571f9a9e' into release/0.10
* commit 'f82e127dd9c7c0d54bf6400f83c7825e571f9a9e':
  parser: fix large overreads
  dsputil: fix invalid array indexing
  shorten: use the unsigned type where needed
  shorten: report meaningful errors
  shorten: K&R formatting cosmetics
  shorten: set invalid channels count to 0
  matroskadec: request a read buffer for the wav header
  h264: check for luma and chroma bit depth being equal
  vc1: Move init code shared between decoder and parser to common code file.
  libmp3lame: use the correct remaining buffer size when flushing
  xxan: fix invalid memory access in xan_decode_frame_type0()
  wmadec: require block_align to be set.

Conflicts:
	libavcodec/h264.c
	libavcodec/libmp3lame.c
	libavcodec/shorten.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 15:33:22 +02:00
Michael Niedermayer
a7908ac012 Merge commit '9b79a05289d91d1184455d12e6c4df457f0657c4' into release/0.10
* commit '9b79a05289d91d1184455d12e6c4df457f0657c4':
  wmaprodec: return an error, not 0, when the input is too small.
  vmdaudio: fix invalid reads when packet size is not a multiple of chunk size
  vorbisdec: Error on bark_map_size equal to 0.
  configure: clean up Altivec detection
  Update RELEASE file for 0.8.6
  update year to 2013
  oggdec: make sure the private parse data is cleaned up (cherry picked from commit d894f74762)
  build: Fix CAF demuxer dependencies
  doc: developer: Allow tabs in the vim configuration for Automake files
  doc: filters: Correct BNF FILTER description

Conflicts:
	RELEASE
	cmdutils.c
	libavcodec/vmdav.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 14:47:49 +02:00
Michael Niedermayer
9285f25e31 Merge commit '60a1ee6e419e244dc2363fdc4ddf8350d506f2ae' into release/0.10
* commit '60a1ee6e419e244dc2363fdc4ddf8350d506f2ae':
  doc: Fix some obsolete references to av* tools as ff* tools

Conflicts:
	doc/indevs.texi

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-04-07 14:43:37 +02:00
Paul B Mahol
1aa50348d8 smacker: fix off by one error
Regression since a93b572ae4.

Fixes #2426.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
(cherry picked from commit e3cc92a623)
2013-04-03 15:17:26 +02:00
Carl Eugen Hoyos
8b72bcba71 Write broken aac frames to mov files instead of skipping them.
Fixes decoding with picky media players.

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

Conflicts:
	libavformat/movenc.c
2013-04-02 12:55:10 +02:00
Carl Eugen Hoyos
5dd5cfd0b8 Only test the first frame for missing aac_adtstoasc bistream filter.
Many players ignore broken aac frames, so don't abort mov or flv
muxing when encountering one, just print a warning instead.

Fixes ticket #2380.
(cherry picked from commit 1741fece70)

Conflicts:
	libavformat/flvenc.c
2013-03-27 01:03:48 +01:00
Reinhard Tartler
b385a77218 update Changelog 2013-03-23 14:48:40 +01:00
Reinhard Tartler
dab40d5bd4 fate: fetch samples that match the release series
The idea is to ensure that 'make fate' always fetches the fate samples
that work with this release.
(cherry picked from commit a89f68776b2771935a348ce07d0a094ae965acfc)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-23 14:46:45 +01:00
Ronald S. Bultje
cd534fdf86 dxva2: include dxva.h if found
Apparently, some build environments require dxva.h even for dxva2,
while others lack this header entirely.  Including it conditionally
allows building in both cases.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-19 08:41:24 +01:00
Kostya Shishkov
36aad4f1cc iff: validate CMAP palette size
Fixes CVE-2013-2495

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 31a77177ff)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-18 20:24:49 +01:00
Carl Eugen Hoyos
12e4aefb80 Do not (re-)set libx264 parameter b_tff if interlaced encoding was not requested.
Reconfiguring can break x264 lossless encoding.

Fixes ticket #2165.
(cherry picked from commit 75c7e4583f)
2013-03-18 02:21:23 +01:00
Reinhard Tartler
fabdeed6fc Changelog: document msrle bugfix 2013-03-17 08:25:46 +01:00
Reinhard Tartler
f0337b0f24 Changelog: cosmetics, remove trailing periods and sort 2013-03-17 08:25:12 +01:00
Anton Khirnov
4160398e2a msrledec: check bounds before constructing a possibly invalid pointer,
CC:libav-stable@libav.org
(cherry picked from commit 9bd6375d5f)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit b7765d00f9)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-17 07:37:06 +01:00
Ronald Bultje
327ff82bac msrle: convert MS RLE decoding function to bytestream2.
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 992f71e95d)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-17 07:36:54 +01:00
Reinhard Tartler
e91a6249b6 Update Changelog for the 0.8.6 Release 2013-03-16 08:48:36 +01:00
Anton Khirnov
b57ab9d7a9 wmaprodec: require block_align to be set.
Avoids an infinite loop in the calling programs with decoder not
consuming any input and not returning output.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 20373a66ec)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-16 08:21:01 +01:00
Anton Khirnov
6dbe931344 ivi_common: do not call MC for intra frames when dc_transform is unset
CC:libav-stable@libav.org
(cherry picked from commit 3ba40ebb6c)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 74880e78d8)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-16 08:21:01 +01:00
Anton Khirnov
87e4f4c79a roqvideodec: fix a potential infinite loop in roqvideo_decode_frame().
When there is just 1 byte remanining in the buffer, nothing will be read
and the loop will continue forever. Check that there are at least 8
bytes, which are always read at the beginning.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 747fbe0c21)

Conflicts:

	libavcodec/roqvideodec.c
2013-03-16 08:21:01 +01:00
Reinhard Tartler
ca335f5000 Revert "libmp3lame: use the correct remaining buffer size when flushing"
This reverts commit 5dbb3298b9, which was
mistakenly backported.
2013-03-16 08:20:35 +01:00
Xi Wang
cab9624892 lzo: fix overflow checking in copy_backptr()
The check `src > dst' in the form `&c->out[-back] > c->out' invokes
pointer overflow, which is undefined behavior in C.

Remove the check.  Also replace `&c->out[-back] < c->out_start' with
a safe form `c->out - c->out_start < back' to avoid overflow.

CC: libav-stable@libav.org

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

(cherry picked from commit ca6c3f2c53)

Conflicts:
	libavutil/lzo.c
2013-03-15 13:35:59 +01:00
Xi Wang
d8010bda7a flacdec: simplify bounds checking in flac_probe()
Simplify `p->buf > p->buf + p->buf_size - 4' as `p->buf_size < 4'.
Avoid a possible out-of-bounds pointer, which is undefined behavior
in C.

CC: libav-stable@libav.org

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

(cherry picked from commit 8425d693ee)
2013-03-15 13:33:35 +01:00
Xi Wang
12d8ae2979 atrac3: avoid oversized shifting in decode_bytes()
When `off' is 0, `0x537F6103 << 32' in the following expression invokes
undefined behavior, the result of which is not necessarily 0.

    (0x537F6103 >> (off * 8)) | (0x537F6103 << (32 - (off * 8)))

Avoid oversized shifting.

CC: libav-stable@libav.org

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

(cherry picked from commit eba1ff3130)

Conflicts:
	libavcodec/atrac3.c
2013-03-15 13:33:25 +01:00
Anton Khirnov
0076639965 avconv: skip attached files when selecting streams to read from.
Fixes Bug 473 / invalid reads when using -attach.
2013-03-15 08:58:11 +01:00
Mans Rullgard
d8fbae3c3c lavf: fix arithmetic overflows in avformat_seek_file()
The values compared here can be more than INT64_MAX apart.  Since the
difference is always positive, converting to uint64_t before subtracting
gives the correct result without overflows.

Signed-off-by: Mans Rullgard <mans@mansr.com>

(cherry picked from commit 91ac403b13)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-03-13 14:14:54 +01:00
Michael Niedermayer
f82e127dd9 parser: fix large overreads
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>

(cherry picked from commit 096abfa150)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-03-13 13:58:10 +01:00
Mans Rullgard
871c8f0abb dsputil: fix invalid array indexing
Indexing outside an array is invalid and causes errors with
gcc 4.8.

Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 0a07f2b346)

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-03-12 23:30:08 +01:00
Luca Barbato
f42d03746a shorten: use the unsigned type where needed
get_uint returns an unsigned value, use an unsigned to store
blocksize to make sure the comparison logic is correct and report
correctly the error for the channel count not supported.

CC: libav-stable@libav.org

(cherry picked from commit 5cf7c72757)
(cherry picked from commit 88089eecfd)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/shorten.c
2013-03-12 20:05:39 +01:00
Luca Barbato
5df064df62 shorten: report meaningful errors
(cherry picked from commit 4c364eb2b8)
(cherry picked from commit 0daf1428e8)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-03-12 20:05:39 +01:00
Luca Barbato
ff5a06f7f0 shorten: K&R formatting cosmetics
(cherry picked from commit a2ad554def)
(cherry picked from commit 97cc2f286f)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

Conflicts:
	libavcodec/shorten.c
2013-03-12 20:05:39 +01:00
Michael Niedermayer
a4a97e5f3c shorten: set invalid channels count to 0
Prevent the loop shorten_decode_close from writing and freeing out of
the array boundary.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>

CC: libav-stable@libav.org

(cherry picked from commit c10da30d84)
(cherry picked from commit 21d568be17)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-03-12 20:05:39 +01:00
Luca Barbato
9314af3b2e matroskadec: request a read buffer for the wav header
Solve an infiniloop.

CC: libav-stable@libav.org

(cherry picked from commit 37cb3b180a)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
2013-03-12 20:05:39 +01:00
Luca Barbato
9e48d77158 h264: check for luma and chroma bit depth being equal
The decoder assumes a single bit depth for all the planes while
the specification allows different bit depths for luma and chroma.

Avoid the possible problems described in CVE-2013-2277
2013-03-12 20:05:39 +01:00
Diego Biurrun
b9ec4414b5 vc1: Move init code shared between decoder and parser to common code file.
This fixes standalone compilation of the VC-1 parser.
(cherry picked from commit 3c715383ea)

Conflicts:

	libavcodec/vc1data.h

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-03-10 13:45:43 +01:00
Anton Khirnov
9b79a05289 wmaprodec: return an error, not 0, when the input is too small.
Returning 0 may result in an infinite loop in valid calling programs. A
decoder should never return 0 without producing any output.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 60dd8b5733)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-09 18:54:28 +01:00
Justin Ruggles
5dbb3298b9 libmp3lame: use the correct remaining buffer size when flushing
CC:libav-stable@libav.org
(cherry picked from commit e984f47873)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit b77d9cbbd5)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-09 18:54:28 +01:00
Anton Khirnov
98406bd26e vmdaudio: fix invalid reads when packet size is not a multiple of chunk size
CC:libav-stable@libav.org
(cherry picked from commit f86d66bcfa)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 77cf052e39)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-09 18:54:28 +01:00
Anton Khirnov
e10af023b2 xxan: fix invalid memory access in xan_decode_frame_type0()
The loop a few lines below the xan_unpack() call accesses up to
dec_size * 2 bytes into y_buffer, so dec_size must be limited to
buffer_size / 2.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 62a657de16)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-09 18:54:28 +01:00
Michael Niedermayer
e050af9a80 vorbisdec: Error on bark_map_size equal to 0.
The value is used to calculate output LSP curve and a division by zero
and out of array accesses would occur.

CVE-2013-0894

CC: libav-stable@libav.org

Reported-by: Dale Curtis <dalecurtis@chromium.org>
Found-by: inferno@chromium.org
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 11dcecfcca)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 494ddd377a)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-09 18:54:28 +01:00
Anton Khirnov
b527dd30e9 wmadec: require block_align to be set.
Avoids an infinite loop in the calling programs with decoder not
consuming any input and not returning output.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit c1f479e8df)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-09 18:54:28 +01:00
Mans Rullgard
29a2fdb184 configure: clean up Altivec detection
There used to be one test for Altivec intrinsics support and a
separate test to determine which of two possible syntaxes to use
for vector literals.  Since 2008, we only support the more common
of these so the split test no longer makes sense.

This combines the tests into one and also changes the hard error on
failure to a warning.  The test can reasonably fail if no --cpu flag
is provided (or is provided with an unknown CPU) and the compiler
default target does not support Altivec.  Aborting in this case is
probably over-reacting.

Fixes: #464, http://bugs.debian.org/701710

Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 20bcce507a)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-09 18:54:28 +01:00
Reinhard Tartler
30bfa9e79f Update RELEASE file for 0.8.6 2013-03-09 18:54:28 +01:00
Reinhard Tartler
cb93705900 update year to 2013
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-03-09 18:54:27 +01:00
Luca Barbato
8829c79039 oggdec: make sure the private parse data is cleaned up
(cherry picked from commit d894f74762)

Related to CVE-2012-2882

Conflicts:

	libavformat/oggdec.h
	libavformat/oggparsevorbis.c
2013-03-09 18:54:27 +01:00
Carl Eugen Hoyos
85e082d081 Require at least three frames to autodetect loas.
(cherry picked from commit a60530e3ee)
2013-03-02 02:05:14 +01:00
Nicolas George
eeacc5a7d0 lavf/avio: check for : in filenames for protocols.
If the first "special" character in a filename is a comma,
it can introduce protocol options, but only if there is a
colon at the end. Otherwise, it is just a filename with a
comma.

Fix trac ticket #2303.
(cherry picked from commit d9fad53f4b)
2013-03-01 08:59:38 +01:00
Diego Biurrun
6a9f050c22 build: Fix CAF demuxer dependencies
(cherry picked from commit a519463366)

Conflicts:

	libavcodec/Makefile
2013-02-25 20:34:26 +01:00
Vicente Jimenez Aguilar
60a1ee6e41 doc: Fix some obsolete references to av* tools as ff* tools
Signed-off-by: Diego Biurrun <diego@biurrun.de>

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-02-24 19:32:52 +01:00
Diego Biurrun
c3829f7085 doc: developer: Allow tabs in the vim configuration for Automake files
While we do not use Automake in libav, this allows our config to be
used more globally without introducing unwanted breakage.
(cherry picked from commit 040c565e51)

Conflicts:

	doc/developer.texi
2013-02-24 19:32:52 +01:00
Vicente Jimenez Aguilar
f20764102b doc: filters: Correct BNF FILTER description
Signed-off-by: Diego Biurrun <diego@biurrun.de>
(cherry picked from commit b5ad422bf4)
2013-02-24 19:32:52 +01:00
Carl Eugen Hoyos
8344601712 Write the fiel atom to mov files independently of the used video coded.
The QuickTime specification does not contain any hint that the atom
must not be written in some cases and both the QuickTime and the
AVID decoders do not fail if the atom is present.

This change allows to signal (visually) interlaced streams with
a codec different from uncompressed video.

As a side-effect, this fixes ticket #2202
(cherry picked from commit 7d0e3b197c)

Conflicts:
	libavformat/movenc.c
	tests/ref/lavf/mov
	tests/ref/seek/lavf_mov
	tests/ref/vsynth/vsynth1-avui
	tests/ref/vsynth/vsynth1-dnxhd-1080i
	tests/ref/vsynth/vsynth1-mpeg4
	tests/ref/vsynth/vsynth2-avui
	tests/ref/vsynth/vsynth2-dnxhd-1080i
	tests/ref/vsynth/vsynth2-mpeg4
2013-02-14 15:47:23 +01:00
Michael Niedermayer
5b7f7f3809 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  pthread: set the frame properties from the thread context, not user.
  mp3: exit on parsing error in mp_decode_frame
  indeo3: initialise pixel planes on allocation

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-14 15:18:56 +01:00
Michael Niedermayer
b07c791252 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 0dfc01c2bb)

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

Conflicts:

	libavcodec/huffyuv.c
(cherry picked from commit 9bc70fe1ae50fd2faa0b9429d47cfbda01a92ebc)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-14 15:18:23 +01:00
Michael Niedermayer
ba4b57e802 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 f67a0d1152)

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

Conflicts:

	libavcodec/huffyuv.c
(cherry picked from commit 277def59fce10d91e3113e5c0f63e22bc4abfa88)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-14 15:18:23 +01:00
Xi Wang
ef953f760e rtmp: fix buffer overflows in ff_amf_tag_contents()
A negative `size' will bypass FFMIN().  In the subsequent memcpy() call,
`size' will be considered as a large positive value, leading to a buffer
overflow.

Change the type of `size' to unsigned int to avoid buffer overflow, and
simplify overflow checks accordingly.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4e692374f7)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-14 15:18:23 +01:00
Xi Wang
69b3fedc09 rtmp: fix multiple broken overflow checks
Sanity checks like `data + size >= data_end || data + size < data' are
broken, because `data + size < data' assumes pointer overflow, which is
undefined behavior in C.  Many compilers such as gcc/clang optimize such
checks away.

Use `size < 0 || size >= data_end - data' instead.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 902cfe2f74)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-14 15:18:23 +01:00
Xi Wang
165f783235 rtpenc: fix overflow checking in avc_mp4_find_startcode()
The check `start + res < start' is broken since pointer overflow is
undefined behavior in C.  Many compilers such as gcc/clang optimize
away this check.

Use `res > end - start' instead.  Also change `res' to unsigned int
to avoid signed left-shift overflow.

Signed-off-by: Xi Wang <xi.wang@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2f014567cf)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2013-02-14 15:18:23 +01:00
Carl Eugen Hoyos
7a21b089c2 sws: dont write out of array on bigendian
Fixes Ticket2229

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4e2c63685e)
2013-02-14 14:42:41 +01:00
Michael Niedermayer
4d9bde86d0 ffmpeg: dont allow -flags to override -pass
Fixes Ticket2154

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

Conflicts:
	ffmpeg_opt.c
2013-02-06 10:23:45 +01:00
Anton Khirnov
a4c9260e69 pthread: set the frame properties from the thread context, not user.
Right now, the frame properties are set from the user-facing
AVCodecContext before it is updated from the thread context, which is
wrong since they may be invalid or obsolete.
2013-01-24 11:45:27 +01:00
Carl Eugen Hoyos
4e869e7a5f matroskaenc: add codec_tag lists back.
This reverts 312645e :
"Do not set codec_tag property for matroska muxers."

Also adds dummy codec_tag lists with codecs
supported in mkv but not in wav / avi.

Fixes ticket #2169.
(cherry picked from commit df39c3ce38)

Conflicts:
	libavformat/matroskaenc.c
2013-01-24 02:42:38 +01:00
Luca Barbato
1076ea8115 mp3: exit on parsing error in mp_decode_frame
Properly forward mp_decode_layer3 errors, mp_decode_layer1 and
mp_decode_layer2 do not return errors.

Based on a patch by Michael Niedermayer.
(cherry picked from commit 0c03cc6838)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-01-20 20:36:57 +01:00
Kostya Shishkov
a94f789c33 indeo3: initialise pixel planes on allocation
This prevents decoder from reading garbage from it in case of errors later.
(cherry picked from commit 81064a8045)

Fixes an invalid read on sample from CVE-2012-2804

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2013-01-20 20:36:57 +01:00
Carl Eugen Hoyos
74b04e6a35 Fix detection of struct v4l2_frmsize_discrete.
It was always detected successfully.
(cherry picked from commit 91e016865c)
2013-01-17 02:45:20 +01:00
Michael Niedermayer
492eb0aa14 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  Update Changelog
  h264: check ref_count validity for num_ref_idx_active_override_flag
  h264: check context state before decoding slice data partitions
  oggdec: free the ogg streams on read_header failure
  oggdec: check memory allocation
  Fix uninitialized reads on malformed ogg files.
  rtsp: Recheck the reordering queue if getting a new packet
  opt: avoid segfault in av_opt_next() if the class does not have an option list
  alacdec: do not be too strict about the extradata size

Conflicts:
	Changelog

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-17 02:33:07 +01:00
Michael Niedermayer
c961ce969a Merge commit 'a335ffd7f4cdaaa6a8fe4187f6f06b0418eea19a' into release/0.10
* commit 'a335ffd7f4cdaaa6a8fe4187f6f06b0418eea19a':
  h264: fix sps parsing for SVC and CAVLC 4:4:4 Intra profiles
  h264: check sps.log2_max_frame_num for validity
  h264: slice-mt: get last_pic_dropable from master context
  ppc: always use pic for shared libraries
  h264: error out on unset current_picture_ptr for h->current_slice > 0
  flashsv: make sure data for zlib priming is available
  h264: enable low delay only if no delayed frames were seen
  flashsv: check for keyframe before using differential coding
  lavf: avoid integer overflow in ff_compute_frame_duration()
  aacdec: Fix an off-by-one overwrite when switching to LTP profile from MAIN.
  APIchanges: Fill in missing commit hashes

Conflicts:
	doc/APIchanges

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-17 02:20:20 +01:00
Michael Niedermayer
52cea9ce92 Merge commit '01a4e7f623a2e6dc95862f9a56c777f058d7bfaf' into release/0.10
* commit '01a4e7f623a2e6dc95862f9a56c777f058d7bfaf':
  lavf: Bump minor version to distinguish branch and master version numbers
  vp6: properly fail on unsupported feature
  mp3: properly forward mp_decode_frame errors
  mpeg12: do not decode extradata more than once.
  indeo3: when freeing buffers, set pointers referencing them to NULL as well
  indeo3: ensure that decoded cell data is in 7-bit range as presumed by decoder
  avconv: fix copying per-stream metadata.
  id3v2: fix reading unsynchronized frames.
  h264: Fix parameters to ff_er_add_slice() call
  build: fix 'clean' target

Conflicts:
	avconv.c
	libavcodec/mpeg12.h
	libavformat/id3v2.c
	libavformat/version.h

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-17 01:58:54 +01:00
Carl Eugen Hoyos
4fc22e85c0 Revert "x86: Require an assembler able to cope with AVX instructions"
This reverts commit e287201c77.
2013-01-17 01:51:28 +01:00
Michael Niedermayer
ea3b68c99d Merge commit 'dcf8f259d107838ff3778343dcb762398130a1a3' into release/0.10
* commit 'dcf8f259d107838ff3778343dcb762398130a1a3':
  build: Add 'check' target to run all compile and test targets.
  Ignore generated aviocat tool.
  avconv: only apply presets when we have an encoder.
  flacenc: ensure the order is within the min/max range in LPC order search
  yuv4mpeg: reject unsupported codecs
  vp8: reset loopfilter delta values at keyframes.
  vp56: release frames on error
  vp56: make parse_header return standard error codes
  ivi_common: check that scan pattern is set before using it.
  Prepare for 0.8.5 Release
  x86: Require an assembler able to cope with AVX instructions

Conflicts:
	RELEASE
	avconv.c
	doc/developer.texi
	libavformat/yuv4mpeg.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2013-01-17 01:29:26 +01:00
Reinhard Tartler
cf2cab5b2a Update Changelog 2013-01-12 17:59:41 +01:00
Janne Grunau
adef01c370 h264: check ref_count validity for num_ref_idx_active_override_flag
Fixes segfault in the fuzzed sample bipbop234.ts_s226407.
CC: libav-stable@libav.org
(cherry-picked from commit 6e5cdf2628)
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2013-01-12 17:59:41 +01:00
Janne Grunau
06312bbb10 h264: check context state before decoding slice data partitions
Fixes mov_h264_aac__Demo_FlagOfOurFathers.mov.SIGSEGV.4e9.656.

Found-by: Mateusz "j00ru" Jurczyk
CC: libav-stable@libav.org
(cherry-picked from commit c1fcf563b1)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:41 +01:00
Luca Barbato
03fec31cd7 oggdec: free the ogg streams on read_header failure
Plug an annoying memory leak on broken files.
(cherry picked from commit 89b51b570d)

Signed-off-by: Luca Barbato <lu_zero@gentoo.org>
(cherry picked from commit 42bd6d9cf6)

Conflicts:

	libavformat/oggdec.c
2013-01-12 17:59:41 +01:00
Luca Barbato
6eebba08e1 oggdec: check memory allocation
(cherry picked from commit ba064ebe48)

Conflicts:

	libavformat/oggdec.c
2013-01-12 17:59:41 +01:00
Victor Lopez
a335ffd7f4 h264: fix sps parsing for SVC and CAVLC 4:4:4 Intra profiles
Fixes bug 396.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:40 +01:00
Dale Curtis
9ded14fcb8 Fix uninitialized reads on malformed ogg files.
The ogg decoder wasn't padding the input buffer with the appropriate
FF_INPUT_BUFFER_PADDING_SIZE bytes. Which led to uninitialized reads in
various pieces of parsing code when they thought they had more data than
they actually did.

Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit ef0d779706)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:40 +01:00
Janne Grunau
f620c12067 h264: check sps.log2_max_frame_num for validity
Fixes infinite or long taking loop in frame num gap code in
the fuzzed sample bipbop234.ts_s223302.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:40 +01:00
Martin Storsjö
d1d329932f rtsp: Recheck the reordering queue if getting a new packet
If we timed out and consumed a packet from the reordering queue,
but didn't return a packet to the caller, recheck the queue status.
Otherwise, we could end up in an infinite loop, trying to consume
a queued packet that has already been consumed.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:40 +01:00
Janne Grunau
1d98811b95 h264: slice-mt: get last_pic_dropable from master context
Fixes fate-h264-conformance-cvnlfi2_sony_h and smllwebdl.mkv from
https://github.com/OpenELEC/OpenELEC.tv/issues/1557 .

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:40 +01:00
Justin Ruggles
dfb7a638e6 opt: avoid segfault in av_opt_next() if the class does not have an option list
CC: libav-stable@libav.org
(cherry picked from commit d02202e08a)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:40 +01:00
Luca Barbato
6b70965f39 ppc: always use pic for shared libraries
CC: libav-stable@libav.org
(cherry picked from commit 1944d532a8)

Conflicts:

	configure
2013-01-12 17:59:40 +01:00
Justin Ruggles
77e6676d3e alacdec: do not be too strict about the extradata size
Sometimes the extradata has duplicate atoms, but that shouldn't prevent
decoding. Just ensure that it is at least 36 bytes as a sanity check.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:40 +01:00
Janne Grunau
f1b3cc02ec h264: error out on unset current_picture_ptr for h->current_slice > 0
Fixes a segfault with fuzzed sample sample_varPAR_s11622_r001-02.avi.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:40 +01:00
Janne Grunau
b6592b402c flashsv: make sure data for zlib priming is available
Fixes a segfault in the fuzzed sample resolutionchange.flv_s314809.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:40 +01:00
Janne Grunau
6cd92c3880 h264: enable low delay only if no delayed frames were seen
Dropping frames is undesirable but that is the only way by which the
decoder could return to low delay mode. Instead emit a warning and
continue with delayed frames.
Fixes a crash in fuzzed sample nasa-8s2.ts_s20033 caused by a larger
than expected has_b_frames value. Low delay keeps getting re-enabled
from a presumely broken SPS.

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

Conflicts:

	libavcodec/h264.c
2013-01-12 17:59:40 +01:00
Janne Grunau
522e97bd9e flashsv: check for keyframe before using differential coding
Fixes a segfault in te fuzzed sample resolutionchange.flv_s211713.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:39 +01:00
Janne Grunau
d282e5ce72 lavf: avoid integer overflow in ff_compute_frame_duration()
Scaling the denominator instead of the numerator if it is too large
loses precision. Fixes an assert caused by a negative frame duration in
the fuzzed sample nasa-8s2.ts_s202310.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:39 +01:00
Alex Converse
a4a63bf5b5 aacdec: Fix an off-by-one overwrite when switching to LTP profile from MAIN.
Found-by: pawlkt
CC: libav-stable@libav.org
Fixes: CVE-2012-5144
(cherry picked from commit 6d5b009267)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-12 17:59:39 +01:00
Diego Biurrun
01a4e7f623 lavf: Bump minor version to distinguish branch and master version numbers
This enables checking for an API version not present in master that
has avformat_get_riff_video_tags() and avformat_get_riff_audio_tags().
2013-01-10 20:51:45 +01:00
Diego Biurrun
bb35a42e93 APIchanges: Fill in missing commit hashes 2013-01-10 20:51:45 +01:00
Piotr Bandurski
fe0e64ca64 tiffdec: Use the correct height field.
Fixes Ticket913

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

Conflicts:
	libavcodec/tiff.c
2013-01-07 00:34:31 +01:00
Luca Barbato
3e700cc66b vp6: properly fail on unsupported feature
Interlacing is not supported at all and mismanaged down the normal
codepaths causing possible buffer management issues.

Fixes: CVE-2012-2783
(cherry picked from commit be75fed975)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-05 12:02:22 +01:00
Luca Barbato
a5290800f5 mp3: properly forward mp_decode_frame errors
The function can return either a parsing error or a memory management
error.

Fixes: CVE-2012-2797

(cherry picked from commit 9ab0874ea8)

Conflicts:

	libavcodec/mpegaudiodec.c

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-05 11:49:25 +01:00
Anton Khirnov
56c1e18a52 mpeg12: do not decode extradata more than once.
Fixes CVE-2012-2803.

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

Conflicts:

	libavcodec/mpeg12.c
2013-01-05 00:35:58 +01:00
Kostya Shishkov
c55ca98769 indeo3: when freeing buffers, set pointers referencing them to NULL as well
Related to CVE-2012-2804
(cherry picked from commit bc00da2701)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-05 00:27:34 +01:00
Kostya Shishkov
e5ea6539d4 indeo3: ensure that decoded cell data is in 7-bit range as presumed by decoder
Related to CVE-2012-2804
(cherry picked from commit fc417db3f1)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-05 00:26:25 +01:00
Anton Khirnov
f65ec488a9 avconv: fix copying per-stream metadata.
It is handled separately from other types because it uses stream
specifiers and currently that triggers an assert in SET_DICT.

(cherry picked from commit 4632abc7a3)

Conflicts:

	avconv_opt.c

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-05 00:25:31 +01:00
Anton Khirnov
3750104e9d id3v2: fix reading unsynchronized frames.
Current code would incorrectly process e.g. 'ff 00 ff 00 ff' to
'ff ff ff', while it should be 'ff ff 00 ff'.

Fixes Bug 395.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-05 00:25:31 +01:00
Janne Grunau
52adbc0e17 h264: Fix parameters to ff_er_add_slice() call
s->mb_x is reset to zero a couple of lines above. It does not make
sense to call ff_er_add_slice() with 0 as endx when the end of the
macroblock row was reached. Fixes unnecessary and counterproductive
error resilience in https://bugzilla.libav.org/show_bug.cgi?id=394.

(cherry picked from commit e6160bda98)

Conflicts:

	libavcodec/h264.c

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-05 00:25:31 +01:00
Diego Biurrun
26b177b8f7 build: fix 'clean' target
This fixes removal of TOOLS as well as HOSTPROGS declared in the
top-level Makefile.  The clean target in common.mak needs to be
eval'd since the variables used within are reset for each library.

(cherry picked from commit 395c3feb3b)

Conflicts:

	common.mak
	library.mak

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-01-03 15:30:45 +01:00
Diego Biurrun
dcf8f259d1 build: Add 'check' target to run all compile and test targets.
(cherry picked from commit 4982e1ddfa)

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-01-03 15:21:39 +01:00
Diego Biurrun
576834b08e Ignore generated aviocat tool.
(cherry picked from commit 50639cbefe)

Signed-off-by: Diego Biurrun <diego@biurrun.de>
2013-01-03 15:20:12 +01:00
Anton Khirnov
50b8e4c8fd avconv: only apply presets when we have an encoder.
Fixes a crash when using a preset with stream copy.
(cherry picked from commit 4e61a38aa0)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-02 20:55:27 +01:00
Justin Ruggles
0ba0e31955 flacenc: ensure the order is within the min/max range in LPC order search
This fixes use of uninitialized values when the FLAC encoder uses the
2-level, 4-level, and 8-level search methods. Fixes failure of the
fate-flac-24-comp-8 test when run using valgrind.
(cherry picked from commit 3a2731cbd3)

Conflicts:

	libavcodec/flacenc.c

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-02 20:44:31 +01:00
Luca Barbato
abe345251a yuv4mpeg: reject unsupported codecs
The muxer already rejects unsupported pixel formats, reject also
unsupported codecs to prevent dangerous misuses.
(cherry picked from commit 424b1e7642)

Conflicts:

	libavformat/yuv4mpeg.c

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-02 20:34:08 +01:00
Sami Pietila
9837f19693 vp8: reset loopfilter delta values at keyframes.
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>

(cherry picked from commit 0bf511d579)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-02 20:29:41 +01:00
Luca Barbato
211badf068 vp56: release frames on error
Fixes CVE-2012-2783

CC: libav-stable@libav.org

(cherry picked from commit f33b5ba63e)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-02 20:28:18 +01:00
Luca Barbato
145317d220 vp56: make parse_header return standard error codes
Returning 0 for failure is misleading.

CC: libav-stable@libav.org

(cherry picked from commit bb675d3ac6)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-02 20:28:08 +01:00
Anton Khirnov
3fca5799c6 ivi_common: check that scan pattern is set before using it.
Fixes CVE-2012-2791.

CC: libav-stable@libav.org

(cherry picked from commit deabb52ab4)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2013-01-02 20:25:32 +01:00
Reinhard Tartler
398d4e8669 Prepare for 0.8.5 Release 2013-01-02 20:08:49 +01:00
Clément Bœsch
c3d7c805bc lavc/ass_split: check for NULL pointer in ff_ass_split_override_codes().
This is consistent with the other ff_ass_split_* functions.

It also fixes a crash when trying to split a dialog with text=NULL
(which seems to happen when the text of the dialog is empty); basically,
this commit fixes crashes when trying to encode an empty text subtitle
dialog (see subrip and mov_text encoders).

Fixes Ticket2048.
(cherry picked from commit c83002a4f8)
2013-01-01 18:22:20 +01:00
Michael Niedermayer
cdb376d775 mpeg1video: fix regression with slices != threads
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a01679586c)
2012-12-13 00:26:08 +01:00
Michael Niedermayer
6773269f4c mpeg1video: support multi threaded slice encoding.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 03df972016)

Conflicts:
	libavcodec/mpeg12enc.c
2012-12-13 00:25:48 +01:00
Michael Niedermayer
2a42b680e9 avidec: try to support oddly muxed MMES stream
Fixes ticket1804

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit be89693ddc)
2012-12-10 01:00:31 +01:00
Michael Niedermayer
f1156fdc02 riff: ignore ff_read_riff_info() failure.
Some files simply contain invalid info tags.
Fixes unrelated bug posted into Ticket1821

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 09456d0df1)
2012-12-10 00:48:15 +01:00
Michael Niedermayer
1a5b7ce0ea riff: retry reading metadata without padding if it fails with
Fixes Ticket1821

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d0c27e88d2)
2012-12-10 00:48:13 +01:00
Janne Grunau
213f651498 h264: slice-mt: get last_pic_dropable from master context
Fixes fate-h264-conformance-cvnlfi2_sony_h and smllwebdl.mkv from
https://github.com/OpenELEC/OpenELEC.tv/issues/1557 .
(cherry picked from commit 24c62ea7a5)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-12-06 16:22:49 +01:00
Diego Biurrun
e287201c77 x86: Require an assembler able to cope with AVX instructions
All modern assemblers have this capability.  Older NASM versions
that lack the capability produce code that crashes at runtime,
so it's better to error out during the build process instead.

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

Conflicts:

	configure
2012-11-11 22:41:46 +01:00
Michael Niedermayer
36982b3616 Update for 0.10.6
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:43:19 +02:00
Michael Niedermayer
5b5e61a0bf noise_bsf: fix division by 0
Fixes CID733737
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 93ef29b6f4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:19:56 +02:00
Thilo Borgmann
7f1fb8d2a3 alsdec: fix clipping of weightings for MCC decoding
Fixes CID717905
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit feaff427c0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:19:56 +02:00
Michael Niedermayer
75a11e950f mpegvideo: fix motion_val checks
Fixes CID604124
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 20ec0d2a75)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:19:56 +02:00
Michael Niedermayer
e6fa08f14e flashsv: check deflateInit() return value
Fixes CID703620
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b3eb4f54c0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:19:56 +02:00
Michael Niedermayer
400b23beab dnxhddata_ Fix mixup of sizeof() and array elements in ff_dnxhd_find_cid()
Fixes CID717910
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1037e484f0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:19:56 +02:00
Michael Niedermayer
cff9f07d39 ffv1: make sure gob_count is not 0
Fixes division by 0
Fixes CID733736

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:19:56 +02:00
Michael Niedermayer
de4606a5b7 pp: avoid overflow in w*h
Fixes CID700580
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3689ec3d28)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:19:56 +02:00
Michael Niedermayer
93a0dd8358 ffeval: avoid folding EOF onto a valid char
Fixes CID733704
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 225d3cc1cc)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:19:56 +02:00
Michael Niedermayer
12801f969b trasher: check seek return value.
Fixes CID733726
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 8ab0b9caba)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:12:45 +02:00
Michael Niedermayer
35b15a0da8 jpegls: increase run_index to 4
Fixes part of CID717913
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 8dc8994427)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:12:44 +02:00
Michael Niedermayer
fa73f547a0 jpegls: fix off limit
Fixes part of CID717913
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4acfe3d193)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:12:42 +02:00
Michael Niedermayer
c09b4dde37 wtvdec: fix memleak on error
Fixes CID718002
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e47024d72f)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:12:41 +02:00
Michael Niedermayer
db4903f4e4 ffv1: avoid checking a double for equality
if 0.0 != 0.0 a out of array read would occur, equal checks
with floating point may behave in such odd ways, though
this is very unlikely in a real implementation of a compiler

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:12:40 +02:00
Michael Niedermayer
7a0e5a63d0 vf_fade: fix memleaks of args
Fixes: CID718989
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f374e9989b)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:12:39 +02:00
Michael Niedermayer
3038e2041e ffserver: prevent nb_streams from becoming too large
Fixes CID732249

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:12:37 +02:00
Michael Niedermayer
8b64036038 aacsbr: change order of operation to prevent out of array read
Fixes CID732250
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c2340831b8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:12:36 +02:00
Michael Niedermayer
f2d56c2eeb motion_est: more complete SAB diamond size check
This makes no difference with the current #defines

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:09:42 +02:00
Paul B Mahol
46c1e5de58 yop: check return value of avformat_new_stream()
Fixes null pointer dereference, fixes CID703729.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:09:40 +02:00
Paul B Mahol
e6dfaf7bb8 truemotion2: remove unreachable code
Fixes CID610345.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:09:39 +02:00
Paul B Mahol
c9df500190 bmp: unbreak non BMP_RGB compression for v4 and v5
Fixes CID733728 & CID733729.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:09:27 +02:00
Michael Niedermayer
d12bf6fc9e libvpxenc: fix memleak on error path
Fixes CID733795
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 104b1d9e10)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:09:22 +02:00
Michael Niedermayer
8a525e4d18 av_tempfile: fix leak in error case
Fixes CID733796 Part2
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit c9454cb643)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:09:21 +02:00
Michael Niedermayer
7450a0215a ffprobe: fix use of uninitialized pointer in av_strtok()
Fixes CID733837
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 4334ba043e)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:09:14 +02:00
Michael Niedermayer
ba10ea845f asrc_aevalsrc: Fix use of uninitialized pointer inside av_strtok()
Fixes CID733842
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 989c91b504)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:09:12 +02:00
Michael Niedermayer
0b9d464348 swscale-test: fix freeing of uninitialized variable
Fixes: CID733844
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit fac1ccbda1)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:09:11 +02:00
Janne Grunau
c279e37e90 flashsv: propagate inflateReset() errors
Fixes CID717493.
(cherry picked from commit c466eb1746)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:09:10 +02:00
Janne Grunau
cc88dacc1a g722enc: fix size argument in memset
Fixes CID700725.
(cherry picked from commit f1de23faaa)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 21:09:07 +02:00
Michael Niedermayer
988910a277 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  svq3: replace unsafe pointer casting with intreadwrite macros
  Update Changelog for the 0.8.4 Release
  lavc: remove stats_out from the options table.
  Prepare for 0.8.4 Release
  tiffenc: Check av_malloc() results.
  mpegaudiodec: fix short_start calculation
  h264: avoid stuck buffer pointer in decode_nal_units
  vf_pad/scale: use double precision for aspect ratios.
  yuv4mpeg: return proper error codes.
  smacker audio: sign-extend the initial 16-bit predicted value

Conflicts:
	Changelog
	RELEASE
	libavfilter/vf_pad.c
	libavfilter/vf_scale.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 17:18:59 +02:00
Michael Niedermayer
d6a55ab016 Merge commit 'be209bdabb11c59de17220bdbf0bf9c9f7cc16f5' into release/0.10
* commit 'be209bdabb11c59de17220bdbf0bf9c9f7cc16f5':
  vf_pad: don't give up its own reference to the output buffer.
  libvorbis: use VBR by default, with default quality of 3
  libvorbis: fix use of minrate/maxrate AVOptions
  h264: fix deadlocks on incomplete reference frame decoding.
  cmdutils: avoid setting data pointers to invalid values in alloc_buffer()
  avidec: return 0, not packet size from read_packet().
  wmapro: prevent division by zero when sample rate is unspecified
  vc1dec: check that coded slice positions and interlacing match.
  alsdec: fix number of decoded samples in first sub-block in BGMC mode.
  alsdec: remove dead assignments
  alsdec: Fix out of ltp_gain_values read.
  alsdec: Check that quantized parcor coeffs are within range.
  alsdec: Check k used for rice decoder.

Conflicts:
	avconv.c
	libavcodec/h264.c
	libavcodec/libvorbis.c
	libavformat/avidec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 17:02:46 +02:00
Michael Niedermayer
36487066ee Merge commit '15c2e8027f4827018608badb1bff1294af1810e4' into release/0.10
* commit '15c2e8027f4827018608badb1bff1294af1810e4':
  wav: do not fail on empty INFO tags
  cavsdec: check for changing w/h.
  indeo4: update AVCodecContext width/height on size change
  avidec: use actually read size instead of requested size
  wmaprodec: check num_vec_coeffs for validity
  lagarith: check count before writing zeros.
  indeo3: fix out of cell write.
  indeo5: check tile size in decode_mb_info().
  indeo5: prevent null pointer dereference on broken files
  indeo5dec: Make sure we have had a valid gop header.
  indeo4/5: check empty tile size in decode_mb_info().
  ivi_common: make ff_ivi_process_empty_tile() static.

Conflicts:
	libavcodec/indeo5.c
	libavformat/wav.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 16:29:54 +02:00
Michael Niedermayer
fe8243d7a9 Merge commit 'c5ec1908597824e93bbe20137ac9662f84f3cb07' into release/0.10
* commit 'c5ec1908597824e93bbe20137ac9662f84f3cb07':
  indeo: check for invalid motion vectors
  indeo: clear allocated band buffers
  indeo: track tile macroblock size
  factor out common decoding code for Indeo 4 and Indeo 5
  indeo: check custom Huffman tables for errors
  dfa: improve boundary checks in decode_dds1()
  dfa: use more meaningful return codes
  dfa: add some checks to ensure that decoder won't write past frame end
  dfa: convert to bytestream2 API
  dfa: check that the caller set width/height properly.
  avsdec: Set dimensions instead of relying on the demuxer.
  ac3dec: ensure get_buffer() gets a buffer for the correct number of channels

Conflicts:
	libavcodec/avs.c
	libavcodec/dfa.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-25 16:17:41 +02:00
Mans Rullgard
6365b43295 svq3: replace unsafe pointer casting with intreadwrite macros
Signed-off-by: Mans Rullgard <mans@mansr.com>
2012-10-23 16:38:52 +02:00
Reinhard Tartler
2c8ce46250 Update Changelog for the 0.8.4 Release 2012-10-22 20:32:41 +02:00
Anton Khirnov
a0f6c93f52 lavc: remove stats_out from the options table.
Since it is declared as a string AVOption, the generic freeing code
attempts to free it on codec close. Some codecs might have already freed
it elsewhere (or didn't even allocate it with av_malloc() in the first
place), so this might lead to an invalid free.

There is no point in having this field accessible as an AVOption, so
remove it from the options table.

Fixes Bug 380.

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

Conflicts:

	libavcodec/options_table.h
2012-10-22 18:51:50 +02:00
Reinhard Tartler
ca8c814970 Prepare for 0.8.4 Release 2012-10-19 19:23:14 +02:00
Alex Converse
8076d32f30 tiffenc: Check av_malloc() results.
(cherry picked from commit b92dfb56d4)

Conflicts:

	libavcodec/tiffenc.c

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-19 19:23:14 +02:00
Luca Barbato
0f3381ad5b mpegaudiodec: fix short_start calculation
The value should be always 3, as it follows from the specification.

Fix a stack buffer overflow in exponents_from_scale_factors as reported
by asan. Thanks to Dale Curtis for the sample vector.
(cherry picked from commit 97cfa55eea)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-19 19:23:14 +02:00
Jindřich Makovička
9822e3aa52 h264: avoid stuck buffer pointer in decode_nal_units
When decode_nal_units() previously encountered a NAL_END_SEQUENCE,
and there are some junk bytes left in the input buffer, but no start codes,
buf_index gets stuck 3 bytes before the end of the buffer.

This can trigger an infinite loop in the caller code, eg. in
try_decode_trame(), as avcodec_decode_video() then keeps returning zeroes,
with 3 bytes of the input packet still available.

With this change, the remaining bytes are skipped so the whole packet gets
consumed.

CC:libav-stable@libav.org

Signed-off-by: Jindřich Makovička <makovick@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 1a8c6917f6)

Conflicts:

	libavcodec/h264.c
2012-10-19 19:23:14 +02:00
Anton Khirnov
0b923a2b72 vf_pad/scale: use double precision for aspect ratios.
Fixes Bug 203.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-19 19:23:14 +02:00
Anton Khirnov
d792be5681 yuv4mpeg: return proper error codes.
Fixes Bug 373.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-19 19:23:14 +02:00
Franz Brauße
443f1463c0 smacker audio: sign-extend the initial 16-bit predicted value
Fixes Bug #265

Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 12cbbbb4ab)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-18 11:13:05 +02:00
Anton Khirnov
be209bdabb vf_pad: don't give up its own reference to the output buffer.
Conflicts:
	libavfilter/vf_pad.c

Fixes Bug 245

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-18 11:06:57 +02:00
Justin Ruggles
24025cc0b9 libvorbis: use VBR by default, with default quality of 3
(cherry picked from commit 147ff24a0e)

Conflicts:
	libavcodec/libvorbis.c

Fixes a part of Bug 277

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-18 10:53:51 +02:00
Justin Ruggles
5920d00d74 libvorbis: fix use of minrate/maxrate AVOptions
- enable the options for audio encoding
- properly check for user-set maxrate
- use correct calling order in vorbis_encode_setup_managed()
(cherry picked from commit 182d4f1f38)

Conflicts:
	libavcodec/libvorbis.c

Fixes a part of Bug 277

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-18 10:27:50 +02:00
Ronald S. Bultje
79fb7bc667 h264: fix deadlocks on incomplete reference frame decoding.
If decoding a second complementary field, and the first was
decoded in our thread, mark decoding of that field as complete.
If decoding fails, mark the decoded field/frame as complete.
Do not allow switching between field modes or field/frame mode
between slices within the same field/frame. Ensure that two
subsequent fields cover top/bottom (rather than top/frame,
bottom/frame or such nonsense situations).

Fixes various deadlocks when decoding samples with errors in
reference frames.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 1e26a48fa2)

Fixes Bug 118

Conflicts:
	libavcodec/h264.c

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-18 10:00:14 +02:00
Anton Khirnov
141d4ed6c0 cmdutils: avoid setting data pointers to invalid values in alloc_buffer()
Fixes bug 352.
(cherry picked from commit 990450c5bf)

Conflicts:
	cmdutils.c

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-18 07:41:22 +02:00
Anton Khirnov
5acd1c6561 avidec: return 0, not packet size from read_packet().
(cherry picked from commit eeade678f0)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-18 07:41:21 +02:00
Sean McGovern
a2d4d9f4fb wmapro: prevent division by zero when sample rate is unspecified
This fixes Bugzilla #327:

Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
(cherry picked from commit 3680b24351)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-18 07:41:21 +02:00
Michael Niedermayer
3c55bf1201 vc1dec: check that coded slice positions and interlacing match.
This fixes out of array writes.

Addresses: CVE-2012-2796

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
(cherry picked from commit 1100acbab2)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-17 21:35:25 +02:00
Thilo Borgmann
dc5283dffc alsdec: fix number of decoded samples in first sub-block in BGMC mode.
Fixes CVE-2012-2790

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 66197988b1)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-17 21:31:21 +02:00
Mans Rullgard
c28e1c12ad alsdec: remove dead assignments
Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 4ca6d206d1)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-17 21:31:01 +02:00
Thilo Borgmann
c5f9c272e9 alsdec: Fix out of ltp_gain_values read.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 97f0efbfb8)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-17 21:27:02 +02:00
Michael Niedermayer
0f81057c12 alsdec: Check that quantized parcor coeffs are within range.
ALS spec:
	11.6.3.1.1 Quantization and encoding of parcor coefficients
	...
	In all cases the resulting quantized values ak are restricted to the range [-64,63].

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 5b051ec3bd)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-17 21:26:46 +02:00
Michael Niedermayer
592ba67815 alsdec: Check k used for rice decoder.
Values that fail this check will cause failure of decode_rice()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 23aae62c2c)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-17 21:26:15 +02:00
Anton Khirnov
15c2e8027f wav: do not fail on empty INFO tags
Fixes Bug 379

CC: libav-stable@libav.org
2012-10-16 20:20:55 +02:00
Michael Niedermayer
be2dd2559f Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8: (23 commits)
  snow: Check mallocs at init
  vorbis: Validate that the floor 1 X values contain no duplicates.
  vorbisenc: check all allocations for failure
  indeo3: validate new frame size before resetting decoder
  lavfi: avfilter_merge_formats: handle case where inputs are same
  rv34: error out on size changes with frame threading
  rv34: Handle only complete frames in frame-mt.
  rv34: use AVERROR return values in ff_rv34_decode_frame()
  vlc/rl: Add ff_ prefix to the nonstatic symbols
  h263: Add ff_ prefix to nonstatic symbols
  alsdec: check opt_order.
  golomb: check remaining bits during unary decoding in get_ur_golomb_jpegls()
  lavf: don't segfault when a NULL filename is passed to avformat_open_input()
  mpegvideo: Don't use ff_mspel_motion() for vc1
  imgconvert: avoid undefined left shift in avcodec_find_best_pix_fmt
  eval: fix swapping of lt() and lte()
  nuv: check RTjpeg header for validity
  Revert "nuv: check per-frame header for validity."
  bmpdec: only initialize palette for pal8.
  sipr: fall back to setting mode based on bit_rate.
  ...

Conflicts:
	avconv.c
	libavcodec/dnxhddec.c
	libavcodec/golomb.h
	libavcodec/h263.h
	libavcodec/imgconvert.c
	libavcodec/mpegvideo_common.h
	libavcodec/mpegvideo_enc.c
	libavcodec/nuv.c
	libavcodec/rv34.c
	libavcodec/sipr.c
	libavcodec/vorbisdec.c
	libavcodec/vorbisenc.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-10-16 04:25:51 +02:00
Michael Niedermayer
2051adbfa0 cavsdec: check for changing w/h.
Our decoder does not support changing w/h.

Fixes CVE-2012-2777 and CVE-2012-2784.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit c20a696306)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:24 -04:00
Michael Niedermayer
2bc1e4fcb9 indeo4: update AVCodecContext width/height on size change
Fixes CVE-2012-2787

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit b146d74730)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:24 -04:00
Anton Khirnov
0582b8e3ea avidec: use actually read size instead of requested size
Fixes CVE-2012-2788
(cherry picked from commit 0af49a63c7)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:24 -04:00
Michael Niedermayer
6744eee1e5 wmaprodec: check num_vec_coeffs for validity
Fixes CVE-2012-2789

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 99f392a584)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:24 -04:00
Michael Niedermayer
14bba214fa lagarith: check count before writing zeros.
Fixes CVE-2012-2793

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit b631e4ed64)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:24 -04:00
Anton Khirnov
1c8e2561b4 indeo3: fix out of cell write.
Fixes CVE-2012-2776.

CC:libav-stable@libav.org

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit e4d4044339)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:24 -04:00
Michael Niedermayer
5c413648c1 indeo5: check tile size in decode_mb_info().
This prevents writing into a too small array if some parameters changed
without the tile being reallocated.

Fixes CVE-2012-2794

CC:libav-stable@libav.org

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 2d09cdbaf2)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:24 -04:00
Janne Grunau
3efe6becc7 indeo5: prevent null pointer dereference on broken files
Found by John Villamil <johnv@matasano.com>
(cherry picked from commit 366ac22ea5)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:24 -04:00
Michael Niedermayer
dc8371b2b1 indeo5dec: Make sure we have had a valid gop header.
This prevents decoding happening on a half initialized context.

Fixes CVE-2012-2779

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 891918431d)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:24 -04:00
Anton Khirnov
0815d9174c indeo4/5: check empty tile size in decode_mb_info().
This prevents writing into a too small array if some parameters changed
without the tile being reallocated.

Based on a patch by Michael Niedermayer <michaelni@gmx.at>

Fixes CVE-2012-2800

CC:libav-stable@libav.org

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit ae3da0ae55)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:24 -04:00
Anton Khirnov
332555f660 ivi_common: make ff_ivi_process_empty_tile() static.
It's not used outside of ivi_common.c
(cherry picked from commit 5d2170c53b)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:24 -04:00
Kostya Shishkov
c5ec190859 indeo: check for invalid motion vectors
(cherry picked from commit cf61aaaca1)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:23 -04:00
Kostya Shishkov
b561618014 indeo: clear allocated band buffers
(cherry picked from commit 23ba1503f2)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:23 -04:00
Kostya Shishkov
e0daa15a96 indeo: track tile macroblock size
(cherry picked from commit a6e4ac40a6)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:23 -04:00
Kostya Shishkov
911c250aef factor out common decoding code for Indeo 4 and Indeo 5
(cherry picked from commit aa372cf470)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:23 -04:00
Kostya Shishkov
965302c9f3 indeo: check custom Huffman tables for errors
(cherry picked from commit fe7a37c36f)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:23 -04:00
Anton Khirnov
0c19855539 dfa: improve boundary checks in decode_dds1()
Fixes CVE-2012-2798

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:23 -04:00
Kostya Shishkov
d0267ecf76 dfa: use more meaningful return codes
(cherry picked from commit fb5c1aaea6)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:20 -04:00
Kostya Shishkov
2281ac9ffd dfa: add some checks to ensure that decoder won't write past frame end
(cherry picked from commit 8099187e89)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 16:03:18 -04:00
Paul B Mahol
12941dbe2c dfa: convert to bytestream2 API
Protects from overreads.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 29b0d94b43)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 15:33:38 -04:00
Anton Khirnov
9e575e54a0 dfa: check that the caller set width/height properly.
Fixes CVE-2012-2786.
(cherry picked from commit ee715f49a0)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 15:31:46 -04:00
Michael Niedermayer
9a76b7375e avsdec: Set dimensions instead of relying on the demuxer.
The decode function assumes that the video will have those dimensions.

Fixes CVE-2012-2801

CC:libav-stable@libav.org

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 85f477935c)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 15:29:00 -04:00
Justin Ruggles
d7de11260b ac3dec: ensure get_buffer() gets a buffer for the correct number of channels
If there is an error during frame parsing, but AVCodecContext.channels was
changed and AC3DecodeContext.out_channels was set previously, the two may not
match.

Fixes CVE-2012-2802
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-14 15:27:39 -04:00
Martin Storsjö
31bc3fb563 snow: Check mallocs at init
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 4d8516fdb1)

Conflicts:

	libavcodec/snow.c
2012-10-06 08:43:43 +02:00
Alex Converse
9aaaeba45c vorbis: Validate that the floor 1 X values contain no duplicates.
Duplicate values in this vector are explicitly banned by the Vorbis I spec
and cause divide-by-zero crashes later on.
(cherry picked from commit ecf79c4d3e)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-06 08:43:43 +02:00
Justin Ruggles
e46cf805b1 vorbisenc: check all allocations for failure
(cherry picked from commit be8d812c96)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-06 08:43:43 +02:00
Kostya Shishkov
d4f3abca6a indeo3: validate new frame size before resetting decoder
(cherry picked from commit 6de226a2b8)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-06 08:43:43 +02:00
Mina Nagy Zaki
e5f4e24942 lavfi: avfilter_merge_formats: handle case where inputs are same
This fixes a double-free crash if lists are the same due to the two
merge_ref() calls at the end of the (useless) merging that happens.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 11b6a82412)

Conflicts:

	libavfilter/formats.c

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-10-06 08:43:43 +02:00
Janne Grunau
b1ad5a21da rv34: error out on size changes with frame threading
Fixes CVE-2012-2772

(cherry picked from commit cb7190cd2c)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-06 08:43:42 +02:00
Janne Grunau
90575bd7dd rv34: Handle only complete frames in frame-mt.
Correct handling of errors to prevent hags or crashes is very complex
otherwise.

The frame initializing is also moved from decode_slice() to
decode_frame() for clarity.
(cherry picked from commit 73ad4471a4)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-10-06 08:43:22 +02:00
Janne Grunau
f695bd6016 rv34: use AVERROR return values in ff_rv34_decode_frame()
Also adds an error message.
(cherry picked from commit 29330721b0)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-29 09:34:19 +02:00
Martin Storsjö
8c0bbe5156 vlc/rl: Add ff_ prefix to the nonstatic symbols
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit e96b4a53df)

Conflicts:
	libavcodec/4xm.c

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-29 09:34:19 +02:00
Martin Storsjö
6d1b91324c h263: Add ff_ prefix to nonstatic symbols
Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit ddce8953a5)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-29 09:34:19 +02:00
Michael Niedermayer
a1b127515b alsdec: check opt_order.
Fixes out of array write in quant_cof.
Also make sure no invalid opt_order stays in the context.

Fixes CVE-2012-2775

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 9853e41aa0)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:20:11 +02:00
Justin Ruggles
d9ffa2aca1 golomb: check remaining bits during unary decoding in get_ur_golomb_jpegls()
Fixes infinite loop in FLAC decoding in case of a truncated bitstream due to
the safe bitstream reader returning 0's at the end.

Fixes Bug 310.

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:07:00 +02:00
Anton Khirnov
7124fa5d36 lavf: don't segfault when a NULL filename is passed to avformat_open_input()
This can easily happen when the caller is using a custom AVIOContext.

Behave as if the filename was an empty string in this case.

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:06:39 +02:00
Michael Niedermayer
da0c457663 mpegvideo: Don't use ff_mspel_motion() for vc1
Using ff_mspel_motion assumes that s (a MpegEncContext
poiinter) really is a Wmv2Context.

This fixes crashes in error resilience on vc1/wmv3 videos.

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:06:18 +02:00
Janne Grunau
7a7229b52d imgconvert: avoid undefined left shift in avcodec_find_best_pix_fmt
CC: libav-stable@libav.org
(cherry picked from commit 39bb27bf79)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:06:02 +02:00
Max Lazarov
25a1a5b1b3 eval: fix swapping of lt() and lte()
CC: libav-stable@libav.org
(cherry picked from commit caac3ab6ef)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:05:40 +02:00
Janne Grunau
6704522ca9 nuv: check RTjpeg header for validity
CC: libav-stable@libav.org
(cherry picked from commit 859a579e9b)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:05:24 +02:00
Janne Grunau
fdb7080781 Revert "nuv: check per-frame header for validity."
The check is bogus since the nuv frameheader is already skipped
and the (decompressed) RTjpeg header is checked.

This reverts commit f6afacdb3b.

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:05:11 +02:00
Anton Khirnov
bed5847563 bmpdec: only initialize palette for pal8.
Gray8 is not considered to be paletted, so this would cause an invalid
write.

Fixes bug 367.

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:04:43 +02:00
Reimar Döffinger
e9ac06160f sipr: fall back to setting mode based on bit_rate.
Not all applications (e.g. MPlayer) set block_align, and
when using a different demuxer it might not even be
easily available.
So fall back to selecting mode based on bit rate as before
if block_align has not useful value.
It can't be worse than failing to decode completely.

(cherry picked from commit 1d0d63052b)

CC: libav-stable@libav.org
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit c54e00610f)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:04:33 +02:00
Kostya Shishkov
02b7239462 vc1dec: add flush function for WMV9 and VC-1 decoders
CC: libav-stable@libav.org
(cherry picked from commit 4dc8c8386e)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:04:33 +02:00
Reimar Döffinger
8efae4cbbf avconv: fix parsing of -force_key_frames option.
Currently it always exits with an error when more than
one position is specified.

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-09-28 08:04:33 +02:00
Michael Niedermayer
50032a75d6 Changelog for 0.10.5
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-19 03:09:28 +02:00
Michael Niedermayer
eed53a38c9 Update for 0.10.5
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-19 02:34:55 +02:00
Michael Niedermayer
501e60dcf5 bmv_videodec: fix out of array read
Fixes Ticket1373

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

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-19 01:08:24 +02:00
Michael Niedermayer
d36c706b86 faxcompr: fix out of array read
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5891e454a6)

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-19 01:08:24 +02:00
Michael Niedermayer
fcb8bbf264 escape124: fix integer overflow leading to excessive memory allocation
Fixes Ticket1629

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

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-19 01:08:24 +02:00
Michael Niedermayer
38c5e8fec5 sp5xdec: fix off by 1 error causing a crash
Fixes Ticket1633

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f0896a6bd9)

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-19 01:08:24 +02:00
Michael Niedermayer
1301942248 mpegaudio_parser: reset state to prevent it to be random
Fixes Ticket1718

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

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-19 01:08:24 +02:00
Ben Jackson
e2c7b37fd2 pthread: Avoid crashes/odd behavior caused by spurious wakeups
pthread_wait_cond can wake up for no reason (Wikipedia: Spurious_wakeup).
The FF_THREAD_SLICE thread mechanism could spontaneously execute jobs or
allow the caller of avctx->execute to return before all jobs were complete.
This adds tests to both cases to ensure the wakeup is real.

Signed-off-by: Ben Jackson <ben@ben.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit e3329474a3)

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-19 01:08:24 +02:00
Michael Niedermayer
7f90fe1b4b Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-19 00:54:30 +02:00
Carl Eugen Hoyos
2cf6afffe5 Fix muxing mjpeg in swf.
(cherry picked from commit 7680d99b43)
2012-09-13 09:21:55 +02:00
jamal
50e6e494c9 build: Fix some paths in uninstall-libs
Folder and file names weren't being separated with a slash.
This resulted in .dll.a, .lib and .def files not being removed on uninstall.

Signed-off-by: Alexander Strasser <eclipse7@gmx.net>
(cherry picked from commit 49440853d0)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-13 04:47:57 +02:00
Ronald S. Bultje
0f54c97f58 dxva2: include dxva.h if found
Apparently, some build environments require dxva.h even for dxva2,
while others lack this header entirely.  Including it conditionally
allows building in both cases.

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

Conflicts:

	configure

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-13 04:45:36 +02:00
Ramiro Polla
a1f678f7ca asfenc: properly write index information
The index must take into account the pre-roll time and must seek backwards,
not forwards.

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

Conflicts:

	tests/ref/lavf/asf
	tests/ref/seek/lavf_asf

Fixes Ticket1563

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-12 16:48:59 +02:00
Ramiro Polla
94905d2af6 asfenc: remove useless casts
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit bc13b74992)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-12 16:37:05 +02:00
Ramiro Polla
b04fbd2cd2 asfenc: reduce code duplication with new variable
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit f2fad251b8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-12 16:36:57 +02:00
Ramiro Polla
f7b045db09 asfenc: rename some variables
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1ceff0859d)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-12 16:36:46 +02:00
Ramiro Polla
de1591b167 asfenc: realloc index_ptr fewer times
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 97d36a1898)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-09-12 16:35:56 +02:00
Carl Eugen Hoyos
c7b73724c7 Clarify that -passlogfile has a different syntax when used with -vcodec libx264. 2012-08-31 14:17:01 +02:00
Anton Khirnov
1846f3b5b1 avconv: fix -force_key_frames
parse_forced_keyframes() relies in encoder timebase being set, so call
it from transcode_init() after it is known.

Conflicts:

	avconv.c

(cherry picked from commit 19ad567311)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-06-26 14:02:58 +02:00
Mans Rullgard
2fb4be9a99 mov: set AVCodecContext.width/height for h264
This is required for correct cropping of files from Canon
cameras.

Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 8aa93e9004)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-06-10 11:22:57 +02:00
Mans Rullgard
e1608014c5 h264: allow cropping to AVCodecContext.width/height
Override the frame size from the SPS with AVCodecContext values
if the latter specify a size smaller by less than one macroblock.
This is required for correct cropping of MOV files from Canon cameras.

Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 30f515091c)

Conflicts:

	libavcodec/h264.c
2012-06-10 09:47:45 +02:00
Michael Niedermayer
8c0c0e9eb3 Update for 0.10.4
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:52:12 +02:00
Michael Niedermayer
997e7692d8 mpegvideo: fix out of heap array accesses
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 317ca0d3f7)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:50:57 +02:00
Michael Niedermayer
944b6a801e mpc8: fix channel checks
fix heap array overflow

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 44c10168cf)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:50:14 +02:00
Michael Niedermayer
ddd9483a10 h263: disable loop filter with lowres
Fixes ticket1212

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit cc229d4e83)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:49:58 +02:00
Michael Niedermayer
9c13d232a4 bmv: fix apparent sign error in the frame_off check
Fixes part of Ticket1373

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:49:18 +02:00
Michael Niedermayer
c4926cba15 bmv: fix integer overflows in vlc decoder.
Fixes part of Ticket1373

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Based-on-patch-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 679c578cb8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:49:14 +02:00
Michael Niedermayer
321bbb6f49 wmv1: check that the input buffer is large enough
Fixes null ptr deref
Fixes Ticket1367

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:47:56 +02:00
Michael Niedermayer
81476cf693 yopdec: check frame oddness to be within supported limits
Fixes Ticket1365

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:47:19 +02:00
Michael Niedermayer
3c69368e6b yopdec: check that palette fits in the packet
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b6fdf8dea7)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:47:11 +02:00
Michael Niedermayer
fcf09ebff5 8svx: fix crash
Fixes Ticket1377

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 03ce421c13)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:46:55 +02:00
Michael Niedermayer
d6c73986cc dv-demux: dont mess with codec values
Fixes part of Ticket1369

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:46:03 +02:00
Paul B Mahol
aefa2bf70a binkaudio: check number of channels
Fixes #1380.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:45:09 +02:00
Michael Niedermayer
ece27b09d6 indeo5: check quant_mat
prevents out of array read

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:45:00 +02:00
Michael Niedermayer
479856a3b2 truemotion1: Check index, fix out of array read
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit fd4c1c0b70)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:44:19 +02:00
Paul B Mahol
fc0d962919 iff: check if there is extradata
Fixes #1368.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:41:15 +02:00
Michael Niedermayer
0452ebfd4b ape: Fix null ptr dereference with files missing a seekatable.
Such files are currently not supported as the table is used at several points

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:40:50 +02:00
Michael Niedermayer
9e9e6bbe7b 4xm: fix division by zero caused by bps<8
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1b8741a684)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:39:12 +02:00
Michael Niedermayer
3e4eea6c32 jvdec: check videosize
Fixes null ptr dereference
fixes Ticket1364

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:38:29 +02:00
Michael Niedermayer
cc0fec8393 motionpixels: check extradata size
Fixes null ptr derefernce
Fixes Ticket1363

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:38:22 +02:00
Michael Niedermayer
fa67ad85ac iff_ilbm: fix null ptr deref
Fixes Ticket1362

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:38:14 +02:00
Michael Niedermayer
0adc452146 yop: check for missing extradata
Fixes null ptr deref
Fixes Ticket1361

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:38:09 +02:00
Michael Niedermayer
7df0e309fd xan: fix out of array read
Fixes ticket1360

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:37:36 +02:00
Michael Niedermayer
a4b329d622 cdgraphics: Fix out of array write
Fixes Ticket1359

Found-by: Piotr Bandurski <ami_stuff@o2.pl>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 1e5c7376c4)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 20:37:27 +02:00
Michael Niedermayer
eefd6bbee9 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  cmdutils: update copyright year to 2012.

Conflicts:
	cmdutils.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-09 19:17:22 +02:00
Ronald S. Bultje
ce39a84a7d cmdutils: update copyright year to 2012. 2012-06-08 12:38:58 +02:00
Michael Niedermayer
514f3e7c02 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  Update Changelog for the 0.8.3 Release
  Prepare for 0.8.3 Release
  ea: check chunk_size for validity.
  png: check bit depth for PAL8/Y400A pixel formats.
  qdm2: clip array indices returned by qdm2_get_vlc().
  tqi: Pass errors from the MB decoder
  h264: Add check for invalid chroma_format_idc
  h263dec: Disallow width/height changing with frame threads.

Conflicts:
	Changelog
	RELEASE
	libavcodec/eatqi.c
	libavcodec/h264_ps.c
	libavcodec/pngdec.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-06-04 13:40:13 +02:00
Reinhard Tartler
4dfea3e9f0 Update Changelog for the 0.8.3 Release 2012-06-03 19:09:07 +02:00
Reinhard Tartler
f9ee7d13e8 Prepare for 0.8.3 Release 2012-06-03 19:05:29 +02:00
Ronald S. Bultje
ec27262c4d ea: check chunk_size for validity.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 273e6af47b)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-06-03 19:05:29 +02:00
Ronald S. Bultje
d34e9e61dd png: check bit depth for PAL8/Y400A pixel formats.
Wrong bit depth can lead to invalid rowsize values, which crashes the
decoder further down.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit d2205d6543)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-06-03 19:04:51 +02:00
Ronald S. Bultje
c38d3e1a39 qdm2: clip array indices returned by qdm2_get_vlc().
Prevents subsequent overreads when these numbers are used as indices
in arrays.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org

Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 64953f67f9)
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>

Conflicts:

	libavcodec/qdm2.c
2012-06-02 19:17:53 -04:00
Michael Niedermayer
5872580e65 tqi: Pass errors from the MB decoder
This silences some valgrind warnings.
CC: libav-stable@libav.org

Fixes second half of http://ffmpeg.org/trac/ffmpeg/ticket/794
Bug found by: Oana Stratulat

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit f85334f58e)
(cherry picked from commit 90290a5150)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-05-23 20:43:42 +02:00
Alexander Strange
4713234518 h264: Add check for invalid chroma_format_idc
Fixes a crash when FF_DEBUG_PICT_INFO is used.

Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 6ef4063957)

Fixes: CVE-2012-0851

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-05-22 21:57:38 +02:00
Michael Niedermayer
5836110018 h263dec: Disallow width/height changing with frame threads.
Fixes CVE-2011-3937

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

Conflicts:

	libavcodec/h263dec.c

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-05-22 21:51:58 +02:00
Michael Niedermayer
3fab87edc9 threads: Perform the generic progress cleanup more carefully.
The cleanup is only done now when
a picture is returned (assuming that it has to be done when its returned)
a error is returned (assuming that there will be no further progress on the frame)
the codec is not h264 (this is still needed due to some deadlocks in realvideo)

This fixes a decoding regression with 00017.MTS

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 18a7f7465e)
2012-05-13 14:09:29 +02:00
Michael Niedermayer
b1f9ff45d4 update for ffmpeg 0.10.3
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-06 01:42:01 +02:00
Michael Niedermayer
96acb0a4eb indeo4: check that num_mbs matches
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit d3db8988d5)
2012-05-06 01:42:01 +02:00
Michael Niedermayer
df93682e64 dsp: fix diff_bytes_mmx() with small width
Fixes Ticket1068

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 73089eccd3e48539555349b36d8aabbf1cea416e)
2012-05-06 01:42:01 +02:00
Michael Niedermayer
22285aba13 Changelog: update
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-06 01:42:01 +02:00
Michael Niedermayer
097ad61100 mmdemux: dont set pkt->size to an invalid value.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0c97fd336e)
2012-05-06 00:59:45 +02:00
Michael Niedermayer
c785a7058a h261: check mtype.
Fixes out of array read

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit ec3cd74f2d)
2012-05-06 00:57:10 +02:00
Michael Niedermayer
6736de0ce6 mpegvideo: increase buffer sizes.
Fixes buffer overflow

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 2c0559d5e2)
2012-05-06 00:55:36 +02:00
Michael Niedermayer
fe8508b948 mov: fix global unicode convertion array overflow.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 437f5daf0b)
2012-05-06 00:55:06 +02:00
Michael Niedermayer
0d40fbaef0 iff: fix null ptr dereference
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 41abc9da50)
2012-05-06 00:54:40 +02:00
Michael Niedermayer
a4846943a3 xmvdemux: dont let current_stream become invalid.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 13381577d1)
2012-05-06 00:53:02 +02:00
Michael Niedermayer
bf2534a5e2 avidec: Dont crash on avi packets that belong to dv streams in dv in avi
Fixes null pointer dereference

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 096231d497)
2012-05-06 00:50:25 +02:00
Michael Niedermayer
1ca4e70b6c cook: check subacket count
Fixes out of array writes.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5a35bd92ad)
2012-05-06 00:47:44 +02:00
Michael Niedermayer
25a2802239 4xmdemux: Check chunk size
Fixes over reading the header array

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-06 00:45:04 +02:00
Michael Niedermayer
581a830829 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  Update Changelog for the 0.8.2 Release
  Prepare for 0.8.2 Release
  vqavideo: return error if image size is not a multiple of block size
  celp filters: Do not read earlier than the start of the 'out' vector.
  motionpixels: Clip YUV values after applying a gradient.
  jpeg: handle progressive in second field of interlaced.
  h263: more strictly forbid frame size changes with frame-mt.
  h264: additional protection against unsupported size/bitdepth changes.
  tta: prevents overflows for 32bit integers in header.
  ttadec: CRC checking
  tta: use skip_bits_long()

Conflicts:
	Changelog
	RELEASE
	libavcodec/h264.c
	libavcodec/tta.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-06 00:25:39 +02:00
Reinhard Tartler
43e5fda45c Update Changelog for the 0.8.2 Release 2012-05-04 22:59:01 +02:00
Reinhard Tartler
a638e10ba0 Prepare for 0.8.2 Release 2012-05-04 22:40:37 +02:00
Mans Rullgard
d5207e2af8 vqavideo: return error if image size is not a multiple of block size
The decoder assumes in various places that the image size
is a multiple of the block size, and there is no obvious
way to support odd sizes.  Bailing out early if the header
specifies a bad size avoids various errors later on.

Fixes CVE-2012-0947.

Signed-off-by: Mans Rullgard <mans@mansr.com>
(cherry picked from commit 58b2e0f0f2)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-05-04 22:14:26 +02:00
Alex Converse
9ea94c44b1 celp filters: Do not read earlier than the start of the 'out' vector.
CC: libav-stable@libav.org
(cherry picked from commit 37ddd38332)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-05-04 22:09:27 +02:00
Alex Converse
aaa6a66677 motionpixels: Clip YUV values after applying a gradient.
Prevents illegal reads on truncated and malformed input.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-05-04 22:09:27 +02:00
Ronald S. Bultje
7240cc3f8b jpeg: handle progressive in second field of interlaced.
Progressive data is allocated later in decode_sof(), not allocating
that data leads to NULL dereferences.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 5eec5a79da)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-05-04 22:09:27 +02:00
Ronald S. Bultje
7fe4c8cb76 h263: more strictly forbid frame size changes with frame-mt.
Prevents crashes because the old check was incomplete.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 2d22d4307d)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-05-04 22:09:27 +02:00
Ronald S. Bultje
746f1594d7 h264: additional protection against unsupported size/bitdepth changes.
Fixes crashes in codepaths not covered by original checks.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit 732f9fcfe5)

Conflicts:

	libavcodec/h264.c

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-05-04 22:09:27 +02:00
Ronald S. Bultje
0e4bb0530f tta: prevents overflows for 32bit integers in header.
This prevents sample_rate/data_length from going negative, which
caused various crashes and undefined behaviour further down.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit ac80b812cd)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-05-04 21:28:45 +02:00
Paul B Mahol
994c0efcc7 ttadec: CRC checking
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 2af3dc8698)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-05-04 21:28:35 +02:00
Paul B Mahol
cf5e119d4a tta: use skip_bits_long()
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 9aff2d1753)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-05-04 21:28:28 +02:00
Michael Niedermayer
1ee1e9e43f vqavideodev: Check image dimensions
Fixes out of heap array read

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3583c8706d)
Independently-Found-by: Fabian Yamaguchi
Fixes: CVE-2012-0947

Conflicts:

	libavcodec/vqavideo.c
2012-05-03 00:22:32 +02:00
Michael Niedermayer
15e9aee544 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8: (24 commits)
  apedec: check bits <= 32.
  truemotion: forbid invalid VLC bitsizes and token values.
  mov: don't overwrite existing indexes.
  truemotion2: handle out-of-frame motion vectors through edge extension.
  lzw: prevent buffer overreads.
  truemotion2: convert packet header reading to bytestream2.
  lagarith: fix buffer overreads.
  raw: forward avpicture_fill() error code in raw_decode().
  vc1: Do not read from array if index is invalid.
  utvideo: port header reading to bytestream2.
  bytestream: add more unchecked variants for bytestream2 API
  bytestream: K&R formatting cosmetics
  bytestream: Add bytestream2 writing API.
  aac: Reset PS parameters on header decode failure.
  mov: Do not read past the end of the ctts_data table.
  xwma: Validate channels and bits_per_coded_sample.
  asf: reset side data elements on packet copy.
  vqa: check palette chunk size before reading data.
  vqavideo: port to bytestream2 API
  wmavoice: fix stack overread.
  ...

Conflicts:
	cmdutils.c
	cmdutils.h
	libavcodec/lagarith.c
	libavcodec/truemotion2.c
	libavcodec/vqavideo.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-05-03 00:20:54 +02:00
Michael Niedermayer
e8050f313e apedec: check bits <= 32.
Fixes a floating-point exception further down.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
(cherry picked from commit 420d1df2e2)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:03 +02:00
Ronald S. Bultje
be424d86a8 truemotion: forbid invalid VLC bitsizes and token values.
SHOW_UBITS() is only defined up to n_bits is 25, therefore forbid
values larger than this in get_vlc2() (max_bits). tokens[][] can be
used as an index in deltas[], which has a size of 64, so ensure the
values are smaller than that.

This prevents crashes on corrupt bitstreams.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit b7b1509d06)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:03 +02:00
Ronald S. Bultje
a08cb950b2 mov: don't overwrite existing indexes.
Prevents all kind of badness if files contain multiple
indexes.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 4f7c7624c0)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:03 +02:00
Ronald S. Bultje
46f8bbfc6d truemotion2: handle out-of-frame motion vectors through edge extension.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit bf39d3b59d)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:03 +02:00
Ronald S. Bultje
562c6a7bf1 lzw: prevent buffer overreads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit ddcf67c8a5)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:03 +02:00
Ronald S. Bultje
e711ccee4d truemotion2: convert packet header reading to bytestream2.
Also use correct buffer sizes in calls to tm2_read_stream(). Together,
this prevents overreads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit bd508d435b)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:03 +02:00
Ronald S. Bultje
d6372e80fe lagarith: fix buffer overreads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 0a82f5275f)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:03 +02:00
Ronald S. Bultje
29d91e9161 raw: forward avpicture_fill() error code in raw_decode().
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 98df2e2414)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:02 +02:00
Mashiat Sarker Shakkhar
583f57f04a vc1: Do not read from array if index is invalid.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 95b192de5d)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:02 +02:00
Ronald S. Bultje
f8f6c14f54 utvideo: port header reading to bytestream2.
Fixes crash during slice size reading if slice_end goes negative.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit ec0ed97b04)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:02 +02:00
Paul B Mahol
9e24f2a1f0 bytestream: add more unchecked variants for bytestream2 API
Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit f1ce053cd0)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:02 +02:00
Aneesh Dogra
e788c6e9cb bytestream: K&R formatting cosmetics
Signed-off-by: Diego Biurrun <diego@biurrun.de>
(cherry picked from commit ab9ae40152)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:02 +02:00
Aneesh Dogra
2e681cf50f bytestream: Add bytestream2 writing API.
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit db7d45237a)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:02 +02:00
Alex Converse
9ddd3abe78 aac: Reset PS parameters on header decode failure.
If the next header frame codes zero envelopes the previous frame's
values will be used. Consequently the invalid values must be cleared.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit a237b38021)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:02 +02:00
Alex Converse
86bd0244ec mov: Do not read past the end of the ctts_data table.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 86f2ae06b9)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:02 +02:00
Alex Converse
15de658c04 xwma: Validate channels and bits_per_coded_sample.
This prevents a SIGFPE later on.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 5023b89bba)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:02 +02:00
Ronald S. Bultje
19d3f7d8ac asf: reset side data elements on packet copy.
Prevents crash (double free) when free()ing the original packet.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit e73c6aaabf)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:02 +02:00
Ronald S. Bultje
c21b858b27 vqa: check palette chunk size before reading data.
Prevents overreads beyond buffer boundaries.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 75d7975268)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:01 +02:00
Paul B Mahol
0b9bb581fd vqavideo: port to bytestream2 API
Protects against overreads.

Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 5a3a906ba2)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:01 +02:00
Ronald S. Bultje
105601c151 wmavoice: fix stack overread.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 262196445c)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:01 +02:00
Ronald S. Bultje
3a4949aa50 indeo4: fix out-of-bounds function call.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org

Signed-off-by: Kostya Shishkov <kostya.shishkov@gmail.com>
(cherry picked from commit 68fd077f68)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:01 +02:00
Reinhard Tartler
ec554ee747 Read preset files with suffix .avpreset
The preset files have been renamed some time ago.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:01 +02:00
Ronald S. Bultje
bf3998d71e mimic: don't use self as reference, and report completion at end of decode().
Fixes hangs on corrupt samples that reference self-frames.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 80387f0e25)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:01 +02:00
Ronald S. Bultje
87208b8fc4 mpeg4: report frame decoding completion at ff_MPV_frame_end().
Prevents hangs on corrupt input.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit c6ccb96bc9)

Conflicts:

	libavcodec/mpegvideo.c

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-04-29 22:07:01 +02:00
Ronald S. Bultje
265a628f16 h264: use struct offsets in get_cabac_bypass_sign_x86().
(cherry picked from commit db025929f2)
2012-04-21 21:41:30 +02:00
ami_stuff
a854d00acd Replace SSE2 instruction in scalarproduct_float_sse() by SSE equivalent.
Fixes an AAC decoding issue with the sample from ticket #213 on machines
with SSE but without SSE2.
Based on 89411a by Reimar.

(cherry picked from commit f6b7863808)
2012-04-04 09:16:49 +02:00
Stefano Sabatini
d076d0febd lavfi/fade: fix black level for non studio-level pixel formats
Fix trac ticket #1139, regression introduced in 8c1fb50d07.
(cherry picked from commit 95ce0ddcfe)
2012-04-04 09:04:15 +02:00
Michael Niedermayer
a56eaa024f mpeg4: dont reset picture_num for xvid
Fixes Ticket1162

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit a4e359a3f9)
2012-04-04 08:38:18 +02:00
Michael Niedermayer
fdc6f6507c h264: fix seeking in low delay streams without IDR
Fixes Ticket1165

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3360b8517a)
2012-04-04 08:38:06 +02:00
Michael Niedermayer
976d173606 Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8:
  id3v2: fix skipping extended header in id3v2.4

Conflicts:
	libavformat/id3v2.c

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-04-02 00:52:23 +02:00
Anton Khirnov
989431c02f id3v2: fix skipping extended header in id3v2.4
In v2.4, the length includes the length field itself.
(cherry picked from commit ddb4431208)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-04-01 19:30:21 +02:00
Franz Brauße
f9bdc93723 smacker audio: sign-extend the initial 16-bit predicted value
Fixes Bug #265

Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 12cbbbb4ab)
2012-04-01 13:57:49 +02:00
Tomas Härdin
e687d77d15 mxfdec: Only parse next partition pack if parsing forward
This fixes ticket #1099.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 393b81f093)
2012-03-21 13:25:59 +01:00
Michael Niedermayer
abfafb6c81 pngenc: Fix incorrect mask used for interlaced mode.
Fixes Ticket1109

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 15db6a9590)
2012-03-21 10:50:58 +01:00
Michael Niedermayer
f139838d64 Update for 0.10.2
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-17 09:14:13 +01:00
Kelly Anderson
0a224ab102 libx264: fix duplicate stats entry
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-17 08:56:59 +01:00
Michael Niedermayer
d39b183d8d Update for 0.10.1
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-17 01:41:41 +01:00
Stefano Sabatini
dc8054128a lavfi: port MP swapuv filter
(cherry picked from commit fa35d880aa)

Conflicts:

	Changelog
	libavfilter/version.h

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-17 00:36:18 +01:00
Michael Niedermayer
001f4c7dc6 jpeglsdec: Prevent out of array write.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 00ab9cdae1)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-16 16:46:30 +01:00
Michael Niedermayer
313ddbfe48 proresdec: Fix read via negative index in a global array.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 0065080320)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-16 16:42:49 +01:00
Michael Niedermayer
7f5bd6c72b diracdec: Correct the bytestream end pointer.
This fixes some arith decoder overreads and a potential infinite loop.

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-16 16:00:07 +01:00
Michael Niedermayer
0be85fd80f diracdec: Check for negative quants which would cause out of array reads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 5cd8afee99)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-16 15:59:30 +01:00
Michael Niedermayer
9f253ebb41 diracdec: Fix integer overflow leading to out of global array read.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 9729f140ae)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-16 15:59:21 +01:00
Michael Niedermayer
6242dae507 sonic: update to new API
Fixes Ticket1075

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

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-16 15:23:10 +01:00
Michael Niedermayer
1749b0d74d mmvideo: restore initial y value.
This bug might have been exploitable (out of HEAP buffer writes)

Bug introduced by libav
	commit a55d5bdc6e
	Date:   Tue Mar 6 15:15:42 2012 -0800

	    algmm: convert to bytestream2 API.
(cherry picked from commit c2e3b564b3)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-16 14:46:08 +01:00
Michael Niedermayer
568e9062bd Merge remote-tracking branch 'qatar/release/0.8' into release/0.10
* qatar/release/0.8: (154 commits)
  Update Changelog for the 0.8.1 Release
  dca: include libavutil/mathematics.h for possibly missing M_SQRT1_2
  dca: don't use av_clip_uintp2().
  snow: check reference frame indices.
  snow: reject unsupported chroma shifts.
  xa_adpcm: limit filter to prevent xa_adpcm_table[] array bounds overruns.
  h264: increase reference poc list from 16 to 32.
  h264: stricter reference limit enforcement.
  h264: improve parsing of broken AVC SPS
  Replace computations of remaining bits with calls to get_bits_left().
  png: convert to bytestream2 API.
  roqvideo: convert to bytestream2 API.
  smc: port to bytestream2 API.
  tgq: convert to bytestream2 API.
  algmm: convert to bytestream2 API.
  jvdec: unbreak video decoding
  h264: Fix invalid interlaced/progressive MB combinations for direct mode prediction.
  libx264: add 'stats' private option for setting 2pass stats filename.
  libx264: fix help text for slice-max-size option.
  avconv: reindent
  ...

Conflicts:
	Changelog
	RELEASE
	avconv.c
	doc/APIchanges
	ffplay.c
	libavcodec/Makefile
	libavcodec/aacdec.c
	libavcodec/alsdec.c
	libavcodec/atrac3.c
	libavcodec/avcodec.h
	libavcodec/dvdata.c
	libavcodec/fraps.c
	libavcodec/golomb.h
	libavcodec/h264.c
	libavcodec/h264.h
	libavcodec/h264_cabac.c
	libavcodec/h264_cavlc.c
	libavcodec/h264_direct.c
	libavcodec/h264_parser.c
	libavcodec/h264_ps.c
	libavcodec/h264idct_template.c
	libavcodec/indeo3.c
	libavcodec/kgv1dec.c
	libavcodec/kmvc.c
	libavcodec/mjpegbdec.c
	libavcodec/mmvideo.c
	libavcodec/mpegaudiodec.c
	libavcodec/mpegvideo.h
	libavcodec/options.c
	libavcodec/pngdec.c
	libavcodec/roqvideodec.c
	libavcodec/shorten.c
	libavcodec/svq3.c
	libavcodec/utils.c
	libavcodec/version.h
	libavcodec/wmadec.c
	libavcodec/xxan.c
	libavformat/Makefile
	libavformat/asfdec.c
	libavformat/dv.c
	libavformat/mov.c
	libavformat/nsvdec.c
	libavformat/utils.c
	libavformat/version.h
	libavutil/avutil.h
	libavutil/error.c
	libavutil/error.h
	libswscale/swscale.c
	libswscale/utils.c
	libswscale/x86/swscale_template.c
	tests/ref/acodec/g722

Merged-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-16 09:01:08 +01:00
Michael Niedermayer
5dbc75870f qpeg: Fix out of array writes.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-16 06:29:10 +01:00
Fabian Greffrath
c91a14638e srtdec: fix a format string vulnerability.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit aaa1173de7)
2012-03-16 06:29:10 +01:00
Nathan Caldwell
c00c380724 aacenc: Fix LONG_START windowing.
Forgot to add the equivalent amount to the incoming sample pointer as the output pointer.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 2e626dd513)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-16 06:29:10 +01:00
Nathan Caldwell
43625c5128 aacenc: Fix a bug where deinterleaved samples were stored in the wrong place.
10l: Forgot to adjust deinterleave for new location of incoming samples in 7946a5a.

This produced incorrect, but surprisingly listenable results.

Thanks to Justin Ruggles for the report.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit dc7e7d4dd9)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-03-16 06:29:10 +01:00
Reinhard Tartler
5effcfa767 Update Changelog for the 0.8.1 Release 2012-03-15 08:58:14 +01:00
Kostya Shishkov
1ee0cd1ad7 dca: include libavutil/mathematics.h for possibly missing M_SQRT1_2
Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2012-03-14 23:32:15 +01:00
Ronald S. Bultje
b594732475 dca: don't use av_clip_uintp2().
The argument is not a literal, thus causing the ARM v6 or later
builds to break.

Signed-off-by: Janne Grunau <janne-libav@jannau.net>
2012-03-14 23:30:19 +01:00
Michael Niedermayer
ce15406e78 snow: check reference frame indices.
Fixes NULL ptr dereference

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 1f8ff2b13c)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:35:09 +01:00
Michael Niedermayer
c9e95636a8 snow: reject unsupported chroma shifts.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit c9837954e7)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:34:55 +01:00
Ronald S. Bultje
6e5c07f4c8 xa_adpcm: limit filter to prevent xa_adpcm_table[] array bounds overruns.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 86020073db)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:34:36 +01:00
Ronald S. Bultje
c999a8ed65 h264: increase reference poc list from 16 to 32.
Interlaced images can have 32 references (16 per field), so limiting the
array size to 16 leads to invalid writes.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 48cbe4b092)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:34:13 +01:00
Ronald S. Bultje
4d343a6f47 h264: stricter reference limit enforcement.
Progressive images can have only 16 references, error out if there are
more, since the data is almost certainly corrupt, and the invalid value
will lead to random crashes or invalid writes later on.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit e0febda22d)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:33:15 +01:00
Michael Niedermayer
a81a6d9c80 h264: improve parsing of broken AVC SPS
Parsing the entire NAL as SPS fixes decoding of some AVC bitstreams
with broken escaping. Since the size of the NAL unit is known and
checked against the buffer end we can parse it entirely without buffer
overreads.

Fixes playback of
http://streams.videolan.org/streams/mp4/Mr_MrsSmith-h264_aac.mp4

Signed-off-by: Janne Grunau <janne-libav@jannau.net>
(cherry picked from commit 3aa661ec56)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:27:22 +01:00
Alex Converse
48f0eeb2e5 Replace computations of remaining bits with calls to get_bits_left().
(cherry picked from commit 3574a85ce5)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:27:16 +01:00
Ronald S. Bultje
d26e47bf6c png: convert to bytestream2 API.
Protects against overreads in the input buffer.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 4c25269ced)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:14:28 +01:00
Ronald S. Bultje
568a474a08 roqvideo: convert to bytestream2 API.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit cdf1577162)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:09:40 +01:00
Ronald S. Bultje
9a66cdbc16 smc: port to bytestream2 API.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 8febcb9fc1)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:09:28 +01:00
Ronald S. Bultje
ddb1149e25 tgq: convert to bytestream2 API.
This protects against input buffer overreads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 1255eed533)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:09:19 +01:00
Ronald S. Bultje
f6778f58d4 algmm: convert to bytestream2 API.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit a55d5bdc6e)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:09:19 +01:00
Paul B Mahol
e4e4d92641 jvdec: unbreak video decoding
The safe bitstream reader broke it since the buffer size was specified
in bytes instead of bits.

Signed-off-by: Janne Grunau <janne-libav@jannau.net>
CC: libav-stable@libav.org
(cherry picked from commit a1c036e961)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:02:23 +01:00
Michael Niedermayer
de0ff4ce69 h264: Fix invalid interlaced/progressive MB combinations for direct mode prediction.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 758ec11153)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:00:52 +01:00
Anton Khirnov
6548cb2578 libx264: add 'stats' private option for setting 2pass stats filename.
x264 always opens the file itself with fopen, so we cannot use the
standard lavc stats mechanism.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:00:12 +01:00
Anton Khirnov
f6257cf4b7 libx264: fix help text for slice-max-size option.
CC: libav-stable@libav.org
(cherry picked from commit 9d5c131ece)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 21:00:02 +01:00
Anton Khirnov
a15adb18fa avconv: reindent
CC: libav-stable@libav.org
(cherry picked from commit 64334ddbbc)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 20:59:00 +01:00
Anton Khirnov
666bd5848a avconv: link '-passlogfile' option to libx264 'stats' AVOption.
Fixes bug 204.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 20:57:11 +01:00
Janne Grunau
d94256d36c Revert "h264: clear trailing bits in partially parsed NAL units"
This reverts commit 729ebb2f18.

There was an off-by-one error in the bit mask calculation clearing
actually the last valid bit and causing
http://bugzilla.libav.org/show_bug.cgi?id=227

The broken sample (Mr_MrsSmith-h264_aac.mp4) the commit was fixing
does not work after correcting the off-by-one error.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 20:56:55 +01:00
Ronald S. Bultje
7bb97a61df mpc: pad mpc_CC/SCF[] tables to allow for negative indices.
MPC8 allows indices of mpc_CC up to -1, and mpc_SCF up to -6, thus pad
the tables by that much on the left end.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit d7eabd5042)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 20:48:29 +01:00
Ronald S. Bultje
c65eadee5d xxan: protect against chroma LUT overreads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit f77bfa8376)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 20:47:19 +01:00
Ronald S. Bultje
a43f4bd601 xxan: convert to bytestream2 API.
Protects against overreads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 5518827816)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 20:47:19 +01:00
Ronald S. Bultje
8f881885c2 xxan: don't read before start of buffer in av_memcpy_backptr().
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit f1279e286b)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 20:47:19 +01:00
Ronald S. Bultje
26521d87ba dsicinvideo: validate buffer offset before copying pixels.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit c95fefa042)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 20:47:19 +01:00
Ronald S. Bultje
e1a4143793 cook: error out on quant_index values outside [-63, 63] range.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 97e48b2f54)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 20:47:19 +01:00
Ronald S. Bultje
b9482a6efd cook: extend channel uncoupling tables so the full bit range is covered.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 37cc8600d0)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-14 20:47:19 +01:00
Ronald S. Bultje
88c3cc019c cook: expand dither_tab[], and make sure indexes into it don't overflow.
Fixes overflows in accessing dither_tab[].

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 442c3a8cb1)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-13 23:40:29 +01:00
Ronald S. Bultje
9980e4df3b huffyuv: add padding to classic (v1) huffman tables.
We slightly overread the input buffer, so we require
padding at the end of the buffer, as is documented in the
get_bits API. Without padding, we'll read uninitialized
data or beyond the end of the .rodata, which may crash.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 4ffe5e2aa5)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-13 23:36:39 +01:00
Ronald S. Bultje
d4f2786cda avs: fix infinite loop on end-of-stream.
The codec would keep returning the last decoded frame if the stream
contains B-frames, since it wouldn't clear that frame from the list of
frames to be returned to the user.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 83f15a1228)

Conflicts:

	libavcodec/cavsdec.c

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-13 23:36:02 +01:00
Alex Converse
2744fdbd9e tiffdec: Prevent illegal memory access caused by recycled pointers.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit fd0be63049)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-13 23:30:55 +01:00
Ronald S. Bultje
1fcc2c6091 wma: fix off-by-one in array bounds check.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit b4bccf3e4e)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-13 23:30:39 +01:00
Ronald S. Bultje
74871ac70a dv: check buffer size before reading profile.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit e97efecec8)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-13 23:30:21 +01:00
Ronald S. Bultje
9cb7f6e54a raw: move buffer size check up.
This way, it protects against overreads for 4bpp/2bpp content also.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit cc5dd632ce)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-13 23:23:58 +01:00
Ronald S. Bultje
ed6aaf579d dca: prevent accessing static arrays with invalid indexes.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit e6ffd997cb)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-13 23:22:32 +01:00
Ronald S. Bultje
e1b4614ab4 lpcm: fix sample size calculation for 20bit LCPM.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit f1320dc3be)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-13 23:12:00 +01:00
Ronald S. Bultje
c3bf08d04c smacker: error out if palette copy-with-offset overruns palette size.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit a93b572ae4)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-13 23:12:00 +01:00
Ronald S. Bultje
12247a13e0 Don't use ff_cropTbl[] for IDCT.
Results of IDCT can by far outreach the range of ff_cropTbl[], leading
to overreads and potentially crashes.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit c23acbaed4)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-08 22:07:55 +01:00
Ronald S. Bultje
7503861b42 swscale: make filterPos 32bit.
Fixes overflows for large image sizes.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 2254b559cb)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-08 22:07:55 +01:00
Ronald S. Bultje
9def2f200e error_resilience: initialize s->block_index[].
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 6193ff6854)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-08 22:07:55 +01:00
Ronald S. Bultje
7b676935ee svq3: protect against negative quantizers.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 11b940a1a8)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-08 22:07:55 +01:00
Reinhard Tartler
9550c63196 Prepare for 0.8.1 Release 2012-03-08 22:07:54 +01:00
Justin Ruggles
4a15240a27 mov: set channel layout for AC-3 streams based on the 'dac3' atom info
fixes Bug 225
(cherry picked from commit 3798205a77)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-08 22:07:54 +01:00
Janne Grunau
a47b96bdd3 rv34: handle size changes during frame multithreading
Factors all context dynamic memory handling to its own functions.
Fixes bug 220.
(cherry picked from commit 2bd730010d)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-08 22:07:54 +01:00
Alex Converse
fb049da952 mov: Add more HDV and XDCAM FourCCs.
Reference: VLC
(cherry picked from commit b142496c56)
2012-03-06 15:31:49 -08:00
Alex Converse
4a325ddeae mov: Add support for MPEG2 HDV 720p24 (hdv4)
(cherry picked from commit 0ad522afb3)
2012-03-06 15:31:41 -08:00
Alex Converse
48ac765efe rv10/20: Fix slice overflow with checked bitstream reader.
(cherry picked from commit 9243ec4a50)
2012-03-06 15:31:23 -08:00
Michael Niedermayer
522645e38f h263dec: Disallow width/height changing with frame threads.
Fixes CVE-2011-3937

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

Conflicts:

	libavcodec/h263dec.c

Signed-off-by: Alex Converse <alex.converse@gmail.com>
2012-03-06 15:28:01 -08:00
Alex Converse
e891ee4bf6 adpcm: Clip step_index values read from the bitstream at the beginning of each frame.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit bbeb29133b)
2012-03-06 15:28:01 -08:00
Alex Converse
ef673211e7 tiff: Make the TIFF_LONG and TIFF_SHORT types unsigned.
TIFF v6.0 (unimplemented) adds signed equivalents.
(cherry picked from commit e32548d133)
2012-03-06 15:28:01 -08:00
Alex Converse
eaeaeb265f dpcm: ignore extra unpaired bytes in stereo streams.
Fixes: CVE-2011-3951

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit ce7aee9b73)
2012-03-06 15:28:01 -08:00
Alex Converse
db315c796d svq3: Prevent illegal reads while parsing extradata.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit 9e1db721c4)
2012-03-06 15:28:01 -08:00
Alex Converse
035dd77cbb dv: Fix small overread in audio frequency table.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit 0ab3687924)
2012-03-06 15:28:01 -08:00
Michael Niedermayer
e3743869e9 ac3dec: Move center and surround mix level tables to the parser.
That way all mix levels as exported by avpriv_ac3_parse_header()
will have the same meaning.

Previously the 3-bit center mix level for E-AC-3 was used to index in a
4-entry table, leading to out-of-array reads.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
Signed-off-by: Alex Converse <alex.converse@gmail.com>
(cherry picked from commit e6d9fa66f1)
2012-03-06 15:28:01 -08:00
Alex Converse
ce14f00dea movdec: Avoid av_malloc(0) in stss
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit 29a20ac4a1)
2012-03-06 15:28:01 -08:00
Mans Rullgard
627f4621f5 ac3: Do not read past the end of ff_ac3_band_start_tab.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Alex Converse <alex.converse@gmail.com>
(cherry picked from commit 034b03e7a0)
2012-03-06 15:28:01 -08:00
Alex Converse
3e8434bcea dv: Fix small stack overread related to CVE-2011-3929 and CVE-2011-3936.
Found with asan.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Alex Converse <alex.converse@gmail.com>
(cherry picked from commit 2d1c0dea5f)
2012-03-06 15:28:01 -08:00
Michael Niedermayer
efd30c4d95 dv: Fix null pointer dereference due to ach=0
dv: Fix null pointer dereference due to ach=0

Fixes part2 of CVE-2011-3929

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Reviewed-by: Roman Shaposhnik <roman@shaposhnik.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Alex Converse <alex.converse@gmail.com>
(cherry picked from commit 5a396bb3a6)
2012-03-06 15:28:00 -08:00
Michael Niedermayer
d7fddc97d4 dv: check stype
dv: check stype

Fixes part1 of CVE-2011-3929
Possibly fixes part of CVE-2011-3936

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Reviewed-by: Roman Shaposhnik <roman@shaposhnik.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Alex Converse <alex.converse@gmail.com>
(cherry picked from commit 635bcfccd4)
2012-03-06 15:28:00 -08:00
Dale Curtis
feed0c6b6a mpegaudiodec: Prevent premature clipping of mp3 input buffer.
Instead of clipping extrasize based on EXTRABYTES, clip based on the
amount of buffer actually left. Without this fix, there are warbles
and other distortions in the test case below.

http://kevincennis.com/mix/assets/sounds/1901_voxfx.mp3
(cherry picked from commit b716542691)

Signed-off-by: Alex Converse <alex.converse@gmail.com>
2012-03-06 15:28:00 -08:00
Alex Converse
d0e53ecff7 mp3dec: Fix a heap-buffer-overflow
In some cases, what is left to read from ptr is smaller than EXTRABYTES.

Based on a patch by Thierry Foucu <tfoucu@gmail.com>.

Signed-off-by: Alex Converse <alex.converse@gmail.com>
(cherry picked from commit f372ce119b)
2012-03-06 15:28:00 -08:00
Alex Converse
1ca84aa162 mpeg12: Pad framerate tab to 16 entries.
There are many places where we read an unchecked 4-bit index into it.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit dfa37fe8a3)
2012-03-06 15:28:00 -08:00
Michael Niedermayer
d5f2382d03 kgv1dec: Increase offsets array size so it is large enough.
Fixes CVE-2011-3945

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

Signed-off-by: Alex Converse <alex.converse@gmail.com>
(cherry picked from commit a02e8df973)
2012-03-06 15:28:00 -08:00
Alex Converse
416849f2e0 kmvc: Check palsize.
Fixes: CVE-2011-3952

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Based on fix by Michael Niedermayer
(cherry picked from commit 386741f887)
2012-03-06 15:28:00 -08:00
Alex Converse
dd37038ac7 nsvdec: Propagate errors
Related to CVE-2011-3940.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit c898431ca5)

Conflicts:

	libavformat/nsvdec.c
2012-03-06 15:28:00 -08:00
Alex Converse
e410dd1792 nsvdec: Be more careful with av_malloc().
Check results for av_malloc() and fix an overflow in one call.

Related to CVE-2011-3940.

Based in part on work from Michael Niedermayer.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit 8fd8a48263)
2012-03-06 15:28:00 -08:00
Michael Niedermayer
ffdc41f039 nsvdec: Fix use of uninitialized streams.
Fixes CVE-2011-3940 (Out of bounds read resulting in out of bounds write)

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

Signed-off-by: Alex Converse <alex.converse@gmail.com>
(cherry picked from commit 6a89b41d97)
2012-03-06 15:28:00 -08:00
Martin Storsjö
ca7e97bdcf g722: Fix the QMF scaling
This fixes clipping if the encoder input used the full 16 bit
input range (samples with a magnitude below 16383 worked fine).
The filtered subband samples should be 15 bit maximum, while
the code earlier produced them scaled to 16 bit.

This makes the decoder output have double the magnitude
compared to before.

The spec reference samples doesn't test the QMF at all, which
was why this part slipped past initially.

(cherry picked from commit b087ce2bee)

Signed-off-by: Martin Storsjö <martin@martin.st>
2012-03-06 15:45:30 +02:00
Justin Ruggles
4ae138cb12 ac3dsp: do not use pshufb in ac3_extract_exponents_ssse3()
We need to do unsigned saturation in order to cover the corner case when the
absolute coefficient value is 16777215 (the maximum value).

Fixes Bug #216
(cherry picked from commit d483bb58c3)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-06 13:55:35 +01:00
Fabian Greffrath
003f7e3dd0 Fix format string vulnerability detected by -Wformat-security.
Signed-off-by: Diego Biurrun <diego@biurrun.de>
(cherry picked from commit c9dbac36ad)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-05 18:01:37 +01:00
Ronald S. Bultje
85eb76a23f h264: fix mmxext chroma deblock to use correct TC values.
(cherry picked from commit b0c4f04338)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-05 18:00:43 +01:00
Ronald S. Bultje
5186984ee9 h264: change underread for 10bit QPEL to overread.
This prevents us from reading before the start of the buffer, and thus
prevents crashes resulting from this behaviour. Fixes bug 237.
(cherry picked from commit 291c9b6285)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-05 18:00:31 +01:00
Ronald S. Bultje
b5331b979b cscd: use negative error values to indicate decode_init() failures.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 8a9faf33f2)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-05 14:48:35 +01:00
Vitor Sessak
11f3173e1b amrnbdec: check frame size before decoding.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Ronald S. Bultje <rsbultje@gmail.com>
(cherry picked from commit 882abda5a2)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-05 14:48:35 +01:00
Ronald S. Bultje
cd17195d1c h264: prevent overreads in intra PCM decoding.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit d1604b3de9)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-05 14:48:35 +01:00
Justin Ruggles
1128b10247 wmaenc: fix m/s stereo encoding for the first frame
We need to set ms_stereo in encode_init() in order to avoid incorrectly
encoding the first frame as non-m/s while flagging it as m/s. Fixes an
uncomfortable pop in the left channel at the start of playback.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 21:26:29 +01:00
Justin Ruggles
6a073aa7a7 wmaenc: limit allowed sample rate to 48kHz
ff_wma_init() allows up to 50kHz, but this generates an exponent band
size table that requires 65 bands. The code assumes 25 bands in many
places, and using sample rates higher than 48kHz will lead to buffer
overwrites.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 21:26:29 +01:00
Justin Ruggles
073891e875 wmaenc: limit block_align to MAX_CODED_SUPERFRAME_SIZE
This is near the theoretical limit for wma frame size and is the most that
our decoder can handle. Allowing higher bit rates will just end up padding
each frame with empty bytes.

Fixes invalid writes for avconv when using very high bit rates.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 21:26:29 +01:00
Justin Ruggles
2e341bc99a wmaenc: require a large enough output buffer to prevent overwrites
The maximum theoretical frame size is around 17000 bytes. Although in
practice it will generally be much smaller, we require a larger buffer
just to be safe.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 21:26:29 +01:00
Alex Converse
b7c8fff803 mpegts: Do not call read_sl_header() when no bytes remain in the buffer.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 4df369692e)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 21:26:29 +01:00
Alex Converse
3f7e90cf0c mpegts: Pad the packet buffer in handle_packet().
This allows it to be used with get_bits without the thread of overreads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 1aa708988a)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 21:26:28 +01:00
Ronald S. Bultje
78d4f8cc56 amrwb: remove duplicate arguments from extrapolate_isf().
Prevents warnings because the dst and src overlap (are the same) in the
memcpy() inside the function.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 9d87374ec0)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 21:26:28 +01:00
Ronald S. Bultje
de2656ec25 amrwb: error out early if mode is invalid.
Prevents using the invalid mode as an index in a static array, which
would generate invalid reads.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 154b8bb800)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 21:26:28 +01:00
Ronald S. Bultje
9686a2c2cf matroska: check buffer size for RM-style byte reordering.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 9c239f6026)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 21:26:28 +01:00
Ronald S. Bultje
b863979c0f wma: fix invalid buffer size assumptions causing random overreads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 349b7977e4)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 12:26:06 +01:00
Alex Converse
fecd7468fc wmadec: Verify bitstream size makes sense before calling init_get_bits.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit 48f1e5212c)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 12:26:06 +01:00
Alex Converse
19da1a39e8 rv10/20: Fix a buffer overread caused by losing track of the remaining buffer size.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 2f6528537f)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 12:26:06 +01:00
Ronald S. Bultje
7e88df99e1 lcl: return negative error codes on decode_init() errors.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit bd17a40a7e)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 12:26:06 +01:00
Justin Ruggles
7f3f85544c avutil: add AVERROR_UNKNOWN
Useful to return instead of -1 when the cause of the error is unknown,
typically from an external library.
(cherry picked from commit c9bca80132)

Conflicts:

	doc/APIchanges
	libavutil/avutil.h

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 12:26:06 +01:00
Ronald S. Bultje
750f5baf30 h264: error out on invalid bitdepth.
Fixes invalid reads while initializing the dequant tables, which uses
the bit depth to determine the QP table size.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 0ce4fe482c)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 12:26:06 +01:00
Ronald S. Bultje
a63f3f714c huffyuv: do not abort on unknown pix_fmt; instead, return an error.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 63c9de6469)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-03-04 12:26:06 +01:00
Ronald S. Bultje
1dd1ee00d5 vmnc: return error on decode_init() failure.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 07a180972f)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-29 21:43:20 +01:00
Ronald S. Bultje
4493af756b rpza: error out on buffer overreads.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 78e9852a2e)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-29 21:43:20 +01:00
Ronald S. Bultje
e904e9b720 qtrle: return error on decode_init() failure.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit e54ae60e46)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-29 21:43:20 +01:00
Ronald S. Bultje
5f896773e0 swscale: fix another integer overflow.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 791de61bbb)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-29 21:43:20 +01:00
Ronald S. Bultje
b2dcac7141 vp56: error out on invalid stream dimensions.
Prevents crashes when playing corrupt vp5/6 streams.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 8bc396fc0e)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-29 14:23:11 +01:00
Ronald S. Bultje
40ccc81146 asf: don't seek back on EOF.
Seeking back on EOF will reset the EOF flag, causing us to re-enter
the loop to find the next marker in the ASF file, thus potentially
causing an infinite loop.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit bb6d5411e1)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-29 14:22:35 +01:00
Ronald S. Bultje
1c63d61372 asf: error out on ridiculously large minpktsize values.
They cause various issues further down in demuxing.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 6e57a02b9f)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-29 14:21:57 +01:00
Anton Khirnov
2ad77c60ef lavf: add functions for accessing the fourcc<->CodecID mapping tables.
Fixes bug 212.
(cherry picked from commit dd6d3b0e02)

Conflicts:

	doc/APIchanges

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-29 10:44:37 +01:00
Paul B Mahol
a1556d37b8 avutil: make intfloat api public
The functions are already av_ prefixed and intfloat header is already provided.
Install libavutil/intfloat.h

Signed-off-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 8b933129b9)

Conflicts:

	doc/APIchanges

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-29 10:44:37 +01:00
Alex Converse
083a8a0037 mjpegbdec: Fix overflow in SOS.
Based in part by a fix from Michael Niedermayer <michaelni@gmx.at>

Fixes CVE-2011-3947

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
(cherry picked from commit b57d262412)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-28 22:20:45 +01:00
Ronald S. Bultje
71a939fee4 oma: don't read beyond end of leaf_table.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 934cd18a43)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-28 22:10:55 +01:00
Ronald S. Bultje
9dbd437da2 Indeo3: fix crashes on corrupt bitstreams.
Splits at borders of cells are invalid, since it leaves one of the
cells with a width/height of zero. Also, propagate errors on buffer
allocation failures, so we don't continue decoding (which crashes).

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit fc9bc08dca)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-28 20:57:44 +01:00
Ronald S. Bultje
2510e1476e vorbis: fix overflows in floor1[] vector and inverse db table index.
(cherry picked from commit 24947d4988)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 18:11:15 +01:00
Reinhard Tartler
0f839cff6b Fix parser not to clobber has_b_frames when extradata is set.
Because in contrast to the decoder, the parser does not setup low_delay.
The code in parse_nal_units would always end up setting has_b_frames
to "1", except when stream is explicitly marked as low delay.
Since the parser itself would create 'extradata', simply reopening
the parser would cause this.

This happens for instance in estimate_timings_from_pts(), which causes the
parser to be reopened on the same stream.

This fixes Libav #22 and FFmpeg (trac) #360

CC: libav-stable@libav.org

Based on a patch by Reimar Döffinger <Reimar.Doeffinger@gmx.de>
(commit 31ac0ac29b)

Comments and description adapted by Reinhard Tartler.

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
(cherry picked from commit 790a367d9e)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 15:56:55 +01:00
Ronald S. Bultje
abe3572878 rm: prevent infinite loops for index parsing.
Specifically, prevent jumping back in the file for the next index, since
this can lead to infinite loops where we jump between indexes referring
to each other, and don't read indexes that don't fit in the file.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit aac07a7a4c)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 10:04:04 +01:00
Ronald S. Bultje
0d30e2c6f2 fraps: release reference buffer on pix_fmt change.
Prevents crash when trying to copy from a non-existing plane in e.g.
a RGB32 reference image to a YUV420P target image

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 830f70442a)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Ronald S. Bultje
a0473085f3 kgv1: release reference picture on size change.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 6c4c27adb6)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Ronald S. Bultje
e537dc230b kgv1: use avctx->get/release_buffer().
Also fixes crashes on corrupt bitstreams.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 33cd32b389)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Ronald S. Bultje
19f4943d12 lcl: error out if uncompressed input buffer is smaller than framesize.
This prevents crashes when trying to read beyond the end of the buffer
while decoding frame data.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit be129271ea)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Ronald S. Bultje
bf6d1a1ca7 mjpeg: abort decoding if packet is too large.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit ab492ca2ab)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Alex Converse
424b6edd19 tiff: Prevent overreads in the type_sizes array.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 447363870f)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Ronald S. Bultje
4f48417fe7 swf: check return values for av_get/new_packet().
Prevents crashers when using the packet if allocation failed.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 31632e73f4)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Ronald S. Bultje
8e3dc37bc0 truemotion2: error out if the huffman tree has no nodes.
This prevents crashers and errors further down when reading nodes in the
empty tree.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 2b83e8b700)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Ronald S. Bultje
0312969b9e rmdec: when using INT4 deinterleaving, error out if sub_packet_h <= 1.
We read sub_packet_h / 2 packets per line of data (during deinterleaving),
which equals zero if sub_packet_h <= 1, thus causing us to not read any
data, leading to an infinite loop.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit e30b3e59a4)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Janne Grunau
62beae313a avplay: fix -threads option
The AVOptions based default to threads auto in 2473a45c8
works only if avplay does not use custom option handling
for -threads.

CC: <libav-stable@libav.org>
(cherry picked from commit e48a70e6da)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Ronald S. Bultje
8011a29fa8 vc1parse: call vc1_init_common().
The parser uses VLC tables initialized in vc1_common_init(), therefore
we should call this function on parser init also.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit c742ab4e81)

Conflicts:

	libavcodec/vc1.h

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Ronald S. Bultje
fe710f2074 wma: don't return 0 on invalid packets.
Return 0 means "please return the same data again", i.e. it causes an
infinite loop. Instead, return an error.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 9d3050d3e9)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Ronald S. Bultje
bba43a1ea0 mjpegb: don't return 0 at the end of frame decoding.
Return 0 indicates "please return the same data again", i.e. it causes
an infinite loop. Instead, return that we consumed the buffer if we
finished decoding succesfully, or return an error if an error occurred.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 74699ac8c8)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Ronald S. Bultje
f947e965be asf: prevent packet_size_left from going negative if hdrlen > pktlen.
This prevents failed assertions further down in the packet processing
where we require non-negative values for packet_size_left.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 41afac7f7a)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:16 +01:00
Ronald S. Bultje
5c365dc979 aiff: don't skip block_align==0 check on COMM-after-SSND files.
This prevents SIGFPEs when using block_align for divisions.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 32a659c758)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Ronald S. Bultje
95a9d44dc3 mp3on4: require a minimum framesize.
If bufsize < headersize, init_get_bits() will be called with a negative
number, causing it to fail and any subsequent call to get_bits() will
crash because it reads from a NULL pointer.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 3e13005cac)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Ronald S. Bultje
27558bd87e huffyuv: error out on bit overrun.
On EOF, get_bits() will continuously return 0, causing an infinite
loop.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 84c202cc37)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Ronald S. Bultje
5ab9294a8d als: prevent infinite loop in zero_remaining().
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit af468015d9)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Ronald S. Bultje
cfd7d166e2 cook: prevent div-by-zero if channels is zero.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 941fc1ea1e)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Ronald S. Bultje
5bcd47cf63 vc1: prevent using last_frame as a reference for I/P first frame.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit ae591aeea5)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Ronald S. Bultje
0c60d5c59f swscale: take first/lastline over/underflows into account for MMX.
Fixes crashes for extremely large resizes (several 100-fold).

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 1d8c4af396)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Ronald S. Bultje
cd9bdc6395 swscale: fix overflows in filterPos[] calculation for large sizes.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 19a65b5be4)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Ronald S. Bultje
b68470707b swscale: enforce a minimum filtersize.
At very small dimensions, this calculation could lead to zero-sized
filters, which leads to uninitialized output, zero-sized allocations,
loop overflows in SIMD that uses do{..}while(i++<filtersize); instead
of for(i=0;i<filtersize;i++){..} and several other similar failures.
Therefore, require a minimum filtersize of 1.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit dae2ce361a)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Ronald S. Bultje
7046ae5593 tta: error out if samplerate is zero.
Prevents a division by zero later on.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 7416d61036)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Janne Grunau
d19e3e19d6 vc1: prevent null pointer dereference on broken files
CC: libav-stable@libav.org
(cherry picked from commit 510ef04a46)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Alex Converse
04597e2595 smacker: Sanity check huffman tables found in the headers.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Janne Grunau
d16653c3d4 lavf: prevent infinite loops while flushing in avformat_find_stream_info
If no data was seen for a stream decoder are returning 0 when fed with
empty packets for flushing. We can stop flushing when the decoder does
not return delayed delayed frames anymore. Changes try_decode_frame()
return value to got_picture or negative error.

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Ronald S. Bultje
183e0eb5b9 matroska: don't overwrite string values until read/alloc was succesful.
This prevents certain tags with a default value assigned to them (as per
the EBML syntax elements) from ever being assigned a NULL value. Other
parts of the code rely on these being non-NULL (i.e. they don't check for
NULL before e.g. using the string in strcmp() or similar), and thus in
effect this prevents crashes when reading of such specific tags fails,
either because of low memory or because of targeted file corruption.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit cd40c31ee9)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Alex Converse
be0b3137d0 matroskadec: Pad AAC extradata.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Alex Converse
683213230e aac: fix infinite loop on end-of-frame with sequence of 1-bits.
Based-on-work-by: Ronald S. Bultje <rsbultje@gmail.com>
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 1cd9a6154b)

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Alex Converse
ad0ee682b3 wma: Clip WMA1 and WMA2 frame length to 11 bits.
The MDCT buffers in the decoder are only sized for up to 11 bits. The
reverse engineered documentation for WMA1/2 headers say that that for
all samplerates above 32kHz 11 bits are used. 12 and 13 bit support
were added for WMAPro. I was unable to make any Microsoft tools generate
a test file at a samplerate above 48kHz.

Discovered by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:15 +01:00
Janne Grunau
ba418ad400 rv20: prevent calling ff_h263_decode_mba() with unset height/width
Prevents a crash of VLC during playback of a invalid matroska file,
found by John Villamil <johnv@matasano.com>.

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

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2012-02-26 10:03:14 +01:00
Ronald S. Bultje
6dcbbdc011 flac: fix infinite loops on all-zero input or end-of-stream.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 52e4018be4)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 10:03:14 +01:00
Ronald S. Bultje
e43bd4fa58 golomb: use HAVE_BITS_REMAINING() macro to prevent infloop on EOF.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 46b3fbc30b)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 10:03:14 +01:00
Ronald S. Bultje
25b4ed053f get_bits: add HAVE_BITS_REMAINING macro.
(cherry picked from commit b44b41633f)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 10:03:14 +01:00
Ronald S. Bultje
e1f2a6a32b golomb: avoid infinite loop on all-zero input (or end of buffer).
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit c6643fddba)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 10:03:14 +01:00
Michael Niedermayer
6fc3287b9c shorten: Use separate pointers for the allocated memory for decoded samples.
Fixes invalid free() if any of the buffers are not allocated due to either
not decoding a header or an error prior to allocating all buffers.

Fixes CVE-2012-0858
CC: libav-stable@libav.org

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit 204cb29b3c)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 10:03:14 +01:00
Michael Niedermayer
f43b6e2b1e atrac3: Fix crash in tonal component decoding.
Add a check to avoid writing past the end of the channel_unit.components[]
array.

Bug Found by: cosminamironesei
Fixes CVE-2012-0853
CC: libav-stable@libav.org

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Signed-off-by: Justin Ruggles <justin.ruggles@gmail.com>
(cherry picked from commit c509f4f747)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 10:03:14 +01:00
Michael Niedermayer
697a45d861 ws_snd1: Fix wrong samples count and crash.
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 9fb7a5af97)

Addresses CVE-2012-0848

Reviewed-by: Justin Ruggles <justin.ruggles@gmail.com>
Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 10:03:05 +01:00
Ronald S. Bultje
4c7879775e h264: disallow constrained intra prediction modes for luma.
Conversion of the luma intra prediction mode to one of the constrained
("alzheimer") ones can happen by crafting special bitstreams, causing
a crash because we'll call a NULL function pointer for 16x16 block intra
prediction, since constrained intra prediction functions are only
implemented for chroma (8x8 blocks).

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
(cherry picked from commit 45b7bd7c53)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 09:09:27 +01:00
Ronald S. Bultje
a2c8db1b79 swscale: fix V plane memory location in bilinear/unscaled RGB/YUYV case.
Fixes bug 221.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 09:09:26 +01:00
Martin Storsjö
fc89f15497 libavcodec: Don't crash in avcodec_encode_audio if time_base isn't set
Earlier, calling avcodec_encode_audio worked fine even if time_base
wasn't set. Now it crashes due to trying to scale the output pts to
the codec context time base. This affects e.g. VLC.

If no time_base is set for audio codecs, set it to the sample
rate.

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 09:09:26 +01:00
Alex Converse
e364f50718 qdm2: Check data block size for bytes to bits overflow.
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind

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

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 09:09:26 +01:00
Anton Khirnov
571a4cf273 lavc: set AVCodecContext.codec in avcodec_get_context_defaults3().
This way, if the AVCodecContext is allocated for a specific codec, the
caller doesn't need to store this codec separately and then pass it
again to avcodec_open2().

It also allows to set codec private options using av_opt_set_* before
opening the codec.
(cherry picked from commit bc90199848)

Signed-off-by: Reinhard Tartler <siretart@tauware.de>
2012-02-26 09:09:26 +01:00
Anton Khirnov
bafd38a352 lavc: make avcodec_close() work properly on unopened codecs.
I.e. free the priv_data and other stuff allocated in
avcodec_alloc_context3() and not segfault.

(cherry picked from commit 0e72ad95f9)
2012-02-26 09:09:26 +01:00
Anton Khirnov
350d06d63f lavc: add avcodec_is_open().
It allows to check whether an AVCodecContext is open in a documented
way. Right now the undocumented way this check is done in lavf/lavc is
by checking whether AVCodecContext.codec is NULL. However it's desirable
to be able to set AVCodecContext.codec before avcodec_open2().

(cherry picked from commit af08d9aeea)

Conflicts:

	doc/APIchanges
2012-02-26 09:03:33 +01:00
Derek Buitenhuis
9f82cbf7c1 wavpack: Don't shift minclip/maxclip
Since we are clipping before we shift the values to
16 or 32 bits, we should not shift the min/max clip
values to compensate.

Fixes 8 and 24 bit lossy decoding.

Fixes ticket #871.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Anton Khirnov <anton@khirnov.net>
(cherry picked from commit 480b133e6f)
2012-02-25 20:50:27 +01:00
Michael Niedermayer
dcde8e1c90 Revert "Improve decoding quality for lossy wavpack."
This has been implemented more correctly.

This reverts commit a915618a29.
(cherry picked from commit 32e74395a8)
2012-02-25 20:50:19 +01:00
Carl Eugen Hoyos
569cb94869 Fix ffmpeg -codecs output.
(cherry picked from commit f6492476a6)
2012-02-18 00:00:06 +01:00
Justin Ruggles
0df7d7482c wavpack: add needed braces for 2 statements inside an if block
(cherry picked from commit 9d7cee50aa)
2012-02-12 01:48:07 +01:00
Carl Eugen Hoyos
b2f27d2926 Improve decoding quality for lossy wavpack.
This reverts e6e7bfc1 and 365e1ec2.
The code may be incorrect both before and after the revert, but we
do not have any samples that were fixed by the original commits.

Fixes ticket #871.
(cherry picked from commit a915618a29)
2012-01-29 18:02:12 +01:00
Michael Niedermayer
7e16636995 doc: remove doc/ffmpeg-mt-authorship.txt for release/0.10
we dont carry the whole git history in releases so theres no
point in having this in them either.

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-26 22:44:59 +01:00
Michael Niedermayer
83d78fece0 Update for 0.10
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
2012-01-26 22:43:32 +01:00
1999 changed files with 89777 additions and 127437 deletions

26
.gitignore vendored
View File

@@ -1,17 +1,9 @@
.config .config
.version .version
*.a
*.o *.o
*.d *.d
*.def
*.dll
*.exe *.exe
*.ho *.ho
*.lib
*.pc
*.so
*.so.*
*.ver
*-example *-example
*-test *-test
*_g *_g
@@ -30,19 +22,20 @@ ffplay
ffprobe ffprobe
ffserver ffserver
avconv avconv
doc/avoptions_codec.texi
doc/avoptions_format.texi
doc/print_options
doc/examples/decoding_encoding
doc/examples/filtering_audio
doc/examples/filtering_video
doc/examples/metadata
doc/examples/muxing
libavcodec/*_tablegen libavcodec/*_tablegen
libavcodec/*_tables.c libavcodec/*_tables.c
libavcodec/*_tables.h libavcodec/*_tables.h
libavcodec/codec_names.h libavcodec/codec_names.h
libavcodec/libavcodec*
libavcore/libavcore*
libavdevice/libavdevice*
libavfilter/libavfilter*
libavformat/libavformat*
libavutil/avconfig.h libavutil/avconfig.h
libavutil/libavutil*
libpostproc/libpostproc*
libswresample/libswresample*
libswscale/libswscale*
tests/audiogen tests/audiogen
tests/base64 tests/base64
tests/data tests/data
@@ -53,7 +46,6 @@ tests/vsynth1
tests/vsynth2 tests/vsynth2
tools/aviocat tools/aviocat
tools/cws2fws tools/cws2fws
tools/ffeval
tools/graph2dot tools/graph2dot
tools/ismindex tools/ismindex
tools/lavfi-showfiltfmts tools/lavfi-showfiltfmts

View File

@@ -500,3 +500,5 @@ necessary. Here is a sample; alter the names:
Ty Coon, President of Vice Ty Coon, President of Vice
That's all there is to it! That's all there is to it!

328
Changelog
View File

@@ -3,53 +3,297 @@ releases are sorted from youngest to oldest.
version next: version next:
version 0.11.2:
version 0.10.11
- pthread: Avoid spurious wakeups
- pthread: Fix deadlock during thread initialization
- mpegvideo: Initialize chroma_*_shift and codec_tag even if the size is 0
- vc1dec: Don't decode slices when the latest slice header failed to decode
- vc1dec: Make sure last_picture is initialized in vc1_decode_skip_blocks
- r3d: Add more input value validation
- fraps: Make the input buffer size checks more strict
- svq3: Avoid a division by zero
- rmdec: Validate the fps value
- twinvqdec: Check the ibps parameter separately
- asfdec: Check the return value of asf_read_stream_properties
- mxfdec: set audio timebase to 1/samplerate
- pcx: Check the packet size before assuming it fits a palette
- rpza: Fix a buffer size check
- xxan: Disallow odd width
- xan: Only read within the data that actually was initialized
- xan: Use bytestream2 to limit reading to within the buffer
- pcx: Consume the whole packet if giving up due to missing palette
- pngdec: Stop trying to decode once inflate returns Z_STREAM_END
- mov: Make sure the read sample count is nonnegative
- bfi: Add some very basic sanity checks for input packet sizes
- bfi: Avoid divisions by zero
- electronicarts: Add more sanity checking for the number of channels
- riffdec: Add sanity checks for the sample rate
- mvi: Add sanity checking for the audio frame size
- xwma: Avoid division by zero
- avidec: Make sure a packet is large enough before reading its data
- vqf: Make sure the bitrate is in the valid range
- vqf: Make sure sample_rate is set to a valid value
- vc1dec: Undo mpegvideo initialization if unable to allocate tables
- vc1dec: Fix leaks in ff_vc1_decode_init_alloc_tables on errors
- wnv1: Make sure the input packet is large enough
- dca: Validate the lfe parameter
- rl2: Avoid a division by zero
- wtv: Add more sanity checks for a length read from the file
- segafilm: Validate the number of audio channels
- qpeg: Add checks for running out of rows in qpeg_decode_inter
- mpegaudiodec: Validate that the number of channels fits at the given offset
- asv1: Verify the amount of extradata
- idroqdec: Make sure a video stream has been allocated before returning packets
- rv10: Validate the dimensions set from the container
- xmv: Add more sanity checks for parameters read from the bitstream
- ffv1: Make sure at least one slice context is initialized
- truemotion2: Use av_freep properly in an error path
- eacmv: Make sure a reference frame exists before referencing it
- mpeg4videodec: Check the width/height in mpeg4_decode_sprite_trajectory
- ivi_common: Make sure color planes have been initialized
- oggparseogm: Convert to use bytestream2
- rv34: Check the return value from ff_rv34_decode_init
- matroskadec: Verify realaudio codec parameters
- mace: Make sure that the channel count is set to a valid value
- svq3: Check for any negative return value from ff_h264_check_intra_pred_mode
- vp3: Check the framerate for validity
- cavsdec: Make sure a sequence header has been decoded before decoding pictures
- sierravmd: Do sanity checking of frame sizes
- omadec: Properly check lengths before incrementing the position
- mpc8: Make sure the first stream exists before parsing the seek table
- mpc8: Check the seek table size parsed from the bitstream
- zmbvdec: Check the buffer size for uncompressed data
- ape: Don't allow the seektable to be omitted
- shorten: Break out of loop looking for fmt chunk if none is found
- shorten: Use a checked bytestream reader for the wave header
- smacker: Make sure we don't fill in huffman codes out of range
- smacker: Avoid integer overflow when allocating packets
- smacker: Don't return packets in unallocated streams
- dsicin: Add some basic sanity checks for fields read from the file
- roqvideodec: check dimensions validity
- qdm2: check array index before use, fix out of array accesses
- alsdec: check block length
version 0.10.10
- x86: fft: Remove 3DNow! optimizations, they break FATE
- x86: ac3dsp: Drop mmx variant of ac3_max_msb_abs_int16
- aac: Check init_get_bits return value
- aac: return meaningful errors
- dsicinav: K&R formatting cosmetics
- mov: Seek back if overreading an individual atom
- vcr1: add sanity checks
- pictordec: pass correct context to avpriv_request_sample
- dsicinav: Clip the source size to the expected maximum
- alsdec: Clean up error paths
- ogg: Fix potential infinite discard loop
- nuv: check rtjpeg_decode_frame_yuv420 return value
- nuv: Reset the frame on resize
- nuv: Use av_fast_realloc
- nuv: return meaningful error codes.
- nuv: Pad the lzo outbuf
- nuv: Do not ignore lzo decompression failures
- oma: correctly mark and decrypt partial packets
- oma: check geob tag boundary
- oma: refactor seek function
- 8bps: Bound-check the input buffer
- rtmp: Do not misuse memcmp
- rtmp: rename data_size to size
- lavc: set the default rc_initial_buffer_occupancy
- 4xm: Reject not a multiple of 16 dimension
- 4xm: do not overread the prestream buffer
- 4xm: validate the buffer size before parsing it
- indeo: Do not reference mismatched tiles
- indeo: Sanitize ff_ivi_init_planes fail paths
- indeo: Bound-check before applying motion compensation
- indeo: Bound-check before applying transform
- indeo: reject negative array indexes
- indeo: Cosmetic formatting
- indeo: Refactor ff_ivi_init_tiles and ivi_decode_blocks
- indeo: Refactor ff_ivi_dec_huff_desc
- lavf: fix the comparison in an overflow check
- dv: Add a guard to not overread the ppcm array
- mpegvideo: Avoid 32-bit wrapping of linesize multiplications
- mjpegb: Detect changing number of planes in interlaced video
- matroskadec: Check that .lang was allocated and set before reading it
- ape demuxer: check for EOF in potentially long loops
- lavf: avoid integer overflow when estimating bitrate
- pictordec: break out of both decoding loops when y drops below 0
- ac3: Return proper error codes
- ac3: Clean up the error paths
- ac3: Do not clash with normal AVERROR
- dxa: Make sure the reference frame exists
- h261: check the mtype index
- segafilm: Error out on impossible packet size
- ogg: Always alloc the private context in vorbis_header
- vc1: check mb_height validity.
- vc1: check the source buffer in vc1_mc functions
- bink: Bound check the quantization matrix.
- xl: Make sure the width is valid
- alsdec: Fix the clipping range
- dsicinav: Bound-check the source buffer when needed
- mov: Do not allow updating the time scale after it has been set
- ac3dec: Don't consume more data than the actual input packet size
- indeo: Reject impossible FRAMETYPE_NULL
- indeo5: return proper error codes
- indeo4: Validate scantable dimension
- indeo4: Check the quantization matrix index
- indeo4: Do not access missing reference MV
- adpcm: Unbreak ima-dk4
- ac3dec: validate channel output mode against channel count
- dca: Respect the current limits in the downmixing capabilities
- dca: Error out on missing DSYNC
- pcm: always use codec->id instead of codec_id
- mlpdec: Do not set invalid context in read_restart_header
- pcx: Do not overread source buffer in pcx_rle_decode
- wmavoice: conceal clearly corrupted blocks
- iff: Do not read over the source buffer
- qdm2: Conceal broken samples
- qdm2: refactor joined stereo support
- adpcm: Write the correct number of samples for ima-dk4
- imc: Catch a division by zero
- atrac3: Error on impossible encoding/channel combinations
- atrac3: set the getbits context the right buffer_end
- atrac3: fix error handling
- qdm2: check and reset dithering index per channel
- westwood_vqa: do not free extradata on error in read_header
- vqavideo: check the version
- rmdec: Use the AVIOContext given as parameter in rm_read_metadata()
- avio: Handle AVERROR_EOF in the same way as the return value 0
- wtv: Mark attachment with a negative stream id
- avidec: Let the inner dv demuxer take care of discarding
- swfdec: do better validation of tag length
version 0.10.8
- kmvc: Clip pixel position to valid range
- kmvc: use fixed sized arrays in the context
- indeo: use a typedef for the mc function pointer
- lavc: check for overflow in init_get_bits
- mjpegdec: properly report unsupported disabled features
- jpegls: return meaningful errors
- jpegls: factorize return paths
- jpegls: check the scan offset
- wavpack: validate samples size parsed in wavpack_decode_block
- ljpeg: use the correct number of components in yuv
- mjpeg: Validate sampling factors
- mjpegdec: validate parameters in mjpeg_decode_scan_progressive_ac
- wavpack: check packet size early
- wavpack: return meaningful errors
- apetag: use int64_t for filesize
- tiff: do not overread the source buffer
- Prepare for 0.8.8 Release
- smacker: fix an off by one in huff.length computation
- smacker: check the return value of smacker_decode_tree
- smacker: pad the extradata allocation
- smacker: check frame size validity
- vmdav: convert to bytestream2
- 4xm: don't rely on get_buffer() initializing the frame.
- 4xm: check the return value of read_huffman_tables().
- 4xm: use the correct logging context
- 4xm: reject frames not compatible with the declared version
- 4xm: check bitstream_size boundary before using it
- 4xm: do not overread the source buffer in decode_p_block
- avfiltergraph: check for sws opts being non-NULL before using them
- bmv: check for len being valid in bmv_decode_frame()
- dfa: check for invalid access in decode_wdlt()
- indeo3: check motion vectors
- indeo3: fix data size check
- indeo3: switch parsing the header to bytestream2
- lavf: make sure stream probe data gets freed.
- oggdec: fix faulty cleanup prototype
- oma: Validate sample rates
- qdm2: check that the FFT size is a power of 2
- rv10: check that extradata is large enough
- xmv: check audio track parameters validity
- xmv: do not leak memory in the error paths in xmv_read_header()
- aac: check the maximum number of channels
- indeo3: fix off by one in MV validity check, Bug #503
- id3v2: check for end of file while unescaping tags
- wav: Always seek to an even offset, Bug #500, LP: #1174737
- proresdec: support mixed interlaced/non-interlaced content
version 0.10.6:
- many bug fixes that where found with Coverity
- The following CVE fixes where backported:
CVE-2012-2796, CVE-2012-2775, CVE-2012-2772, CVE-2012-2776,
CVE-2012-2779, CVE-2012-2787, CVE-2012-2794, CVE-2012-2800,
CVE-2012-2802, CVE-2012-2801, CVE-2012-2786, CVE-2012-2798,
CVE-2012-2793, CVE-2012-2789, CVE-2012-2788, CVE-2012-2790,
CVE-2012-2777, CVE-2012-2784
- hundreads of other bug fixes, some possibly security relevant,
see the git log for details.
version 0.10.5:
- Several bugs and crashes have been fixed as well as build problems - Several bugs and crashes have been fixed as well as build problems
with recent mingw64 with recent mingw64
version 0.11: version 0.10.4:
Fixes:CVE-2012-2772, CVE-2012-2774, CVE-2012-2775, CVE-2012-2776, CVE-2012-2777,
CVE-2012-2779, CVE-2012-2782, CVE-2012-2783, CVE-2012-2784, CVE-2012-2785, - Several bugs and crashes have been fixed
CVE-2012-2786, CVE-2012-2787, CVE-2012-2788, CVE-2012-2789, CVE-2012-2790, Note, CVE-2012-0851 and CVE-2011-3937 have been fixed in previous releases
CVE-2012-2791, CVE-2012-2792, CVE-2012-2793, CVE-2012-2794, CVE-2012-2795,
CVE-2012-2796, CVE-2012-2797, CVE-2012-2798, CVE-2012-2799, CVE-2012-2800, version 0.10.3:
CVE-2012-2801, CVE-2012-2802, CVE-2012-2803, CVE-2012-2804,
- v408 Quicktime and Microsoft AYUV Uncompressed 4:4:4:4 encoder and decoder - Security fixes in the 4xm demuxer, avi demuxer, cook decoder,
- setfield filter mm demuxer, mpegvideo decoder, vqavideo decoder (CVE-2012-0947) and
- CDXL demuxer and decoder xmv demuxer.
- Apple ProRes encoder
- ffprobe -count_packets and -count_frames options - Several bugs and crashes have been fixed in the following codecs: AAC,
- Sun Rasterfile Encoder APE, H.263, H.264, Indeo 4, Mimic, MJPEG, Motion Pixels Video, RAW,
- ID3v2 attached pictures reading and writing TTA, VC1, VQA, WMA Voice, vqavideo.
- WMA Lossless decoder
- bluray protocol - Several bugs and crashes have been fixed in the following formats:
- blackdetect filter ASF, ID3v2, MOV, xWMA
- libutvideo encoder wrapper (--enable-libutvideo)
- This release additionally updates the following codecs to the
bytestream2 API, and therefore benefit from additional overflow
checks: truemotion2, utvideo, vqavideo
version 0.10.1
- Several security fixes, many bugfixes affecting many formats and
codecs, the list below is not complete.
- swapuv filter - swapuv filter
- bbox filter
- XBM encoder and decoder - Several bugs and crashes have been fixed in the following codecs: AAC,
- RealAudio Lossless decoder AC-3, ADPCM, AMR (both NB and WB), ATRAC3, CAVC, Cook, camstudio, DCA,
- ZeroCodec decoder DPCM, DSI CIN, DV, EA TGQ, FLAC, fraps, G.722 (both encoder and
- tile video filter decoder), H.264, huvffyuv, BB JV decoder, Indeo 3, KGV1, LCL, the
- Metal Gear Solid: The Twin Snakes demuxer libx264 wrapper, MJPEG, mp3on4, Musepack, MPEG1/2, PNG, QDM2, Qt RLE,
- OpenEXR image decoder ROQ, RV10, RV30/RV34/RV40, shorten, smacker, subrip, SVQ3, TIFF,
- removelogo filter Truemotion2, TTA, VC1, VMware Screen codec, Vorbis, VP5, VP6, WMA,
- drop support for ffmpeg without libavfilter Westwood SNDx, XXAN.
- drawtext video filter: fontconfig support
- ffmpeg -benchmark_all option - This release additionally updates the following codecs to the
- super2xsai filter ported from libmpcodecs bytestream2 API, and therefore benefit from additional overflow
- add libavresample audio conversion library for compatibility checks: XXAN, ALG MM, TQG, SMC, Qt SMC, ROQ, PNG
- MicroDVD decoder
- Avid Meridien (AVUI) encoder and decoder - Several bugs and crashes have been fixed in the following formats:
- accept + prefix to -pix_fmt option to disable automatic conversions. AIFF, ASF, DV, Matroska, NSV, MOV, MPEG-TS, Smacker, Sony OpenMG, RM,
- complete audio filtering in libavfilter and ffmpeg SWF.
- add fps filter
- audio split filter - Libswscale has an potential overflow for large image size fixed.
- vorbis parser
- png parser - The following APIs have been added:
- audio mix filter
avcodec_is_open()
avformat_get_riff_video_tags()
avformat_get_riff_audio_tags()
Please see the file doc/APIchanges and the Doxygen documentation for
further information.
version 0.10: version 0.10:
@@ -793,7 +1037,7 @@ version 0.4.5:
- MPEG-4 vol header fixes (Jonathan Marsden <snmjbm at pacbell.net>) - MPEG-4 vol header fixes (Jonathan Marsden <snmjbm at pacbell.net>)
- ARM optimizations (Lionel Ulmer <lionel.ulmer at free.fr>). - ARM optimizations (Lionel Ulmer <lionel.ulmer at free.fr>).
- Windows porting of file converter - Windows porting of file converter
- added MJPEG raw format (input/output) - added MJPEG raw format (input/ouput)
- added JPEG image format support (input/output) - added JPEG image format support (input/output)

View File

@@ -31,7 +31,7 @@ PROJECT_NAME = FFmpeg
# This could be handy for archiving the generated documentation or # This could be handy for archiving the generated documentation or
# if some version control system is used. # if some version control system is used.
PROJECT_NUMBER = 0.11.5 PROJECT_NUMBER = 0.10.15
# With the PROJECT_LOGO tag one can specify an logo or icon that is included # With the PROJECT_LOGO tag one can specify an logo or icon that is included
# in the documentation. The maximum height of the logo should not exceed 55 # in the documentation. The maximum height of the logo should not exceed 55

View File

@@ -20,12 +20,8 @@ Specifically, the GPL parts of FFmpeg are
There are a handful of files under other licensing terms, namely: There are a handful of files under other licensing terms, namely:
* The files libavcodec/jfdctfst.c, libavcodec/jfdctint_template.c and * The files libavcodec/jfdctfst.c, libavcodec/jfdctint.c, libavcodec/jrevdct.c
libavcodec/jrevdct.c are taken from libjpeg, see the top of the files for are taken from libjpeg, see the top of the files for licensing details.
licensing details. Specifically note that you must credit the IJG in the
documentation accompanying your program if you only distribute executables.
You must also indicate any changes including additions and deletions to
those three files in the documentation.
Should you, for whatever reason, prefer to use version 3 of the (L)GPL, then Should you, for whatever reason, prefer to use version 3 of the (L)GPL, then
the configure parameter --enable-version3 will activate this licensing option the configure parameter --enable-version3 will activate this licensing option

View File

@@ -159,7 +159,6 @@ Codecs:
indeo5* Kostya Shishkov indeo5* Kostya Shishkov
interplayvideo.c Mike Melanson interplayvideo.c Mike Melanson
ivi* Kostya Shishkov ivi* Kostya Shishkov
jacosub* Clément Bœsch
jpeg_ls.c Kostya Shishkov jpeg_ls.c Kostya Shishkov
jvdec.c Peter Ross jvdec.c Peter Ross
kmvc.c Kostya Shishkov kmvc.c Kostya Shishkov
@@ -172,7 +171,6 @@ Codecs:
libschroedinger* David Conrad libschroedinger* David Conrad
libspeexdec.c Justin Ruggles libspeexdec.c Justin Ruggles
libtheoraenc.c David Conrad libtheoraenc.c David Conrad
libutvideo* Derek Buitenhuis
libvorbis.c David Conrad libvorbis.c David Conrad
libxavs.c Stefan Gehrer libxavs.c Stefan Gehrer
libx264.c Mans Rullgard, Jason Garrett-Glaser libx264.c Mans Rullgard, Jason Garrett-Glaser
@@ -245,7 +243,6 @@ Codecs:
xan.c Mike Melanson xan.c Mike Melanson
xl.c Kostya Shishkov xl.c Kostya Shishkov
xvmc.c Ivan Kalvachev xvmc.c Ivan Kalvachev
zerocodec.c Derek Buitenhuis
zmbv* Kostya Shishkov zmbv* Kostya Shishkov
Hardware acceleration: Hardware acceleration:
@@ -316,7 +313,6 @@ Muxers/Demuxers:
ipmovie.c Mike Melanson ipmovie.c Mike Melanson
img2.c Michael Niedermayer img2.c Michael Niedermayer
iss.c Stefan Gehrer iss.c Stefan Gehrer
jacosub* Clément Bœsch
jvdec.c Peter Ross jvdec.c Peter Ross
libmodplug.c Clément Bœsch libmodplug.c Clément Bœsch
libnut.c Oded Shimon libnut.c Oded Shimon
@@ -374,7 +370,6 @@ Muxers/Demuxers:
wv.c Kostya Shishkov wv.c Kostya Shishkov
Protocols: Protocols:
bluray.c Petri Hintukainen
http.c Ronald S. Bultje http.c Ronald S. Bultje
mms*.c Ronald S. Bultje mms*.c Ronald S. Bultje
udp.c Luca Abeni udp.c Luca Abeni
@@ -400,11 +395,8 @@ x86 Michael Niedermayer
Releases Releases
======== ========
1.2 Michael Niedermayer 0.9 Michael Niedermayer
1.1 Michael Niedermayer
1.0 Michael Niedermayer
If you want to maintain an older release, please contact us
GnuPG Fingerprints of maintainers and contributors GnuPG Fingerprints of maintainers and contributors

View File

@@ -19,7 +19,7 @@ PROGS := $(PROGS-yes:%=%$(EXESUF))
INSTPROGS = $(PROGS-yes:%=%$(PROGSSUF)$(EXESUF)) INSTPROGS = $(PROGS-yes:%=%$(PROGSSUF)$(EXESUF))
OBJS = $(PROGS-yes:%=%.o) cmdutils.o OBJS = $(PROGS-yes:%=%.o) cmdutils.o
TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64 TESTTOOLS = audiogen videogen rotozoom tiny_psnr base64
HOSTPROGS := $(TESTTOOLS:%=tests/%) doc/print_options HOSTPROGS := $(TESTTOOLS:%=tests/%)
TOOLS = qt-faststart trasher TOOLS = qt-faststart trasher
TOOLS-$(CONFIG_ZLIB) += cws2fws TOOLS-$(CONFIG_ZLIB) += cws2fws
@@ -31,7 +31,6 @@ ALLMANPAGES = $(BASENAMES:%=%.1)
FFLIBS-$(CONFIG_AVDEVICE) += avdevice FFLIBS-$(CONFIG_AVDEVICE) += avdevice
FFLIBS-$(CONFIG_AVFILTER) += avfilter FFLIBS-$(CONFIG_AVFILTER) += avfilter
FFLIBS-$(CONFIG_AVFORMAT) += avformat FFLIBS-$(CONFIG_AVFORMAT) += avformat
FFLIBS-$(CONFIG_AVRESAMPLE) += avresample
FFLIBS-$(CONFIG_AVCODEC) += avcodec FFLIBS-$(CONFIG_AVCODEC) += avcodec
FFLIBS-$(CONFIG_POSTPROC) += postproc FFLIBS-$(CONFIG_POSTPROC) += postproc
FFLIBS-$(CONFIG_SWRESAMPLE)+= swresample FFLIBS-$(CONFIG_SWRESAMPLE)+= swresample
@@ -40,7 +39,6 @@ FFLIBS-$(CONFIG_SWSCALE) += swscale
FFLIBS := avutil FFLIBS := avutil
DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.ffpreset) $(SRC_PATH)/doc/ffprobe.xsd DATA_FILES := $(wildcard $(SRC_PATH)/presets/*.ffpreset) $(SRC_PATH)/doc/ffprobe.xsd
EXAMPLES_FILES := $(wildcard $(SRC_PATH)/doc/examples/*.c) $(SRC_PATH)/doc/examples/Makefile
SKIPHEADERS = cmdutils_common_opts.h SKIPHEADERS = cmdutils_common_opts.h
@@ -66,11 +64,9 @@ config.h: .config
@-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n' @-printf '\nWARNING: $(?F) newer than config.h, rerun configure\n\n'
@-tput sgr0 2>/dev/null @-tput sgr0 2>/dev/null
SUBDIR_VARS := CLEANFILES EXAMPLES FFLIBS HOSTPROGS TESTPROGS TOOLS \ SUBDIR_VARS := OBJS FFLIBS CLEANFILES DIRS TESTPROGS EXAMPLES SKIPHEADERS \
ARCH_HEADERS BUILT_HEADERS SKIPHEADERS \ ALTIVEC-OBJS MMX-OBJS NEON-OBJS X86-OBJS YASM-OBJS-FFT YASM-OBJS \
ALTIVEC-OBJS ARMV5TE-OBJS ARMV6-OBJS ARMVFP-OBJS MMI-OBJS \ HOSTPROGS BUILT_HEADERS TESTOBJS ARCH_HEADERS ARMV6-OBJS TOOLS
MMX-OBJS NEON-OBJS VIS-OBJS YASM-OBJS \
OBJS TESTOBJS
define RESET define RESET
$(1) := $(1) :=
@@ -126,10 +122,9 @@ install-progs: install-progs-yes $(PROGS)
$(Q)mkdir -p "$(BINDIR)" $(Q)mkdir -p "$(BINDIR)"
$(INSTALL) -c -m 755 $(INSTPROGS) "$(BINDIR)" $(INSTALL) -c -m 755 $(INSTPROGS) "$(BINDIR)"
install-data: $(DATA_FILES) $(EXAMPLES_FILES) install-data: $(DATA_FILES)
$(Q)mkdir -p "$(DATADIR)/examples" $(Q)mkdir -p "$(DATADIR)"
$(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)" $(INSTALL) -m 644 $(DATA_FILES) "$(DATADIR)"
$(INSTALL) -m 644 $(EXAMPLES_FILES) "$(DATADIR)/examples"
uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data uninstall: uninstall-libs uninstall-headers uninstall-progs uninstall-data
@@ -142,7 +137,6 @@ uninstall-data:
clean:: clean::
$(RM) $(ALLPROGS) $(ALLPROGS_G) $(RM) $(ALLPROGS) $(ALLPROGS_G)
$(RM) $(CLEANSUFFIXES) $(RM) $(CLEANSUFFIXES)
$(RM) $(TOOLS)
$(RM) $(CLEANSUFFIXES:%=tools/%) $(RM) $(CLEANSUFFIXES:%=tools/%)
$(RM) coverage.info $(RM) coverage.info
$(RM) -r coverage-html $(RM) -r coverage-html
@@ -179,5 +173,5 @@ $(sort $(OBJDIRS)):
# so this saves some time on slow systems. # so this saves some time on slow systems.
.SUFFIXES: .SUFFIXES:
.PHONY: all all-yes alltools check *clean config install* .PHONY: all all-yes alltools check *clean config examples install*
.PHONY: testprogs uninstall* .PHONY: testprogs uninstall*

8
README
View File

@@ -4,15 +4,9 @@ FFmpeg README
1) Documentation 1) Documentation
---------------- ----------------
* Read the documentation in the doc/ directory in git. * Read the documentation in the doc/ directory.
You can also view it online at http://ffmpeg.org/documentation.html
2) Licensing 2) Licensing
------------ ------------
* See the LICENSE file. * See the LICENSE file.
3) Build and Install
--------------------
* See the INSTALL file.

View File

@@ -1 +1 @@
0.11.5 0.10.15

View File

@@ -1 +1 @@
0.11.5 0.10.15

View File

@@ -1,13 +0,0 @@
OBJS-$(HAVE_ARMV5TE) += $(ARMV5TE-OBJS) $(ARMV5TE-OBJS-yes)
OBJS-$(HAVE_ARMV6) += $(ARMV6-OBJS) $(ARMV6-OBJS-yes)
OBJS-$(HAVE_ARMVFP) += $(ARMVFP-OBJS) $(ARMVFP-OBJS-yes)
OBJS-$(HAVE_NEON) += $(NEON-OBJS) $(NEON-OBJS-yes)
OBJS-$(HAVE_MMI) += $(MMI-OBJS) $(MMI-OBJS-yes)
OBJS-$(HAVE_ALTIVEC) += $(ALTIVEC-OBJS) $(ALTIVEC-OBJS-yes)
OBJS-$(HAVE_VIS) += $(VIS-OBJS) $(VIS-OBJS-yes)
OBJS-$(HAVE_MMX) += $(MMX-OBJS) $(MMX-OBJS-yes)
OBJS-$(HAVE_YASM) += $(YASM-OBJS) $(YASM-OBJS-yes)

View File

@@ -32,13 +32,11 @@
#include "libavformat/avformat.h" #include "libavformat/avformat.h"
#include "libavfilter/avfilter.h" #include "libavfilter/avfilter.h"
#include "libavdevice/avdevice.h" #include "libavdevice/avdevice.h"
#include "libavresample/avresample.h"
#include "libswscale/swscale.h" #include "libswscale/swscale.h"
#include "libswresample/swresample.h" #include "libswresample/swresample.h"
#if CONFIG_POSTPROC #if CONFIG_POSTPROC
#include "libpostproc/postprocess.h" #include "libpostproc/postprocess.h"
#endif #endif
#include "libavutil/avassert.h"
#include "libavutil/avstring.h" #include "libavutil/avstring.h"
#include "libavutil/mathematics.h" #include "libavutil/mathematics.h"
#include "libavutil/parseutils.h" #include "libavutil/parseutils.h"
@@ -56,7 +54,6 @@
#endif #endif
struct SwsContext *sws_opts; struct SwsContext *sws_opts;
SwrContext *swr_opts;
AVDictionary *format_opts, *codec_opts; AVDictionary *format_opts, *codec_opts;
const int this_year = 2014; const int this_year = 2014;
@@ -69,7 +66,6 @@ void init_opts(void)
sws_opts = sws_getContext(16, 16, 0, 16, 16, 0, SWS_BICUBIC, sws_opts = sws_getContext(16, 16, 0, 16, 16, 0, SWS_BICUBIC,
NULL, NULL, NULL); NULL, NULL, NULL);
#endif #endif
swr_opts = swr_alloc();
} }
void uninit_opts(void) void uninit_opts(void)
@@ -78,7 +74,6 @@ void uninit_opts(void)
sws_freeContext(sws_opts); sws_freeContext(sws_opts);
sws_opts = NULL; sws_opts = NULL;
#endif #endif
swr_free(&swr_opts);
av_dict_free(&format_opts); av_dict_free(&format_opts);
av_dict_free(&codec_opts); av_dict_free(&codec_opts);
} }
@@ -255,12 +250,14 @@ int parse_option(void *optctx, const char *opt, const char *arg,
if (!po->name && opt[0] == 'n' && opt[1] == 'o') { if (!po->name && opt[0] == 'n' && opt[1] == 'o') {
/* handle 'no' bool option */ /* handle 'no' bool option */
po = find_option(options, opt + 2); po = find_option(options, opt + 2);
if ((po->name && (po->flags & OPT_BOOL))) if (!(po->name && (po->flags & OPT_BOOL)))
goto unknown_opt;
bool_val = 0; bool_val = 0;
} }
if (!po->name) if (!po->name)
po = find_option(options, "default"); po = find_option(options, "default");
if (!po->name) { if (!po->name) {
unknown_opt:
av_log(NULL, AV_LOG_ERROR, "Unrecognized option '%s'\n", opt); av_log(NULL, AV_LOG_ERROR, "Unrecognized option '%s'\n", opt);
return AVERROR(EINVAL); return AVERROR(EINVAL);
} }
@@ -345,7 +342,10 @@ void parse_options(void *optctx, int argc, char **argv, const OptionDef *options
} }
} }
int locate_option(int argc, char **argv, const OptionDef *options, /*
* Return index of option opt in argv or 0 if not found.
*/
static int locate_option(int argc, char **argv, const OptionDef *options,
const char *optname) const char *optname)
{ {
const OptionDef *po; const OptionDef *po;
@@ -420,10 +420,13 @@ void parse_loglevel(int argc, char **argv, const OptionDef *options)
#define FLAGS(o) ((o)->type == AV_OPT_TYPE_FLAGS) ? AV_DICT_APPEND : 0 #define FLAGS(o) ((o)->type == AV_OPT_TYPE_FLAGS) ? AV_DICT_APPEND : 0
int opt_default(const char *opt, const char *arg) int opt_default(const char *opt, const char *arg)
{ {
const AVOption *oc, *of, *os, *oswr = NULL; const AVOption *oc, *of, *os;
char opt_stripped[128]; char opt_stripped[128];
const char *p; const char *p;
const AVClass *cc = avcodec_get_class(), *fc = avformat_get_class(), *sc, *swr_class; const AVClass *cc = avcodec_get_class(), *fc = avformat_get_class();
#if CONFIG_SWSCALE
const AVClass *sc = sws_get_class();
#endif
if (!(p = strchr(opt, ':'))) if (!(p = strchr(opt, ':')))
p = opt + strlen(opt); p = opt + strlen(opt);
@@ -438,7 +441,6 @@ int opt_default(const char *opt, const char *arg)
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ)))
av_dict_set(&format_opts, opt, arg, FLAGS(of)); av_dict_set(&format_opts, opt, arg, FLAGS(of));
#if CONFIG_SWSCALE #if CONFIG_SWSCALE
sc = sws_get_class();
if ((os = av_opt_find(&sc, opt, NULL, 0, if ((os = av_opt_find(&sc, opt, NULL, 0,
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) { AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) {
// XXX we only support sws_flags, not arbitrary sws options // XXX we only support sws_flags, not arbitrary sws options
@@ -449,17 +451,8 @@ int opt_default(const char *opt, const char *arg)
} }
} }
#endif #endif
swr_class = swr_get_class();
if (!oc && !of && !os && (oswr = av_opt_find(&swr_class, opt, NULL, 0,
AV_OPT_SEARCH_CHILDREN | AV_OPT_SEARCH_FAKE_OBJ))) {
int ret = av_opt_set(swr_opts, opt, arg, 0);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error setting option %s.\n", opt);
return ret;
}
}
if (oc || of || os || oswr) if (oc || of || os)
return 0; return 0;
av_log(NULL, AV_LOG_ERROR, "Unrecognized option '%s'\n", opt); av_log(NULL, AV_LOG_ERROR, "Unrecognized option '%s'\n", opt);
return AVERROR_OPTION_NOT_FOUND; return AVERROR_OPTION_NOT_FOUND;
@@ -546,18 +539,6 @@ int opt_max_alloc(const char *opt, const char *arg)
return 0; return 0;
} }
int opt_cpuflags(const char *opt, const char *arg)
{
int ret;
unsigned flags = av_get_cpu_flags();
if ((ret = av_parse_cpu_caps(&flags, arg)) < 0)
return ret;
av_force_cpu_flags(flags);
return 0;
}
int opt_codec_debug(const char *opt, const char *arg) int opt_codec_debug(const char *opt, const char *arg)
{ {
av_log_set_level(AV_LOG_DEBUG); av_log_set_level(AV_LOG_DEBUG);
@@ -599,8 +580,7 @@ static int warned_cfg = 0;
const char *indent = flags & INDENT? " " : ""; \ const char *indent = flags & INDENT? " " : ""; \
if (flags & SHOW_VERSION) { \ if (flags & SHOW_VERSION) { \
unsigned int version = libname##_version(); \ unsigned int version = libname##_version(); \
av_log(NULL, level, \ av_log(NULL, level, "%slib%-11s %2d.%3d.%3d / %2d.%3d.%3d\n",\
"%slib%-11s %2d.%3d.%3d / %2d.%3d.%3d\n", \
indent, #libname, \ indent, #libname, \
LIB##LIBNAME##_VERSION_MAJOR, \ LIB##LIBNAME##_VERSION_MAJOR, \
LIB##LIBNAME##_VERSION_MINOR, \ LIB##LIBNAME##_VERSION_MINOR, \
@@ -629,7 +609,6 @@ static void print_all_libs_info(int flags, int level)
PRINT_LIB_INFO(avformat, AVFORMAT, flags, level); PRINT_LIB_INFO(avformat, AVFORMAT, flags, level);
PRINT_LIB_INFO(avdevice, AVDEVICE, flags, level); PRINT_LIB_INFO(avdevice, AVDEVICE, flags, level);
PRINT_LIB_INFO(avfilter, AVFILTER, flags, level); PRINT_LIB_INFO(avfilter, AVFILTER, flags, level);
// PRINT_LIB_INFO(avresample, AVRESAMPLE, flags, level);
PRINT_LIB_INFO(swscale, SWSCALE, flags, level); PRINT_LIB_INFO(swscale, SWSCALE, flags, level);
PRINT_LIB_INFO(swresample,SWRESAMPLE, flags, level); PRINT_LIB_INFO(swresample,SWRESAMPLE, flags, level);
#if CONFIG_POSTPROC #if CONFIG_POSTPROC
@@ -827,9 +806,9 @@ int opt_codecs(const char *opt, const char *arg)
decode = encode = cap = 0; decode = encode = cap = 0;
} }
if (p2 && strcmp(p->name, p2->name) == 0) { if (p2 && strcmp(p->name, p2->name) == 0) {
if (av_codec_is_decoder(p)) if (p->decode)
decode = 1; decode = 1;
if (av_codec_is_encoder(p)) if (p->encode || p->encode2)
encode = 1; encode = 1;
cap |= p->capabilities; cap |= p->capabilities;
} }
@@ -875,16 +854,20 @@ int opt_bsfs(const char *opt, const char *arg)
int opt_protocols(const char *opt, const char *arg) int opt_protocols(const char *opt, const char *arg)
{ {
void *opaque = NULL; URLProtocol *up=NULL;
const char *name;
printf("Supported file protocols:\n" printf("Supported file protocols:\n"
"Input:\n"); "I.. = Input supported\n"
while ((name = avio_enum_protocols(&opaque, 0))) ".O. = Output supported\n"
printf("%s\n", name); "..S = Seek supported\n"
printf("Output:\n"); "FLAGS NAME\n"
while ((name = avio_enum_protocols(&opaque, 1))) "----- \n");
printf("%s\n", name); while((up = av_protocol_next(up)))
printf("%c%c%c %s\n",
up->url_read ? 'I' : '.',
up->url_write ? 'O' : '.',
up->url_seek ? 'S' : '.',
up->name);
return 0; return 0;
} }
@@ -1076,7 +1059,7 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
case 's': type = AVMEDIA_TYPE_SUBTITLE; break; case 's': type = AVMEDIA_TYPE_SUBTITLE; break;
case 'd': type = AVMEDIA_TYPE_DATA; break; case 'd': type = AVMEDIA_TYPE_DATA; break;
case 't': type = AVMEDIA_TYPE_ATTACHMENT; break; case 't': type = AVMEDIA_TYPE_ATTACHMENT; break;
default: av_assert0(0); default: abort(); // never reached, silence warning
} }
if (type != st->codec->codec_type) if (type != st->codec->codec_type)
return 0; return 0;
@@ -1109,12 +1092,6 @@ int check_stream_specifier(AVFormatContext *s, AVStream *st, const char *spec)
return 1; return 1;
} }
return 0; return 0;
} else if (*spec == '#') {
int sid;
char *endptr;
sid = strtol(spec + 1, &endptr, 0);
if (!*endptr)
return st->id == sid;
} else if (!*spec) /* empty specifier, matches everything */ } else if (!*spec) /* empty specifier, matches everything */
return 1; return 1;

View File

@@ -51,7 +51,6 @@ extern const int this_year;
extern AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB]; extern AVCodecContext *avcodec_opts[AVMEDIA_TYPE_NB];
extern AVFormatContext *avformat_opts; extern AVFormatContext *avformat_opts;
extern struct SwsContext *sws_opts; extern struct SwsContext *sws_opts;
extern struct SwrContext *swr_opts;
extern AVDictionary *format_opts, *codec_opts; extern AVDictionary *format_opts, *codec_opts;
/** /**
@@ -86,8 +85,6 @@ int opt_report(const char *opt);
int opt_max_alloc(const char *opt, const char *arg); int opt_max_alloc(const char *opt, const char *arg);
int opt_cpuflags(const char *opt, const char *arg);
int opt_codec_debug(const char *opt, const char *arg); int opt_codec_debug(const char *opt, const char *arg);
/** /**
@@ -207,12 +204,6 @@ int parse_option(void *optctx, const char *opt, const char *arg,
*/ */
void parse_loglevel(int argc, char **argv, const OptionDef *options); void parse_loglevel(int argc, char **argv, const OptionDef *options);
/**
* Return index of option opt in argv or 0 if not found.
*/
int locate_option(int argc, char **argv, const OptionDef *options,
const char *optname);
/** /**
* Check if the given stream matches a stream specifier. * Check if the given stream matches a stream specifier.
* *
@@ -358,7 +349,7 @@ int cmdutils_read_file(const char *filename, char **bufptr, size_t *size);
* at configuration time or in a "ffpresets" folder along the executable * at configuration time or in a "ffpresets" folder along the executable
* on win32, in that order. If no such file is found and * on win32, in that order. If no such file is found and
* codec_name is defined, then search for a file named * codec_name is defined, then search for a file named
* codec_name-preset_name.avpreset in the above-mentioned directories. * codec_name-preset_name.ffpreset in the above-mentioned directories.
* *
* @param filename buffer where the name of the found filename is written * @param filename buffer where the name of the found filename is written
* @param filename_size size in bytes of the filename buffer * @param filename_size size in bytes of the filename buffer

View File

@@ -14,7 +14,5 @@
{ "loglevel", HAS_ARG, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" }, { "loglevel", HAS_ARG, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" },
{ "v", HAS_ARG, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" }, { "v", HAS_ARG, {(void*)opt_loglevel}, "set libav* logging level", "loglevel" },
{ "debug", HAS_ARG, {(void*)opt_codec_debug}, "set debug flags", "flags" }, { "debug", HAS_ARG, {(void*)opt_codec_debug}, "set debug flags", "flags" },
{ "fdebug", HAS_ARG, {(void*)opt_codec_debug}, "set debug flags", "flags" },
{ "report", 0, {(void*)opt_report}, "generate a report" }, { "report", 0, {(void*)opt_report}, "generate a report" },
{ "max_alloc", HAS_ARG, {(void*)opt_max_alloc}, "set maximum size of a single allocated block", "bytes" }, { "max_alloc", HAS_ARG, {(void*)opt_max_alloc}, "set maximum size of a single allocated block", "bytes" },
{ "cpuflags", HAS_ARG | OPT_EXPERT, {(void*)opt_cpuflags}, "force specific cpu flags", "flags" },

View File

@@ -20,7 +20,7 @@ $(foreach VAR,$(SILENT),$(eval override $(VAR) = @$($(VAR))))
$(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL)) $(eval INSTALL = @$(call ECHO,INSTALL,$$(^:$(SRC_DIR)/%=%)); $(INSTALL))
endif endif
ALLFFLIBS = avcodec avdevice avfilter avformat avresample avutil postproc swscale swresample ALLFFLIBS = avcodec avdevice avfilter avformat avutil postproc swscale swresample
# NASM requires -I path terminated with / # NASM requires -I path terminated with /
IFLAGS := -I. -I$(SRC_PATH)/ IFLAGS := -I. -I$(SRC_PATH)/
@@ -73,7 +73,7 @@ COMPILE_S = $(call COMPILE,AS)
$(OBJS): $(OBJS):
endif endif
include $(SRC_PATH)/arch.mak OBJS-$(HAVE_MMX) += $(MMX-OBJS-yes)
OBJS += $(OBJS-yes) OBJS += $(OBJS-yes)
FFLIBS := $(FFLIBS-yes) $(FFLIBS) FFLIBS := $(FFLIBS-yes) $(FFLIBS)
@@ -115,6 +115,15 @@ OBJDIRS := $(OBJDIRS) $(dir $(OBJS) $(HOSTOBJS) $(TESTOBJS))
CLEANSUFFIXES = *.d *.o *~ *.ho *.map *.ver *.gcno *.gcda CLEANSUFFIXES = *.d *.o *~ *.ho *.map *.ver *.gcno *.gcda
DISTCLEANSUFFIXES = *.pc DISTCLEANSUFFIXES = *.pc
LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a LIBSUFFIXES = *.a *.lib *.so *.so.* *.dylib *.dll *.def *.dll.a *.exp
define RULES
clean::
$(RM) $(OBJS) $(OBJS:.o=.d)
$(RM) $(HOSTPROGS)
$(RM) $(TOOLS)
endef
$(eval $(RULES))
-include $(wildcard $(OBJS:.o=.d) $(TESTOBJS:.o=.d)) -include $(wildcard $(OBJS:.o=.d) $(TESTOBJS:.o=.d))

391
configure vendored

File diff suppressed because it is too large Load Diff

View File

@@ -2,164 +2,39 @@ Never assume the API of libav* to be stable unless at least 1 month has passed
since the last major version increase. since the last major version increase.
The last version increases were: The last version increases were:
libavcodec: 2012-01-27 libavcodec: 2011-04-18
libavdevice: 2011-04-18 libavdevice: 2011-04-18
libavfilter: 2011-04-18 libavfilter: 2011-04-18
libavformat: 2012-01-27 libavformat: 2011-04-18
libavresample: 2012-04-24
libpostproc: 2011-04-18 libpostproc: 2011-04-18
libswresample: 2011-09-19
libswscale: 2011-06-20 libswscale: 2011-06-20
libavutil: 2011-04-18 libavutil: 2011-04-18
API changes, most recent first: API changes, most recent first:
2012-05-24 - xxxxxxx - lavu 51.54.100 2012-01-24 - xxxxxxx - lavfi 2.60.100
Move AVPALETTE_SIZE and AVPALETTE_COUNT macros from
libavcodec/avcodec.h to libavutil/pixfmt.h.
2012-05-07 - xxxxxxx - lavf 54.5.100
Add av_guess_sample_aspect_ratio() function.
2012-04-20 - xxxxxxx - lavfi 2.70.100
Add avfilter_unref_bufferp() to avfilter.h.
2012-04-12 - xxxxxxx - lavfi 2.68.100
Install libavfilter/asrc_abuffer.h public header.
2012-03-26 - a67d9cf - lavfi 2.66.100
Add avfilter_fill_frame_from_{audio_,}buffer_ref() functions.
2012-05-15 - lavfi 2.74.100 / 2.17.0
Add support for audio filters
61930bd / ac71230, 1cbf7fb / a2cd9be - add video/audio buffer sink in a new installed
header buffersink.h
1cbf7fb / 720c6b7 - add av_buffersrc_write_frame(), deprecate
av_vsrc_buffer_add_frame()
61930bd / ab16504 - add avfilter_copy_buf_props()
61930bd / 9453c9e - add extended_data to AVFilterBuffer
61930bd / 1b8c927 - add avfilter_get_audio_buffer_ref_from_arrays()
2012-05-09 - lavu 51.53.100 / 51.30.0 - samplefmt.h
61930bd / 142e740 - add av_samples_copy()
61930bd / 6d7f617 - add av_samples_set_silence()
2012-05-09 - 61930bd / a5117a2 - lavc 54.21.101 / 54.13.1
For audio formats with fixed frame size, the last frame
no longer needs to be padded with silence, libavcodec
will handle this internally (effectively all encoders
behave as if they had CODEC_CAP_SMALL_LAST_FRAME set).
2012-05-07 - 653d117 / 828bd08 - lavc 54.20.100 / 54.13.0 - avcodec.h
Add sample_rate and channel_layout fields to AVFrame.
2012-05-01 - 2330eb1 / 4010d72 - lavr 0.0.1
Change AV_MIX_COEFF_TYPE_Q6 to AV_MIX_COEFF_TYPE_Q8.
2012-04-25 - e890b68 / 3527a73 - lavu 51.48.100 / 51.29.0 - cpu.h
Add av_parse_cpu_flags()
2012-04-24 - 3ead79e / c8af852 - lavr 0.0.0
Add libavresample audio conversion library
2012-04-20 - 3194ab7 / 0c0d1bc - lavu 51.47.100 / 51.28.0 - audio_fifo.h
Add audio FIFO functions:
av_audio_fifo_free()
av_audio_fifo_alloc()
av_audio_fifo_realloc()
av_audio_fifo_write()
av_audio_fifo_read()
av_audio_fifo_drain()
av_audio_fifo_reset()
av_audio_fifo_size()
av_audio_fifo_space()
2012-04-14 - lavfi 2.70.100 / 2.16.0 - avfiltergraph.h
7432bcf / d7bcc71 Add avfilter_graph_parse2().
2012-04-08 - 6bfb304 / 4d693b0 - lavu 51.46.100 / 51.27.0 - samplefmt.h
Add av_get_packed_sample_fmt() and av_get_planar_sample_fmt()
2012-03-21 - b75c67d - lavu 51.43.100
Add bprint.h for bprint API.
2012-02-21 - 9cbf17e - lavc 54.4.100
Add av_get_pcm_codec() function.
2012-02-16 - 560b224 - libswr 0.7.100
Add swr_set_matrix() function.
2012-02-09 - c28e7af - lavu 51.39.100
Add a new installed header libavutil/timestamp.h with timestamp
utilities.
2012-02-06 - 70ffda3 - lavu 51.38.100
Add av_parse_ratio() function to parseutils.h.
2012-02-06 - 70ffda3 - lavu 51.38.100
Add AV_LOG_MAX_OFFSET macro to log.h.
2012-02-02 - 0eaa123 - lavu 51.37.100
Add public timecode helpers.
2012-01-24 - 0c3577b - lavfi 2.60.100
Add avfilter_graph_dump. Add avfilter_graph_dump.
2012-03-05 - lavc 54.10.100 / 54.8.0
f095391 / 6699d07 Add av_get_exact_bits_per_sample()
f095391 / 9524cf7 Add av_get_audio_frame_duration()
2012-03-04 - 2af8f2c / 44fe77b - lavc 54.8.100 / 54.7.0 - avcodec.h
Add av_codec_is_encoder/decoder().
2012-03-01 - 1eb7f39 / 442c132 - lavc 54.5.100 / 54.3.0 - avcodec.h
Add av_packet_shrink_side_data.
2012-02-29 - 79ae084 / dd2a4bc - lavf 54.2.100 / 54.2.0 - avformat.h
Add AVStream.attached_pic and AV_DISPOSITION_ATTACHED_PIC,
used for dealing with attached pictures/cover art.
2012-02-25 - 305e4b3 / c9bca80 - lavu 51.41.100 / 51.24.0 - error.h
Add AVERROR_UNKNOWN
NOTE: this was backported to 0.8
2012-02-20 - eadd426 / e9cda85 - lavc 54.2.100 / 54.2.0
Add duration field to AVCodecParserContext
2012-02-20 - eadd426 / 0b42a93 - lavu 51.40.100 / 51.23.1 - mathematics.h
Add av_rescale_q_rnd()
2012-02-08 - f2b20b7 / 38d5533 - lavu 51.38.101 / 51.22.1 - pixdesc.h
Add PIX_FMT_PSEUDOPAL flag.
2012-02-08 - f2b20b7 / 52f82a1 - lavc 54.2.100 / 54.1.0
Add avcodec_encode_video2() and deprecate avcodec_encode_video().
2012-02-01 - 4c677df / 316fc74 - lavc 54.1.0
Add av_fast_padded_malloc() as alternative for av_realloc() when aligned
memory is required. The buffer will always have FF_INPUT_BUFFER_PADDING_SIZE
zero-padded bytes at the end.
2012-01-31 - a369a6b / dd6d3b0 - lavf 54.1.0
Add avformat_get_riff_video_tags() and avformat_get_riff_audio_tags().
NOTE: this was backported to 0.8
2012-01-31 - a369a6b / af08d9a - lavc 54.1.0
Add avcodec_is_open() function.
NOTE: this was backported to 0.8
2012-01-30 - 151ecc2 / 8b93312 - lavu 51.36.100 / 51.22.0 - intfloat.h
Add a new installed header libavutil/intfloat.h with int/float punning
functions.
NOTE: this was backported to 0.8
2012-01-25 - lavf 53.31.100 / 53.22.0 2012-01-25 - lavf 53.31.100 / 53.22.0
3c5fe5b / f1caf01 Allow doing av_write_frame(ctx, NULL) for flushing possible 3c5fe5b / f1caf01 Allow doing av_write_frame(ctx, NULL) for flushing possible
buffered data within a muxer. Added AVFMT_ALLOW_FLUSH for buffered data within a muxer. Added AVFMT_ALLOW_FLUSH for
muxers supporting it (av_write_frame makes sure it is called muxers supporting it (av_write_frame makes sure it is called
only for muxers with this flag). only for muxers with this flag).
2012-03-04 - 7f3f855 - lavu 51.22.1 - error.h
Add AVERROR_UNKNOWN
2012-02-29 - 2ad77c6 - lavf 53.21.1
Add avformat_get_riff_video_tags() and avformat_get_riff_audio_tags().
2012-02-29 - a1556d3 - lavu 51.22.0 - intfloat.h
Add a new installed header libavutil/intfloat.h with int/float punning
functions.
2012-02-17 - 350d06d - lavc 53.35.0
Add avcodec_is_open() function.
2012-01-15 - lavc 53.56.105 / 53.34.0 2012-01-15 - lavc 53.56.105 / 53.34.0
New audio encoding API: New audio encoding API:
67f5650 / b2c75b6 Add CODEC_CAP_VARIABLE_FRAME_SIZE capability for use by audio 67f5650 / b2c75b6 Add CODEC_CAP_VARIABLE_FRAME_SIZE capability for use by audio
@@ -174,13 +49,13 @@ API changes, most recent first:
2011-12-08 - a502939 - lavfi 2.52.0 2011-12-08 - a502939 - lavfi 2.52.0
Add av_buffersink_poll_frame() to buffersink.h. Add av_buffersink_poll_frame() to buffersink.h.
2011-12-08 - 26c6fec - lavu 51.31.0 2011-12-08 - xxxxxxx - lavu 51.31.0
Add av_log_format_line. Add av_log_format_line.
2011-12-03 - 976b095 - lavu 51.30.0 2011-12-03 - xxxxxxx - lavu 51.30.0
Add AVERROR_BUG. Add AVERROR_BUG.
2011-11-24 - 573ffbb - lavu 51.28.1 2011-xx-xx - xxxxxxx - lavu 51.28.1
Add av_get_alt_sample_fmt() to samplefmt.h. Add av_get_alt_sample_fmt() to samplefmt.h.
2011-11-03 - 96949da - lavu 51.23.0 2011-11-03 - 96949da - lavu 51.23.0
@@ -247,7 +122,7 @@ API changes, most recent first:
Add av_toupper()/av_tolower() Add av_toupper()/av_tolower()
2011-11-05 - d8cab5c / b6d08f4 - lavf 53.19.0 / 53.13.0 2011-11-05 - d8cab5c / b6d08f4 - lavf 53.19.0 / 53.13.0
Add avformat_network_init()/avformat_network_deinit() Add avformat_network_init()/avformat_network_uninit()
2011-10-27 - 6faf0a2 / 512557b - lavc 53.24.0 / 53.15.0 2011-10-27 - 6faf0a2 / 512557b - lavc 53.24.0 / 53.15.0
Remove avcodec_parse_frame. Remove avcodec_parse_frame.
@@ -358,14 +233,9 @@ API changes, most recent first:
2011-07-10 - 3602ad7 / a67c061 - lavf 53.6.0 2011-07-10 - 3602ad7 / a67c061 - lavf 53.6.0
Add avformat_find_stream_info(), deprecate av_find_stream_info(). Add avformat_find_stream_info(), deprecate av_find_stream_info().
NOTE: this was backported to 0.7
2011-07-10 - 3602ad7 / 0b950fe - lavc 53.8.0 2011-07-10 - 3602ad7 / 0b950fe - lavc 53.8.0
Add avcodec_open2(), deprecate avcodec_open(). Add avcodec_open2(), deprecate avcodec_open().
NOTE: this was backported to 0.7
Add avcodec_alloc_context3. Deprecate avcodec_alloc_context() and
avcodec_alloc_context2().
2011-07-01 - b442ca6 - lavf 53.5.0 - avformat.h 2011-07-01 - b442ca6 - lavf 53.5.0 - avformat.h
Add function av_get_output_timestamp(). Add function av_get_output_timestamp().
@@ -683,39 +553,39 @@ API changes, most recent first:
2011-01-31 - 910b5b8 - lavfi 1.75.0 - AVFilterLink sample_aspect_ratio 2011-01-31 - 910b5b8 - lavfi 1.75.0 - AVFilterLink sample_aspect_ratio
Add sample_aspect_ratio field to AVFilterLink. Add sample_aspect_ratio field to AVFilterLink.
2011-01-15 - a242ac3 - lavfi 1.74.0 - AVFilterBufferRefAudioProps 2011-01-15 - r26374 - lavfi 1.74.0 - AVFilterBufferRefAudioProps
Rename AVFilterBufferRefAudioProps.samples_nb to nb_samples. Rename AVFilterBufferRefAudioProps.samples_nb to nb_samples.
2011-01-14 - 7f88a5b - lavf 52.93.0 - av_metadata_copy() 2011-01-14 - r26330 - lavf 52.93.0 - av_metadata_copy()
Add av_metadata_copy() in avformat.h. Add av_metadata_copy() in avformat.h.
2011-01-07 - 81c623f - lavc 52.107.0 - deprecate reordered_opaque 2011-01-07 - r26262 - lavc 52.107.0 - deprecate reordered_opaque
Deprecate reordered_opaque in favor of pkt_pts/dts. Deprecate reordered_opaque in favor of pkt_pts/dts.
2011-01-07 - 1919fea - lavc 52.106.0 - pkt_dts 2011-01-07 - r26261 - lavc 52.106.0 - pkt_dts
Add pkt_dts to AVFrame, this will in the future allow multithreading decoders Add pkt_dts to AVFrame, this will in the future allow multithreading decoders
to not mess up dts. to not mess up dts.
2011-01-07 - 393cbb9 - lavc 52.105.0 - pkt_pts 2011-01-07 - r26260 - lavc 52.105.0 - pkt_pts
Add pkt_pts to AVFrame. Add pkt_pts to AVFrame.
2011-01-07 - 060ec0a - lavc 52.104.0 - av_get_profile_name() 2011-01-07 - r26259 - lavc 52.104.0 - av_get_profile_name()
Add av_get_profile_name to libavcodec/avcodec.h. Add av_get_profile_name to libavcodec/avcodec.h.
2010-12-27 - 0ccabee - lavfi 1.71.0 - AV_PERM_NEG_LINESIZES 2010-12-27 - r26108 - lavfi 1.71.0 - AV_PERM_NEG_LINESIZES
Add AV_PERM_NEG_LINESIZES in avfilter.h. Add AV_PERM_NEG_LINESIZES in avfilter.h.
2010-12-27 - 9128ae0 - lavf 52.91.0 - av_find_best_stream() 2010-12-27 - r26104 - lavf 52.91.0 - av_find_best_stream()
Add av_find_best_stream to libavformat/avformat.h. Add av_find_best_stream to libavformat/avformat.h.
2010-12-27 - 107a7e3 - lavf 52.90.0 2010-12-27 - r26103 - lavf 52.90.0
Add AVFMT_NOSTREAMS flag for formats with no streams, Add AVFMT_NOSTREAMS flag for formats with no streams,
like e.g. text metadata. like e.g. text metadata.
2010-12-22 - 0328b9e - lavu 50.36.0 - file.h 2010-12-22 - r26073 - lavu 50.36.0 - file.h
Add functions av_file_map() and av_file_unmap() in file.h. Add functions av_file_map() and av_file_unmap() in file.h.
2010-12-19 - 0bc55f5 - lavu 50.35.0 - error.h 2010-12-19 - r26056 - lavu 50.35.0 - error.h
Add "not found" error codes: Add "not found" error codes:
AVERROR_DEMUXER_NOT_FOUND AVERROR_DEMUXER_NOT_FOUND
AVERROR_MUXER_NOT_FOUND AVERROR_MUXER_NOT_FOUND
@@ -726,28 +596,28 @@ API changes, most recent first:
AVERROR_BSF_NOT_FOUND AVERROR_BSF_NOT_FOUND
AVERROR_STREAM_NOT_FOUND AVERROR_STREAM_NOT_FOUND
2010-12-09 - c61cdd0 - lavcore 0.16.0 - avcore.h 2010-12-09 - r25923 - lavcore 0.16.0 - avcore.h
Move AV_NOPTS_VALUE, AV_TIME_BASE, AV_TIME_BASE_Q symbols from Move AV_NOPTS_VALUE, AV_TIME_BASE, AV_TIME_BASE_Q symbols from
avcodec.h to avcore.h. avcodec.h to avcore.h.
2010-12-04 - 16cfc96 - lavc 52.98.0 - CODEC_CAP_NEG_LINESIZES 2010-12-04 - r25886 - lavc 52.98.0 - CODEC_CAP_NEG_LINESIZES
Add CODEC_CAP_NEG_LINESIZES codec capability flag in avcodec.h. Add CODEC_CAP_NEG_LINESIZES codec capability flag in avcodec.h.
2010-12-04 - bb4afa1 - lavu 50.34.0 - av_get_pix_fmt_string() 2010-12-04 - r25879 - lavu 50.34.0 - av_get_pix_fmt_string()
Deprecate avcodec_pix_fmt_string() in favor of Deprecate avcodec_pix_fmt_string() in favor of
pixdesc.h/av_get_pix_fmt_string(). pixdesc.h/av_get_pix_fmt_string().
2010-12-04 - 4da12e3 - lavcore 0.15.0 - av_image_alloc() 2010-12-04 - r25878 - lavcore 0.15.0 - av_image_alloc()
Add av_image_alloc() to libavcore/imgutils.h. Add av_image_alloc() to libavcore/imgutils.h.
2010-12-02 - 037be76 - lavfi 1.67.0 - avfilter_graph_create_filter() 2010-12-02 - r25862 - lavfi 1.67.0 - avfilter_graph_create_filter()
Add function avfilter_graph_create_filter() in avfiltergraph.h. Add function avfilter_graph_create_filter() in avfiltergraph.h.
2010-11-25 - 4723bc2 - lavfi 1.65.0 - avfilter_get_video_buffer_ref_from_arrays() 2010-11-25 - r25826 - lavfi 1.65.0 - avfilter_get_video_buffer_ref_from_arrays()
Add function avfilter_get_video_buffer_ref_from_arrays() in Add function avfilter_get_video_buffer_ref_from_arrays() in
avfilter.h. avfilter.h.
2010-11-21 - 176a615 - lavcore 0.14.0 - audioconvert.h 2010-11-21 - r25787 - lavcore 0.14.0 - audioconvert.h
Add a public audio channel API in audioconvert.h, and deprecate the Add a public audio channel API in audioconvert.h, and deprecate the
corresponding functions in libavcodec: corresponding functions in libavcodec:
avcodec_get_channel_name() avcodec_get_channel_name()
@@ -756,23 +626,23 @@ API changes, most recent first:
avcodec_channel_layout_num_channels() avcodec_channel_layout_num_channels()
and the CH_* macros defined in libavcodec/avcodec.h. and the CH_* macros defined in libavcodec/avcodec.h.
2010-11-21 - 6bfc268 - lavf 52.85.0 - avformat.h 2010-11-21 - r25777 - lavf 52.85.0 - avformat.h
Add av_append_packet(). Add av_append_packet().
2010-11-21 - a08d918 - lavc 52.97.0 - avcodec.h 2010-11-21 - r25776 - lavc 52.97.0 - avcodec.h
Add av_grow_packet(). Add av_grow_packet().
2010-11-17 - 0985e1a - lavcore 0.13.0 - parseutils.h 2010-11-17 - r25761 - lavcore 0.13.0 - parseutils.h
Add av_parse_color() declared in libavcore/parseutils.h. Add av_parse_color() declared in libavcore/parseutils.h.
2010-11-13 - cb2c971 - lavc 52.95.0 - AVCodecContext 2010-11-13 - r25745 - lavc 52.95.0 - AVCodecContext
Add AVCodecContext.subtitle_header and AVCodecContext.subtitle_header_size Add AVCodecContext.subtitle_header and AVCodecContext.subtitle_header_size
fields. fields.
2010-11-13 - 5aaea02 - lavfi 1.62.0 - avfiltergraph.h 2010-11-13 - r25740 - lavfi 1.62.0 - avfiltergraph.h
Make avfiltergraph.h public. Make avfiltergraph.h public.
2010-11-13 - 4fcbb2a - lavfi 1.61.0 - avfiltergraph.h 2010-11-13 - r25737 - lavfi 1.61.0 - avfiltergraph.h
Remove declarations from avfiltergraph.h for the functions: Remove declarations from avfiltergraph.h for the functions:
avfilter_graph_check_validity() avfilter_graph_check_validity()
avfilter_graph_config_links() avfilter_graph_config_links()
@@ -780,7 +650,7 @@ API changes, most recent first:
which are now internal. which are now internal.
Use avfilter_graph_config() instead. Use avfilter_graph_config() instead.
2010-11-08 - d2af720 - lavu 50.33.0 - eval.h 2010-11-08 - r25708 - lavu 50.33.0 - eval.h
Deprecate functions: Deprecate functions:
av_parse_and_eval_expr(), av_parse_and_eval_expr(),
av_parse_expr(), av_parse_expr(),
@@ -792,30 +662,30 @@ API changes, most recent first:
av_expr_eval(), av_expr_eval(),
av_expr_free(). av_expr_free().
2010-11-08 - 24de0ed - lavfi 1.59.0 - avfilter_free() 2010-11-08 - r25707 - lavfi 1.59.0 - avfilter_free()
Rename avfilter_destroy() to avfilter_free(). Rename avfilter_destroy() to avfilter_free().
This change breaks libavfilter API/ABI. This change breaks libavfilter API/ABI.
2010-11-07 - 1e80a0e - lavfi 1.58.0 - avfiltergraph.h 2010-11-07 - r25705 - lavfi 1.58.0 - avfiltergraph.h
Remove graphparser.h header, move AVFilterInOut and Remove graphparser.h header, move AVFilterInOut and
avfilter_graph_parse() declarations to libavfilter/avfiltergraph.h. avfilter_graph_parse() declarations to libavfilter/avfiltergraph.h.
2010-11-07 - 7313132 - lavfi 1.57.0 - AVFilterInOut 2010-11-07 - r25700 - lavfi 1.57.0 - AVFilterInOut
Rename field AVFilterInOut.filter to AVFilterInOut.filter_ctx. Rename field AVFilterInOut.filter to AVFilterInOut.filter_ctx.
This change breaks libavfilter API. This change breaks libavfilter API.
2010-11-04 - 97dd1e4 - lavfi 1.56.0 - avfilter_graph_free() 2010-11-04 - r25674 - lavfi 1.56.0 - avfilter_graph_free()
Rename avfilter_graph_destroy() to avfilter_graph_free(). Rename avfilter_graph_destroy() to avfilter_graph_free().
This change breaks libavfilter API/ABI. This change breaks libavfilter API/ABI.
2010-11-04 - e15aeea - lavfi 1.55.0 - avfilter_graph_alloc() 2010-11-04 - r25673 - lavfi 1.55.0 - avfilter_graph_alloc()
Add avfilter_graph_alloc() to libavfilter/avfiltergraph.h. Add avfilter_graph_alloc() to libavfilter/avfiltergraph.h.
2010-11-02 - 6f84cd1 - lavcore 0.12.0 - av_get_bits_per_sample_fmt() 2010-11-02 - r25654 - lavcore 0.12.0 - av_get_bits_per_sample_fmt()
Add av_get_bits_per_sample_fmt() to libavcore/samplefmt.h and Add av_get_bits_per_sample_fmt() to libavcore/samplefmt.h and
deprecate av_get_bits_per_sample_format(). deprecate av_get_bits_per_sample_format().
2010-11-02 - d63e456 - lavcore 0.11.0 - samplefmt.h 2010-11-02 - r25653 - lavcore 0.11.0 - samplefmt.h
Add sample format functions in libavcore/samplefmt.h: Add sample format functions in libavcore/samplefmt.h:
av_get_sample_fmt_name(), av_get_sample_fmt_name(),
av_get_sample_fmt(), av_get_sample_fmt(),
@@ -825,149 +695,149 @@ API changes, most recent first:
avcodec_get_sample_fmt(), avcodec_get_sample_fmt(),
avcodec_sample_fmt_string(). avcodec_sample_fmt_string().
2010-11-02 - 262d1c5 - lavcore 0.10.0 - samplefmt.h 2010-11-02 - r25652 - lavcore 0.10.0 - samplefmt.h
Define enum AVSampleFormat in libavcore/samplefmt.h, deprecate enum Define enum AVSampleFormat in libavcore/samplefmt.h, deprecate enum
SampleFormat. SampleFormat.
2010-10-16 - 2a24df9 - lavfi 1.52.0 - avfilter_graph_config() 2010-10-16 - r25502 - lavfi 1.52.0 - avfilter_graph_config()
Add the function avfilter_graph_config() in avfiltergraph.h. Add the function avfilter_graph_config() in avfiltergraph.h.
2010-10-15 - 03700d3 - lavf 52.83.0 - metadata API 2010-10-15 - r25493 - lavf 52.83.0 - metadata API
Change demuxers to export metadata in generic format and Change demuxers to export metadata in generic format and
muxers to accept generic format. Deprecate the public muxers to accept generic format. Deprecate the public
conversion API. conversion API.
2010-10-10 - 867ae7a - lavfi 1.49.0 - AVFilterLink.time_base 2010-10-10 - r25441 - lavfi 1.49.0 - AVFilterLink.time_base
Add time_base field to AVFilterLink. Add time_base field to AVFilterLink.
2010-09-27 - c85eef4 - lavu 50.31.0 - av_set_options_string() 2010-09-27 - r25236 - lavu 50.31.0 - av_set_options_string()
Move av_set_options_string() from libavfilter/parseutils.h to Move av_set_options_string() from libavfilter/parseutils.h to
libavutil/opt.h. libavutil/opt.h.
2010-09-27 - acc0490 - lavfi 1.47.0 - AVFilterLink 2010-09-27 - r25227 - lavfi 1.47.0 - AVFilterLink
Make the AVFilterLink fields srcpad and dstpad store the pointers to Make the AVFilterLink fields srcpad and dstpad store the pointers to
the source and destination pads, rather than their indexes. the source and destination pads, rather than their indexes.
2010-09-27 - 372e288 - lavu 50.30.0 - av_get_token() 2010-09-27 - r25225 - lavu 50.30.0 - av_get_token()
Move av_get_token() from libavfilter/parseutils.h to Move av_get_token() from libavfilter/parseutils.h to
libavutil/avstring.h. libavutil/avstring.h.
2010-09-26 - 635d4ae - lsws 0.12.0 - swscale.h 2010-09-26 - r32368 - lsws 0.12.0 - swscale.h
Add the functions sws_alloc_context() and sws_init_context(). Add the functions sws_alloc_context() and sws_init_context().
2010-09-26 - 6ed0404 - lavu 50.29.0 - opt.h 2010-09-26 - r25210 - lavu 50.29.0 - opt.h
Move libavcodec/opt.h to libavutil/opt.h. Move libavcodec/opt.h to libavutil/opt.h.
2010-09-24 - 1c1c80f - lavu 50.28.0 - av_log_set_flags() 2010-09-24 - r25174 - lavu 50.28.0 - av_log_set_flags()
Default of av_log() changed due to many problems to the old no repeat Default of av_log() changed due to many problems to the old no repeat
detection. Read the docs of AV_LOG_SKIP_REPEATED in log.h before detection. Read the docs of AV_LOG_SKIP_REPEATED in log.h before
enabling it for your app!. enabling it for your app!.
2010-09-24 - f66eb58 - lavc 52.90.0 - av_opt_show2() 2010-09-24 - r25167 - lavc 52.90.0 - av_opt_show2()
Deprecate av_opt_show() in favor or av_opt_show2(). Deprecate av_opt_show() in favor or av_opt_show2().
2010-09-14 - bc6f0af - lavu 50.27.0 - av_popcount() 2010-09-14 - r25120 - lavu 50.27.0 - av_popcount()
Add av_popcount() to libavutil/common.h. Add av_popcount() to libavutil/common.h.
2010-09-08 - c6c98d0 - lavu 50.26.0 - av_get_cpu_flags() 2010-09-08 - r25076 - lavu 50.26.0 - av_get_cpu_flags()
Add av_get_cpu_flags(). Add av_get_cpu_flags().
2010-09-07 - 34017fd - lavcore 0.9.0 - av_image_copy() 2010-09-07 - r25067 - lavcore 0.9.0 - av_image_copy()
Add av_image_copy(). Add av_image_copy().
2010-09-07 - 9686abb - lavcore 0.8.0 - av_image_copy_plane() 2010-09-07 - r25064 - lavcore 0.8.0 - av_image_copy_plane()
Add av_image_copy_plane(). Add av_image_copy_plane().
2010-09-07 - 9b7269e - lavcore 0.7.0 - imgutils.h 2010-09-07 - r25057 - lavcore 0.7.0 - imgutils.h
Adopt hierarchical scheme for the imgutils.h function names, Adopt hierarchical scheme for the imgutils.h function names,
deprecate the old names. deprecate the old names.
2010-09-04 - 7160bb7 - lavu 50.25.0 - AV_CPU_FLAG_* 2010-09-04 - r25040 - lavu 50.25.0 - AV_CPU_FLAG_*
Deprecate the FF_MM_* flags defined in libavcodec/avcodec.h in favor Deprecate the FF_MM_* flags defined in libavcodec/avcodec.h in favor
of the AV_CPU_FLAG_* flags defined in libavutil/cpu.h. of the AV_CPU_FLAG_* flags defined in libavutil/cpu.h.
2010-08-26 - 5da19b5 - lavc 52.87.0 - avcodec_get_channel_layout() 2010-08-26 - r24936 - lavc 52.87.0 - avcodec_get_channel_layout()
Add avcodec_get_channel_layout() in audioconvert.h. Add avcodec_get_channel_layout() in audioconvert.h.
2010-08-20 - e344336 - lavcore 0.6.0 - av_fill_image_max_pixsteps() 2010-08-20 - r24851 - lavcore 0.6.0 - av_fill_image_max_pixsteps()
Rename av_fill_image_max_pixstep() to av_fill_image_max_pixsteps(). Rename av_fill_image_max_pixstep() to av_fill_image_max_pixsteps().
2010-08-18 - a6ddf8b - lavcore 0.5.0 - av_fill_image_max_pixstep() 2010-08-18 - r24827 - lavcore 0.5.0 - av_fill_image_max_pixstep()
Add av_fill_image_max_pixstep() in imgutils.h. Add av_fill_image_max_pixstep() in imgutils.h.
2010-08-17 - 4f2d2e4 - lavu 50.24.0 - AV_NE() 2010-08-17 - r24814 - lavu 50.24.0 - AV_NE()
Add the AV_NE macro. Add the AV_NE macro.
2010-08-17 - ad2c950 - lavfi 1.36.0 - audio framework 2010-08-17 - r24811 - lavfi 1.36.0 - audio framework
Implement AVFilterBufferRefAudioProps struct for audio properties, Implement AVFilterBufferRefAudioProps struct for audio properties,
get_audio_buffer(), filter_samples() functions and related changes. get_audio_buffer(), filter_samples() functions and related changes.
2010-08-12 - 81c1eca - lavcore 0.4.0 - av_get_image_linesize() 2010-08-12 - r24787 - lavcore 0.4.0 - av_get_image_linesize()
Add av_get_image_linesize() in imgutils.h. Add av_get_image_linesize() in imgutils.h.
2010-08-11 - c1db7bf - lavfi 1.34.0 - AVFilterBufferRef 2010-08-11 - r24773 - lavfi 1.34.0 - AVFilterBufferRef
Resize data and linesize arrays in AVFilterBufferRef to 8. Resize data and linesize arrays in AVFilterBufferRef to 8.
This change breaks libavfilter API/ABI. This change breaks libavfilter API/ABI.
2010-08-11 - 9f08d80 - lavc 52.85.0 - av_picture_data_copy() 2010-08-11 - r24768 - lavc 52.85.0 - av_picture_data_copy()
Add av_picture_data_copy in avcodec.h. Add av_picture_data_copy in avcodec.h.
2010-08-11 - 84c0386 - lavfi 1.33.0 - avfilter_open() 2010-08-11 - r24765 - lavfi 1.33.0 - avfilter_open()
Change avfilter_open() signature: Change avfilter_open() signature:
AVFilterContext *avfilter_open(AVFilter *filter, const char *inst_name) -> AVFilterContext *avfilter_open(AVFilter *filter, const char *inst_name) ->
int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name); int avfilter_open(AVFilterContext **filter_ctx, AVFilter *filter, const char *inst_name);
This change breaks libavfilter API/ABI. This change breaks libavfilter API/ABI.
2010-08-11 - cc80caf - lavfi 1.32.0 - AVFilterBufferRef 2010-08-11 - r24763 - lavfi 1.32.0 - AVFilterBufferRef
Add a type field to AVFilterBufferRef, and move video specific Add a type field to AVFilterBufferRef, and move video specific
properties to AVFilterBufferRefVideoProps. properties to AVFilterBufferRefVideoProps.
This change breaks libavfilter API/ABI. This change breaks libavfilter API/ABI.
2010-08-07 - 5d4890d - lavfi 1.31.0 - AVFilterLink 2010-08-07 - r24732 - lavfi 1.31.0 - AVFilterLink
Rename AVFilterLink fields: Rename AVFilterLink fields:
AVFilterLink.srcpic -> AVFilterLink.src_buf AVFilterLink.srcpic -> AVFilterLink.src_buf
AVFilterLink.cur_pic -> AVFilterLink.cur_buf AVFilterLink.cur_pic -> AVFilterLink.cur_buf
AVFilterLink.outpic -> AVFilterLink.out_buf AVFilterLink.outpic -> AVFilterLink.out_buf
2010-08-07 - 7fce481 - lavfi 1.30.0 2010-08-07 - r24731 - lavfi 1.30.0
Rename functions and fields: Rename functions and fields:
avfilter_(un)ref_pic -> avfilter_(un)ref_buffer avfilter_(un)ref_pic -> avfilter_(un)ref_buffer
avfilter_copy_picref_props -> avfilter_copy_buffer_ref_props avfilter_copy_picref_props -> avfilter_copy_buffer_ref_props
AVFilterBufferRef.pic -> AVFilterBufferRef.buffer AVFilterBufferRef.pic -> AVFilterBufferRef.buffer
2010-08-07 - ecc8dad - lavfi 1.29.0 - AVFilterBufferRef 2010-08-07 - r24730 - lavfi 1.29.0 - AVFilterBufferRef
Rename AVFilterPicRef to AVFilterBufferRef. Rename AVFilterPicRef to AVFilterBufferRef.
2010-08-07 - d54e094 - lavfi 1.28.0 - AVFilterBuffer 2010-08-07 - r24728 - lavfi 1.28.0 - AVFilterBuffer
Move format field from AVFilterBuffer to AVFilterPicRef. Move format field from AVFilterBuffer to AVFilterPicRef.
2010-08-06 - bf176f5 - lavcore 0.3.0 - av_check_image_size() 2010-08-06 - r24709 - lavcore 0.3.0 - av_check_image_size()
Deprecate avcodec_check_dimensions() in favor of the function Deprecate avcodec_check_dimensions() in favor of the function
av_check_image_size() defined in libavcore/imgutils.h. av_check_image_size() defined in libavcore/imgutils.h.
2010-07-30 - 56b5e9d - lavfi 1.27.0 - AVFilterBuffer 2010-07-30 - r24592 - lavfi 1.27.0 - AVFilterBuffer
Increase size of the arrays AVFilterBuffer.data and Increase size of the arrays AVFilterBuffer.data and
AVFilterBuffer.linesize from 4 to 8. AVFilterBuffer.linesize from 4 to 8.
This change breaks libavfilter ABI. This change breaks libavfilter ABI.
2010-07-29 - e7bd48a - lavcore 0.2.0 - imgutils.h 2010-07-29 - r24583 - lavcore 0.2.0 - imgutils.h
Add functions av_fill_image_linesizes() and Add functions av_fill_image_linesizes() and
av_fill_image_pointers(), declared in libavcore/imgutils.h. av_fill_image_pointers(), declared in libavcore/imgutils.h.
2010-07-27 - 126b638 - lavcore 0.1.0 - parseutils.h 2010-07-27 - r24518 - lavcore 0.1.0 - parseutils.h
Deprecate av_parse_video_frame_size() and av_parse_video_frame_rate() Deprecate av_parse_video_frame_size() and av_parse_video_frame_rate()
defined in libavcodec in favor of the newly added functions defined in libavcodec in favor of the newly added functions
av_parse_video_size() and av_parse_video_rate() declared in av_parse_video_size() and av_parse_video_rate() declared in
libavcore/parseutils.h. libavcore/parseutils.h.
2010-07-23 - 4485247 - lavu 50.23.0 - mathematics.h 2010-07-23 - r24439 - lavu 50.23.0 - mathematics.h
Add the M_PHI constant definition. Add the M_PHI constant definition.
2010-07-22 - bdab614 - lavfi 1.26.0 - media format generalization 2010-07-22 - r24424 - lavfi 1.26.0 - media format generalization
Add a type field to AVFilterLink. Add a type field to AVFilterLink.
Change the field types: Change the field types:
@@ -987,235 +857,235 @@ API changes, most recent first:
This change breaks libavfilter API/ABI. This change breaks libavfilter API/ABI.
2010-07-21 - aac6ca6 - lavcore 0.0.0 2010-07-21 - r24393 - lavcore 0.0.0
Add libavcore. Add libavcore.
2010-07-17 - b5c582f - lavfi 1.25.0 - AVFilterBuffer 2010-07-17 - r24291 - lavfi 1.25.0 - AVFilterBuffer
Remove w and h fields from AVFilterBuffer. Remove w and h fields from AVFilterBuffer.
2010-07-17 - f0d77b2 - lavfi 1.24.0 - AVFilterBuffer 2010-07-17 - r24284 - lavfi 1.24.0 - AVFilterBuffer
Rename AVFilterPic to AVFilterBuffer. Rename AVFilterPic to AVFilterBuffer.
2010-07-17 - 57fe80f - lavf 52.74.0 - url_fskip() 2010-07-17 - r24278 - lavf 52.74.0 - url_fskip()
Make url_fskip() return an int error code instead of void. Make url_fskip() return an int error code instead of void.
2010-07-11 - 23940f1 - lavc 52.83.0 2010-07-11 - r24199 - lavc 52.83.0
Add AVCodecContext.lpc_type and AVCodecContext.lpc_passes fields. Add AVCodecContext.lpc_type and AVCodecContext.lpc_passes fields.
Add AVLPCType enum. Add AVLPCType enum.
Deprecate AVCodecContext.use_lpc. Deprecate AVCodecContext.use_lpc.
2010-07-11 - e1d7c88 - lavc 52.82.0 - avsubtitle_free() 2010-07-11 - r24185 - lavc 52.82.0 - avsubtitle_free()
Add a function for free the contents of a AVSubtitle generated by Add a function for free the contents of a AVSubtitle generated by
avcodec_decode_subtitle. avcodec_decode_subtitle.
2010-07-11 - b91d08f - lavu 50.22.0 - bswap.h and intreadwrite.h 2010-07-11 - r24174 - lavu 50.22.0 - bswap.h and intreadwrite.h
Make the bswap.h and intreadwrite.h API public. Make the bswap.h and intreadwrite.h API public.
2010-07-08 - ce1cd1c - lavu 50.21.0 - pixdesc.h 2010-07-08 - r24101 - lavu 50.21.0 - pixdesc.h
Rename read/write_line() to av_read/write_image_line(). Rename read/write_line() to av_read/write_image_line().
2010-07-07 - 4d508e4 - lavfi 1.21.0 - avfilter_copy_picref_props() 2010-07-07 - r24091 - lavfi 1.21.0 - avfilter_copy_picref_props()
Add avfilter_copy_picref_props(). Add avfilter_copy_picref_props().
2010-07-03 - 2d525ef - lavc 52.79.0 2010-07-03 - r24021 - lavc 52.79.0
Add FF_COMPLIANCE_UNOFFICIAL and change all instances of Add FF_COMPLIANCE_UNOFFICIAL and change all instances of
FF_COMPLIANCE_INOFFICIAL to use FF_COMPLIANCE_UNOFFICIAL. FF_COMPLIANCE_INOFFICIAL to use FF_COMPLIANCE_UNOFFICIAL.
2010-07-02 - 89eec74 - lavu 50.20.0 - lfg.h 2010-07-02 - r23985 - lavu 50.20.0 - lfg.h
Export av_lfg_init(), av_lfg_get(), av_mlfg_get(), and av_bmg_get() through Export av_lfg_init(), av_lfg_get(), av_mlfg_get(), and av_bmg_get() through
lfg.h. lfg.h.
2010-06-28 - a52e2c3 - lavfi 1.20.1 - av_parse_color() 2010-06-28 - r23835 - lavfi 1.20.1 - av_parse_color()
Extend av_parse_color() syntax, make it accept an alpha value specifier and Extend av_parse_color() syntax, make it accept an alpha value specifier and
set the alpha value to 255 by default. set the alpha value to 255 by default.
2010-06-22 - 735cf6b - lavf 52.71.0 - URLProtocol.priv_data_size, priv_data_class 2010-06-22 - r23706 - lavf 52.71.0 - URLProtocol.priv_data_size, priv_data_class
Add priv_data_size and priv_data_class to URLProtocol. Add priv_data_size and priv_data_class to URLProtocol.
2010-06-22 - ffbb289 - lavf 52.70.0 - url_alloc(), url_connect() 2010-06-22 - r23704 - lavf 52.70.0 - url_alloc(), url_connect()
Add url_alloc() and url_connect(). Add url_alloc() and url_connect().
2010-06-22 - 9b07a2d - lavf 52.69.0 - av_register_protocol2() 2010-06-22 - r23702 - lavf 52.69.0 - av_register_protocol2()
Add av_register_protocol2(), deprecating av_register_protocol(). Add av_register_protocol2(), deprecating av_register_protocol().
2010-06-09 - 65db058 - lavu 50.19.0 - av_compare_mod() 2010-06-09 - r23551 - lavu 50.19.0 - av_compare_mod()
Add av_compare_mod() to libavutil/mathematics.h. Add av_compare_mod() to libavutil/mathematics.h.
2010-06-05 - 0b99215 - lavu 50.18.0 - eval API 2010-06-05 - r23485 - lavu 50.18.0 - eval API
Make the eval API public. Make the eval API public.
2010-06-04 - 31878fc - lavu 50.17.0 - AV_BASE64_SIZE 2010-06-04 - r23461 - lavu 50.17.0 - AV_BASE64_SIZE
Add AV_BASE64_SIZE() macro. Add AV_BASE64_SIZE() macro.
2010-06-02 - 7e566bb - lavc 52.73.0 - av_get_codec_tag_string() 2010-06-02 - r23421 - lavc 52.73.0 - av_get_codec_tag_string()
Add av_get_codec_tag_string(). Add av_get_codec_tag_string().
2010-06-01 - 2b99142 - lsws 0.11.0 - convertPalette API 2010-06-01 - r31301 - lsws 0.11.0 - convertPalette API
Add sws_convertPalette8ToPacked32() and sws_convertPalette8ToPacked24(). Add sws_convertPalette8ToPacked32() and sws_convertPalette8ToPacked24().
2010-05-26 - 93ebfee - lavc 52.72.0 - CODEC_CAP_EXPERIMENTAL 2010-05-26 - r23334 - lavc 52.72.0 - CODEC_CAP_EXPERIMENTAL
Add CODEC_CAP_EXPERIMENTAL flag. Add CODEC_CAP_EXPERIMENTAL flag.
NOTE: this was backported to 0.6 NOTE: this was backported to 0.6
2010-05-23 - 9977863 - lavu 50.16.0 - av_get_random_seed() 2010-05-23 - r23255 - lavu 50.16.0 - av_get_random_seed()
Add av_get_random_seed(). Add av_get_random_seed().
2010-05-18 - 796ac23 - lavf 52.63.0 - AVFMT_FLAG_RTP_HINT 2010-05-18 - r23161 - lavf 52.63.0 - AVFMT_FLAG_RTP_HINT
Add AVFMT_FLAG_RTP_HINT as possible value for AVFormatContext.flags. Add AVFMT_FLAG_RTP_HINT as possible value for AVFormatContext.flags.
NOTE: this was backported to 0.6 NOTE: this was backported to 0.6
2010-05-09 - b6bc205 - lavfi 1.20.0 - AVFilterPicRef 2010-05-09 - r23066 - lavfi 1.20.0 - AVFilterPicRef
Add interlaced and top_field_first fields to AVFilterPicRef. Add interlaced and top_field_first fields to AVFilterPicRef.
------------------------------8<------------------------------------- ------------------------------8<-------------------------------------
0.6 branch was cut here 0.6 branch was cut here
----------------------------->8-------------------------------------- ----------------------------->8--------------------------------------
2010-05-01 - 8e2ee18 - lavf 52.62.0 - probe function 2010-05-01 - r23002 - lavf 52.62.0 - probe function
Add av_probe_input_format2 to API, it allows ignoring probe Add av_probe_input_format2 to API, it allows ignoring probe
results below given score and returns the actual probe score. results below given score and returns the actual probe score.
2010-04-01 - 3dd6180 - lavf 52.61.0 - metadata API 2010-04-01 - r22806 - lavf 52.61.0 - metadata API
Add a flag for av_metadata_set2() to disable overwriting of Add a flag for av_metadata_set2() to disable overwriting of
existing tags. existing tags.
2010-04-01 - 0fb49b5 - lavc 52.66.0 2010-04-01 - r22753 - lavc 52.66.0
Add avcodec_get_edge_width(). Add avcodec_get_edge_width().
2010-03-31 - d103218 - lavc 52.65.0 2010-03-31 - r22750 - lavc 52.65.0
Add avcodec_copy_context(). Add avcodec_copy_context().
2010-03-31 - 1a70d12 - lavf 52.60.0 - av_match_ext() 2010-03-31 - r22748 - lavf 52.60.0 - av_match_ext()
Make av_match_ext() public. Make av_match_ext() public.
2010-03-31 - 1149150 - lavu 50.14.0 - AVMediaType 2010-03-31 - r22736 - lavu 50.14.0 - AVMediaType
Move AVMediaType enum from libavcodec to libavutil. Move AVMediaType enum from libavcodec to libavutil.
2010-03-31 - 72415b2 - lavc 52.64.0 - AVMediaType 2010-03-31 - r22735 - lavc 52.64.0 - AVMediaType
Define AVMediaType enum, and use it instead of enum CodecType, which Define AVMediaType enum, and use it instead of enum CodecType, which
is deprecated and will be dropped at the next major bump. is deprecated and will be dropped at the next major bump.
2010-03-25 - 8795823 - lavu 50.13.0 - av_strerror() 2010-03-25 - r22684 - lavu 50.13.0 - av_strerror()
Implement av_strerror(). Implement av_strerror().
2010-03-23 - e1484eb - lavc 52.60.0 - av_dct_init() 2010-03-23 - r22649 - lavc 52.60.0 - av_dct_init()
Support DCT-I and DST-I. Support DCT-I and DST-I.
2010-03-15 - b8819c8 - lavf 52.56.0 - AVFormatContext.start_time_realtime 2010-03-15 - r22540 - lavf 52.56.0 - AVFormatContext.start_time_realtime
Add AVFormatContext.start_time_realtime field. Add AVFormatContext.start_time_realtime field.
2010-03-13 - 5bb5c1d - lavfi 1.18.0 - AVFilterPicRef.pos 2010-03-13 - r22506 - lavfi 1.18.0 - AVFilterPicRef.pos
Add AVFilterPicRef.pos field. Add AVFilterPicRef.pos field.
2010-03-13 - 60c144f - lavu 50.12.0 - error.h 2010-03-13 - r22501 - lavu 50.12.0 - error.h
Move error code definitions from libavcodec/avcodec.h to Move error code definitions from libavcodec/avcodec.h to
the new public header libavutil/error.h. the new public header libavutil/error.h.
2010-03-07 - c709483 - lavc 52.56.0 - avfft.h 2010-03-07 - r22291 - lavc 52.56.0 - avfft.h
Add public FFT interface. Add public FFT interface.
2010-03-06 - ac6ef86 - lavu 50.11.0 - av_stristr() 2010-03-06 - r22251 - lavu 50.11.0 - av_stristr()
Add av_stristr(). Add av_stristr().
2010-03-03 - 4b83fc0 - lavu 50.10.0 - av_tree_enumerate() 2010-03-03 - r22174 - lavu 50.10.0 - av_tree_enumerate()
Add av_tree_enumerate(). Add av_tree_enumerate().
2010-02-07 - b687c1a - lavu 50.9.0 - av_compare_ts() 2010-02-07 - r21673 - lavu 50.9.0 - av_compare_ts()
Add av_compare_ts(). Add av_compare_ts().
2010-02-05 - 3f3dc76 - lsws 0.10.0 - sws_getCoefficients() 2010-02-05 - r30513 - lsws 0.10.0 - sws_getCoefficients()
Add sws_getCoefficients(). Add sws_getCoefficients().
2010-02-01 - ca76a11 - lavf 52.50.0 - metadata API 2010-02-01 - r21587 - lavf 52.50.0 - metadata API
Add a list of generic tag names, change 'author' -> 'artist', Add a list of generic tag names, change 'author' -> 'artist',
'year' -> 'date'. 'year' -> 'date'.
2010-01-30 - 80a07f6 - lavu 50.8.0 - av_get_pix_fmt() 2010-01-30 - r21545 - lavu 50.8.0 - av_get_pix_fmt()
Add av_get_pix_fmt(). Add av_get_pix_fmt().
2010-01-21 - 01cc47d - lsws 0.9.0 - sws_scale() 2010-01-21 - r30381 - lsws 0.9.0 - sws_scale()
Change constness attributes of sws_scale() parameters. Change constness attributes of sws_scale() parameters.
2010-01-10 - 3fb8e77 - lavfi 1.15.0 - avfilter_graph_config_links() 2010-01-10 - r21121 - lavfi 1.15.0 - avfilter_graph_config_links()
Add a log_ctx parameter to avfilter_graph_config_links(). Add a log_ctx parameter to avfilter_graph_config_links().
2010-01-07 - 8e9767f - lsws 0.8.0 - sws_isSupported{In,Out}put() 2010-01-07 - r30236 - lsws 0.8.0 - sws_isSupported{In,Out}put()
Add sws_isSupportedInput() and sws_isSupportedOutput() functions. Add sws_isSupportedInput() and sws_isSupportedOutput() functions.
2010-01-06 - c1d662f - lavfi 1.14.0 - avfilter_add_colorspace() 2010-01-06 - r21035 - lavfi 1.14.0 - avfilter_add_colorspace()
Change the avfilter_add_colorspace() signature, make it accept an Change the avfilter_add_colorspace() signature, make it accept an
(AVFilterFormats **) rather than an (AVFilterFormats *) as before. (AVFilterFormats **) rather than an (AVFilterFormats *) as before.
2010-01-03 - 4fd1f18 - lavfi 1.13.0 - avfilter_add_colorspace() 2010-01-03 - r21007 - lavfi 1.13.0 - avfilter_add_colorspace()
Add avfilter_add_colorspace(). Add avfilter_add_colorspace().
2010-01-02 - 8eb631f - lavf 52.46.0 - av_match_ext() 2010-01-02 - r20998 - lavf 52.46.0 - av_match_ext()
Add av_match_ext(), it should be used in place of match_ext(). Add av_match_ext(), it should be used in place of match_ext().
2010-01-01 - a1f547b - lavf 52.45.0 - av_guess_format() 2010-01-01 - r20991 - lavf 52.45.0 - av_guess_format()
Add av_guess_format(), it should be used in place of guess_format(). Add av_guess_format(), it should be used in place of guess_format().
2009-12-13 - a181981 - lavf 52.43.0 - metadata API 2009-12-13 - r20834 - lavf 52.43.0 - metadata API
Add av_metadata_set2(), AV_METADATA_DONT_STRDUP_KEY and Add av_metadata_set2(), AV_METADATA_DONT_STRDUP_KEY and
AV_METADATA_DONT_STRDUP_VAL. AV_METADATA_DONT_STRDUP_VAL.
2009-12-13 - 277c733 - lavu 50.7.0 - avstring.h API 2009-12-13 - r20829 - lavu 50.7.0 - avstring.h API
Add av_d2str(). Add av_d2str().
2009-12-13 - 02b398e - lavc 52.42.0 - AVStream 2009-12-13 - r20826 - lavc 52.42.0 - AVStream
Add avg_frame_rate. Add avg_frame_rate.
2009-12-12 - 3ba69a1 - lavu 50.6.0 - av_bmg_next() 2009-12-12 - r20808 - lavu 50.6.0 - av_bmg_next()
Introduce the av_bmg_next() function. Introduce the av_bmg_next() function.
2009-12-05 - a13a543 - lavfi 1.12.0 - avfilter_draw_slice() 2009-12-05 - r20734 - lavfi 1.12.0 - avfilter_draw_slice()
Add a slice_dir parameter to avfilter_draw_slice(). Add a slice_dir parameter to avfilter_draw_slice().
2009-11-26 - 4cc3f6a - lavfi 1.11.0 - AVFilter 2009-11-26 - r20611 - lavfi 1.11.0 - AVFilter
Remove the next field from AVFilter, this is not anymore required. Remove the next field from AVFilter, this is not anymore required.
2009-11-25 - 1433c4a - lavfi 1.10.0 - avfilter_next() 2009-11-25 - r20607 - lavfi 1.10.0 - avfilter_next()
Introduce the avfilter_next() function. Introduce the avfilter_next() function.
2009-11-25 - 86a60fa - lavfi 1.9.0 - avfilter_register() 2009-11-25 - r20605 - lavfi 1.9.0 - avfilter_register()
Change the signature of avfilter_register() to make it return an Change the signature of avfilter_register() to make it return an
int. This is required since now the registration operation may fail. int. This is required since now the registration operation may fail.
2009-11-25 - 74a0059 - lavu 50.5.0 - pixdesc.h API 2009-11-25 - r20603 - lavu 50.5.0 - pixdesc.h API
Make the pixdesc.h API public. Make the pixdesc.h API public.
2009-10-27 - 243110f - lavfi 1.5.0 - AVFilter.next 2009-10-27 - r20385 - lavfi 1.5.0 - AVFilter.next
Add a next field to AVFilter, this is used for simplifying the Add a next field to AVFilter, this is used for simplifying the
registration and management of the registered filters. registration and management of the registered filters.
2009-10-23 - cccd292 - lavfi 1.4.1 - AVFilter.description 2009-10-23 - r20356 - lavfi 1.4.1 - AVFilter.description
Add a description field to AVFilter. Add a description field to AVFilter.
2009-10-19 - 6b5dc05 - lavfi 1.3.0 - avfilter_make_format_list() 2009-10-19 - r20302 - lavfi 1.3.0 - avfilter_make_format_list()
Change the interface of avfilter_make_format_list() from Change the interface of avfilter_make_format_list() from
avfilter_make_format_list(int n, ...) to avfilter_make_format_list(int n, ...) to
avfilter_make_format_list(enum PixelFormat *pix_fmts). avfilter_make_format_list(enum PixelFormat *pix_fmts).
2009-10-18 - 0eb4ff9 - lavfi 1.0.0 - avfilter_get_video_buffer() 2009-10-18 - r20272 - lavfi 1.0.0 - avfilter_get_video_buffer()
Make avfilter_get_video_buffer() recursive and add the w and h Make avfilter_get_video_buffer() recursive and add the w and h
parameters to it. parameters to it.
2009-10-07 - 46c40e4 - lavfi 0.5.1 - AVFilterPic 2009-10-07 - r20189 - lavfi 0.5.1 - AVFilterPic
Add w and h fields to AVFilterPic. Add w and h fields to AVFilterPic.
2009-06-22 - 92400be - lavf 52.34.1 - AVFormatContext.packet_size 2009-06-22 - r19250 - lavf 52.34.1 - AVFormatContext.packet_size
This is now an unsigned int instead of a signed int. This is now an unsigned int instead of a signed int.
2009-06-19 - a4276ba - lavc 52.32.0 - AVSubtitle.pts 2009-06-19 - r19222 - lavc 52.32.0 - AVSubtitle.pts
Add a pts field to AVSubtitle which gives the subtitle packet pts Add a pts field to AVSubtitle which gives the subtitle packet pts
in AV_TIME_BASE. Some subtitle de-/encoders (e.g. XSUB) will in AV_TIME_BASE. Some subtitle de-/encoders (e.g. XSUB) will
not work right without this. not work right without this.
2009-06-03 - 8f3f2e0 - lavc 52.30.2 - AV_PKT_FLAG_KEY 2009-06-03 - r19078 - lavc 52.30.2 - AV_PKT_FLAG_KEY
PKT_FLAG_KEY has been deprecated and will be dropped at the next PKT_FLAG_KEY has been deprecated and will be dropped at the next
major version. Use AV_PKT_FLAG_KEY instead. major version. Use AV_PKT_FLAG_KEY instead.
2009-06-01 - f988ce6 - lavc 52.30.0 - av_lockmgr_register() 2009-06-01 - r19025 - lavc 52.30.0 - av_lockmgr_register()
av_lockmgr_register() can be used to register a callback function av_lockmgr_register() can be used to register a callback function
that lavc (and in the future, libraries that depend on lavc) can use that lavc (and in the future, libraries that depend on lavc) can use
to implement mutexes. The application should provide a callback function to implement mutexes. The application should provide a callback function
@@ -1223,27 +1093,27 @@ API changes, most recent first:
When the lock manager is registered, FFmpeg is guaranteed to behave When the lock manager is registered, FFmpeg is guaranteed to behave
correctly in a multi-threaded application. correctly in a multi-threaded application.
2009-04-30 - ce1d9c8 - lavc 52.28.0 - av_free_packet() 2009-04-30 - r18719 - lavc 52.28.0 - av_free_packet()
av_free_packet() is no longer an inline function. It is now exported. av_free_packet() is no longer an inline function. It is now exported.
2009-04-11 - 80d403f - lavc 52.25.0 - deprecate av_destruct_packet_nofree() 2009-04-11 - r18431 - lavc 52.25.0 - deprecate av_destruct_packet_nofree()
Please use NULL instead. This has been supported since r16506 Please use NULL instead. This has been supported since r16506
(lavf > 52.23.1, lavc > 52.10.0). (lavf > 52.23.1, lavc > 52.10.0).
2009-04-07 - 7a00bba - lavc 52.23.0 - avcodec_decode_video/audio/subtitle 2009-04-07 - r18351 - lavc 52.23.0 - avcodec_decode_video/audio/subtitle
The old decoding functions are deprecated, all new code should use the The old decoding functions are deprecated, all new code should use the
new functions avcodec_decode_video2(), avcodec_decode_audio3() and new functions avcodec_decode_video2(), avcodec_decode_audio3() and
avcodec_decode_subtitle2(). These new functions take an AVPacket *pkt avcodec_decode_subtitle2(). These new functions take an AVPacket *pkt
argument instead of a const uint8_t *buf / int buf_size pair. argument instead of a const uint8_t *buf / int buf_size pair.
2009-04-03 - 7b09db3 - lavu 50.3.0 - av_fifo_space() 2009-04-03 - r18321 - lavu 50.3.0 - av_fifo_space()
Introduce the av_fifo_space() function. Introduce the av_fifo_space() function.
2009-04-02 - fabd246 - lavc 52.23.0 - AVPacket 2009-04-02 - r18317 - lavc 52.23.0 - AVPacket
Move AVPacket declaration from libavformat/avformat.h to Move AVPacket declaration from libavformat/avformat.h to
libavcodec/avcodec.h. libavcodec/avcodec.h.
2009-03-22 - 6e08ca9 - lavu 50.2.0 - RGB32 pixel formats 2009-03-22 - r18163 - lavu 50.2.0 - RGB32 pixel formats
Convert the pixel formats PIX_FMT_ARGB, PIX_FMT_RGBA, PIX_FMT_ABGR, Convert the pixel formats PIX_FMT_ARGB, PIX_FMT_RGBA, PIX_FMT_ABGR,
PIX_FMT_BGRA, which were defined as macros, into enum PixelFormat values. PIX_FMT_BGRA, which were defined as macros, into enum PixelFormat values.
Conversely PIX_FMT_RGB32, PIX_FMT_RGB32_1, PIX_FMT_BGR32 and Conversely PIX_FMT_RGB32, PIX_FMT_RGB32_1, PIX_FMT_BGR32 and
@@ -1252,17 +1122,17 @@ API changes, most recent first:
Re-sort the enum PixelFormat list accordingly. Re-sort the enum PixelFormat list accordingly.
This change breaks API/ABI backward compatibility. This change breaks API/ABI backward compatibility.
2009-03-22 - f82674e - lavu 50.1.0 - PIX_FMT_RGB5X5 endian variants 2009-03-22 - r18133 - lavu 50.1.0 - PIX_FMT_RGB5X5 endian variants
Add the enum PixelFormat values: Add the enum PixelFormat values:
PIX_FMT_RGB565BE, PIX_FMT_RGB565LE, PIX_FMT_RGB555BE, PIX_FMT_RGB555LE, PIX_FMT_RGB565BE, PIX_FMT_RGB565LE, PIX_FMT_RGB555BE, PIX_FMT_RGB555LE,
PIX_FMT_BGR565BE, PIX_FMT_BGR565LE, PIX_FMT_BGR555BE, PIX_FMT_BGR555LE. PIX_FMT_BGR565BE, PIX_FMT_BGR565LE, PIX_FMT_BGR555BE, PIX_FMT_BGR555LE.
2009-03-21 - ee6624e - lavu 50.0.0 - av_random* 2009-03-21 - r18116 - lavu 50.0.0 - av_random*
The Mersenne Twister PRNG implemented through the av_random* functions The Mersenne Twister PRNG implemented through the av_random* functions
was removed. Use the lagged Fibonacci PRNG through the av_lfg* functions was removed. Use the lagged Fibonacci PRNG through the av_lfg* functions
instead. instead.
2009-03-08 - 41dd680 - lavu 50.0.0 - AVFifoBuffer 2009-03-08 - r17869 - lavu 50.0.0 - AVFifoBuffer
av_fifo_init, av_fifo_read, av_fifo_write and av_fifo_realloc were dropped av_fifo_init, av_fifo_read, av_fifo_write and av_fifo_realloc were dropped
and replaced by av_fifo_alloc, av_fifo_generic_read, av_fifo_generic_write and replaced by av_fifo_alloc, av_fifo_generic_read, av_fifo_generic_write
and av_fifo_realloc2. and av_fifo_realloc2.
@@ -1271,7 +1141,7 @@ API changes, most recent first:
The AVFifoBuffer/struct AVFifoBuffer may only be used in an opaque way by The AVFifoBuffer/struct AVFifoBuffer may only be used in an opaque way by
applications, they may not use sizeof() or directly access members. applications, they may not use sizeof() or directly access members.
2009-03-01 - ec26457 - lavf 52.31.0 - Generic metadata API 2009-03-01 - r17682 - lavf 52.31.0 - Generic metadata API
Introduce a new metadata API (see av_metadata_get() and friends). Introduce a new metadata API (see av_metadata_get() and friends).
The old API is now deprecated and should not be used anymore. This especially The old API is now deprecated and should not be used anymore. This especially
includes the following structure fields: includes the following structure fields:

View File

@@ -8,7 +8,6 @@ HTMLPAGES = $(PROGS-yes:%=doc/%.html) \
doc/git-howto.html \ doc/git-howto.html \
doc/libavfilter.html \ doc/libavfilter.html \
doc/platform.html \ doc/platform.html \
doc/syntax.html \
TXTPAGES = doc/fate.txt \ TXTPAGES = doc/fate.txt \
@@ -29,30 +28,22 @@ doc/%.txt: doc/%.texi
$(Q)$(TEXIDEP) $(Q)$(TEXIDEP)
$(M)makeinfo --force --no-headers -o $@ $< 2>/dev/null $(M)makeinfo --force --no-headers -o $@ $< 2>/dev/null
doc/print_options.o: libavformat/options_table.h libavcodec/options_table.h
GENTEXI = format codec
GENTEXI := $(GENTEXI:%=doc/avoptions_%.texi)
$(GENTEXI): TAG = GENTEXI
$(GENTEXI): doc/avoptions_%.texi: doc/print_options$(HOSTEXESUF)
$(M)doc/print_options $* > $@
doc/%.html: TAG = HTML doc/%.html: TAG = HTML
doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.init $(GENTEXI) doc/%.html: doc/%.texi $(SRC_PATH)/doc/t2h.init
$(Q)$(TEXIDEP) $(Q)$(TEXIDEP)
$(M)texi2html -I doc -monolithic --init-file $(SRC_PATH)/doc/t2h.init --output $@ $< $(M)texi2html -monolithic --init-file $(SRC_PATH)/doc/t2h.init --output $@ $<
doc/%.pod: TAG = POD doc/%.pod: TAG = POD
doc/%.pod: doc/%.texi $(GENTEXI) doc/%.pod: doc/%.texi
$(Q)$(TEXIDEP) $(Q)$(TEXIDEP)
$(M)$(SRC_PATH)/doc/texi2pod.pl -Idoc $< $@ $(M)$(SRC_PATH)/doc/texi2pod.pl $< $@
doc/%.1: TAG = MAN doc/%.1: TAG = MAN
doc/%.1: doc/%.pod $(GENTEXI) doc/%.1: doc/%.pod
$(M)pod2man --section=1 --center=" " --release=" " $< > $@ $(M)pod2man --section=1 --center=" " --release=" " $< > $@
$(DOCS): | doc/ $(DOCS): | doc
OBJDIRS += doc
install-progs-$(CONFIG_DOC): install-man install-progs-$(CONFIG_DOC): install-man
@@ -66,7 +57,7 @@ uninstall-man:
$(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES)) $(RM) $(addprefix "$(MANDIR)/man1/",$(ALLMANPAGES))
clean:: clean::
$(RM) $(TXTPAGES) doc/*.html doc/*.pod doc/*.1 $(CLEANSUFFIXES:%=doc/%) doc/avoptions_*.texi $(RM) $(TXTPAGES) doc/*.html doc/*.pod doc/*.1 $(CLEANSUFFIXES:%=doc/%)
-include $(wildcard $(DOCS:%=%.d)) -include $(wildcard $(DOCS:%=%.d))

View File

@@ -1,11 +1,13 @@
Release Notes Release Notes
============= =============
* 0.11 "Happiness" May, 2012 * 0.10 "Freedom" January, 2012
General notes General notes
------------- -------------
This release is binary compatible with 0.8 and 0.9.
See the Changelog file for a list of significant changes. Note, there See the Changelog file for a list of significant changes. Note, there
are many more new features and bugfixes than whats listed there. are many more new features and bugfixes than whats listed there.
@@ -14,3 +16,34 @@ accepted. If you are experiencing issues with any formally released version of
FFmpeg, please try git master to check if the issue still exists. If it does, FFmpeg, please try git master to check if the issue still exists. If it does,
make your report against the development code following the usual bug reporting make your report against the development code following the usual bug reporting
guidelines. guidelines.
API changes
-----------
A number of additional APIs have been introduced and some existing
functions have been deprecated and are scheduled for removal in the next
release. Significant API changes include:
* new audio decoding API which decodes from an AVPacket to an AVFrame and
is able to use AVCodecContext.get_buffer() in the similar way as video decoding.
* new audio encoding API which encodes from an AVFrame to an AVPacket, thus
allowing it to properly output timing information and side data.
Please see the git history and the file doc/APIchanges for details.
Other notable changes
---------------------
Libavcodec and libavformat built as shared libraries now hide non-public
symbols. This will break applications using those symbols. Possible solutions
are, in order of preference:
1) Try finding a way of accomplishing the same with public API.
2) If there is no corresponding public API, but you think there should be,
post a request on the developer mailing list or IRC channel.
3) Finally if your program needs access to FFmpeg / libavcodec / libavformat
internals for some special reason then the best solution is to link statically.
Please see the Changelog file and git history for a more detailed list of changes.

View File

@@ -41,8 +41,6 @@ streams of this type.
@item p:@var{program_id}[:@var{stream_index}] @item p:@var{program_id}[:@var{stream_index}]
If @var{stream_index} is given, then matches stream number @var{stream_index} in If @var{stream_index} is given, then matches stream number @var{stream_index} in
program with id @var{program_id}. Otherwise matches all streams in this program. program with id @var{program_id}. Otherwise matches all streams in this program.
@item #@var{stream_id}
Matches the stream by format-specific ID.
@end table @end table
@section Generic options @section Generic options
@@ -136,15 +134,6 @@ It also implies @code{-loglevel verbose}.
Note: setting the environment variable @code{FFREPORT} to any value has the Note: setting the environment variable @code{FFREPORT} to any value has the
same effect. same effect.
@item -cpuflags flags (@emph{global})
Allows setting and clearing cpu flags. This option is intended
for testing. Do not use it unless you know what you're doing.
@example
ffmpeg -cpuflags -sse+mmx ...
ffmpeg -cpuflags mmx ...
ffmpeg -cpuflags 0 ...
@end example
@end table @end table
@section AVOptions @section AVOptions
@@ -177,6 +166,3 @@ use @option{-option 0}/@option{-option 1}.
Note2 old undocumented way of specifying per-stream AVOptions by prepending Note2 old undocumented way of specifying per-stream AVOptions by prepending
v/a/s to the options name is now obsolete and will be removed soon. v/a/s to the options name is now obsolete and will be removed soon.
@include avoptions_codec.texi
@include avoptions_format.texi

View File

@@ -71,7 +71,7 @@ stream (carrying the AVI1 header ID and lacking a DHT segment) to
produce fully qualified JPEG images. produce fully qualified JPEG images.
@example @example
ffmpeg -i mjpeg-movie.avi -c:v copy -bsf:v mjpeg2jpeg frame_%d.jpg ffmpeg -i mjpeg-movie.avi -c:v copy -vbsf mjpeg2jpeg frame_%d.jpg
exiftran -i -9 frame*.jpg exiftran -i -9 frame*.jpg
ffmpeg -i frame_%d.jpg -c:v copy rotated.avi ffmpeg -i frame_%d.jpg -c:v copy rotated.avi
@end example @end example

View File

@@ -60,67 +60,4 @@ This decoder generates wave patterns according to predefined sequences. Its
use is purely internal and the format of the data it accepts is not publicly use is purely internal and the format of the data it accepts is not publicly
documented. documented.
@section libcelt
libcelt decoder wrapper
libcelt allows libavcodec to decode the Xiph CELT ultra-low delay audio codec.
Requires the presence of the libcelt headers and library during configuration.
You need to explicitly configure the build with @code{--enable-libcelt}.
@section libgsm
libgsm decoder wrapper
libgsm allows libavcodec to decode the GSM full rate audio codec. Requires
the presence of the libgsm headers and library during configuration. You need
to explicitly configure the build with @code{--enable-libgsm}.
This decoder supports both the ordinary GSM and the Microsoft variant.
@section libilbc
libilbc decoder wrapper
libilbc allows libavcodec to decode the Internet Low Bitrate Codec (iLBC)
audio codec. Requires the presence of the libilbc headers and library during
configuration. You need to explicitly configure the build with
@code{--enable-libilbc}.
@subsection Options
The following option is supported by the libilbc wrapper.
@table @option
@item enhance
Enable the enhancement of the decoded audio when set to 1. The default
value is 0 (disabled).
@end table
@section libopencore-amrnb
libopencore-amrnb decoder wrapper
libopencore-amrnb allows libavcodec to decode the Adaptive Multi-Rate
Narrowband audio codec. Using it requires the presence of the
libopencore-amrnb headers and library during configuration. You need to
explicitly configure the build with @code{--enable-libopencore-amrnb}.
An FFmpeg native decoder for AMR-NB exists, so users can decode AMR-NB
without this library.
@section libopencore-amrwb
libopencore-amrwb decoder wrapper.
libopencore-amrwb allows libavcodec to decode the Adaptive Multi-Rate
Wideband audio codec. Using it requires the presence of the
libopencore-amrwb headers and library during configuration. You need to
explicitly configure the build with @code{--enable-libopencore-amrwb}.
An FFmpeg native decoder for AMR-WB exists, so users can decode AMR-WB
without this library.
@c man end AUDIO DECODERS @c man end AUDIO DECODERS

View File

@@ -14,13 +14,12 @@
@section API @section API
@itemize @bullet @itemize @bullet
@item libavcodec is the library containing the codecs (both encoding and @item libavcodec is the library containing the codecs (both encoding and
decoding). Look at @file{doc/examples/decoding_encoding.c} to see how to use decoding). Look at @file{libavcodec/apiexample.c} to see how to use it.
it.
@item libavformat is the library containing the file format handling (mux and @item libavformat is the library containing the file format handling (mux and
demux code for several formats). Look at @file{ffplay.c} to use it in a demux code for several formats). Look at @file{ffplay.c} to use it in a
player. See @file{doc/examples/muxing.c} to use it to generate audio or video player. See @file{libavformat/output-example.c} to use it to generate
streams. audio or video streams.
@end itemize @end itemize
@@ -188,10 +187,8 @@ the following snippet into your @file{.vimrc}:
set expandtab set expandtab
set shiftwidth=4 set shiftwidth=4
set softtabstop=4 set softtabstop=4
set cindent " Allow tabs in Makefiles.
set cinoptions=(0 autocmd FileType make,automake set noexpandtab shiftwidth=8 softtabstop=8
" allow tabs in Makefiles
autocmd FileType make set noexpandtab shiftwidth=8 softtabstop=8
" Trailing whitespace and tabs are forbidden, so highlight them. " Trailing whitespace and tabs are forbidden, so highlight them.
highlight ForbiddenWhitespace ctermbg=red guibg=red highlight ForbiddenWhitespace ctermbg=red guibg=red
match ForbiddenWhitespace /\s\+$\|\t/ match ForbiddenWhitespace /\s\+$\|\t/
@@ -201,16 +198,10 @@ autocmd InsertEnter * match ForbiddenWhitespace /\t\|\s\+\%#\@@<!$/
For Emacs, add these roughly equivalent lines to your @file{.emacs.d/init.el}: For Emacs, add these roughly equivalent lines to your @file{.emacs.d/init.el}:
@example @example
(c-add-style "ffmpeg" (setq c-default-style "k&r")
'("k&r" (setq-default c-basic-offset 4)
(c-basic-offset . 4) (setq-default indent-tabs-mode nil)
(indent-tabs-mode nil) (setq-default show-trailing-whitespace t)
(show-trailing-whitespace t)
(c-offsets-alist
(statement-cont . (c-lineup-assignments +)))
)
)
(setq c-default-style "ffmpeg")
@end example @end example
@section Development Policy @section Development Policy

View File

@@ -412,131 +412,6 @@ Selected by Encoder (default)
@end table @end table
@section libmp3lame
LAME (Lame Ain't an MP3 Encoder) MP3 encoder wrapper
Requires the presence of the libmp3lame headers and library during
configuration. You need to explicitly configure the build with
@code{--enable-libmp3lame}.
@subsection Option Mapping
The following options are supported by the libmp3lame wrapper,
the LAME-equivalent options follow the FFmpeg ones.
@multitable @columnfractions .2 .2
@item FFmpeg @tab LAME
@item b @tab b
FFmpeg @code{b} option is expressed in bits/s, lame @code{bitrate}
in kilobits/s.
@item q @tab V
Quality setting for VBR.
@item compression_level @tab q
Algorithm quality. Valid options are integers from 0-9.
@item reservoir @tab N.A.
Enable use of bit reservoir. LAME has this enabled by default.
@item joint_stereo @tab -m j
Enables the the encoder to use (on a frame by frame basis) either L/R
stereo or mid/side stereo.
@end multitable
@section libopencore-amrnb
OpenCORE Adaptive Multi-Rate Narrowband encoder.
Requires the presence of the libopencore-amrnb headers and library during
configuration. You need to explicitly configure the build with
@code{--enable-libopencore-amrnb --enable-version3}.
This is a mono-only encoder. Officially it only supports 8000Hz sample rate,
but you can override it by setting @option{strict} to @samp{unofficial} or
lower.
@subsection Options
@table @option
@item b
Set bitrate in bits per second. Only the following bitrates are supported,
otherwise libavcodec will round to the nearest valid bitrate.
@table @option
@item 4750
@item 5150
@item 5900
@item 6700
@item 7400
@item 7950
@item 10200
@item 12200
@end table
@item dtx
Allow discontinuous transmission (generate comfort noise) when set to 1. The
default value is 0 (disabled).
@end table
@section libvo-aacenc
VisualOn AAC encoder
Requires the presence of the libvo-aacenc headers and library during
configuration. You need to explicitly configure the build with
@code{--enable-libvo-aacenc --enable-version3}.
@subsection Options
The VisualOn AAC encoder only support encoding AAC-LC and up to 2
channels. It is also CBR-only. It is considered to be worse than the
native experimental FFmpeg AAC encoder.
@table @option
@item b
Bitrate.
@end table
@section libvo-amrwbenc
VisualOn Adaptive Multi-Rate Wideband encoder
Requires the presence of the libvo-amrwbenc headers and library during
configuration. You need to explicitly configure the build with
@code{--enable-libvo-amrwbenc --enable-version3}.
This is a mono-only encoder. Officially it only supports 16000Hz sample
rate, but you can override it by setting @option{strict} to
@samp{unofficial} or lower.
@subsection Options
@table @option
@item b
Set bitrate in bits/s. Only the following bitrates are supported, otherwise
libavcodec will round to the nearest valid bitrate.
@table @samp
@item 6600
@item 8850
@item 12650
@item 14250
@item 15850
@item 18250
@item 19850
@item 23050
@item 23850
@end table
@item dtx
Allow discontinuous transmission (generate comfort noise) when set to 1. The
default value is 0 (disabled).
@end table
@c man end AUDIO ENCODERS @c man end AUDIO ENCODERS
@chapter Video Encoders @chapter Video Encoders
@@ -710,116 +585,4 @@ ffmpeg -i foo.mpg -vcodec libx264 -x264opts keyint=123:min-keyint=20 -an out.mkv
For more information about libx264 and the supported options see: For more information about libx264 and the supported options see:
@url{http://www.videolan.org/developers/x264.html} @url{http://www.videolan.org/developers/x264.html}
@section libxvid
Xvid MPEG-4 Part 2 encoder wrapper.
This encoder requires the presence of the libxvidcore headers and library
during configuration. You need to explicitly configure the build with
@code{--enable-libxvid --enable-gpl}.
The native @code{mpeg4} encoder supports the MPEG-4 Part 2 format, so
users can encode to this format without this library.
@subsection Options
The following options are supported by the libxvid wrapper. Some of
the following options are listed but are not documented, and
correspond to shared codec options. The other shared options
which are not listed have no effect for the libxvid encoder.
@table @option
@item b
@item g
@item qmin
@item qmax
@item mpeg_quant
@item threads
@item bf
@item b_qfactor
@item b_qoffset
@item flags
Set specific encoding flags. Possible values:
@table @samp
@item mv4
Use four motion vector by macroblock.
@item aic
Enable high quality AC prediction.
@item gray
Only encode grayscale.
@item gmc
Enable the use of global motion compensation (GMC).
@item qpel
Enable quarter-pixel motion compensation.
@item cgop
Enable closed GOP.
@item global_header
Place global headers in extradata instead of every keyframe.
@end table
@item trellis
@item me_method
Set motion estimation method. Possible values in decreasing order of
speed and increasing order of quality:
@table @samp
@item zero
Use no motion estimation (default).
@item phods
@item x1
@item log
Enable advanced diamond zonal search for 16x16 blocks and half-pixel
refinement for 16x16 blocks. @samp{x1} and @samp{log} are aliases for
@samp{phods}.
@item epzs
Enable all of the things described above, plus advanced diamond zonal
search for 8x8 blocks, half-pixel refinement for 8x8 blocks, and motion
estimation on chroma planes.
@item full
Enable all of the things described above, plus extended 16x16 and 8x8
blocks search.
@end table
@item mbd
Set macroblock decision algorithm. Possible values in the increasing
order of quality:
@table @samp
@item simple
Use macroblock comparing function algorithm (default).
@item bits
Enable rate distortion-based half pixel and quarter pixel refinement for
16x16 blocks.
@item rd
Enable all of the things described above, plus rate distortion-based
half pixel and quarter pixel refinement for 8x8 blocks, and rate
distortion-based search using square pattern.
@end table
@end table
@c man end VIDEO ENCODERS @c man end VIDEO ENCODERS

View File

@@ -106,18 +106,6 @@ the evaluation of @var{y}, return 0 otherwise.
@item ifnot(x, y) @item ifnot(x, y)
Evaluate @var{x}, and if the result is zero return the result of the Evaluate @var{x}, and if the result is zero return the result of the
evaluation of @var{y}, return 0 otherwise. evaluation of @var{y}, return 0 otherwise.
@item taylor(expr, x) taylor(expr, x, id)
Evaluate a taylor series at x.
expr represents the LD(id)-th derivates of f(x) at 0. If id is not specified
then 0 is assumed.
note, when you have the derivatives at y instead of 0
taylor(expr, x-y) can be used
When the series does not converge the results are undefined.
@item root(expr, max)
Finds x where f(x)=0 in the interval 0..max.
f() must be continuous or the result is undefined.
@end table @end table
The following constants are available: The following constants are available:

View File

@@ -1,28 +1,17 @@
# use pkg-config for getting CFLAGS and LDLIBS # use pkg-config for getting CFLAGS abd LDFLAGS
FFMPEG_LIBS= libavdevice \ FFMPEG_LIBS=libavdevice libavformat libavfilter libavcodec libswscale libavutil
libavformat \
libavfilter \
libavcodec \
libavresample \
libswresample \
libswscale \
libavutil \
CFLAGS += -Wall -O2 -g
CFLAGS+=$(shell pkg-config --cflags $(FFMPEG_LIBS)) CFLAGS+=$(shell pkg-config --cflags $(FFMPEG_LIBS))
LDLIBS += $(shell pkg-config --libs $(FFMPEG_LIBS)) LDFLAGS+=$(shell pkg-config --libs $(FFMPEG_LIBS))
EXAMPLES= decoding_encoding \ EXAMPLES=decoding_encoding filtering metadata muxing
filtering_video \
filtering_audio \
metadata \
muxing \
OBJS=$(addsuffix .o,$(EXAMPLES)) OBJS=$(addsuffix .o,$(EXAMPLES))
# the following examples make explicit use of the math library %: %.o
decoding_encoding: LDLIBS += -lm $(CC) $< $(LDFLAGS) -o $@
muxing: LDLIBS += -lm
%.o: %.c
$(CC) $< $(CFLAGS) -c -o $@
.phony: all clean .phony: all clean

View File

@@ -29,13 +29,11 @@
* format handling * format handling
*/ */
#include <math.h> #include "libavutil/imgutils.h"
#include "libavutil/opt.h"
#include <libavutil/imgutils.h> #include "libavcodec/avcodec.h"
#include <libavutil/opt.h> #include "libavutil/mathematics.h"
#include <libavcodec/avcodec.h> #include "libavutil/samplefmt.h"
#include <libavutil/mathematics.h>
#include <libavutil/samplefmt.h>
#define INBUF_SIZE 4096 #define INBUF_SIZE 4096
#define AUDIO_INBUF_SIZE 20480 #define AUDIO_INBUF_SIZE 20480
@@ -54,7 +52,7 @@ static void audio_encode_example(const char *filename)
float t, tincr; float t, tincr;
uint8_t *outbuf; uint8_t *outbuf;
printf("Encode audio file %s\n", filename); printf("Audio encoding\n");
/* find the MP2 encoder */ /* find the MP2 encoder */
codec = avcodec_find_encoder(CODEC_ID_MP2); codec = avcodec_find_encoder(CODEC_ID_MP2);
@@ -72,7 +70,7 @@ static void audio_encode_example(const char *filename)
c->sample_fmt = AV_SAMPLE_FMT_S16; c->sample_fmt = AV_SAMPLE_FMT_S16;
/* open it */ /* open it */
if (avcodec_open2(c, codec, NULL) < 0) { if (avcodec_open(c, codec) < 0) {
fprintf(stderr, "could not open codec\n"); fprintf(stderr, "could not open codec\n");
exit(1); exit(1);
} }
@@ -125,7 +123,7 @@ static void audio_decode_example(const char *outfilename, const char *filename)
av_init_packet(&avpkt); av_init_packet(&avpkt);
printf("Decode audio file %s\n", filename); printf("Audio decoding\n");
/* find the mpeg audio decoder */ /* find the mpeg audio decoder */
codec = avcodec_find_decoder(CODEC_ID_MP2); codec = avcodec_find_decoder(CODEC_ID_MP2);
@@ -137,7 +135,7 @@ static void audio_decode_example(const char *outfilename, const char *filename)
c = avcodec_alloc_context3(codec); c = avcodec_alloc_context3(codec);
/* open it */ /* open it */
if (avcodec_open2(c, codec, NULL) < 0) { if (avcodec_open(c, codec) < 0) {
fprintf(stderr, "could not open codec\n"); fprintf(stderr, "could not open codec\n");
exit(1); exit(1);
} }
@@ -213,13 +211,12 @@ static void video_encode_example(const char *filename, int codec_id)
{ {
AVCodec *codec; AVCodec *codec;
AVCodecContext *c= NULL; AVCodecContext *c= NULL;
int i, out_size, x, y, outbuf_size; int i, out_size, size, x, y, outbuf_size;
FILE *f; FILE *f;
AVFrame *picture; AVFrame *picture;
uint8_t *outbuf; uint8_t *outbuf;
int had_output=0;
printf("Encode video file %s\n", filename); printf("Video encoding\n");
/* find the mpeg1 video encoder */ /* find the mpeg1 video encoder */
codec = avcodec_find_encoder(codec_id); codec = avcodec_find_encoder(codec_id);
@@ -246,7 +243,7 @@ static void video_encode_example(const char *filename, int codec_id)
av_opt_set(c->priv_data, "preset", "slow", 0); av_opt_set(c->priv_data, "preset", "slow", 0);
/* open it */ /* open it */
if (avcodec_open2(c, codec, NULL) < 0) { if (avcodec_open(c, codec) < 0) {
fprintf(stderr, "could not open codec\n"); fprintf(stderr, "could not open codec\n");
exit(1); exit(1);
} }
@@ -258,7 +255,7 @@ static void video_encode_example(const char *filename, int codec_id)
} }
/* alloc image and output buffer */ /* alloc image and output buffer */
outbuf_size = 100000 + 12*c->width*c->height; outbuf_size = 100000;
outbuf = malloc(outbuf_size); outbuf = malloc(outbuf_size);
/* the image can be allocated by any means and av_image_alloc() is /* the image can be allocated by any means and av_image_alloc() is
@@ -287,17 +284,15 @@ static void video_encode_example(const char *filename, int codec_id)
/* encode the image */ /* encode the image */
out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture); out_size = avcodec_encode_video(c, outbuf, outbuf_size, picture);
had_output |= out_size;
printf("encoding frame %3d (size=%5d)\n", i, out_size); printf("encoding frame %3d (size=%5d)\n", i, out_size);
fwrite(outbuf, 1, out_size, f); fwrite(outbuf, 1, out_size, f);
} }
/* get the delayed frames */ /* get the delayed frames */
for(; out_size || !had_output; i++) { for(; out_size; i++) {
fflush(stdout); fflush(stdout);
out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL); out_size = avcodec_encode_video(c, outbuf, outbuf_size, NULL);
had_output |= out_size;
printf("write frame %3d (size=%5d)\n", i, out_size); printf("write frame %3d (size=%5d)\n", i, out_size);
fwrite(outbuf, 1, out_size, f); fwrite(outbuf, 1, out_size, f);
} }
@@ -351,7 +346,7 @@ static void video_decode_example(const char *outfilename, const char *filename)
/* set end of buffer to 0 (this ensures that no overreading happens for damaged mpeg streams) */ /* set end of buffer to 0 (this ensures that no overreading happens for damaged mpeg streams) */
memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE); memset(inbuf + INBUF_SIZE, 0, FF_INPUT_BUFFER_PADDING_SIZE);
printf("Decode video file %s\n", filename); printf("Video decoding\n");
/* find the mpeg1 video decoder */ /* find the mpeg1 video decoder */
codec = avcodec_find_decoder(CODEC_ID_MPEG1VIDEO); codec = avcodec_find_decoder(CODEC_ID_MPEG1VIDEO);
@@ -371,7 +366,7 @@ static void video_decode_example(const char *outfilename, const char *filename)
available in the bitstream. */ available in the bitstream. */
/* open it */ /* open it */
if (avcodec_open2(c, codec, NULL) < 0) { if (avcodec_open(c, codec) < 0) {
fprintf(stderr, "could not open codec\n"); fprintf(stderr, "could not open codec\n");
exit(1); exit(1);
} }
@@ -458,6 +453,9 @@ int main(int argc, char **argv)
{ {
const char *filename; const char *filename;
/* must be called before using avcodec lib */
avcodec_init();
/* register all the codecs */ /* register all the codecs */
avcodec_register_all(); avcodec_register_all();

View File

@@ -27,13 +27,11 @@
*/ */
#define _XOPEN_SOURCE 600 /* for usleep */ #define _XOPEN_SOURCE 600 /* for usleep */
#include <unistd.h>
#include <libavcodec/avcodec.h> #include <libavcodec/avcodec.h>
#include <libavformat/avformat.h> #include <libavformat/avformat.h>
#include <libavfilter/avfiltergraph.h> #include <libavfilter/avfiltergraph.h>
#include <libavfilter/avcodec.h> #include <libavfilter/vsrc_buffer.h>
#include <libavfilter/buffersink.h>
const char *filter_descr = "scale=78:24"; const char *filter_descr = "scale=78:24";
@@ -47,7 +45,7 @@ static int64_t last_pts = AV_NOPTS_VALUE;
static int open_input_file(const char *filename) static int open_input_file(const char *filename)
{ {
int ret; int ret, i;
AVCodec *dec; AVCodec *dec;
if ((ret = avformat_open_input(&fmt_ctx, filename, NULL, NULL)) < 0) { if ((ret = avformat_open_input(&fmt_ctx, filename, NULL, NULL)) < 0) {
@@ -55,7 +53,7 @@ static int open_input_file(const char *filename)
return ret; return ret;
} }
if ((ret = avformat_find_stream_info(fmt_ctx, NULL)) < 0) { if ((ret = av_find_stream_info(fmt_ctx)) < 0) {
av_log(NULL, AV_LOG_ERROR, "Cannot find stream information\n"); av_log(NULL, AV_LOG_ERROR, "Cannot find stream information\n");
return ret; return ret;
} }
@@ -70,7 +68,7 @@ static int open_input_file(const char *filename)
dec_ctx = fmt_ctx->streams[video_stream_index]->codec; dec_ctx = fmt_ctx->streams[video_stream_index]->codec;
/* init the video decoder */ /* init the video decoder */
if ((ret = avcodec_open2(dec_ctx, dec, NULL)) < 0) { if ((ret = avcodec_open(dec_ctx, dec)) < 0) {
av_log(NULL, AV_LOG_ERROR, "Cannot open video decoder\n"); av_log(NULL, AV_LOG_ERROR, "Cannot open video decoder\n");
return ret; return ret;
} }
@@ -120,13 +118,12 @@ static int init_filters(const char *filters_descr)
inputs->pad_idx = 0; inputs->pad_idx = 0;
inputs->next = NULL; inputs->next = NULL;
if ((ret = avfilter_graph_parse(filter_graph, filters_descr, if ((ret = avfilter_graph_parse(filter_graph, filter_descr,
&inputs, &outputs, NULL)) < 0) &inputs, &outputs, NULL)) < 0)
return ret; return ret;
if ((ret = avfilter_graph_config(filter_graph, NULL)) < 0) if ((ret = avfilter_graph_config(filter_graph, NULL)) < 0)
return ret; return ret;
return 0;
} }
static void display_picref(AVFilterBufferRef *picref, AVRational time_base) static void display_picref(AVFilterBufferRef *picref, AVRational time_base)
@@ -198,14 +195,15 @@ int main(int argc, char **argv)
} }
if (got_frame) { if (got_frame) {
frame.pts = av_frame_get_best_effort_timestamp(&frame); if (frame.pts == AV_NOPTS_VALUE)
frame.pts = frame.pkt_dts == AV_NOPTS_VALUE ?
frame.pkt_dts : frame.pkt_pts;
/* push the decoded frame into the filtergraph */ /* push the decoded frame into the filtergraph */
av_vsrc_buffer_add_frame(buffersrc_ctx, &frame, 0); av_vsrc_buffer_add_frame(buffersrc_ctx, &frame);
/* pull filtered pictures from the filtergraph */ /* pull filtered pictures from the filtergraph */
while (avfilter_poll_frame(buffersink_ctx->inputs[0])) { while (avfilter_poll_frame(buffersink_ctx->inputs[0])) {
av_buffersink_get_buffer_ref(buffersink_ctx, &picref, 0); av_vsink_buffer_get_video_buffer_ref(buffersink_ctx, &picref, 0);
if (picref) { if (picref) {
display_picref(picref, buffersink_ctx->inputs[0]->time_base); display_picref(picref, buffersink_ctx->inputs[0]->time_base);
avfilter_unref_buffer(picref); avfilter_unref_buffer(picref);
@@ -218,7 +216,7 @@ end:
avfilter_graph_free(&filter_graph); avfilter_graph_free(&filter_graph);
if (dec_ctx) if (dec_ctx)
avcodec_close(dec_ctx); avcodec_close(dec_ctx);
avformat_close_input(&fmt_ctx); av_close_input_file(fmt_ctx);
if (ret < 0 && ret != AVERROR_EOF) { if (ret < 0 && ret != AVERROR_EOF) {
char buf[1024]; char buf[1024];

View File

@@ -1,235 +0,0 @@
/*
* Copyright (c) 2010 Nicolas George
* Copyright (c) 2011 Stefano Sabatini
* Copyright (c) 2012 Clément Bœsch
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
/**
* @file
* API example for audio decoding and filtering
*/
#include <unistd.h>
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavfilter/avfiltergraph.h>
#include <libavfilter/avcodec.h>
#include <libavfilter/buffersink.h>
#include <libavfilter/buffersrc.h>
const char *filter_descr = "aresample=8000,aconvert=s16:mono";
const char *player = "ffplay -f s16le -ar 8000 -ac 1 -";
static AVFormatContext *fmt_ctx;
static AVCodecContext *dec_ctx;
AVFilterContext *buffersink_ctx;
AVFilterContext *buffersrc_ctx;
AVFilterGraph *filter_graph;
static int audio_stream_index = -1;
static int open_input_file(const char *filename)
{
int ret;
AVCodec *dec;
if ((ret = avformat_open_input(&fmt_ctx, filename, NULL, NULL)) < 0) {
av_log(NULL, AV_LOG_ERROR, "Cannot open input file\n");
return ret;
}
if ((ret = avformat_find_stream_info(fmt_ctx, NULL)) < 0) {
av_log(NULL, AV_LOG_ERROR, "Cannot find stream information\n");
return ret;
}
/* select the audio stream */
ret = av_find_best_stream(fmt_ctx, AVMEDIA_TYPE_AUDIO, -1, -1, &dec, 0);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Cannot find a audio stream in the input file\n");
return ret;
}
audio_stream_index = ret;
dec_ctx = fmt_ctx->streams[audio_stream_index]->codec;
/* init the audio decoder */
if ((ret = avcodec_open2(dec_ctx, dec, NULL)) < 0) {
av_log(NULL, AV_LOG_ERROR, "Cannot open audio decoder\n");
return ret;
}
return 0;
}
static int init_filters(const char *filters_descr)
{
char args[512];
int ret;
AVFilter *abuffersrc = avfilter_get_by_name("abuffer");
AVFilter *abuffersink = avfilter_get_by_name("abuffersink");
AVFilterInOut *outputs = avfilter_inout_alloc();
AVFilterInOut *inputs = avfilter_inout_alloc();
const enum AVSampleFormat sample_fmts[] = { AV_SAMPLE_FMT_S16, -1 };
const int64_t *chlayouts = avfilter_all_channel_layouts;
AVABufferSinkParams *abuffersink_params;
const AVFilterLink *outlink;
filter_graph = avfilter_graph_alloc();
/* buffer audio source: the decoded frames from the decoder will be inserted here. */
if (!dec_ctx->channel_layout)
dec_ctx->channel_layout = av_get_default_channel_layout(dec_ctx->channels);
snprintf(args, sizeof(args), "%d:%d:0x%"PRIx64,
dec_ctx->sample_rate, dec_ctx->sample_fmt, dec_ctx->channel_layout);
ret = avfilter_graph_create_filter(&buffersrc_ctx, abuffersrc, "in",
args, NULL, filter_graph);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Cannot create audio buffer source\n");
return ret;
}
/* buffer audio sink: to terminate the filter chain. */
abuffersink_params = av_abuffersink_params_alloc();
abuffersink_params->sample_fmts = sample_fmts;
abuffersink_params->channel_layouts = chlayouts;
ret = avfilter_graph_create_filter(&buffersink_ctx, abuffersink, "out",
NULL, abuffersink_params, filter_graph);
av_free(abuffersink_params);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Cannot create audio buffer sink\n");
return ret;
}
/* Endpoints for the filter graph. */
outputs->name = av_strdup("in");
outputs->filter_ctx = buffersrc_ctx;
outputs->pad_idx = 0;
outputs->next = NULL;
inputs->name = av_strdup("out");
inputs->filter_ctx = buffersink_ctx;
inputs->pad_idx = 0;
inputs->next = NULL;
if ((ret = avfilter_graph_parse(filter_graph, filters_descr,
&inputs, &outputs, NULL)) < 0)
return ret;
if ((ret = avfilter_graph_config(filter_graph, NULL)) < 0)
return ret;
/* Print summary of the sink buffer
* Note: args buffer is reused to store channel layout string */
outlink = buffersink_ctx->inputs[0];
av_get_channel_layout_string(args, sizeof(args), -1, outlink->channel_layout);
av_log(NULL, AV_LOG_INFO, "Output: srate:%dHz fmt:%s chlayout:%s\n",
(int)outlink->sample_rate,
(char *)av_x_if_null(av_get_sample_fmt_name(outlink->format), "?"),
args);
return 0;
}
static void print_samplesref(AVFilterBufferRef *samplesref)
{
const AVFilterBufferRefAudioProps *props = samplesref->audio;
const int n = props->nb_samples * av_get_channel_layout_nb_channels(props->channel_layout);
const uint16_t *p = (uint16_t*)samplesref->data[0];
const uint16_t *p_end = p + n;
while (p < p_end) {
fputc(*p & 0xff, stdout);
fputc(*p>>8 & 0xff, stdout);
p++;
}
fflush(stdout);
}
int main(int argc, char **argv)
{
int ret;
AVPacket packet;
AVFrame frame;
int got_frame;
if (argc != 2) {
fprintf(stderr, "Usage: %s file | %s\n", argv[0], player);
exit(1);
}
avcodec_register_all();
av_register_all();
avfilter_register_all();
if ((ret = open_input_file(argv[1])) < 0)
goto end;
if ((ret = init_filters(filter_descr)) < 0)
goto end;
/* read all packets */
while (1) {
AVFilterBufferRef *samplesref;
if ((ret = av_read_frame(fmt_ctx, &packet)) < 0)
break;
if (packet.stream_index == audio_stream_index) {
avcodec_get_frame_defaults(&frame);
got_frame = 0;
ret = avcodec_decode_audio4(dec_ctx, &frame, &got_frame, &packet);
av_free_packet(&packet);
if (ret < 0) {
av_log(NULL, AV_LOG_ERROR, "Error decoding audio\n");
continue;
}
if (got_frame) {
/* push the audio data from decoded frame into the filtergraph */
if (av_buffersrc_add_frame(buffersrc_ctx, &frame, 0) < 0) {
av_log(NULL, AV_LOG_ERROR, "Error while feeding the audio filtergraph\n");
break;
}
/* pull filtered audio from the filtergraph */
while (avfilter_poll_frame(buffersink_ctx->inputs[0])) {
av_buffersink_get_buffer_ref(buffersink_ctx, &samplesref, 0);
if (samplesref) {
print_samplesref(samplesref);
avfilter_unref_buffer(samplesref);
}
}
}
}
}
end:
avfilter_graph_free(&filter_graph);
if (dec_ctx)
avcodec_close(dec_ctx);
avformat_close_input(&fmt_ctx);
if (ret < 0 && ret != AVERROR_EOF) {
char buf[1024];
av_strerror(ret, buf, sizeof(buf));
fprintf(stderr, "Error occurred: %s\n", buf);
exit(1);
}
exit(0);
}

View File

@@ -50,6 +50,6 @@ int main (int argc, char **argv)
while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX))) while ((tag = av_dict_get(fmt_ctx->metadata, "", tag, AV_DICT_IGNORE_SUFFIX)))
printf("%s=%s\n", tag->key, tag->value); printf("%s=%s\n", tag->key, tag->value);
avformat_close_input(&fmt_ctx); avformat_free_context(fmt_ctx);
return 0; return 0;
} }

View File

@@ -33,9 +33,9 @@
#include <string.h> #include <string.h>
#include <math.h> #include <math.h>
#include <libavutil/mathematics.h> #include "libavutil/mathematics.h"
#include <libavformat/avformat.h> #include "libavformat/avformat.h"
#include <libswscale/swscale.h> #include "libswscale/swscale.h"
#undef exit #undef exit
@@ -52,6 +52,8 @@ static int sws_flags = SWS_BICUBIC;
static float t, tincr, tincr2; static float t, tincr, tincr2;
static int16_t *samples; static int16_t *samples;
static uint8_t *audio_outbuf;
static int audio_outbuf_size;
static int audio_input_frame_size; static int audio_input_frame_size;
/* /*
@@ -61,16 +63,8 @@ static AVStream *add_audio_stream(AVFormatContext *oc, enum CodecID codec_id)
{ {
AVCodecContext *c; AVCodecContext *c;
AVStream *st; AVStream *st;
AVCodec *codec;
/* find the audio encoder */ st = avformat_new_stream(oc, NULL);
codec = avcodec_find_encoder(codec_id);
if (!codec) {
fprintf(stderr, "codec not found\n");
exit(1);
}
st = avformat_new_stream(oc, codec);
if (!st) { if (!st) {
fprintf(stderr, "Could not alloc stream\n"); fprintf(stderr, "Could not alloc stream\n");
exit(1); exit(1);
@@ -78,6 +72,8 @@ static AVStream *add_audio_stream(AVFormatContext *oc, enum CodecID codec_id)
st->id = 1; st->id = 1;
c = st->codec; c = st->codec;
c->codec_id = codec_id;
c->codec_type = AVMEDIA_TYPE_AUDIO;
/* put sample parameters */ /* put sample parameters */
c->sample_fmt = AV_SAMPLE_FMT_S16; c->sample_fmt = AV_SAMPLE_FMT_S16;
@@ -95,11 +91,19 @@ static AVStream *add_audio_stream(AVFormatContext *oc, enum CodecID codec_id)
static void open_audio(AVFormatContext *oc, AVStream *st) static void open_audio(AVFormatContext *oc, AVStream *st)
{ {
AVCodecContext *c; AVCodecContext *c;
AVCodec *codec;
c = st->codec; c = st->codec;
/* find the audio encoder */
codec = avcodec_find_encoder(c->codec_id);
if (!codec) {
fprintf(stderr, "codec not found\n");
exit(1);
}
/* open it */ /* open it */
if (avcodec_open2(c, NULL, NULL) < 0) { if (avcodec_open(c, codec) < 0) {
fprintf(stderr, "could not open codec\n"); fprintf(stderr, "could not open codec\n");
exit(1); exit(1);
} }
@@ -110,17 +114,31 @@ static void open_audio(AVFormatContext *oc, AVStream *st)
/* increment frequency by 110 Hz per second */ /* increment frequency by 110 Hz per second */
tincr2 = 2 * M_PI * 110.0 / c->sample_rate / c->sample_rate; tincr2 = 2 * M_PI * 110.0 / c->sample_rate / c->sample_rate;
if (c->codec->capabilities & CODEC_CAP_VARIABLE_FRAME_SIZE) audio_outbuf_size = 10000;
audio_input_frame_size = 10000; audio_outbuf = av_malloc(audio_outbuf_size);
else
/* ugly hack for PCM codecs (will be removed ASAP with new PCM
support to compute the input frame size in samples */
if (c->frame_size <= 1) {
audio_input_frame_size = audio_outbuf_size / c->channels;
switch(st->codec->codec_id) {
case CODEC_ID_PCM_S16LE:
case CODEC_ID_PCM_S16BE:
case CODEC_ID_PCM_U16LE:
case CODEC_ID_PCM_U16BE:
audio_input_frame_size >>= 1;
break;
default:
break;
}
} else {
audio_input_frame_size = c->frame_size; audio_input_frame_size = c->frame_size;
samples = av_malloc(audio_input_frame_size * }
av_get_bytes_per_sample(c->sample_fmt) * samples = av_malloc(audio_input_frame_size * 2 * c->channels);
c->channels);
} }
/* Prepare a 16 bit dummy audio frame of 'frame_size' samples and /* prepare a 16 bit dummy audio frame of 'frame_size' samples and
* 'nb_channels' channels. */ 'nb_channels' channels */
static void get_audio_frame(int16_t *samples, int frame_size, int nb_channels) static void get_audio_frame(int16_t *samples, int frame_size, int nb_channels)
{ {
int j, i, v; int j, i, v;
@@ -139,28 +157,22 @@ static void get_audio_frame(int16_t *samples, int frame_size, int nb_channels)
static void write_audio_frame(AVFormatContext *oc, AVStream *st) static void write_audio_frame(AVFormatContext *oc, AVStream *st)
{ {
AVCodecContext *c; AVCodecContext *c;
AVPacket pkt = { 0 }; // data and size must be 0; AVPacket pkt;
AVFrame *frame = avcodec_alloc_frame();
int got_packet;
av_init_packet(&pkt); av_init_packet(&pkt);
c = st->codec; c = st->codec;
get_audio_frame(samples, audio_input_frame_size, c->channels); get_audio_frame(samples, audio_input_frame_size, c->channels);
frame->nb_samples = audio_input_frame_size;
avcodec_fill_audio_frame(frame, c->channels, c->sample_fmt,
(uint8_t *)samples,
audio_input_frame_size *
av_get_bytes_per_sample(c->sample_fmt) *
c->channels, 1);
avcodec_encode_audio2(c, &pkt, frame, &got_packet); pkt.size = avcodec_encode_audio(c, audio_outbuf, audio_outbuf_size, samples);
if (!got_packet)
return;
if (c->coded_frame && c->coded_frame->pts != AV_NOPTS_VALUE)
pkt.pts= av_rescale_q(c->coded_frame->pts, c->time_base, st->time_base);
pkt.flags |= AV_PKT_FLAG_KEY;
pkt.stream_index = st->index; pkt.stream_index = st->index;
pkt.data = audio_outbuf;
/* Write the compressed frame to the media file. */ /* write the compressed frame in the media file */
if (av_interleaved_write_frame(oc, &pkt) != 0) { if (av_interleaved_write_frame(oc, &pkt) != 0) {
fprintf(stderr, "Error while writing audio frame\n"); fprintf(stderr, "Error while writing audio frame\n");
exit(1); exit(1);
@@ -172,6 +184,7 @@ static void close_audio(AVFormatContext *oc, AVStream *st)
avcodec_close(st->codec); avcodec_close(st->codec);
av_free(samples); av_free(samples);
av_free(audio_outbuf);
} }
/**************************************************************/ /**************************************************************/
@@ -181,21 +194,14 @@ static AVFrame *picture, *tmp_picture;
static uint8_t *video_outbuf; static uint8_t *video_outbuf;
static int frame_count, video_outbuf_size; static int frame_count, video_outbuf_size;
/* Add a video output stream. */ /* add a video output stream */
static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id) static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id)
{ {
AVCodecContext *c; AVCodecContext *c;
AVStream *st; AVStream *st;
AVCodec *codec; AVCodec *codec;
/* find the video encoder */ st = avformat_new_stream(oc, NULL);
codec = avcodec_find_encoder(codec_id);
if (!codec) {
fprintf(stderr, "codec not found\n");
exit(1);
}
st = avformat_new_stream(oc, codec);
if (!st) { if (!st) {
fprintf(stderr, "Could not alloc stream\n"); fprintf(stderr, "Could not alloc stream\n");
exit(1); exit(1);
@@ -213,15 +219,15 @@ static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id)
c->codec_id = codec_id; c->codec_id = codec_id;
/* Put sample parameters. */ /* put sample parameters */
c->bit_rate = 400000; c->bit_rate = 400000;
/* Resolution must be a multiple of two. */ /* resolution must be a multiple of two */
c->width = 352; c->width = 352;
c->height = 288; c->height = 288;
/* timebase: This is the fundamental unit of time (in seconds) in terms /* time base: this is the fundamental unit of time (in seconds) in terms
* of which frame timestamps are represented. For fixed-fps content, of which frame timestamps are represented. for fixed-fps content,
* timebase should be 1/framerate and timestamp increments should be timebase should be 1/framerate and timestamp increments should be
* identical to 1. */ identically 1. */
c->time_base.den = STREAM_FRAME_RATE; c->time_base.den = STREAM_FRAME_RATE;
c->time_base.num = 1; c->time_base.num = 1;
c->gop_size = 12; /* emit one intra frame every twelve frames at most */ c->gop_size = 12; /* emit one intra frame every twelve frames at most */
@@ -232,11 +238,11 @@ static AVStream *add_video_stream(AVFormatContext *oc, enum CodecID codec_id)
} }
if (c->codec_id == CODEC_ID_MPEG1VIDEO){ if (c->codec_id == CODEC_ID_MPEG1VIDEO){
/* Needed to avoid using macroblocks in which some coeffs overflow. /* Needed to avoid using macroblocks in which some coeffs overflow.
* This does not happen with normal video, it just happens here as This does not happen with normal video, it just happens here as
* the motion of the chroma plane does not match the luma plane. */ the motion of the chroma plane does not match the luma plane. */
c->mb_decision=2; c->mb_decision=2;
} }
/* Some formats want stream headers to be separate. */ // some formats want stream headers to be separate
if (oc->oformat->flags & AVFMT_GLOBALHEADER) if (oc->oformat->flags & AVFMT_GLOBALHEADER)
c->flags |= CODEC_FLAG_GLOBAL_HEADER; c->flags |= CODEC_FLAG_GLOBAL_HEADER;
@@ -265,38 +271,46 @@ static AVFrame *alloc_picture(enum PixelFormat pix_fmt, int width, int height)
static void open_video(AVFormatContext *oc, AVStream *st) static void open_video(AVFormatContext *oc, AVStream *st)
{ {
AVCodec *codec;
AVCodecContext *c; AVCodecContext *c;
c = st->codec; c = st->codec;
/* find the video encoder */
codec = avcodec_find_encoder(c->codec_id);
if (!codec) {
fprintf(stderr, "codec not found\n");
exit(1);
}
/* open the codec */ /* open the codec */
if (avcodec_open2(c, NULL, NULL) < 0) { if (avcodec_open(c, codec) < 0) {
fprintf(stderr, "could not open codec\n"); fprintf(stderr, "could not open codec\n");
exit(1); exit(1);
} }
video_outbuf = NULL; video_outbuf = NULL;
if (!(oc->oformat->flags & AVFMT_RAWPICTURE)) { if (!(oc->oformat->flags & AVFMT_RAWPICTURE)) {
/* Allocate output buffer. */ /* allocate output buffer */
/* XXX: API change will be done. */ /* XXX: API change will be done */
/* Buffers passed into lav* can be allocated any way you prefer, /* buffers passed into lav* can be allocated any way you prefer,
* as long as they're aligned enough for the architecture, and as long as they're aligned enough for the architecture, and
* they're freed appropriately (such as using av_free for buffers they're freed appropriately (such as using av_free for buffers
* allocated with av_malloc). */ allocated with av_malloc) */
video_outbuf_size = 200000; video_outbuf_size = 200000;
video_outbuf = av_malloc(video_outbuf_size); video_outbuf = av_malloc(video_outbuf_size);
} }
/* Allocate the encoded raw picture. */ /* allocate the encoded raw picture */
picture = alloc_picture(c->pix_fmt, c->width, c->height); picture = alloc_picture(c->pix_fmt, c->width, c->height);
if (!picture) { if (!picture) {
fprintf(stderr, "Could not allocate picture\n"); fprintf(stderr, "Could not allocate picture\n");
exit(1); exit(1);
} }
/* If the output format is not YUV420P, then a temporary YUV420P /* if the output format is not YUV420P, then a temporary YUV420P
* picture is needed too. It is then converted to the required picture is needed too. It is then converted to the required
* output format. */ output format */
tmp_picture = NULL; tmp_picture = NULL;
if (c->pix_fmt != PIX_FMT_YUV420P) { if (c->pix_fmt != PIX_FMT_YUV420P) {
tmp_picture = alloc_picture(PIX_FMT_YUV420P, c->width, c->height); tmp_picture = alloc_picture(PIX_FMT_YUV420P, c->width, c->height);
@@ -307,18 +321,19 @@ static void open_video(AVFormatContext *oc, AVStream *st)
} }
} }
/* Prepare a dummy image. */ /* prepare a dummy image */
static void fill_yuv_image(AVFrame *pict, int frame_index, static void fill_yuv_image(AVFrame *pict, int frame_index, int width, int height)
int width, int height)
{ {
int x, y, i; int x, y, i;
i = frame_index; i = frame_index;
/* Y */ /* Y */
for (y = 0; y < height; y++) for (y = 0; y < height; y++) {
for (x = 0; x < width; x++) for (x = 0; x < width; x++) {
pict->data[0][y * pict->linesize[0] + x] = x + y + i * 3; pict->data[0][y * pict->linesize[0] + x] = x + y + i * 3;
}
}
/* Cb and Cr */ /* Cb and Cr */
for (y = 0; y < height/2; y++) { for (y = 0; y < height/2; y++) {
@@ -338,13 +353,13 @@ static void write_video_frame(AVFormatContext *oc, AVStream *st)
c = st->codec; c = st->codec;
if (frame_count >= STREAM_NB_FRAMES) { if (frame_count >= STREAM_NB_FRAMES) {
/* No more frames to compress. The codec has a latency of a few /* no more frame to compress. The codec has a latency of a few
* frames if using B-frames, so we get the last frames by frames if using B frames, so we get the last frames by
* passing the same picture again. */ passing the same picture again */
} else { } else {
if (c->pix_fmt != PIX_FMT_YUV420P) { if (c->pix_fmt != PIX_FMT_YUV420P) {
/* as we only generate a YUV420P picture, we must convert it /* as we only generate a YUV420P picture, we must convert it
* to the codec pixel format if needed */ to the codec pixel format if needed */
if (img_convert_ctx == NULL) { if (img_convert_ctx == NULL) {
img_convert_ctx = sws_getContext(c->width, c->height, img_convert_ctx = sws_getContext(c->width, c->height,
PIX_FMT_YUV420P, PIX_FMT_YUV420P,
@@ -352,8 +367,7 @@ static void write_video_frame(AVFormatContext *oc, AVStream *st)
c->pix_fmt, c->pix_fmt,
sws_flags, NULL, NULL, NULL); sws_flags, NULL, NULL, NULL);
if (img_convert_ctx == NULL) { if (img_convert_ctx == NULL) {
fprintf(stderr, fprintf(stderr, "Cannot initialize the conversion context\n");
"Cannot initialize the conversion context\n");
exit(1); exit(1);
} }
} }
@@ -365,9 +379,10 @@ static void write_video_frame(AVFormatContext *oc, AVStream *st)
} }
} }
if (oc->oformat->flags & AVFMT_RAWPICTURE) { if (oc->oformat->flags & AVFMT_RAWPICTURE) {
/* Raw video case - the API will change slightly in the near /* raw video case. The API will change slightly in the near
* future for that. */ future for that. */
AVPacket pkt; AVPacket pkt;
av_init_packet(&pkt); av_init_packet(&pkt);
@@ -379,24 +394,21 @@ static void write_video_frame(AVFormatContext *oc, AVStream *st)
ret = av_interleaved_write_frame(oc, &pkt); ret = av_interleaved_write_frame(oc, &pkt);
} else { } else {
/* encode the image */ /* encode the image */
out_size = avcodec_encode_video(c, video_outbuf, out_size = avcodec_encode_video(c, video_outbuf, video_outbuf_size, picture);
video_outbuf_size, picture); /* if zero size, it means the image was buffered */
/* If size is zero, it means the image was buffered. */
if (out_size > 0) { if (out_size > 0) {
AVPacket pkt; AVPacket pkt;
av_init_packet(&pkt); av_init_packet(&pkt);
if (c->coded_frame->pts != AV_NOPTS_VALUE) if (c->coded_frame->pts != AV_NOPTS_VALUE)
pkt.pts = av_rescale_q(c->coded_frame->pts, pkt.pts= av_rescale_q(c->coded_frame->pts, c->time_base, st->time_base);
c->time_base, st->time_base);
if(c->coded_frame->key_frame) if(c->coded_frame->key_frame)
pkt.flags |= AV_PKT_FLAG_KEY; pkt.flags |= AV_PKT_FLAG_KEY;
pkt.stream_index = st->index; pkt.stream_index = st->index;
pkt.data = video_outbuf; pkt.data = video_outbuf;
pkt.size = out_size; pkt.size = out_size;
/* Write the compressed frame to the media file. */ /* write the compressed frame in the media file */
ret = av_interleaved_write_frame(oc, &pkt); ret = av_interleaved_write_frame(oc, &pkt);
} else { } else {
ret = 0; ret = 0;
@@ -433,7 +445,7 @@ int main(int argc, char **argv)
double audio_pts, video_pts; double audio_pts, video_pts;
int i; int i;
/* Initialize libavcodec, and register all codecs and formats. */ /* initialize libavcodec, and register all codecs and formats */
av_register_all(); av_register_all();
if (argc != 2) { if (argc != 2) {
@@ -458,8 +470,8 @@ int main(int argc, char **argv)
} }
fmt = oc->oformat; fmt = oc->oformat;
/* Add the audio and video streams using the default format codecs /* add the audio and video streams using the default format codecs
* and initialize the codecs. */ and initialize the codecs */
video_st = NULL; video_st = NULL;
audio_st = NULL; audio_st = NULL;
if (fmt->video_codec != CODEC_ID_NONE) { if (fmt->video_codec != CODEC_ID_NONE) {
@@ -469,15 +481,15 @@ int main(int argc, char **argv)
audio_st = add_audio_stream(oc, fmt->audio_codec); audio_st = add_audio_stream(oc, fmt->audio_codec);
} }
/* Now that all the parameters are set, we can open the audio and av_dump_format(oc, 0, filename, 1);
* video codecs and allocate the necessary encode buffers. */
/* now that all the parameters are set, we can open the audio and
video codecs and allocate the necessary encode buffers */
if (video_st) if (video_st)
open_video(oc, video_st); open_video(oc, video_st);
if (audio_st) if (audio_st)
open_audio(oc, audio_st); open_audio(oc, audio_st);
av_dump_format(oc, 0, filename, 1);
/* open the output file, if needed */ /* open the output file, if needed */
if (!(fmt->flags & AVFMT_NOFILE)) { if (!(fmt->flags & AVFMT_NOFILE)) {
if (avio_open(&oc->pb, filename, AVIO_FLAG_WRITE) < 0) { if (avio_open(&oc->pb, filename, AVIO_FLAG_WRITE) < 0) {
@@ -486,20 +498,18 @@ int main(int argc, char **argv)
} }
} }
/* Write the stream header, if any. */ /* write the stream header, if any */
avformat_write_header(oc, NULL); av_write_header(oc);
picture->pts = 0; picture->pts = 0;
for(;;) { for(;;) {
/* Compute current audio and video time. */ /* compute current audio and video time */
if (audio_st) if (audio_st)
audio_pts = (double)audio_st->pts.val * audio_st->time_base.num / audio_st->time_base.den; audio_pts = (double)audio_st->pts.val * audio_st->time_base.num / audio_st->time_base.den;
else else
audio_pts = 0.0; audio_pts = 0.0;
if (video_st) if (video_st)
video_pts = (double)video_st->pts.val * video_st->time_base.num / video_pts = (double)video_st->pts.val * video_st->time_base.num / video_st->time_base.den;
video_st->time_base.den;
else else
video_pts = 0.0; video_pts = 0.0;
@@ -516,27 +526,28 @@ int main(int argc, char **argv)
} }
} }
/* Write the trailer, if any. The trailer must be written before you /* write the trailer, if any. the trailer must be written
* close the CodecContexts open when you wrote the header; otherwise * before you close the CodecContexts open when you wrote the
* av_write_trailer() may try to use memory that was freed on * header; otherwise write_trailer may try to use memory that
* av_codec_close(). */ * was freed on av_codec_close() */
av_write_trailer(oc); av_write_trailer(oc);
/* Close each codec. */ /* close each codec */
if (video_st) if (video_st)
close_video(oc, video_st); close_video(oc, video_st);
if (audio_st) if (audio_st)
close_audio(oc, audio_st); close_audio(oc, audio_st);
/* Free the streams. */ /* free the streams */
for(i = 0; i < oc->nb_streams; i++) { for(i = 0; i < oc->nb_streams; i++) {
av_freep(&oc->streams[i]->codec); av_freep(&oc->streams[i]->codec);
av_freep(&oc->streams[i]); av_freep(&oc->streams[i]);
} }
if (!(fmt->flags & AVFMT_NOFILE)) if (!(fmt->flags & AVFMT_NOFILE)) {
/* Close the output file. */ /* close the output file */
avio_close(oc->pb); avio_close(oc->pb);
}
/* free the stream */ /* free the stream */
av_free(oc); av_free(oc);

View File

@@ -166,11 +166,9 @@ the synchronisation of the samples directory.
@item THREADS @item THREADS
Specify how many threads to use while running regression tests, it is Specify how many threads to use while running regression tests, it is
quite useful to detect thread-related regressions. quite useful to detect thread-related regressions.
@item CPUFLAGS
Specify CPU flags.
@end table @end table
Example: Example:
@example @example
make V=1 SAMPLES=/var/fate/samples THREADS=2 CPUFLAGS=mmx fate make V=1 SAMPLES=/var/fate/samples THREADS=2 fate
@end example @end example

View File

@@ -143,7 +143,7 @@ Stop writing the output after its duration reaches @var{duration}.
@var{duration} may be a number in seconds, or in @code{hh:mm:ss[.xxx]} form. @var{duration} may be a number in seconds, or in @code{hh:mm:ss[.xxx]} form.
@item -fs @var{limit_size} (@emph{output}) @item -fs @var{limit_size} (@emph{output})
Set the file size limit, expressed in bytes. Set the file size limit.
@item -ss @var{position} (@emph{input/output}) @item -ss @var{position} (@emph{input/output})
When used as an input option (before @code{-i}), seeks in this input file to When used as an input option (before @code{-i}), seeks in this input file to
@@ -164,7 +164,7 @@ streams are delayed by @var{offset} seconds.
Set the recording timestamp in the container. Set the recording timestamp in the container.
The syntax for @var{time} is: The syntax for @var{time} is:
@example @example
now|([(YYYY-MM-DD|YYYYMMDD)[T|t| ]]((HH:MM:SS[.m...])|(HHMMSS[.m...]))[Z|z]) now|([(YYYY-MM-DD|YYYYMMDD)[T|t| ]]((HH[:MM[:SS[.m...]]])|(HH[MM[SS[.m...]]]))[Z|z])
@end example @end example
If the value is "now" it takes the current time. If the value is "now" it takes the current time.
Time is local time unless 'Z' or 'z' is appended, in which case it is Time is local time unless 'Z' or 'z' is appended, in which case it is
@@ -224,23 +224,12 @@ codec-dependent.
@var{filter_graph} is a description of the filter graph to apply to @var{filter_graph} is a description of the filter graph to apply to
the stream. Use @code{-filters} to show all the available filters the stream. Use @code{-filters} to show all the available filters
(including also sources and sinks). (including also sources and sinks).
See also the @option{-filter_complex} option if you want to create filter graphs
with multiple inputs and/or outputs.
@item -pre[:@var{stream_specifier}] @var{preset_name} (@emph{output,per-stream}) @item -pre[:@var{stream_specifier}] @var{preset_name} (@emph{output,per-stream})
Specify the preset for matching stream(s). Specify the preset for matching stream(s).
@item -stats (@emph{global}) @item -stats (@emph{global})
Print encoding progress/statistics. On by default. Print encoding progress/statistics. On by default.
@item -debug_ts (@emph{global})
Print timestamp information. It is off by default. This option is
mostly useful for testing and debugging purposes, and the output
format may change from one version to another, so it should not be
employed by portable scripts.
See also the option @code{-fdebug ts}.
@item -attach @var{filename} (@emph{output}) @item -attach @var{filename} (@emph{output})
Add an attachment to the output file. This is supported by a few formats Add an attachment to the output file. This is supported by a few formats
like Matroska for e.g. fonts used in rendering subtitles. Attachments like Matroska for e.g. fonts used in rendering subtitles. Attachments
@@ -282,10 +271,70 @@ attachments.
@item -vframes @var{number} (@emph{output}) @item -vframes @var{number} (@emph{output})
Set the number of video frames to record. This is an alias for @code{-frames:v}. Set the number of video frames to record. This is an alias for @code{-frames:v}.
@item -r[:@var{stream_specifier}] @var{fps} (@emph{input/output,per-stream}) @item -r[:@var{stream_specifier}] @var{fps} (@emph{input/output,per-stream})
Set frame rate (Hz value, fraction or abbreviation), (default = 25). For output Set frame rate (Hz value, fraction or abbreviation), (default = 25).
streams implies @code{-vsync cfr}.
@item -s[:@var{stream_specifier}] @var{size} (@emph{input/output,per-stream}) @item -s[:@var{stream_specifier}] @var{size} (@emph{input/output,per-stream})
Set frame size. The format is @samp{wxh} (default - same as source). Set frame size. The format is @samp{wxh} (default - same as source).
The following abbreviations are recognized:
@table @samp
@item sqcif
128x96
@item qcif
176x144
@item cif
352x288
@item 4cif
704x576
@item 16cif
1408x1152
@item qqvga
160x120
@item qvga
320x240
@item vga
640x480
@item svga
800x600
@item xga
1024x768
@item uxga
1600x1200
@item qxga
2048x1536
@item sxga
1280x1024
@item qsxga
2560x2048
@item hsxga
5120x4096
@item wvga
852x480
@item wxga
1366x768
@item wsxga
1600x1024
@item wuxga
1920x1200
@item woxga
2560x1600
@item wqsxga
3200x2048
@item wquxga
3840x2400
@item whsxga
6400x4096
@item whuxga
7680x4800
@item cga
320x200
@item ega
640x350
@item hd480
852x480
@item hd720
1280x720
@item hd1080
1920x1080
@end table
@item -aspect[:@var{stream_specifier}] @var{aspect} (@emph{output,per-stream}) @item -aspect[:@var{stream_specifier}] @var{aspect} (@emph{output,per-stream})
Set the video display aspect ratio specified by @var{aspect}. Set the video display aspect ratio specified by @var{aspect}.
@@ -312,7 +361,25 @@ pad=width:height:x:y:color instead.
@item -vn (@emph{output}) @item -vn (@emph{output})
Disable video recording. Disable video recording.
@item -bt @var{tolerance}
Set video bitrate tolerance (in bits, default 4000k).
Has a minimum value of: (target_bitrate/target_framerate).
In 1-pass mode, bitrate tolerance specifies how far ratecontrol is
willing to deviate from the target average bitrate value. This is
not related to min/max bitrate. Lowering tolerance too much has
an adverse effect on quality.
@item -maxrate @var{bitrate}
Set max video bitrate (in bit/s).
Requires -bufsize to be set.
@item -minrate @var{bitrate}
Set min video bitrate (in bit/s).
Most useful in setting up a CBR encode:
@example
ffmpeg -i myfile.avi -b:v 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v
@end example
It is of little use elsewise.
@item -bufsize @var{size}
Set video buffer verifier buffer size (in bits).
@item -vcodec @var{codec} (@emph{output}) @item -vcodec @var{codec} (@emph{output})
Set the video codec. This is an alias for @code{-codec:v}. Set the video codec. This is an alias for @code{-codec:v}.
@item -same_quant @item -same_quant
@@ -361,29 +428,202 @@ also sources and sinks). This is an alias for @code{-filter:v}.
@item -pix_fmt[:@var{stream_specifier}] @var{format} (@emph{input/output,per-stream}) @item -pix_fmt[:@var{stream_specifier}] @var{format} (@emph{input/output,per-stream})
Set pixel format. Use @code{-pix_fmts} to show all the supported Set pixel format. Use @code{-pix_fmts} to show all the supported
pixel formats. pixel formats.
If the selected pixel format can not be selected, ffmpeg will print a
warning and select the best pixel format supported by the encoder.
If @var{pix_fmt} is prefixed by a @code{+}, ffmpeg will exit with an error
if the requested pixel format can not be selected, and automatic conversions
inside filter graphs are disabled.
If @var{pix_fmt} is a single @code{+}, ffmpeg selects the same pixel format
as the input (or graph output) and automatic conversions are disabled.
@item -sws_flags @var{flags} (@emph{input/output}) @item -sws_flags @var{flags} (@emph{input/output})
Set SwScaler flags. Set SwScaler flags.
@item -g @var{gop_size}
Set the group of pictures size.
@item -intra
deprecated, use -g 1
@item -vdt @var{n} @item -vdt @var{n}
Discard threshold. Discard threshold.
@item -qmin @var{q}
minimum video quantizer scale (VBR)
@item -qmax @var{q}
maximum video quantizer scale (VBR)
@item -qdiff @var{q}
maximum difference between the quantizer scales (VBR)
@item -qblur @var{blur}
video quantizer scale blur (VBR) (range 0.0 - 1.0)
@item -qcomp @var{compression}
video quantizer scale compression (VBR) (default 0.5).
Constant of ratecontrol equation. Recommended range for default rc_eq: 0.0-1.0
@item -lmin @var{lambda}
minimum video lagrange factor (VBR)
@item -lmax @var{lambda}
max video lagrange factor (VBR)
@item -mblmin @var{lambda}
minimum macroblock quantizer scale (VBR)
@item -mblmax @var{lambda}
maximum macroblock quantizer scale (VBR)
These four options (lmin, lmax, mblmin, mblmax) use 'lambda' units,
but you may use the QP2LAMBDA constant to easily convert from 'q' units:
@example
ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
@end example
@item -rc_init_cplx @var{complexity}
initial complexity for single pass encoding
@item -b_qfactor @var{factor}
qp factor between P- and B-frames
@item -i_qfactor @var{factor}
qp factor between P- and I-frames
@item -b_qoffset @var{offset}
qp offset between P- and B-frames
@item -i_qoffset @var{offset}
qp offset between P- and I-frames
@item -rc_eq @var{equation}
Set rate control equation (see section "Expression Evaluation")
(default = @code{tex^qComp}).
When computing the rate control equation expression, besides the
standard functions defined in the section "Expression Evaluation", the
following functions are available:
@table @var
@item bits2qp(bits)
@item qp2bits(qp)
@end table
and the following constants are available:
@table @var
@item iTex
@item pTex
@item tex
@item mv
@item fCode
@item iCount
@item mcVar
@item var
@item isI
@item isP
@item isB
@item avgQP
@item qComp
@item avgIITex
@item avgPITex
@item avgPPTex
@item avgBPTex
@item avgTex
@end table
@item -rc_override[:@var{stream_specifier}] @var{override} (@emph{output,per-stream}) @item -rc_override[:@var{stream_specifier}] @var{override} (@emph{output,per-stream})
Rate control override for specific intervals, formatted as "int,int,int" Rate control override for specific intervals, formatted as "int,int,int"
list separated with slashes. Two first values are the beginning and list separated with slashes. Two first values are the beginning and
end frame numbers, last one is quantizer to use if positive, or quality end frame numbers, last one is quantizer to use if positive, or quality
factor if negative. factor if negative.
@item -me_method @var{method}
Set motion estimation method to @var{method}.
Available methods are (from lowest to best quality):
@table @samp
@item zero
Try just the (0, 0) vector.
@item phods
@item log
@item x1
@item hex
@item umh
@item epzs
(default method)
@item full
exhaustive search (slow and marginally better than epzs)
@end table
@item -dct_algo @var{algo}
Set DCT algorithm to @var{algo}. Available values are:
@table @samp
@item 0
FF_DCT_AUTO (default)
@item 1
FF_DCT_FASTINT
@item 2
FF_DCT_INT
@item 3
FF_DCT_MMX
@item 4
FF_DCT_MLIB
@item 5
FF_DCT_ALTIVEC
@end table
@item -idct_algo @var{algo}
Set IDCT algorithm to @var{algo}. Available values are:
@table @samp
@item 0
FF_IDCT_AUTO (default)
@item 1
FF_IDCT_INT
@item 2
FF_IDCT_SIMPLE
@item 3
FF_IDCT_SIMPLEMMX
@item 4
FF_IDCT_LIBMPEG2MMX
@item 5
FF_IDCT_PS2
@item 6
FF_IDCT_MLIB
@item 7
FF_IDCT_ARM
@item 8
FF_IDCT_ALTIVEC
@item 9
FF_IDCT_SH4
@item 10
FF_IDCT_SIMPLEARM
@end table
@item -er @var{n}
Set error resilience to @var{n}.
@table @samp
@item 1
FF_ER_CAREFUL (default)
@item 2
FF_ER_COMPLIANT
@item 3
FF_ER_AGGRESSIVE
@item 4
FF_ER_VERY_AGGRESSIVE
@end table
@item -ec @var{bit_mask}
Set error concealment to @var{bit_mask}. @var{bit_mask} is a bit mask of
the following values:
@table @samp
@item 1
FF_EC_GUESS_MVS (default = enabled)
@item 2
FF_EC_DEBLOCK (default = enabled)
@end table
@item -bf @var{frames}
Use 'frames' B-frames (supported for MPEG-1, MPEG-2 and MPEG-4).
@item -mbd @var{mode}
macroblock decision
@table @samp
@item 0
FF_MB_DECISION_SIMPLE: Use mb_cmp (cannot change it yet in ffmpeg).
@item 1
FF_MB_DECISION_BITS: Choose the one which needs the fewest bits.
@item 2
FF_MB_DECISION_RD: rate distortion
@end table
@item -4mv
Use four motion vector by macroblock (MPEG-4 only).
@item -part
Use data partitioning (MPEG-4 only).
@item -bug @var{param}
Work around encoder bugs that are not auto-detected.
@item -strict @var{strictness}
How strictly to follow the standards.
@item -aic
Enable Advanced intra coding (h263+).
@item -umv
Enable Unlimited Motion Vector (h263+)
@item -deinterlace @item -deinterlace
Deinterlace pictures. Deinterlace pictures.
This option is deprecated since the deinterlacing is very low quality.
Use the yadif filter with @code{-filter:v yadif}.
@item -ilme @item -ilme
Force interlacing support in encoder (MPEG-2 and MPEG-4 only). Force interlacing support in encoder (MPEG-2 and MPEG-4 only).
Use this option if your input file is interlaced and you want Use this option if your input file is interlaced and you want
@@ -442,11 +682,6 @@ Set the audio codec. This is an alias for @code{-codec:a}.
@item -sample_fmt[:@var{stream_specifier}] @var{sample_fmt} (@emph{output,per-stream}) @item -sample_fmt[:@var{stream_specifier}] @var{sample_fmt} (@emph{output,per-stream})
Set the audio sample format. Use @code{-sample_fmts} to get a list Set the audio sample format. Use @code{-sample_fmts} to get a list
of supported sample formats. of supported sample formats.
@item -af @var{filter_graph} (@emph{output})
@var{filter_graph} is a description of the filter graph to apply to
the input audio.
Use the option "-filters" to show all the available filters (including
also sources and sinks). This is an alias for @code{-filter:a}.
@end table @end table
@section Advanced Audio options: @section Advanced Audio options:
@@ -454,6 +689,28 @@ also sources and sinks). This is an alias for @code{-filter:a}.
@table @option @table @option
@item -atag @var{fourcc/tag} (@emph{output}) @item -atag @var{fourcc/tag} (@emph{output})
Force audio tag/fourcc. This is an alias for @code{-tag:a}. Force audio tag/fourcc. This is an alias for @code{-tag:a}.
@item -audio_service_type @var{type}
Set the type of service that the audio stream contains.
@table @option
@item ma
Main Audio Service (default)
@item ef
Effects
@item vi
Visually Impaired
@item hi
Hearing Impaired
@item di
Dialogue
@item co
Commentary
@item em
Emergency
@item vo
Voice Over
@item ka
Karaoke
@end table
@item -absf @var{bitstream_filter} @item -absf @var{bitstream_filter}
Deprecated, see -bsf Deprecated, see -bsf
@end table @end table
@@ -481,7 +738,7 @@ Synchronize read on input.
@section Advanced options @section Advanced options
@table @option @table @option
@item -map [-]@var{input_file_id}[:@var{stream_specifier}][,@var{sync_file_id}[:@var{stream_specifier}]] | @var{[linklabel]} (@emph{output}) @item -map [-]@var{input_file_id}[:@var{stream_specifier}][,@var{sync_file_id}[:@var{stream_specifier}]] (@emph{output})
Designate one or more input streams as a source for the output file. Each input Designate one or more input streams as a source for the output file. Each input
stream is identified by the input file index @var{input_file_id} and stream is identified by the input file index @var{input_file_id} and
@@ -497,10 +754,6 @@ the source for output stream 1, etc.
A @code{-} character before the stream identifier creates a "negative" mapping. A @code{-} character before the stream identifier creates a "negative" mapping.
It disables matching streams from already created mappings. It disables matching streams from already created mappings.
An alternative @var{[linklabel]} form will map outputs from complex filter
graphs (see the @option{-filter_complex} option) to the output file.
@var{linklabel} must correspond to a defined output link label in the graph.
For example, to map ALL streams from the first input file to output For example, to map ALL streams from the first input file to output
@example @example
ffmpeg -i INPUT -map 0 output ffmpeg -i INPUT -map 0 output
@@ -538,7 +791,7 @@ Note that using this option disables the default mappings for this output file.
@item -map_channel [@var{input_file_id}.@var{stream_specifier}.@var{channel_id}|-1][:@var{output_file_id}.@var{stream_specifier}] @item -map_channel [@var{input_file_id}.@var{stream_specifier}.@var{channel_id}|-1][:@var{output_file_id}.@var{stream_specifier}]
Map an audio channel from a given input to an output. If Map an audio channel from a given input to an output. If
@var{output_file_id}.@var{stream_specifier} is not set, the audio channel will @var{output_file_id}.@var{stream_specifier} are not set, the audio channel will
be mapped on all the audio streams. be mapped on all the audio streams.
Using "-1" instead of Using "-1" instead of
@@ -560,18 +813,18 @@ The order of the "-map_channel" option specifies the order of the channels in
the output stream. The output channel layout is guessed from the number of the output stream. The output channel layout is guessed from the number of
channels mapped (mono if one "-map_channel", stereo if two, etc.). Using "-ac" channels mapped (mono if one "-map_channel", stereo if two, etc.). Using "-ac"
in combination of "-map_channel" makes the channel gain levels to be updated if in combination of "-map_channel" makes the channel gain levels to be updated if
input and output channel layouts don't match (for instance two "-map_channel" channel layouts don't match (for instance two "-map_channel" options and "-ac
options and "-ac 6"). 6").
You can also extract each channel of an input to specific outputs; the following You can also extract each channel of an @var{INPUT} to specific outputs; the
command extracts two channels of the @var{INPUT} audio stream (file 0, stream 0) following command extract each channel of the audio stream (file 0, stream 0)
to the respective @var{OUTPUT_CH0} and @var{OUTPUT_CH1} outputs: to the respective @var{OUTPUT_CH0} and @var{OUTPUT_CH1}:
@example @example
ffmpeg -i INPUT -map_channel 0.0.0 OUTPUT_CH0 -map_channel 0.0.1 OUTPUT_CH1 ffmpeg -i INPUT -map_channel 0.0.0 OUTPUT_CH0 -map_channel 0.0.1 OUTPUT_CH1
@end example @end example
The following example splits the channels of a stereo input into two separate The following example split the channels of a stereo input into streams:
streams, which are put into the same output file:
@example @example
ffmpeg -i stereo.wav -map 0:0 -map 0:0 -map_channel 0.0.0:0.0 -map_channel 0.0.1:0.1 -y out.ogg ffmpeg -i stereo.wav -map 0:0 -map 0:0 -map_channel 0.0.0:0.0 -map_channel 0.0.1:0.1 -y out.ogg
@end example @end example
@@ -581,20 +834,9 @@ input stream; you can't for example use "-map_channel" to pick multiple input
audio channels contained in different streams (from the same or different files) audio channels contained in different streams (from the same or different files)
and merge them into a single output stream. It is therefore not currently and merge them into a single output stream. It is therefore not currently
possible, for example, to turn two separate mono streams into a single stereo possible, for example, to turn two separate mono streams into a single stereo
stream. However splitting a stereo stream into two single channel mono streams stream. However spliting a stereo stream into two single channel mono streams
is possible. is possible.
If you need this feature, a possible workaround is to use the @emph{amerge}
filter. For example, if you need to merge a media (here @file{input.mkv}) with 2
mono audio streams into one single stereo channel audio stream (and keep the
video stream), you can use the following command:
@example
ffmpeg -i input.mkv -f lavfi -i "
amovie=input.mkv:si=1 [a1];
amovie=input.mkv:si=2 [a2];
[a1][a2] amerge" -c:a pcm_s16le -c:v copy output.mkv
@end example
@item -map_metadata[:@var{metadata_spec_out}] @var{infile}[:@var{metadata_spec_in}] (@emph{output,per-metadata}) @item -map_metadata[:@var{metadata_spec_out}] @var{infile}[:@var{metadata_spec_in}] (@emph{output,per-metadata})
Set metadata information of the next output file from @var{infile}. Note that Set metadata information of the next output file from @var{infile}. Note that
those are file indices (zero-based), not filenames. those are file indices (zero-based), not filenames.
@@ -679,15 +921,14 @@ Show benchmarking information at the end of an encode.
Shows CPU time used and maximum memory consumption. Shows CPU time used and maximum memory consumption.
Maximum memory consumption is not supported on all systems, Maximum memory consumption is not supported on all systems,
it will usually display as 0 if not supported. it will usually display as 0 if not supported.
@item -benchmark_all (@emph{global})
Show benchmarking information during the encode.
Shows CPU time used in various steps (audio/video encode/decode).
@item -timelimit @var{duration} (@emph{global}) @item -timelimit @var{duration} (@emph{global})
Exit after ffmpeg has been running for @var{duration} seconds. Exit after ffmpeg has been running for @var{duration} seconds.
@item -dump (@emph{global}) @item -dump (@emph{global})
Dump each input packet to stderr. Dump each input packet to stderr.
@item -hex (@emph{global}) @item -hex (@emph{global})
When dumping packets, also dump the payload. When dumping packets, also dump the payload.
@item -ps @var{size}
Set RTP payload size in bytes.
@item -re (@emph{input}) @item -re (@emph{input})
Read input at native frame rate. Mainly used to simulate a grab device. Read input at native frame rate. Mainly used to simulate a grab device.
@item -loop_input @item -loop_input
@@ -698,10 +939,10 @@ This option is deprecated, use -loop 1.
Repeatedly loop output for formats that support looping such as animated GIF Repeatedly loop output for formats that support looping such as animated GIF
(0 will loop the output infinitely). (0 will loop the output infinitely).
This option is deprecated, use -loop. This option is deprecated, use -loop.
@item -threads @var{count}
Thread count.
@item -vsync @var{parameter} @item -vsync @var{parameter}
Video sync method. Video sync method.
For compatibility reasons old values can be specified as numbers.
Newly added values will have to be specified as strings always.
@table @option @table @option
@item 0, passthrough @item 0, passthrough
@@ -712,9 +953,6 @@ constant framerate.
@item 2, vfr @item 2, vfr
Frames are passed through with their timestamp or dropped so as to Frames are passed through with their timestamp or dropped so as to
prevent 2 frames from having the same timestamp. prevent 2 frames from having the same timestamp.
@item drop
As passthrough but destroys all timestamps, making the muxer generate
fresh timestamps based on frame-rate.
@item -1, auto @item -1, auto
Chooses between 1 and 2 depending on muxer capabilities. This is the Chooses between 1 and 2 depending on muxer capabilities. This is the
default method. default method.
@@ -729,33 +967,10 @@ Audio sync method. "Stretches/squeezes" the audio stream to match the timestamps
the parameter is the maximum samples per second by which the audio is changed. the parameter is the maximum samples per second by which the audio is changed.
-async 1 is a special case where only the start of the audio stream is corrected -async 1 is a special case where only the start of the audio stream is corrected
without any later correction. without any later correction.
This option has been deprecated. Use the @code{asyncts} audio filter instead.
@item -copyts @item -copyts
Copy timestamps from input to output. Copy timestamps from input to output.
@item -copytb @var{mode} @item -copytb
Specify how to set the encoder timebase when stream copying. @var{mode} is an Copy input stream time base from input to output when stream copying.
integer numeric value, and can assume one of the following values:
@table @option
@item 1
Use the demuxer timebase.
The time base is copied to the output encoder from the corresponding input
demuxer. This is sometimes required to avoid non monotonically increasing
timestamps when copying video streams with variable frame rate.
@item 0
Use the decoder timebase.
The time base is copied to the output encoder from the corresponding input
decoder.
@item -1
Try to make the choice automatically, in order to generate a sane output.
@end table
Default value is -1.
@item -shortest @item -shortest
Finish encoding when the shortest input stream ends. Finish encoding when the shortest input stream ends.
@item -dts_delta_threshold @item -dts_delta_threshold
@@ -781,10 +996,10 @@ Set bitstream filters for matching streams. @var{bistream_filters} is
a comma-separated list of bitstream filters. Use the @code{-bsfs} option a comma-separated list of bitstream filters. Use the @code{-bsfs} option
to get the list of bitstream filters. to get the list of bitstream filters.
@example @example
ffmpeg -i h264.mp4 -c:v copy -bsf:v h264_mp4toannexb -an out.h264 ffmpeg -i h264.mp4 -c:v copy -vbsf h264_mp4toannexb -an out.h264
@end example @end example
@example @example
ffmpeg -i file.mov -an -vn -bsf:s mov2textsub -c:s copy -f rawvideo sub.txt ffmpeg -i file.mov -an -vn -sbsf mov2textsub -c:s copy -f rawvideo sub.txt
@end example @end example
@item -tag[:@var{stream_specifier}] @var{codec_tag} (@emph{per-stream}) @item -tag[:@var{stream_specifier}] @var{codec_tag} (@emph{per-stream})
@@ -796,44 +1011,6 @@ Specify Timecode for writing. @var{SEP} is ':' for non drop timecode and ';'
@example @example
ffmpeg -i input.mpg -timecode 01:02:03.04 -r 30000/1001 -s ntsc output.mpg ffmpeg -i input.mpg -timecode 01:02:03.04 -r 30000/1001 -s ntsc output.mpg
@end example @end example
@item -filter_complex @var{filtergraph} (@emph{global})
Define a complex filter graph, i.e. one with arbitrary number of inputs and/or
outputs. For simple graphs -- those with one input and one output of the same
type -- see the @option{-filter} options. @var{filtergraph} is a description of
the filter graph, as described in @ref{Filtergraph syntax}.
Input link labels must refer to input streams using the
@code{[file_index:stream_specifier]} syntax (i.e. the same as @option{-map}
uses). If @var{stream_specifier} matches multiple streams, the first one will be
used. An unlabeled input will be connected to the first unused input stream of
the matching type.
Output link labels are referred to with @option{-map}. Unlabeled outputs are
added to the first output file.
For example, to overlay an image over video
@example
ffmpeg -i video.mkv -i image.png -filter_complex '[0:v][1:v]overlay[out]' -map
'[out]' out.mkv
@end example
Here @code{[0:v]} refers to the first video stream in the first input file,
which is linked to the first (main) input of the overlay filter. Similarly the
first video stream in the second input is linked to the second (overlay) input
of overlay.
Assuming there is only one video stream in each input file, we can omit input
labels, so the above is equivalent to
@example
ffmpeg -i video.mkv -i image.png -filter_complex 'overlay[out]' -map
'[out]' out.mkv
@end example
Furthermore we can omit the output label and the single output from the filter
graph will be added to the output file automatically, so we can simply write
@example
ffmpeg -i video.mkv -i image.png -filter_complex 'overlay' out.mkv
@end example
@end table @end table
@section Preset files @section Preset files
@@ -895,7 +1072,7 @@ frame rate or decrease the frame size.
@item @item
If your computer is not fast enough, you can speed up the If your computer is not fast enough, you can speed up the
compression at the expense of the compression ratio. You can use compression at the expense of the compression ratio. You can use
'-me zero' to speed up motion estimation, and '-g 0' to disable '-me zero' to speed up motion estimation, and '-intra' to disable
motion estimation completely (you have only I-frames, which means it motion estimation completely (you have only I-frames, which means it
is about as good as JPEG compression). is about as good as JPEG compression).
@@ -1084,18 +1261,6 @@ composed of three digits padded with zeroes to express the sequence
number. It is the same syntax supported by the C printf function, but number. It is the same syntax supported by the C printf function, but
only formats accepting a normal integer are suitable. only formats accepting a normal integer are suitable.
When importing an image sequence, -i also supports expanding shell-like
wildcard patterns (globbing) internally. To lower the chance of interfering
with your actual file names and the shell's glob expansion, you are required
to activate glob meta characters by prefixing them with a single @code{%}
character, like in @code{foo-%*.jpeg}, @code{foo-%?%?%?.jpeg} or
@code{foo-00%[234%]%*.jpeg}.
If your filename actually contains a character sequence of a @code{%} character
followed by a glob character, you must double the @code{%} character to escape
it. Imagine your files begin with @code{%?-foo-}, then you could use a glob
pattern like @code{%%?-foo-%*.jpeg}. For input patterns that could be both a
printf or a glob pattern, ffmpeg will assume it is a glob pattern.
@item @item
You can put many streams of the same type in the output: You can put many streams of the same type in the output:
@@ -1106,23 +1271,9 @@ ffmpeg -i test1.avi -i test2.avi -map 0.3 -map 0.2 -map 0.1 -map 0.0 -c copy tes
The resulting output file @file{test12.avi} will contain first four streams from The resulting output file @file{test12.avi} will contain first four streams from
the input file in reverse order. the input file in reverse order.
@item
To force CBR video output:
@example
ffmpeg -i myfile.avi -b 4000k -minrate 4000k -maxrate 4000k -bufsize 1835k out.m2v
@end example
@item
The four options lmin, lmax, mblmin and mblmax use 'lambda' units,
but you may use the QP2LAMBDA constant to easily convert from 'q' units:
@example
ffmpeg -i src.ext -lmax 21*QP2LAMBDA dst.ext
@end example
@end itemize @end itemize
@c man end EXAMPLES @c man end EXAMPLES
@include syntax.texi
@include eval.texi @include eval.texi
@include decoders.texi @include decoders.texi
@include encoders.texi @include encoders.texi

View File

@@ -29,7 +29,7 @@
\ / : \ / :
+======\======================/======+ ^ : +======\======================/======+ ^ :
------> 0 | : source_index : st-:--- | : : ------> 0 | : source_index : st-:--- | : :
OutputFile output_files[] / +------------------------------------+ : : OuputFile output_files[] / +------------------------------------+ : :
/ 1 | : : : | : : / 1 | : : : | : :
^ +------+------------+-----+ / +------------------------------------+ : : ^ +------+------------+-----+ / +------------------------------------+ : :
: | : ost_index -:-----:------/ 2 | : : : | : : : | : ost_index -:-----:------/ 2 | : : : | : :

View File

@@ -178,7 +178,6 @@ Seek to percentage in file corresponding to fraction of width.
@c man end @c man end
@include syntax.texi
@include eval.texi @include eval.texi
@include decoders.texi @include decoders.texi
@include demuxers.texi @include demuxers.texi

View File

@@ -106,11 +106,6 @@ stream.
All the container format information is printed within a section with All the container format information is printed within a section with
name "FORMAT". name "FORMAT".
@item -show_format_entry @var{name}
Like @option{-show_format}, but only prints the specified entry of the
container format information, rather than all. This option may be given more
than once, then all specified entries will be shown.
@item -show_packets @item -show_packets
Show information about each packet contained in the input multimedia Show information about each packet contained in the input multimedia
stream. stream.
@@ -132,14 +127,6 @@ multimedia stream.
Each media stream information is printed within a dedicated section Each media stream information is printed within a dedicated section
with name "STREAM". with name "STREAM".
@item -count_frames
Count the number of frames per stream and report it in the
corresponding stream section.
@item -count_packets
Count the number of packets per stream and report it in the
corresponding stream section.
@item -show_private_data, -private @item -show_private_data, -private
Show private data, that is data depending on the format of the Show private data, that is data depending on the format of the
particular shown element. particular shown element.
@@ -195,22 +182,6 @@ keyN=valN
Metadata tags are printed as a line in the corresponding FORMAT or Metadata tags are printed as a line in the corresponding FORMAT or
STREAM section, and are prefixed by the string "TAG:". STREAM section, and are prefixed by the string "TAG:".
This writer accepts options as a list of @var{key}=@var{value} pairs,
separated by ":".
A description of the accepted options follows.
@table @option
@item nokey, nk
If set to 1 specify not to print the key of each field. Default value
is 0.
@item noprint_wrappers, nw
If set to 1 specify not to print the section header and footer.
Default value is 0.
@end table
@section compact @section compact
Compact format. Compact format.
@@ -294,10 +265,6 @@ XML based format.
The XML output is described in the XML schema description file The XML output is described in the XML schema description file
@file{ffprobe.xsd} installed in the FFmpeg datadir. @file{ffprobe.xsd} installed in the FFmpeg datadir.
An updated version of the schema can be retrieved at the url
@url{http://www.ffmpeg.org/schema/ffprobe.xsd}, which redirects to the
latest schema committed into the FFmpeg development source code tree.
Note that the output issued will be compliant to the Note that the output issued will be compliant to the
@file{ffprobe.xsd} schema only when no special global output options @file{ffprobe.xsd} schema only when no special global output options
(@option{unit}, @option{prefix}, @option{byte_binary_prefix}, (@option{unit}, @option{prefix}, @option{byte_binary_prefix},
@@ -324,31 +291,26 @@ This option automatically sets @option{fully_qualified} to 1.
For more information about the XML format, see For more information about the XML format, see
@url{http://www.w3.org/XML/}. @url{http://www.w3.org/XML/}.
@c man end WRITERS
@chapter Timecode @chapter Timecode
@c man begin TIMECODE
@command{ffprobe} supports Timecode extraction: @command{ffprobe} supports Timecode extraction:
@itemize @itemize
@item @item MPEG1/2 timecode is extracted from the GOP, and is available in the video
MPEG1/2 timecode is extracted from the GOP, and is available in the video
stream details (@option{-show_streams}, see @var{timecode}). stream details (@option{-show_streams}, see @var{timecode}).
@item @item MOV timecode is extracted from tmcd track, so is available in the tmcd
MOV timecode is extracted from tmcd track, so is available in the tmcd
stream metadata (@option{-show_streams}, see @var{TAG:timecode}). stream metadata (@option{-show_streams}, see @var{TAG:timecode}).
@item @item DV and GXF timecodes are available in format metadata
DV and GXF timecodes are available in format metadata
(@option{-show_format}, see @var{TAG:timecode}). (@option{-show_format}, see @var{TAG:timecode}).
@end itemize @end itemize
@c man end TIMECODE
@include syntax.texi @c man end WRITERS
@include decoders.texi @include decoders.texi
@include demuxers.texi @include demuxers.texi
@include protocols.texi @include protocols.texi

View File

@@ -110,10 +110,7 @@
<xsd:attribute name="time_base" type="xsd:string" use="required"/> <xsd:attribute name="time_base" type="xsd:string" use="required"/>
<xsd:attribute name="start_time" type="xsd:float"/> <xsd:attribute name="start_time" type="xsd:float"/>
<xsd:attribute name="duration" type="xsd:float"/> <xsd:attribute name="duration" type="xsd:float"/>
<xsd:attribute name="bit_rate" type="xsd:int"/>
<xsd:attribute name="nb_frames" type="xsd:int"/> <xsd:attribute name="nb_frames" type="xsd:int"/>
<xsd:attribute name="nb_read_frames" type="xsd:int"/>
<xsd:attribute name="nb_read_packets" type="xsd:int"/>
</xsd:complexType> </xsd:complexType>
<xsd:complexType name="formatType"> <xsd:complexType name="formatType">

View File

@@ -373,3 +373,5 @@ ACL allow 192.168.0.0 192.168.255.255
<Redirect index.html> <Redirect index.html>
URL http://www.ffmpeg.org/ URL http://www.ffmpeg.org/
</Redirect> </Redirect>

View File

@@ -1,116 +0,0 @@
Filter design
=============
This document explains guidelines that should be observed (or ignored with
good reason) when writing filters for libavfilter.
In this document, the word “frame” indicates either a video frame or a group
of audio samples, as stored in an AVFilterBuffer structure.
Format negotiation
==================
The query_formats method should set, for each input and each output links,
the list supported formats.
For video links, that means pixel format. For audio links, that means
channel layout, and sample format (the sample packing is implied by the
sample format).
The lists are not just lists, they are references to shared objects. When
the negotiation mechanism computes the intersection of the formats
supported at each ends of a link, all references to both lists are
replaced with a reference to the intersection. And when a single format is
eventually chosen for a link amongst the remaining list, again, all
references to the list are updated.
That means that if a filter requires that its input and output have the
same format amongst a supported list, all it have to do is use a reference
to the same list of formats.
Buffer references ownership and permissions
===========================================
TODO
Frame scheduling
================
The purpose of these rules is to ensure that frames flow in the filter
graph without getting stuck and accumulating somewhere.
Simple filters that output one frame for each input frame should not have
to worry about it.
start_frame / filter_samples
----------------------------
These methods are called when a frame is pushed to the filter's input.
They can be called at any time except in a reentrant way.
If the input frame is enough to produce output, then the filter should
push the output frames on the output link immediately.
As an exception to the previous rule, if the input frame is enough to
produce several output frames, then the filter needs output only at
least one per link. The additional frames can be left buffered in the
filter; these buffered frames must be flushed immediately if a new input
produces new output.
(Example: framerate-doubling filter: start_frame must (1) flush the
second copy of the previous frame, if it is still there, (2) push the
first copy of the incoming frame, (3) keep the second copy for later.)
If the input frame is not enough to produce output, the filter must not
call request_frame to get more. It must just process the frame or queue
it. The task of requesting more frames is left to the filter's
request_frame method or the application.
If a filter has several inputs, the filter must be ready for frames
arriving randomly on any input. Therefore, any filter with several input
will most likely require some kind of queuing mechanism. It is perfectly
acceptable to have a limited queue and to drop frames when the inputs
are too unbalanced.
request_frame
-------------
This method is called when a frame is wanted on an output.
For an input, it should directly call start_frame or filter_samples on
the corresponding output.
For a filter, if there are queued frames already ready, one of these
frames should be pushed. If not, the filter should request a frame on
one of its input, repeatedly until at least one frame has been pushed.
Return values:
if request_frame could produce a frame, it should return 0;
if it could not for temporary reasons, it should return AVERROR(EAGAIN);
if it could not because there are no more frames, it should return
AVERROR_EOF.
The typical implementation of request_frame for a filter with several
inputs will look like that:
if (frames_queued) {
push_one_frame();
return 0;
}
while (!frame_pushed) {
input = input_where_a_frame_is_most_needed();
ret = avfilter_request_frame(input);
if (ret == AVERROR_EOF) {
process_eof_on_input();
} else if (ret < 0) {
return ret;
}
}
return 0;
Note that, except for filters that can have queued frames, request_frame
does not push frames: it requests them to its input, and as a reaction,
the start_frame / filter_samples method will be called and do the work.

File diff suppressed because it is too large Load Diff

View File

@@ -13,8 +13,7 @@
FFmpeg can be hooked up with a number of external libraries to add support FFmpeg can be hooked up with a number of external libraries to add support
for more formats. None of them are used by default, their use has to be for more formats. None of them are used by default, their use has to be
explicitly requested by passing the appropriate flags to explicitly requested by passing the appropriate flags to @file{./configure}.
@command{./configure}.
@section OpenJPEG @section OpenJPEG
@@ -144,8 +143,6 @@ library:
@tab Multimedia format used by Delphine Software games. @tab Multimedia format used by Delphine Software games.
@item CD+G @tab @tab X @item CD+G @tab @tab X
@tab Video format used by CD+G karaoke disks @tab Video format used by CD+G karaoke disks
@item Commodore CDXL @tab @tab X
@tab Amiga CD video format
@item Core Audio Format @tab X @tab X @item Core Audio Format @tab X @tab X
@tab Apple Core Audio Format @tab Apple Core Audio Format
@item CRC testing format @tab X @tab @item CRC testing format @tab X @tab
@@ -211,7 +208,6 @@ library:
@item MAXIS XA @tab @tab X @item MAXIS XA @tab @tab X
@tab Used in Sim City 3000; file extension .xa. @tab Used in Sim City 3000; file extension .xa.
@item MD Studio @tab @tab X @item MD Studio @tab @tab X
@item Metal Gear Solid: The Twin Snakes @tab @tab X
@item Mobotix .mxg @tab @tab X @item Mobotix .mxg @tab @tab X
@item Monkey's Audio @tab @tab X @item Monkey's Audio @tab @tab X
@item Motion Pixels MVI @tab @tab X @item Motion Pixels MVI @tab @tab X
@@ -353,7 +349,6 @@ library:
@item eXtended BINary text (XBIN) @tab @tab X @item eXtended BINary text (XBIN) @tab @tab X
@item YUV4MPEG pipe @tab X @tab X @item YUV4MPEG pipe @tab X @tab X
@item Psygnosis YOP @tab @tab X @item Psygnosis YOP @tab @tab X
@item ZeroCodec Lossless Video @tab @tab X
@end multitable @end multitable
@code{X} means that encoding (resp. decoding) is supported. @code{X} means that encoding (resp. decoding) is supported.
@@ -373,8 +368,6 @@ following image formats are supported:
@tab Microsoft BMP image @tab Microsoft BMP image
@item DPX @tab X @tab X @item DPX @tab X @tab X
@tab Digital Picture Exchange @tab Digital Picture Exchange
@item EXR @tab @tab X
@tab OpenEXR
@item JPEG @tab X @tab X @item JPEG @tab X @tab X
@tab Progressive JPEG is not supported. @tab Progressive JPEG is not supported.
@item JPEG 2000 @tab X @tab X @item JPEG 2000 @tab X @tab X
@@ -400,14 +393,12 @@ following image formats are supported:
@tab V.Flash PTX format @tab V.Flash PTX format
@item SGI @tab X @tab X @item SGI @tab X @tab X
@tab SGI RGB image format @tab SGI RGB image format
@item Sun Rasterfile @tab X @tab X @item Sun Rasterfile @tab @tab X
@tab Sun RAS image format @tab Sun RAS image format
@item TIFF @tab X @tab X @item TIFF @tab X @tab X
@tab YUV, JPEG and some extension is not supported yet. @tab YUV, JPEG and some extension is not supported yet.
@item Truevision Targa @tab X @tab X @item Truevision Targa @tab X @tab X
@tab Targa (.TGA) image format @tab Targa (.TGA) image format
@item XBM @tab X @tab X
@tab X BitMap image format
@item XWD @tab X @tab X @item XWD @tab X @tab X
@tab X Window Dump image format @tab X Window Dump image format
@end multitable @end multitable
@@ -453,8 +444,6 @@ following image formats are supported:
@tab fourcc: AVrp @tab fourcc: AVrp
@item AVS (Audio Video Standard) video @tab @tab X @item AVS (Audio Video Standard) video @tab @tab X
@tab Video encoding used by the Creature Shock game. @tab Video encoding used by the Creature Shock game.
@item AYUV @tab X @tab X
@tab Microsoft uncompressed packed 4:4:4:4
@item Beam Software VB @tab @tab X @item Beam Software VB @tab @tab X
@item Bethesda VID video @tab @tab X @item Bethesda VID video @tab @tab X
@tab Used in some games from Bethesda Softworks. @tab Used in some games from Bethesda Softworks.
@@ -469,8 +458,6 @@ following image formats are supported:
@tab fourcc: CSCD @tab fourcc: CSCD
@item CD+G @tab @tab X @item CD+G @tab @tab X
@tab Video codec for CD+G karaoke disks @tab Video codec for CD+G karaoke disks
@item CDXL @tab @tab X
@tab Amiga CD video codec
@item Chinese AVS video @tab E @tab X @item Chinese AVS video @tab E @tab X
@tab AVS1-P2, JiZhun profile, encoding through external library libxavs @tab AVS1-P2, JiZhun profile, encoding through external library libxavs
@item Delphine Software International CIN video @tab @tab X @item Delphine Software International CIN video @tab @tab X
@@ -483,7 +470,7 @@ following image formats are supported:
@item DFA @tab @tab X @item DFA @tab @tab X
@tab Codec used in Chronomaster game. @tab Codec used in Chronomaster game.
@item Dirac @tab E @tab X @item Dirac @tab E @tab X
@tab supported through external library libschroedinger @tab supported through external libdirac/libschroedinger libraries
@item Deluxe Paint Animation @tab @tab X @item Deluxe Paint Animation @tab @tab X
@item DNxHD @tab X @tab X @item DNxHD @tab X @tab X
@tab aka SMPTE VC3 @tab aka SMPTE VC3
@@ -504,13 +491,12 @@ following image formats are supported:
@item Escape 124 @tab @tab X @item Escape 124 @tab @tab X
@item Escape 130 @tab @tab X @item Escape 130 @tab @tab X
@item FFmpeg video codec #1 @tab X @tab X @item FFmpeg video codec #1 @tab X @tab X
@tab lossless codec (fourcc: FFV1) @tab experimental lossless codec (fourcc: FFV1)
@item Flash Screen Video v1 @tab X @tab X @item Flash Screen Video v1 @tab X @tab X
@tab fourcc: FSV1 @tab fourcc: FSV1
@item Flash Screen Video v2 @tab X @tab X @item Flash Screen Video v2 @tab X @tab X
@item Flash Video (FLV) @tab X @tab X @item Flash Video (FLV) @tab X @tab X
@tab Sorenson H.263 used in Flash @tab Sorenson H.263 used in Flash
@item Forward Uncompressed @tab @tab X
@item Fraps @tab @tab X @item Fraps @tab @tab X
@item H.261 @tab X @tab X @item H.261 @tab X @tab X
@item H.263 / H.263-1996 @tab X @tab X @item H.263 / H.263-1996 @tab X @tab X
@@ -626,7 +612,6 @@ following image formats are supported:
@item Ut Video @tab @tab X @item Ut Video @tab @tab X
@item v210 QuickTime uncompressed 4:2:2 10-bit @tab X @tab X @item v210 QuickTime uncompressed 4:2:2 10-bit @tab X @tab X
@item v308 QuickTime uncompressed 4:4:4 @tab X @tab X @item v308 QuickTime uncompressed 4:4:4 @tab X @tab X
@item v408 QuickTime uncompressed 4:4:4:4 @tab X @tab X
@item v410 QuickTime uncompressed 4:4:4 10-bit @tab X @tab X @item v410 QuickTime uncompressed 4:4:4 10-bit @tab X @tab X
@item VBLE Lossless Codec @tab @tab X @item VBLE Lossless Codec @tab @tab X
@item VMware Screen Codec / VMware Video @tab @tab X @item VMware Screen Codec / VMware Video @tab @tab X
@@ -796,7 +781,6 @@ following image formats are supported:
@tab Real 28800 bit/s codec @tab Real 28800 bit/s codec
@item RealAudio 3.0 (dnet) @tab IX @tab X @item RealAudio 3.0 (dnet) @tab IX @tab X
@tab Real low bitrate AC-3 codec @tab Real low bitrate AC-3 codec
@item RealAudio Lossless @tab @tab X
@item RealAudio SIPR / ACELP.NET @tab @tab X @item RealAudio SIPR / ACELP.NET @tab @tab X
@item Shorten @tab @tab X @item Shorten @tab @tab X
@item Sierra VMD audio @tab @tab X @item Sierra VMD audio @tab @tab X
@@ -819,7 +803,6 @@ following image formats are supported:
@item Westwood Audio (SND1) @tab @tab X @item Westwood Audio (SND1) @tab @tab X
@item Windows Media Audio 1 @tab X @tab X @item Windows Media Audio 1 @tab X @tab X
@item Windows Media Audio 2 @tab X @tab X @item Windows Media Audio 2 @tab X @tab X
@item Windows Media Audio Lossless @tab @tab X
@item Windows Media Audio Pro @tab @tab X @item Windows Media Audio Pro @tab @tab X
@item Windows Media Audio Voice @tab @tab X @item Windows Media Audio Voice @tab @tab X
@end multitable @end multitable
@@ -838,8 +821,7 @@ performance on systems without hardware floating point support).
@item SSA/ASS @tab X @tab X @tab X @tab X @item SSA/ASS @tab X @tab X @tab X @tab X
@item DVB @tab X @tab X @tab X @tab X @item DVB @tab X @tab X @tab X @tab X
@item DVD @tab X @tab X @tab X @tab X @item DVD @tab X @tab X @tab X @tab X
@item JACOsub @tab X @tab X @tab @tab X @item MicroDVD @tab X @tab X @tab @tab
@item MicroDVD @tab X @tab X @tab @tab X
@item PGS @tab @tab @tab @tab X @item PGS @tab @tab @tab @tab X
@item SubRip (SRT) @tab X @tab X @tab X @tab X @item SubRip (SRT) @tab X @tab X @tab X @tab X
@item XSUB @tab @tab @tab X @tab X @item XSUB @tab @tab @tab X @tab X
@@ -872,12 +854,11 @@ performance on systems without hardware floating point support).
@item ALSA @tab X @tab X @item ALSA @tab X @tab X
@item BKTR @tab X @tab @item BKTR @tab X @tab
@item DV1394 @tab X @tab @item DV1394 @tab X @tab
@item Linux framebuffer @tab X @tab
@item JACK @tab X @tab @item JACK @tab X @tab
@item LIBCDIO @tab X
@item LIBDC1394 @tab X @tab @item LIBDC1394 @tab X @tab
@item OSS @tab X @tab X @item OSS @tab X @tab X
@item Pulseaudio @tab X @tab @item Pulseaudio @tab X @tab
@item Video4Linux @tab X @tab
@item Video4Linux2 @tab X @tab @item Video4Linux2 @tab X @tab
@item VfW capture @tab X @tab @item VfW capture @tab X @tab
@item X11 grabbing @tab X @tab @item X11 grabbing @tab X @tab
@@ -893,7 +874,7 @@ performance on systems without hardware floating point support).
@item GXF @tab X @tab X @item GXF @tab X @tab X
@item MOV @tab X @tab @item MOV @tab X @tab
@item MPEG1/2 @tab X @tab X @item MPEG1/2 @tab X @tab X
@item MXF @tab X @tab X @item MXF @tab @tab X
@end multitable @end multitable
@bye @bye

View File

@@ -65,14 +65,6 @@ git clone git@@source.ffmpeg.org:ffmpeg <target>
This will put the FFmpeg sources into the directory @var{<target>} and let This will put the FFmpeg sources into the directory @var{<target>} and let
you push back your changes to the remote repository. you push back your changes to the remote repository.
Make sure that you do not have Windows line endings in your checkouts,
otherwise you may experience spurious compilation failures. One way to
achieve this is to run
@example
git config --global core.autocrlf false
@end example
@section Updating the source tree to the latest revision @section Updating the source tree to the latest revision

View File

@@ -59,7 +59,7 @@ BSD video input device.
Windows DirectShow input device. Windows DirectShow input device.
DirectShow support is enabled when FFmpeg is built with the mingw-w64 project. DirectShow support is enabled when FFmpeg is built with mingw-w64.
Currently only audio and video devices are supported. Currently only audio and video devices are supported.
Multiple devices may be opened as separate inputs, but they may also be Multiple devices may be opened as separate inputs, but they may also be
@@ -504,9 +504,9 @@ command:
ffmpeg -f sndio -i /dev/audio0 /tmp/oss.wav ffmpeg -f sndio -i /dev/audio0 /tmp/oss.wav
@end example @end example
@section video4linux2 @section video4linux and video4linux2
Video4Linux2 input video device. Video4Linux and Video4Linux2 input video devices.
The name of the device to grab is a file device node, usually Linux The name of the device to grab is a file device node, usually Linux
systems tend to automatically create such nodes when the device systems tend to automatically create such nodes when the device
@@ -514,28 +514,36 @@ systems tend to automatically create such nodes when the device
kind @file{/dev/video@var{N}}, where @var{N} is a number associated to kind @file{/dev/video@var{N}}, where @var{N} is a number associated to
the device. the device.
Video4Linux2 devices usually support a limited set of Video4Linux and Video4Linux2 devices only support a limited set of
@var{width}x@var{height} sizes and framerates. You can check which are @var{width}x@var{height} sizes and framerates. You can check which are
supported using @command{-list_formats all} for Video4Linux2 devices. supported for example with the command @command{dov4l} for Video4Linux
devices and using @command{-list_formats all} for Video4Linux2 devices.
Some usage examples of the video4linux2 devices with ffmpeg and ffplay: If the size for the device is set to 0x0, the input device will
try to auto-detect the size to use.
Only for the video4linux2 device, if the frame rate is set to 0/0 the
input device will use the frame rate value already set in the driver.
The time base for the timestamps is 1 microsecond. Depending on the kernel Video4Linux support is deprecated since Linux 2.6.30, and will be
version and configuration, the timestamps may be derived from the real time dropped in later versions.
clock (origin at the Unix Epoch) or the monotonic clock (origin usually at
boot time, unaffected by NTP or manual changes to the clock). The
@option{-timestamps abs} or @option{-ts abs} option can be used to force
conversion into the real time clock.
Note that if FFmpeg is build with v4l-utils support ("--enable-libv4l2" Note that if FFmpeg is build with v4l-utils support ("--enable-libv4l2"
option), it will always be used. option), it will always be used.
@example
# Grab and show the input of a video4linux2 device.
ffplay -f video4linux2 -framerate 30 -video_size hd720 /dev/video0
# Grab and record the input of a video4linux2 device, leave the Follow some usage examples of the video4linux devices with the ff*
framerate and size as previously set. tools.
ffmpeg -f video4linux2 -input_format mjpeg -i /dev/video0 out.mpeg @example
# Grab and show the input of a video4linux device, frame rate is set
# to the default of 25/1.
ffplay -s 320x240 -f video4linux /dev/video0
# Grab and show the input of a video4linux2 device, auto-adjust size.
ffplay -f video4linux2 /dev/video0
# Grab and record the input of a video4linux2 device, auto-adjust size,
# frame rate value defaults to 0/0 so it is read from the video4linux2
# driver.
ffmpeg -f video4linux2 -i /dev/video0 out.mpeg
@end example @end example
"v4l" and "v4l2" can be used as aliases for the respective "video4linux" and "v4l" and "v4l2" can be used as aliases for the respective "video4linux" and

View File

@@ -18,23 +18,6 @@ enabled muxers.
A description of some of the currently available muxers follows. A description of some of the currently available muxers follows.
@anchor{aiff}
@section aiff
Audio Interchange File Format muxer.
It accepts the following options:
@table @option
@item write_id3v2
Enable ID3v2 tags writing when set to 1. Default is 0 (disabled).
@item id3v2_version
Select ID3v2 version to write. Currently only version 3 and 4 (aka.
ID3v2.3 and ID3v2.4) are supported. The default is version 4.
@end table
@anchor{crc} @anchor{crc}
@section crc @section crc
@@ -73,37 +56,31 @@ See also the @ref{framecrc} muxer.
@anchor{framecrc} @anchor{framecrc}
@section framecrc @section framecrc
Per-packet CRC (Cyclic Redundancy Check) testing format. Per-frame CRC (Cyclic Redundancy Check) testing format.
This muxer computes and prints the Adler-32 CRC for each audio This muxer computes and prints the Adler-32 CRC for each decoded audio
and video packet. By default audio frames are converted to signed and video frame. By default audio frames are converted to signed
16-bit raw audio and video frames to raw video before computing the 16-bit raw audio and video frames to raw video before computing the
CRC. CRC.
The output of the muxer consists of a line for each audio and video The output of the muxer consists of a line for each audio and video
packet of the form: frame of the form: @var{stream_index}, @var{frame_dts},
@example @var{frame_size}, 0x@var{CRC}, where @var{CRC} is a hexadecimal
@var{stream_index}, @var{packet_dts}, @var{packet_pts}, @var{packet_duration}, @var{packet_size}, 0x@var{CRC} number 0-padded to 8 digits containing the CRC of the decoded frame.
@end example
@var{CRC} is a hexadecimal number 0-padded to 8 digits containing the For example to compute the CRC of each decoded frame in the input, and
CRC of the packet. store it in the file @file{out.crc}:
For example to compute the CRC of the audio and video frames in
@file{INPUT}, converted to raw audio and video packets, and store it
in the file @file{out.crc}:
@example @example
ffmpeg -i INPUT -f framecrc out.crc ffmpeg -i INPUT -f framecrc out.crc
@end example @end example
To print the information to stdout, use the command: You can print the CRC of each decoded frame to stdout with the command:
@example @example
ffmpeg -i INPUT -f framecrc - ffmpeg -i INPUT -f framecrc -
@end example @end example
With @command{ffmpeg}, you can select the output format to which the You can select the output format of each frame with @command{ffmpeg} by
audio and video frames are encoded before computing the CRC for each specifying the audio and video codec and format. For example, to
packet by specifying the audio and video codec. For example, to
compute the CRC of each decoded input audio frame converted to PCM compute the CRC of each decoded input audio frame converted to PCM
unsigned 8-bit and of each decoded input video frame converted to unsigned 8-bit and of each decoded input video frame converted to
MPEG-2 video, use the command: MPEG-2 video, use the command:
@@ -113,39 +90,6 @@ ffmpeg -i INPUT -c:a pcm_u8 -c:v mpeg2video -f framecrc -
See also the @ref{crc} muxer. See also the @ref{crc} muxer.
@anchor{framemd5}
@section framemd5
Per-packet MD5 testing format.
This muxer computes and prints the MD5 hash for each audio
and video packet. By default audio frames are converted to signed
16-bit raw audio and video frames to raw video before computing the
hash.
The output of the muxer consists of a line for each audio and video
packet of the form:
@example
@var{stream_index}, @var{packet_dts}, @var{packet_pts}, @var{packet_duration}, @var{packet_size}, @var{MD5}
@end example
@var{MD5} is a hexadecimal number representing the computed MD5 hash
for the packet.
For example to compute the MD5 of the audio and video frames in
@file{INPUT}, converted to raw audio and video packets, and store it
in the file @file{out.md5}:
@example
ffmpeg -i INPUT -f framemd5 out.md5
@end example
To print the information to stdout, use the command:
@example
ffmpeg -i INPUT -f framemd5 -
@end example
See also the @ref{md5} muxer.
@anchor{image2} @anchor{image2}
@section image2 @section image2
@@ -204,104 +148,18 @@ each of the YUV420P components. To read or write this image file format,
specify the name of the '.Y' file. The muxer will automatically open the specify the name of the '.Y' file. The muxer will automatically open the
'.U' and '.V' files as required. '.U' and '.V' files as required.
@anchor{md5} @section mov
@section md5
MD5 testing format. MOV / MP4 muxer
This muxer computes and prints the MD5 hash of all the input audio The muxer options are:
and video frames. By default audio frames are converted to signed
16-bit raw audio and video frames to raw video before computing the
hash.
The output of the muxer consists of a single line of the form:
MD5=@var{MD5}, where @var{MD5} is a hexadecimal number representing
the computed MD5 hash.
For example to compute the MD5 hash of the input converted to raw
audio and video, and store it in the file @file{out.md5}:
@example
ffmpeg -i INPUT -f md5 out.md5
@end example
You can print the MD5 to stdout with the command:
@example
ffmpeg -i INPUT -f md5 -
@end example
See also the @ref{framemd5} muxer.
@section MOV/MP4/ISMV
The mov/mp4/ismv muxer supports fragmentation. Normally, a MOV/MP4
file has all the metadata about all packets stored in one location
(written at the end of the file, it can be moved to the start for
better playback using the @command{qt-faststart} tool). A fragmented
file consists of a number of fragments, where packets and metadata
about these packets are stored together. Writing a fragmented
file has the advantage that the file is decodable even if the
writing is interrupted (while a normal MOV/MP4 is undecodable if
it is not properly finished), and it requires less memory when writing
very long files (since writing normal MOV/MP4 files stores info about
every single packet in memory until the file is closed). The downside
is that it is less compatible with other applications.
Fragmentation is enabled by setting one of the AVOptions that define
how to cut the file into fragments:
@table @option @table @option
@item -moov_size @var{bytes} @item -moov_size @var{bytes}
Reserves space for the moov atom at the beginning of the file instead of placing the Reserves space for the moov atom at the beginning of the file instead of placing the
moov atom at the end. If the space reserved is insufficient, muxing will fail. moov atom at the end. If the space reserved is insufficient, muxing will fail.
@item -movflags frag_keyframe
Start a new fragment at each video keyframe.
@item -frag_duration @var{duration}
Create fragments that are @var{duration} microseconds long.
@item -frag_size @var{size}
Create fragments that contain up to @var{size} bytes of payload data.
@item -movflags frag_custom
Allow the caller to manually choose when to cut fragments, by
calling @code{av_write_frame(ctx, NULL)} to write a fragment with
the packets written so far. (This is only useful with other
applications integrating libavformat, not from @command{ffmpeg}.)
@item -min_frag_duration @var{duration}
Don't create fragments that are shorter than @var{duration} microseconds long.
@end table @end table
If more than one condition is specified, fragments are cut when
one of the specified conditions is fulfilled. The exception to this is
@code{-min_frag_duration}, which has to be fulfilled for any of the other
conditions to apply.
Additionally, the way the output file is written can be adjusted
through a few other options:
@table @option
@item -movflags empty_moov
Write an initial moov atom directly at the start of the file, without
describing any samples in it. Generally, an mdat/moov pair is written
at the start of the file, as a normal MOV/MP4 file, containing only
a short portion of the file. With this option set, there is no initial
mdat atom, and the moov atom only describes the tracks but has
a zero duration.
Files written with this option set do not work in QuickTime.
This option is implicitly set when writing ismv (Smooth Streaming) files.
@item -movflags separate_moof
Write a separate moof (movie fragment) atom for each track. Normally,
packets for all tracks are written in a moof atom (which is slightly
more efficient), but with this option set, the muxer writes one moof/mdat
pair for each track, making it easier to separate tracks.
This option is implicitly set when writing ismv (Smooth Streaming) files.
@end table
Smooth Streaming content can be pushed in real time to a publishing
point on IIS with this muxer. Example:
@example
ffmpeg -re @var{<normal input/transcoding options>} -movflags isml+frag_keyframe -f ismv http://server/publishingpoint.isml/Streams(Encoder1)
@end example
@section mpegts @section mpegts
MPEG transport stream muxer. MPEG transport stream muxer.
@@ -452,47 +310,11 @@ Set segment duration to @var{t} seconds.
Generate also a listfile named @var{name}. Generate also a listfile named @var{name}.
@item segment_list_size @var{size} @item segment_list_size @var{size}
Overwrite the listfile once it reaches @var{size} entries. Overwrite the listfile once it reaches @var{size} entries.
@item segment_wrap @var{limit}
Wrap around segment index once it reaches @var{limit}.
@end table @end table
@example @example
ffmpeg -i in.mkv -c copy -map 0 -f segment -list out.list out%03d.nut ffmpeg -i in.mkv -c copy -map 0 -f segment -list out.list out%03d.nut
@end example @end example
@section mp3
The MP3 muxer writes a raw MP3 stream with an ID3v2 header at the beginning and
optionally an ID3v1 tag at the end. ID3v2.3 and ID3v2.4 are supported, the
@code{id3v2_version} option controls which one is used. The legacy ID3v1 tag is
not written by default, but may be enabled with the @code{write_id3v1} option.
For seekable output the muxer also writes a Xing frame at the beginning, which
contains the number of frames in the file. It is useful for computing duration
of VBR files.
The muxer supports writing ID3v2 attached pictures (APIC frames). The pictures
are supplied to the muxer in form of a video stream with a single packet. There
can be any number of those streams, each will correspond to a single APIC frame.
The stream metadata tags @var{title} and @var{comment} map to APIC
@var{description} and @var{picture type} respectively. See
@url{http://id3.org/id3v2.4.0-frames} for allowed picture types.
Note that the APIC frames must be written at the beginning, so the muxer will
buffer the audio frames until it gets all the pictures. It is therefore advised
to provide the pictures as soon as possible to avoid excessive buffering.
Examples:
Write an mp3 with an ID3v2.3 header and an ID3v1 footer:
@example
ffmpeg -i INPUT -id3v2_version 3 -write_id3v1 1 out.mp3
@end example
Attach a picture to an mp3:
@example
ffmpeg -i input.mp3 -i cover.png -c copy -metadata:s:v title="Album cover"
-metadata:s:v comment="Cover (Front)" out.mp3
@end example
@c man end MUXERS @c man end MUXERS

View File

@@ -27,11 +27,11 @@ to configure.
@section BSD @section BSD
BSD make will not build FFmpeg, you need to install and use GNU Make BSD make will not build FFmpeg, you need to install and use GNU Make
(@command{gmake}). (@file{gmake}).
@section (Open)Solaris @section (Open)Solaris
GNU Make is required to build FFmpeg, so you have to invoke (@command{gmake}), GNU Make is required to build FFmpeg, so you have to invoke (@file{gmake}),
standard Solaris Make will not work. When building with a non-c99 front-end standard Solaris Make will not work. When building with a non-c99 front-end
(gcc, generic suncc) add either @code{--extra-libs=/usr/lib/values-xpg6.o} (gcc, generic suncc) add either @code{--extra-libs=/usr/lib/values-xpg6.o}
or @code{--extra-libs=/usr/lib/64/values-xpg6.o} to the configure options or @code{--extra-libs=/usr/lib/64/values-xpg6.o} to the configure options
@@ -51,14 +51,15 @@ The toolchain provided with Xcode is sufficient to build the basic
unacelerated code. unacelerated code.
Mac OS X on PowerPC or ARM (iPhone) requires a preprocessor from Mac OS X on PowerPC or ARM (iPhone) requires a preprocessor from
@url{http://github.com/yuvi/gas-preprocessor} to build the optimized @url{https://github.com/FFmpeg/gas-preprocessor} or
assembler functions. Just download the Perl script and put it somewhere @url{https://github.com/yuvi/gas-preprocessor} to build the optimized
assembler functions. Put the Perl script somewhere
in your PATH, FFmpeg's configure will pick it up automatically. in your PATH, FFmpeg's configure will pick it up automatically.
Mac OS X on amd64 and x86 requires @command{yasm} to build most of the Mac OS X on amd64 and x86 requires @command{yasm} to build most of the
optimized assembler functions. @uref{http://www.finkproject.org/, Fink}, optimized assembler functions. @uref{http://www.finkproject.org/, Fink},
@uref{http://www.gentoo.org/proj/en/gentoo-alt/prefix/bootstrap-macos.xml, Gentoo Prefix}, @uref{http://www.gentoo.org/proj/en/gentoo-alt/prefix/bootstrap-macos.xml, Gentoo Prefix},
@uref{http://mxcl.github.com/homebrew/, Homebrew} @uref{https://mxcl.github.com/homebrew/, Homebrew}
or @uref{http://www.macports.org, MacPorts} can easily provide it. or @uref{http://www.macports.org, MacPorts} can easily provide it.
@@ -89,7 +90,7 @@ section and the FAQ.
FFmpeg does not build out-of-the-box with the packages the automated MinGW FFmpeg does not build out-of-the-box with the packages the automated MinGW
installer provides. It also requires coreutils to be installed and many other installer provides. It also requires coreutils to be installed and many other
packages updated to the latest version. The minimum versions for some packages packages updated to the latest version. The minimum version for some packages
are listed below: are listed below:
@itemize @itemize
@@ -109,11 +110,14 @@ Notes:
@item Building natively using MSYS can be sped up by disabling implicit rules @item Building natively using MSYS can be sped up by disabling implicit rules
in the Makefile by calling @code{make -r} instead of plain @code{make}. This in the Makefile by calling @code{make -r} instead of plain @code{make}. This
speed up is close to non-existent for normal one-off builds and is only speed up is close to non-existent for normal one-off builds and is only
noticeable when running make for a second time (for example during noticeable when running make for a second time (for example in
@code{make install}). @code{make install}).
@item In order to compile FFplay, you must have the MinGW development library @item In order to compile FFplay, you must have the MinGW development library
of @uref{http://www.libsdl.org/, SDL} and @code{pkg-config} installed. of @uref{http://www.libsdl.org/, SDL}.
Edit the @file{bin/sdl-config} script so that it points to the correct prefix
where SDL was installed. Verify that @file{sdl-config} can be launched from
the MSYS command line.
@item By using @code{./configure --enable-shared} when configuring FFmpeg, @item By using @code{./configure --enable-shared} when configuring FFmpeg,
you can build the FFmpeg libraries (e.g. libavutil, libavcodec, you can build the FFmpeg libraries (e.g. libavutil, libavcodec,
@@ -137,7 +141,7 @@ you might have to modify the procedures slightly.
@subsection Using static libraries @subsection Using static libraries
Assuming you have just built and installed FFmpeg in @file{/usr/local}: Assuming you have just built and installed FFmpeg in @file{/usr/local}.
@enumerate @enumerate
@@ -272,7 +276,7 @@ To create import libraries that work with the @code{/OPT:REF} option
@enumerate @enumerate
@item Open @emph{Visual Studio 2005 Command Prompt}. @item Open @file{Visual Studio 2005 Command Prompt}.
Alternatively, in a normal command line prompt, call @file{vcvars32.bat} Alternatively, in a normal command line prompt, call @file{vcvars32.bat}
which sets up the environment variables for the Visual C++ tools which sets up the environment variables for the Visual C++ tools
@@ -282,14 +286,17 @@ which sets up the environment variables for the Visual C++ tools
@item Enter the @file{bin} directory where the created LIB and DLL files @item Enter the @file{bin} directory where the created LIB and DLL files
are stored. are stored.
@item Generate new import libraries with @command{lib.exe}: @item Generate new import libraries with @file{lib.exe}:
@example @example
lib /machine:i386 /def:..\lib\foo-version.def /out:foo.lib lib /machine:i386 /def:..\lib\avcodec-53.def /out:avcodec.lib
lib /machine:i386 /def:..\lib\avdevice-53.def /out:avdevice.lib
lib /machine:i386 /def:..\lib\avfilter-2.def /out:avfilter.lib
lib /machine:i386 /def:..\lib\avformat-53.def /out:avformat.lib
lib /machine:i386 /def:..\lib\avutil-51.def /out:avutil.lib
lib /machine:i386 /def:..\lib\swscale-2.def /out:swscale.lib
@end example @end example
Replace @code{foo-version} and @code{foo} with the respective library names.
@end enumerate @end enumerate
@anchor{Cross compilation for Windows with Linux} @anchor{Cross compilation for Windows with Linux}
@@ -331,8 +338,8 @@ Then run
to make a static build. to make a static build.
To build shared libraries add a special compiler flag to work around current The current @code{gcc4-core} package is buggy and needs this flag to build
@code{gcc4-core} package bugs in addition to the normal configure flags: shared libraries:
@example @example
./configure --enable-shared --disable-static --extra-cflags=-fno-reorder-functions ./configure --enable-shared --disable-static --extra-cflags=-fno-reorder-functions
@@ -348,12 +355,16 @@ These library packages are only available from
@uref{http://sourceware.org/cygwinports/, Cygwin Ports}: @uref{http://sourceware.org/cygwinports/, Cygwin Ports}:
@example @example
yasm, libSDL-devel, libfaac-devel, libaacplus-devel, libgsm-devel, libmp3lame-devel, yasm, libSDL-devel, libdirac-devel, libfaac-devel, libaacplus-devel, libgsm-devel,
libschroedinger1.0-devel, speex-devel, libtheora-devel, libxvidcore-devel libmp3lame-devel, libschroedinger1.0-devel, speex-devel, libtheora-devel,
libxvidcore-devel
@end example @end example
The recommendation for x264 is to build it from source, as it evolves too The recommendation for libnut and x264 is to build them from source by
quickly for Cygwin Ports to be up to date. yourself, as they evolve too quickly for Cygwin Ports to be up to date.
Cygwin 1.7.x has IPv6 support. You can add IPv6 to Cygwin 1.5.x by means
of the @code{libgetaddrinfo-devel} package, available at Cygwin Ports.
@section Crosscompilation for Windows under Cygwin @section Crosscompilation for Windows under Cygwin

View File

@@ -1,125 +0,0 @@
/*
* Copyright (c) 2012 Anton Khirnov
*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
/*
* generate texinfo manpages for avoptions
*/
#include <stddef.h>
#include <string.h>
#include <float.h>
#include "libavformat/avformat.h"
#include "libavcodec/avcodec.h"
#include "libavutil/opt.h"
static void print_usage(void)
{
fprintf(stderr, "Usage: enum_options type\n"
"type: format codec\n");
exit(1);
}
static void print_option(const AVOption *opts, const AVOption *o, int per_stream)
{
printf("@item -%s%s @var{", o->name, per_stream ? "[:stream_specifier]" : "");
switch (o->type) {
case AV_OPT_TYPE_BINARY: printf("hexadecimal string"); break;
case AV_OPT_TYPE_STRING: printf("string"); break;
case AV_OPT_TYPE_INT:
case AV_OPT_TYPE_INT64: printf("integer"); break;
case AV_OPT_TYPE_FLOAT:
case AV_OPT_TYPE_DOUBLE: printf("float"); break;
case AV_OPT_TYPE_RATIONAL: printf("rational number"); break;
case AV_OPT_TYPE_FLAGS: printf("flags"); break;
default: printf("value"); break;
}
printf("} (@emph{");
if (o->flags & AV_OPT_FLAG_DECODING_PARAM) {
printf("input");
if (o->flags & AV_OPT_FLAG_ENCODING_PARAM)
printf("/");
}
if (o->flags & AV_OPT_FLAG_ENCODING_PARAM) printf("output");
if (o->flags & AV_OPT_FLAG_AUDIO_PARAM) printf(",audio");
if (o->flags & AV_OPT_FLAG_VIDEO_PARAM) printf(",video");
if (o->flags & AV_OPT_FLAG_SUBTITLE_PARAM) printf(",subtitles");
printf("})\n");
if (o->help)
printf("%s\n", o->help);
if (o->unit) {
const AVOption *u;
printf("\nPossible values:\n@table @samp\n");
for (u = opts; u->name; u++) {
if (u->type == AV_OPT_TYPE_CONST && u->unit && !strcmp(u->unit, o->unit))
printf("@item %s\n%s\n", u->name, u->help ? u->help : "");
}
printf("@end table\n");
}
}
static void show_opts(const AVOption *opts, int per_stream)
{
const AVOption *o;
printf("@table @option\n");
for (o = opts; o->name; o++) {
if (o->type != AV_OPT_TYPE_CONST)
print_option(opts, o, per_stream);
}
printf("@end table\n");
}
static void show_format_opts(void)
{
#include "libavformat/options_table.h"
printf("@section Format AVOptions\n");
show_opts(options, 0);
}
static void show_codec_opts(void)
{
#include "libavcodec/options_table.h"
printf("@section Codec AVOptions\n");
show_opts(options, 1);
}
int main(int argc, char **argv)
{
if (argc < 2)
print_usage();
printf("@c DO NOT EDIT THIS FILE!\n"
"@c It was generated by print_options.\n\n");
if (!strcmp(argv[1], "format"))
show_format_opts();
else if (!strcmp(argv[1], "codec"))
show_codec_opts();
else
print_usage();
return 0;
}

View File

@@ -19,34 +19,20 @@ supported protocols.
A description of the currently available protocols follows. A description of the currently available protocols follows.
@section bluray @section applehttp
Read BluRay playlist. Read Apple HTTP Live Streaming compliant segmented stream as
a uniform one. The M3U8 playlists describing the segments can be
remote HTTP resources or local files, accessed using the standard
file protocol.
HTTP is default, specific protocol can be declared by specifying
"+@var{proto}" after the applehttp URI scheme name, where @var{proto}
is either "file" or "http".
The accepted options are:
@table @option
@item angle
BluRay angle
@item chapter
Start chapter (1...N)
@item playlist
Playlist to read (BDMV/PLAYLIST/?????.mpls)
@end table
Examples:
Read longest playlist from BluRay mounted to /mnt/bluray:
@example @example
bluray:/mnt/bluray applehttp://host/path/to/remote/resource.m3u8
@end example applehttp+http://host/path/to/remote/resource.m3u8
applehttp+file://path/to/local/resource.m3u8
Read angle 2 of playlist 4 from BluRay mounted to /mnt/bluray, start from chapter 2:
@example
-playlist 4 -angle 2 -chapter 2 bluray:/mnt/bluray
@end example @end example
@section concat @section concat
@@ -95,26 +81,6 @@ specified with the name "FILE.mpeg" is interpreted as the URL
Gopher protocol. Gopher protocol.
@section hls
Read Apple HTTP Live Streaming compliant segmented stream as
a uniform one. The M3U8 playlists describing the segments can be
remote HTTP resources or local files, accessed using the standard
file protocol.
The nested protocol is declared by specifying
"+@var{proto}" after the hls URI scheme name, where @var{proto}
is either "file" or "http".
@example
hls+http://host/path/to/remote/resource.m3u8
hls+file://path/to/local/resource.m3u8
@end example
Using this protocol is discouraged - the hls demuxer should work
just as well (if not, please report the issues) and is more complete.
To use the hls demuxer instead, simply use the direct URLs to the
m3u8 files.
@section http @section http
HTTP (Hyper Text Transfer Protocol). HTTP (Hyper Text Transfer Protocol).
@@ -276,7 +242,7 @@ data transferred over RDT).
The muxer can be used to send a stream using RTSP ANNOUNCE to a server The muxer can be used to send a stream using RTSP ANNOUNCE to a server
supporting it (currently Darwin Streaming Server and Mischa Spiegelmock's supporting it (currently Darwin Streaming Server and Mischa Spiegelmock's
@uref{http://github.com/revmischa/rtsp-server, RTSP server}). @uref{https://github.com/revmischa/rtsp-server, RTSP server}).
The required syntax for a RTSP url is: The required syntax for a RTSP url is:
@example @example
@@ -318,9 +284,9 @@ Accept packets only from negotiated peer address and port.
@end table @end table
When receiving data over UDP, the demuxer tries to reorder received packets When receiving data over UDP, the demuxer tries to reorder received packets
(since they may arrive out of order, or packets may get lost totally). This (since they may arrive out of order, or packets may get lost totally). In
can be disabled by setting the maximum demuxing delay to zero (via order for this to be enabled, a maximum delay must be specified in the
the @code{max_delay} field of AVFormatContext). @code{max_delay} field of AVFormatContext.
When watching multi-bitrate Real-RTSP streams with @command{ffplay}, the When watching multi-bitrate Real-RTSP streams with @command{ffplay}, the
streams to display can be chosen with @code{-vst} @var{n} and streams to display can be chosen with @code{-vst} @var{n} and

View File

@@ -32,7 +32,7 @@ Special Converter v
Output Output
Planar/Packed convertion is done when needed during sample format convertion Planar/Packed convertion is done when needed during sample format convertion
Every step can be skipped without memcpy when its not needed. Every step can be skiped without memcpy when its not needed.
Either Resampling and Rematrixing can be performed first depending on which Either Resampling and Rematrixing can be performed first depending on which
way its faster. way its faster.
The Buffers are needed for resampling due to resamplng being a process that The Buffers are needed for resampling due to resamplng being a process that

View File

@@ -96,3 +96,4 @@ would benefit from it.
Also, as already hinted at, initFilter() accepts an optional convolutional Also, as already hinted at, initFilter() accepts an optional convolutional
filter as input that can be used for contrast, saturation, blur, sharpening filter as input that can be used for contrast, saturation, blur, sharpening
shift, chroma vs. luma shift, ... shift, chroma vs. luma shift, ...

View File

@@ -1,158 +0,0 @@
@chapter Syntax
@c man begin SYNTAX
When evaluating specific formats, FFmpeg uses internal library parsing
functions, shared by the tools. This section documents the syntax of
some of these formats.
@anchor{date syntax}
@section Date
The accepted syntax is:
@example
[(YYYY-MM-DD|YYYYMMDD)[T|t| ]]((HH:MM:SS[.m...]]])|(HHMMSS[.m...]]]))[Z]
now
@end example
If the value is "now" it takes the current time.
Time is local time unless Z is appended, in which case it is
interpreted as UTC.
If the year-month-day part is not specified it takes the current
year-month-day.
@anchor{time duration syntax}
@section Time duration
The accepted syntax is:
@example
[-]HH:MM:SS[.m...]
[-]S+[.m...]
@end example
@var{HH} expresses the number of hours, @var{MM} the number a of minutes
and @var{SS} the number of seconds.
@anchor{video size syntax}
@section Video size
Specify the size of the sourced video, it may be a string of the form
@var{width}x@var{height}, or the name of a size abbreviation.
The following abbreviations are recognized:
@table @samp
@item sqcif
128x96
@item qcif
176x144
@item cif
352x288
@item 4cif
704x576
@item 16cif
1408x1152
@item qqvga
160x120
@item qvga
320x240
@item vga
640x480
@item svga
800x600
@item xga
1024x768
@item uxga
1600x1200
@item qxga
2048x1536
@item sxga
1280x1024
@item qsxga
2560x2048
@item hsxga
5120x4096
@item wvga
852x480
@item wxga
1366x768
@item wsxga
1600x1024
@item wuxga
1920x1200
@item woxga
2560x1600
@item wqsxga
3200x2048
@item wquxga
3840x2400
@item whsxga
6400x4096
@item whuxga
7680x4800
@item cga
320x200
@item ega
640x350
@item hd480
852x480
@item hd720
1280x720
@item hd1080
1920x1080
@end table
@anchor{video rate syntax}
@section Video rate
Specify the frame rate of a video, expressed as the number of frames
generated per second. It has to be a string in the format
@var{frame_rate_num}/@var{frame_rate_den}, an integer number, a float
number or a valid video frame rate abbreviation.
The following abbreviations are recognized:
@table @samp
@item ntsc
30000/1001
@item pal
25/1
@item qntsc
30000/1
@item qpal
25/1
@item sntsc
30000/1
@item spal
25/1
@item film
24/1
@item ntsc-film
24000/1
@end table
@anchor{ratio syntax}
@section Ratio
A ratio can be expressed as an expression, or in the form
@var{numerator}:@var{denominator}.
Note that a ratio with infinite (1/0) or negative value is
considered valid, so you should check on the returned value if you
want to exclude those values.
The undefined value can be expressed using the "0:0" string.
@anchor{color syntax}
@section Color
It can be the name of a color (case insensitive match) or a
[0x|#]RRGGBB[AA] sequence, possibly followed by "@" and a string
representing the alpha component.
The alpha component may be a string composed by "0x" followed by an
hexadecimal number or a decimal number between 0.0 and 1.0, which
represents the opacity value (0x00/0.0 means completely transparent,
0xff/1.0 completely opaque).
If the alpha component is not specified then 0xff is assumed.
The string "random" will result in a random color.
@c man end SYNTAX

View File

@@ -1,4 +1,4 @@
#! /usr/bin/perl #! /usr/bin/perl -w
# Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc. # Copyright (C) 1999, 2000, 2001 Free Software Foundation, Inc.
@@ -23,13 +23,11 @@
# markup to Perl POD format. It's intended to be used to extract # markup to Perl POD format. It's intended to be used to extract
# something suitable for a manpage from a Texinfo document. # something suitable for a manpage from a Texinfo document.
use warnings;
$output = 0; $output = 0;
$skipping = 0; $skipping = 0;
%chapters = (); %sects = ();
@chapters_sequence = (); @sects_sequence = ();
$chapter = ""; $section = "";
@icstack = (); @icstack = ();
@endwstack = (); @endwstack = ();
@skstack = (); @skstack = ();
@@ -38,7 +36,7 @@ $shift = "";
%defs = (); %defs = ();
$fnno = 1; $fnno = 1;
$inf = ""; $inf = "";
@ibase = (); $ibase = "";
while ($_ = shift) { while ($_ = shift) {
if (/^-D(.*)$/) { if (/^-D(.*)$/) {
@@ -54,8 +52,6 @@ while ($_ = shift) {
die "flags may only contain letters, digits, hyphens, dashes and underscores\n" die "flags may only contain letters, digits, hyphens, dashes and underscores\n"
unless $flag =~ /^[a-zA-Z0-9_-]+$/; unless $flag =~ /^[a-zA-Z0-9_-]+$/;
$defs{$flag} = $value; $defs{$flag} = $value;
} elsif (/^-I(.*)$/) {
push @ibase, $1 ne "" ? $1 : shift;
} elsif (/^-/) { } elsif (/^-/) {
usage(); usage();
} else { } else {
@@ -65,12 +61,10 @@ while ($_ = shift) {
} }
} }
push @ibase, ".";
if (defined $in) { if (defined $in) {
$inf = gensym(); $inf = gensym();
open($inf, "<$in") or die "opening \"$in\": $!\n"; open($inf, "<$in") or die "opening \"$in\": $!\n";
push @ibase, $1 if $in =~ m|^(.+)/[^/]+$|; $ibase = $1 if $in =~ m|^(.+)/[^/]+$|;
} else { } else {
$inf = \*STDIN; $inf = \*STDIN;
} }
@@ -80,7 +74,7 @@ if (defined $out) {
} }
while(defined $inf) { while(defined $inf) {
INF: while(<$inf>) { while(<$inf>) {
# Certain commands are discarded without further processing. # Certain commands are discarded without further processing.
/^\@(?: /^\@(?:
[a-z]+index # @*index: useful only in complete manual [a-z]+index # @*index: useful only in complete manual
@@ -110,28 +104,23 @@ INF: while(<$inf>) {
push @instack, $inf; push @instack, $inf;
$inf = gensym(); $inf = gensym();
for (@ibase) { # Try cwd and $ibase.
open($inf, "<" . $_ . "/" . $1) and next INF; open($inf, "<" . $1)
} or open($inf, "<" . $ibase . "/" . $1)
die "cannot open $1: $!\n"; or die "cannot open $1 or $ibase/$1: $!\n";
};
/^\@chapter\s+([A-Za-z ]+)/ and do {
# close old chapter
$chapters{$chapter_name} .= postprocess($chapter) if ($chapter_name);
# start new chapter
$chapter_name = $1, push (@chapters_sequence, $chapter_name) unless $skipping;
$chapters{$chapter_name} = "" unless exists $chapters{$chapter_name};
$chapter = "";
$output = 1;
next; next;
}; };
/^\@bye/ and do { # Look for blocks surrounded by @c man begin SECTION ... @c man end.
# close old chapter # This really oughta be @ifman ... @end ifman and the like, but such
$chapters{$chapter_name} .= postprocess($chapter) if ($chapter_name); # would require rev'ing all other Texinfo translators.
last INF; /^\@c\s+man\s+begin\s+([A-Za-z ]+)/ and $sect = $1, push (@sects_sequence, $sect), $output = 1, next;
/^\@c\s+man\s+end/ and do {
$sects{$sect} = "" unless exists $sects{$sect};
$sects{$sect} .= postprocess($section);
$section = "";
$output = 0;
next;
}; };
# handle variables # handle variables
@@ -156,20 +145,20 @@ INF: while(<$inf>) {
# Ignore @end foo, where foo is not an operation which may # Ignore @end foo, where foo is not an operation which may
# cause us to skip, if we are presently skipping. # cause us to skip, if we are presently skipping.
my $ended = $1; my $ended = $1;
next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu|iftex|ifhtml|ifnothtml)$/; next if $skipping && $ended !~ /^(?:ifset|ifclear|ignore|menu|iftex)$/;
die "\@end $ended without \@$ended at line $.\n" unless defined $endw; die "\@end $ended without \@$ended at line $.\n" unless defined $endw;
die "\@$endw ended by \@end $ended at line $.\n" unless $ended eq $endw; die "\@$endw ended by \@end $ended at line $.\n" unless $ended eq $endw;
$endw = pop @endwstack; $endw = pop @endwstack;
if ($ended =~ /^(?:ifset|ifclear|ignore|menu|iftex|ifhtml|ifnothtml)$/) { if ($ended =~ /^(?:ifset|ifclear|ignore|menu|iftex)$/) {
$skipping = pop @skstack; $skipping = pop @skstack;
next; next;
} elsif ($ended =~ /^(?:example|smallexample|display)$/) { } elsif ($ended =~ /^(?:example|smallexample|display)$/) {
$shift = ""; $shift = "";
$_ = ""; # need a paragraph break $_ = ""; # need a paragraph break
} elsif ($ended =~ /^(?:itemize|enumerate|(?:multi|[fv])?table)$/) { } elsif ($ended =~ /^(?:itemize|enumerate|[fv]?table)$/) {
$_ = "\n=back\n"; $_ = "\n=back\n";
$ic = pop @icstack; $ic = pop @icstack;
} else { } else {
@@ -196,11 +185,11 @@ INF: while(<$inf>) {
next; next;
}; };
/^\@(ignore|menu|iftex|ifhtml|ifnothtml)\b/ and do { /^\@(ignore|menu|iftex)\b/ and do {
push @endwstack, $endw; push @endwstack, $endw;
push @skstack, $skipping; push @skstack, $skipping;
$endw = $1; $endw = $1;
$skipping = $endw !~ /ifnothtml/; $skipping = 1;
next; next;
}; };
@@ -217,6 +206,7 @@ INF: while(<$inf>) {
s/\@TeX\{\}/TeX/g; s/\@TeX\{\}/TeX/g;
s/\@pounds\{\}/\#/g; s/\@pounds\{\}/\#/g;
s/\@minus(?:\{\})?/-/g; s/\@minus(?:\{\})?/-/g;
s/\\,/,/g;
# Now the ones that have to be replaced by special escapes # Now the ones that have to be replaced by special escapes
# (which will be turned back into text by unmunge()) # (which will be turned back into text by unmunge())
@@ -269,16 +259,15 @@ INF: while(<$inf>) {
$endw = "enumerate"; $endw = "enumerate";
}; };
/^\@((?:multi|[fv])?table)\s+(\@[a-z]+)/ and do { /^\@([fv]?table)\s+(\@[a-z]+)/ and do {
push @endwstack, $endw; push @endwstack, $endw;
push @icstack, $ic; push @icstack, $ic;
$endw = $1; $endw = $1;
$ic = $2; $ic = $2;
$ic =~ s/\@(?:samp|strong|key|gcctabopt|option|env|command)/B/; $ic =~ s/\@(?:samp|strong|key|gcctabopt|option|env)/B/;
$ic =~ s/\@(?:code|kbd)/C/; $ic =~ s/\@(?:code|kbd)/C/;
$ic =~ s/\@(?:dfn|var|emph|cite|i)/I/; $ic =~ s/\@(?:dfn|var|emph|cite|i)/I/;
$ic =~ s/\@(?:file)/F/; $ic =~ s/\@(?:file)/F/;
$ic =~ s/\@(?:columnfractions)//;
$_ = "\n=over 4\n"; $_ = "\n=over 4\n";
}; };
@@ -289,21 +278,6 @@ INF: while(<$inf>) {
$_ = ""; # need a paragraph break $_ = ""; # need a paragraph break
}; };
/^\@item\s+(.*\S)\s*$/ and $endw eq "multitable" and do {
my $columns = $1;
$columns =~ s/\@tab/ : /;
$_ = "\n=item B&LT;". $columns ."&GT;\n";
};
/^\@tab\s+(.*\S)\s*$/ and $endw eq "multitable" and do {
my $columns = $1;
$columns =~ s/\@tab/ : /;
$_ = " : ". $columns;
$chapter =~ s/\n+\s+$//;
};
/^\@itemx?\s*(.+)?$/ and do { /^\@itemx?\s*(.+)?$/ and do {
if (defined $1) { if (defined $1) {
# Entity escapes prevent munging by the <> processing below. # Entity escapes prevent munging by the <> processing below.
@@ -315,7 +289,7 @@ INF: while(<$inf>) {
} }
}; };
$chapter .= $shift.$_."\n"; $section .= $shift.$_."\n";
} }
# End of current file. # End of current file.
close($inf); close($inf);
@@ -324,15 +298,16 @@ $inf = pop @instack;
die "No filename or title\n" unless defined $fn && defined $tl; die "No filename or title\n" unless defined $fn && defined $tl;
$chapters{NAME} = "$fn \- $tl\n"; $sects{NAME} = "$fn \- $tl\n";
$chapters{FOOTNOTES} .= "=back\n" if exists $chapters{FOOTNOTES}; $sects{FOOTNOTES} .= "=back\n" if exists $sects{FOOTNOTES};
unshift @chapters_sequence, "NAME"; unshift @sects_sequence, "NAME";
for $chapter (@chapters_sequence) { for $sect (@sects_sequence) {
if (exists $chapters{$chapter}) { if(exists $sects{$sect}) {
$head = uc($chapter); $head = $sect;
$head =~ s/SEEALSO/SEE ALSO/;
print "=head1 $head\n\n"; print "=head1 $head\n\n";
print scalar unmunge ($chapters{$chapter}); print scalar unmunge ($sects{$sect});
print "\n"; print "\n";
} }
} }
@@ -377,7 +352,6 @@ sub postprocess
s/\(?\@xref\{(?:[^\}]*)\}(?:[^.<]|(?:<[^<>]*>))*\.\)?//g; s/\(?\@xref\{(?:[^\}]*)\}(?:[^.<]|(?:<[^<>]*>))*\.\)?//g;
s/\s+\(\@pxref\{(?:[^\}]*)\}\)//g; s/\s+\(\@pxref\{(?:[^\}]*)\}\)//g;
s/;\s+\@pxref\{(?:[^\}]*)\}//g; s/;\s+\@pxref\{(?:[^\}]*)\}//g;
s/\@ref\{(?:[^,\}]*,)(?:[^,\}]*,)([^,\}]*).*\}/$1/g;
s/\@ref\{([^\}]*)\}/$1/g; s/\@ref\{([^\}]*)\}/$1/g;
s/\@noindent\s*//g; s/\@noindent\s*//g;
s/\@refill//g; s/\@refill//g;
@@ -387,7 +361,7 @@ sub postprocess
# @uref can take one, two, or three arguments, with different # @uref can take one, two, or three arguments, with different
# semantics each time. @url and @email are just like @uref with # semantics each time. @url and @email are just like @uref with
# one argument, for our purposes. # one argument, for our purposes.
s/\@(?:uref|url|email)\{([^\},]*),?[^\}]*\}/&lt;B<$1>&gt;/g; s/\@(?:uref|url|email)\{([^\},]*)\}/&lt;B<$1>&gt;/g;
s/\@uref\{([^\},]*),([^\},]*)\}/$2 (C<$1>)/g; s/\@uref\{([^\},]*),([^\},]*)\}/$2 (C<$1>)/g;
s/\@uref\{([^\},]*),([^\},]*),([^\},]*)\}/$3/g; s/\@uref\{([^\},]*),([^\},]*),([^\},]*)\}/$3/g;
@@ -431,13 +405,13 @@ sub unmunge
sub add_footnote sub add_footnote
{ {
unless (exists $chapters{FOOTNOTES}) { unless (exists $sects{FOOTNOTES}) {
$chapters{FOOTNOTES} = "\n=over 4\n\n"; $sects{FOOTNOTES} = "\n=over 4\n\n";
} }
$chapters{FOOTNOTES} .= "=item $fnno.\n\n"; $fnno++; $sects{FOOTNOTES} .= "=item $fnno.\n\n"; $fnno++;
$chapters{FOOTNOTES} .= $_[0]; $sects{FOOTNOTES} .= $_[0];
$chapters{FOOTNOTES} .= "\n\n"; $sects{FOOTNOTES} .= "\n\n";
} }
# stolen from Symbol.pm # stolen from Symbol.pm

View File

@@ -107,3 +107,4 @@ one with score 3)
Author: Michael niedermayer Author: Michael niedermayer
Copyright LGPL Copyright LGPL

3214
ffmpeg.c

File diff suppressed because it is too large Load Diff

273
ffplay.c
View File

@@ -40,6 +40,7 @@
#include "libavformat/avformat.h" #include "libavformat/avformat.h"
#include "libavdevice/avdevice.h" #include "libavdevice/avdevice.h"
#include "libswscale/swscale.h" #include "libswscale/swscale.h"
#include "libavcodec/audioconvert.h"
#include "libavutil/opt.h" #include "libavutil/opt.h"
#include "libavcodec/avfft.h" #include "libavcodec/avfft.h"
#include "libswresample/swresample.h" #include "libswresample/swresample.h"
@@ -63,6 +64,7 @@ const char program_name[] = "ffplay";
const int program_birth_year = 2003; const int program_birth_year = 2003;
#define MAX_QUEUE_SIZE (15 * 1024 * 1024) #define MAX_QUEUE_SIZE (15 * 1024 * 1024)
#define MIN_AUDIOQ_SIZE (20 * 16 * 1024)
#define MIN_FRAMES 5 #define MIN_FRAMES 5
/* SDL audio buffer size, in samples. Should be small to have precise /* SDL audio buffer size, in samples. Should be small to have precise
@@ -104,7 +106,6 @@ typedef struct VideoPicture {
int skip; int skip;
SDL_Overlay *bmp; SDL_Overlay *bmp;
int width, height; /* source height & width */ int width, height; /* source height & width */
AVRational sample_aspect_ratio;
int allocated; int allocated;
int reallocate; int reallocate;
enum PixelFormat pix_fmt; enum PixelFormat pix_fmt;
@@ -132,7 +133,6 @@ typedef struct VideoState {
AVInputFormat *iformat; AVInputFormat *iformat;
int no_background; int no_background;
int abort_request; int abort_request;
int force_refresh;
int paused; int paused;
int last_paused; int last_paused;
int seek_req; int seek_req;
@@ -232,14 +232,8 @@ typedef struct VideoState {
#endif #endif
int refresh; int refresh;
int last_video_stream, last_audio_stream, last_subtitle_stream;
} VideoState; } VideoState;
typedef struct AllocEventProps {
VideoState *is;
AVFrame *frame;
} AllocEventProps;
static int opt_help(const char *opt, const char *arg); static int opt_help(const char *opt, const char *arg);
/* options specified by the user */ /* options specified by the user */
@@ -304,11 +298,12 @@ void av_noreturn exit_program(int ret)
exit(ret); exit(ret);
} }
static int packet_queue_put_private(PacketQueue *q, AVPacket *pkt) static int packet_queue_put(PacketQueue *q, AVPacket *pkt)
{ {
AVPacketList *pkt1; AVPacketList *pkt1;
if (q->abort_request) /* duplicate the packet */
if (pkt != &flush_pkt && av_dup_packet(pkt) < 0)
return -1; return -1;
pkt1 = av_malloc(sizeof(AVPacketList)); pkt1 = av_malloc(sizeof(AVPacketList));
@@ -317,7 +312,11 @@ static int packet_queue_put_private(PacketQueue *q, AVPacket *pkt)
pkt1->pkt = *pkt; pkt1->pkt = *pkt;
pkt1->next = NULL; pkt1->next = NULL;
SDL_LockMutex(q->mutex);
if (!q->last_pkt) if (!q->last_pkt)
q->first_pkt = pkt1; q->first_pkt = pkt1;
else else
q->last_pkt->next = pkt1; q->last_pkt->next = pkt1;
@@ -326,25 +325,9 @@ static int packet_queue_put_private(PacketQueue *q, AVPacket *pkt)
q->size += pkt1->pkt.size + sizeof(*pkt1); q->size += pkt1->pkt.size + sizeof(*pkt1);
/* XXX: should duplicate packet data in DV case */ /* XXX: should duplicate packet data in DV case */
SDL_CondSignal(q->cond); SDL_CondSignal(q->cond);
return 0;
}
static int packet_queue_put(PacketQueue *q, AVPacket *pkt)
{
int ret;
/* duplicate the packet */
if (pkt != &flush_pkt && av_dup_packet(pkt) < 0)
return -1;
SDL_LockMutex(q->mutex);
ret = packet_queue_put_private(q, pkt);
SDL_UnlockMutex(q->mutex); SDL_UnlockMutex(q->mutex);
return 0;
if (pkt != &flush_pkt && ret < 0)
av_free_packet(pkt);
return ret;
} }
/* packet queue handling */ /* packet queue handling */
@@ -353,7 +336,7 @@ static void packet_queue_init(PacketQueue *q)
memset(q, 0, sizeof(PacketQueue)); memset(q, 0, sizeof(PacketQueue));
q->mutex = SDL_CreateMutex(); q->mutex = SDL_CreateMutex();
q->cond = SDL_CreateCond(); q->cond = SDL_CreateCond();
q->abort_request = 1; packet_queue_put(q, &flush_pkt);
} }
static void packet_queue_flush(PacketQueue *q) static void packet_queue_flush(PacketQueue *q)
@@ -373,7 +356,7 @@ static void packet_queue_flush(PacketQueue *q)
SDL_UnlockMutex(q->mutex); SDL_UnlockMutex(q->mutex);
} }
static void packet_queue_destroy(PacketQueue *q) static void packet_queue_end(PacketQueue *q)
{ {
packet_queue_flush(q); packet_queue_flush(q);
SDL_DestroyMutex(q->mutex); SDL_DestroyMutex(q->mutex);
@@ -391,14 +374,6 @@ static void packet_queue_abort(PacketQueue *q)
SDL_UnlockMutex(q->mutex); SDL_UnlockMutex(q->mutex);
} }
static void packet_queue_start(PacketQueue *q)
{
SDL_LockMutex(q->mutex);
q->abort_request = 0;
packet_queue_put_private(q, &flush_pkt);
SDL_UnlockMutex(q->mutex);
}
/* return < 0 if aborted, 0 if no packet and > 0 if packet. */ /* return < 0 if aborted, 0 if no packet and > 0 if packet. */
static int packet_queue_get(PacketQueue *q, AVPacket *pkt, int block) static int packet_queue_get(PacketQueue *q, AVPacket *pkt, int block)
{ {
@@ -692,11 +667,21 @@ static void video_image_display(VideoState *is)
vp = &is->pictq[is->pictq_rindex]; vp = &is->pictq[is->pictq_rindex];
if (vp->bmp) { if (vp->bmp) {
if (vp->sample_aspect_ratio.num == 0) #if CONFIG_AVFILTER
if (vp->picref->video->sample_aspect_ratio.num == 0)
aspect_ratio = 0; aspect_ratio = 0;
else else
aspect_ratio = av_q2d(vp->sample_aspect_ratio); aspect_ratio = av_q2d(vp->picref->video->sample_aspect_ratio);
#else
/* XXX: use variable in the frame */
if (is->video_st->sample_aspect_ratio.num)
aspect_ratio = av_q2d(is->video_st->sample_aspect_ratio);
else if (is->video_st->codec->sample_aspect_ratio.num)
aspect_ratio = av_q2d(is->video_st->codec->sample_aspect_ratio);
else
aspect_ratio = 0;
#endif
if (aspect_ratio <= 0.0) if (aspect_ratio <= 0.0)
aspect_ratio = 1.0; aspect_ratio = 1.0;
aspect_ratio *= (float)vp->width / (float)vp->height; aspect_ratio *= (float)vp->width / (float)vp->height;
@@ -882,7 +867,6 @@ static void video_audio_display(VideoState *s)
} }
} }
SDL_UpdateRect(screen, s->xpos, s->ytop, 1, s->height); SDL_UpdateRect(screen, s->xpos, s->ytop, 1, s->height);
if (!s->paused)
s->xpos++; s->xpos++;
if (s->xpos >= s->width) if (s->xpos >= s->width)
s->xpos= s->xleft; s->xpos= s->xleft;
@@ -897,9 +881,6 @@ static void stream_close(VideoState *is)
is->abort_request = 1; is->abort_request = 1;
SDL_WaitThread(is->read_tid, NULL); SDL_WaitThread(is->read_tid, NULL);
SDL_WaitThread(is->refresh_tid, NULL); SDL_WaitThread(is->refresh_tid, NULL);
packet_queue_destroy(&is->videoq);
packet_queue_destroy(&is->audioq);
packet_queue_destroy(&is->subtitleq);
/* free all pictures */ /* free all pictures */
for (i = 0; i < VIDEO_PICTURE_QUEUE_SIZE; i++) { for (i = 0; i < VIDEO_PICTURE_QUEUE_SIZE; i++) {
@@ -953,7 +934,6 @@ static int video_open(VideoState *is, int force_set_video_mode)
{ {
int flags = SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL; int flags = SDL_HWSURFACE | SDL_ASYNCBLIT | SDL_HWACCEL;
int w,h; int w,h;
VideoPicture *vp = &is->pictq[is->pictq_rindex];
if (is_full_screen) flags |= SDL_FULLSCREEN; if (is_full_screen) flags |= SDL_FULLSCREEN;
else flags |= SDL_RESIZABLE; else flags |= SDL_RESIZABLE;
@@ -964,9 +944,15 @@ static int video_open(VideoState *is, int force_set_video_mode)
} else if (!is_full_screen && screen_width) { } else if (!is_full_screen && screen_width) {
w = screen_width; w = screen_width;
h = screen_height; h = screen_height;
} else if (vp->width) { #if CONFIG_AVFILTER
w = vp->width; } else if (is->out_video_filter && is->out_video_filter->inputs[0]) {
h = vp->height; w = is->out_video_filter->inputs[0]->w;
h = is->out_video_filter->inputs[0]->h;
#else
} else if (is->video_st && is->video_st->codec->width) {
w = is->video_st->codec->width;
h = is->video_st->codec->height;
#endif
} else { } else {
w = 640; w = 640;
h = 480; h = 480;
@@ -1007,7 +993,7 @@ static int refresh_thread(void *opaque)
SDL_Event event; SDL_Event event;
event.type = FF_REFRESH_EVENT; event.type = FF_REFRESH_EVENT;
event.user.data1 = opaque; event.user.data1 = opaque;
if (!is->refresh && (!is->paused || is->force_refresh)) { if (!is->refresh) {
is->refresh = 1; is->refresh = 1;
SDL_PushEvent(&event); SDL_PushEvent(&event);
} }
@@ -1170,9 +1156,6 @@ retry:
goto retry; goto retry;
} }
if (is->paused)
goto display;
/* compute nominal last_duration */ /* compute nominal last_duration */
last_duration = vp->pts - is->frame_last_pts; last_duration = vp->pts - is->frame_last_pts;
if (last_duration > 0 && last_duration < 10.0) { if (last_duration > 0 && last_duration < 10.0) {
@@ -1251,12 +1234,10 @@ retry:
} }
} }
display:
/* display picture */ /* display picture */
if (!display_disable) if (!display_disable)
video_display(is); video_display(is);
if (!is->paused)
pictq_next_picture(is); pictq_next_picture(is);
} }
} else if (is->audio_st) { } else if (is->audio_st) {
@@ -1269,7 +1250,6 @@ display:
if (!display_disable) if (!display_disable)
video_display(is); video_display(is);
} }
is->force_refresh = 0;
if (show_status) { if (show_status) {
static int64_t last_time; static int64_t last_time;
int64_t cur_time; int64_t cur_time;
@@ -1307,10 +1287,9 @@ display:
/* allocate a picture (needs to do that in main thread to avoid /* allocate a picture (needs to do that in main thread to avoid
potential locking problems */ potential locking problems */
static void alloc_picture(AllocEventProps *event_props) static void alloc_picture(void *opaque)
{ {
VideoState *is = event_props->is; VideoState *is = opaque;
AVFrame *frame = event_props->frame;
VideoPicture *vp; VideoPicture *vp;
vp = &is->pictq[is->pictq_windex]; vp = &is->pictq[is->pictq_windex];
@@ -1322,14 +1301,16 @@ static void alloc_picture(AllocEventProps *event_props)
if (vp->picref) if (vp->picref)
avfilter_unref_buffer(vp->picref); avfilter_unref_buffer(vp->picref);
vp->picref = NULL; vp->picref = NULL;
vp->width = is->out_video_filter->inputs[0]->w;
vp->height = is->out_video_filter->inputs[0]->h;
vp->pix_fmt = is->out_video_filter->inputs[0]->format;
#else
vp->width = is->video_st->codec->width;
vp->height = is->video_st->codec->height;
vp->pix_fmt = is->video_st->codec->pix_fmt;
#endif #endif
vp->width = frame->width;
vp->height = frame->height;
vp->pix_fmt = frame->format;
video_open(event_props->is, 0);
vp->bmp = SDL_CreateYUVOverlay(vp->width, vp->height, vp->bmp = SDL_CreateYUVOverlay(vp->width, vp->height,
SDL_YV12_OVERLAY, SDL_YV12_OVERLAY,
screen); screen);
@@ -1391,22 +1372,22 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts1, int64_
/* alloc or resize hardware picture buffer */ /* alloc or resize hardware picture buffer */
if (!vp->bmp || vp->reallocate || if (!vp->bmp || vp->reallocate ||
vp->width != src_frame->width || #if CONFIG_AVFILTER
vp->height != src_frame->height) { vp->width != is->out_video_filter->inputs[0]->w ||
vp->height != is->out_video_filter->inputs[0]->h) {
#else
vp->width != is->video_st->codec->width ||
vp->height != is->video_st->codec->height) {
#endif
SDL_Event event; SDL_Event event;
AllocEventProps event_props;
event_props.frame = src_frame;
event_props.is = is;
vp->allocated = 0; vp->allocated = 0;
vp->reallocate = 0; vp->reallocate = 0;
/* the allocation must be done in the main thread to avoid /* the allocation must be done in the main thread to avoid
locking problems. We wait in this block for the event to complete, locking problems */
so we can pass a pointer to event_props to it. */
event.type = FF_ALLOC_EVENT; event.type = FF_ALLOC_EVENT;
event.user.data1 = &event_props; event.user.data1 = is;
SDL_PushEvent(&event); SDL_PushEvent(&event);
/* wait until the picture is allocated */ /* wait until the picture is allocated */
@@ -1428,7 +1409,7 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts1, int64_
/* if the frame is not skipped, then display it */ /* if the frame is not skipped, then display it */
if (vp->bmp) { if (vp->bmp) {
AVPicture pict = { { 0 } }; AVPicture pict;
#if CONFIG_AVFILTER #if CONFIG_AVFILTER
if (vp->picref) if (vp->picref)
avfilter_unref_buffer(vp->picref); avfilter_unref_buffer(vp->picref);
@@ -1438,6 +1419,7 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts1, int64_
/* get a pointer on the bitmap */ /* get a pointer on the bitmap */
SDL_LockYUVOverlay (vp->bmp); SDL_LockYUVOverlay (vp->bmp);
memset(&pict, 0, sizeof(AVPicture));
pict.data[0] = vp->bmp->pixels[0]; pict.data[0] = vp->bmp->pixels[0];
pict.data[1] = vp->bmp->pixels[2]; pict.data[1] = vp->bmp->pixels[2];
pict.data[2] = vp->bmp->pixels[1]; pict.data[2] = vp->bmp->pixels[1];
@@ -1450,7 +1432,6 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts1, int64_
// FIXME use direct rendering // FIXME use direct rendering
av_picture_copy(&pict, (AVPicture *)src_frame, av_picture_copy(&pict, (AVPicture *)src_frame,
vp->pix_fmt, vp->width, vp->height); vp->pix_fmt, vp->width, vp->height);
vp->sample_aspect_ratio = vp->picref->video->sample_aspect_ratio;
#else #else
sws_flags = av_get_int(sws_opts, "sws_flags", NULL); sws_flags = av_get_int(sws_opts, "sws_flags", NULL);
is->img_convert_ctx = sws_getCachedContext(is->img_convert_ctx, is->img_convert_ctx = sws_getCachedContext(is->img_convert_ctx,
@@ -1462,7 +1443,6 @@ static int queue_picture(VideoState *is, AVFrame *src_frame, double pts1, int64_
} }
sws_scale(is->img_convert_ctx, src_frame->data, src_frame->linesize, sws_scale(is->img_convert_ctx, src_frame->data, src_frame->linesize,
0, vp->height, pict.data, pict.linesize); 0, vp->height, pict.data, pict.linesize);
vp->sample_aspect_ratio = av_guess_sample_aspect_ratio(is->ic, is->video_st, src_frame);
#endif #endif
/* update the bitmap content */ /* update the bitmap content */
SDL_UnlockYUVOverlay(vp->bmp); SDL_UnlockYUVOverlay(vp->bmp);
@@ -1515,7 +1495,7 @@ static int get_video_frame(VideoState *is, AVFrame *frame, int64_t *pts, AVPacke
int ret = 1; int ret = 1;
if (decoder_reorder_pts == -1) { if (decoder_reorder_pts == -1) {
*pts = av_frame_get_best_effort_timestamp(frame); *pts = *(int64_t*)av_opt_ptr(avcodec_get_frame_class(), frame, "best_effort_timestamp");
} else if (decoder_reorder_pts) { } else if (decoder_reorder_pts) {
*pts = frame->pkt_pts; *pts = frame->pkt_pts;
} else { } else {
@@ -1565,7 +1545,7 @@ static int input_get_buffer(AVCodecContext *codec, AVFrame *pic)
AVFilterContext *ctx = codec->opaque; AVFilterContext *ctx = codec->opaque;
AVFilterBufferRef *ref; AVFilterBufferRef *ref;
int perms = AV_PERM_WRITE; int perms = AV_PERM_WRITE;
int i, w, h, stride[AV_NUM_DATA_POINTERS]; int i, w, h, stride[4];
unsigned edge; unsigned edge;
int pixel_size; int pixel_size;
@@ -1584,7 +1564,7 @@ static int input_get_buffer(AVCodecContext *codec, AVFrame *pic)
w = codec->width; w = codec->width;
h = codec->height; h = codec->height;
if(av_image_check_size(w, h, 0, codec) || codec->pix_fmt<0) if(av_image_check_size(w, h, 0, codec))
return -1; return -1;
avcodec_align_dimensions2(codec, &w, &h, stride); avcodec_align_dimensions2(codec, &w, &h, stride);
@@ -1605,7 +1585,6 @@ static int input_get_buffer(AVCodecContext *codec, AVFrame *pic)
unsigned hshift = (i == 1 || i == 2) ? av_pix_fmt_descriptors[ref->format].log2_chroma_w : 0; unsigned hshift = (i == 1 || i == 2) ? av_pix_fmt_descriptors[ref->format].log2_chroma_w : 0;
unsigned vshift = (i == 1 || i == 2) ? av_pix_fmt_descriptors[ref->format].log2_chroma_h : 0; unsigned vshift = (i == 1 || i == 2) ? av_pix_fmt_descriptors[ref->format].log2_chroma_h : 0;
pic->base[i] = ref->data[i];
if (ref->data[i]) { if (ref->data[i]) {
ref->data[i] += ((edge * pixel_size) >> hshift) + ((edge * ref->linesize[i]) >> vshift); ref->data[i] += ((edge * pixel_size) >> hshift) + ((edge * ref->linesize[i]) >> vshift);
} }
@@ -1615,10 +1594,6 @@ static int input_get_buffer(AVCodecContext *codec, AVFrame *pic)
pic->opaque = ref; pic->opaque = ref;
pic->type = FF_BUFFER_TYPE_USER; pic->type = FF_BUFFER_TYPE_USER;
pic->reordered_opaque = codec->reordered_opaque; pic->reordered_opaque = codec->reordered_opaque;
pic->width = codec->width;
pic->height = codec->height;
pic->format = codec->pix_fmt;
pic->sample_aspect_ratio = codec->sample_aspect_ratio;
if (codec->pkt) pic->pkt_pts = codec->pkt->pts; if (codec->pkt) pic->pkt_pts = codec->pkt->pts;
else pic->pkt_pts = AV_NOPTS_VALUE; else pic->pkt_pts = AV_NOPTS_VALUE;
return 0; return 0;
@@ -1636,7 +1611,7 @@ static int input_reget_buffer(AVCodecContext *codec, AVFrame *pic)
if (pic->data[0] == NULL) { if (pic->data[0] == NULL) {
pic->buffer_hints |= FF_BUFFER_HINTS_READABLE; pic->buffer_hints |= FF_BUFFER_HINTS_READABLE;
return codec->get_buffer(codec, pic); return input_get_buffer(codec, pic);
} }
if ((codec->width != ref->video->w) || (codec->height != ref->video->h) || if ((codec->width != ref->video->w) || (codec->height != ref->video->h) ||
@@ -1696,19 +1671,18 @@ static int input_request_frame(AVFilterLink *link)
if (priv->use_dr1 && priv->frame->opaque) { if (priv->use_dr1 && priv->frame->opaque) {
picref = avfilter_ref_buffer(priv->frame->opaque, ~0); picref = avfilter_ref_buffer(priv->frame->opaque, ~0);
} else { } else {
picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, priv->frame->width, priv->frame->height); picref = avfilter_get_video_buffer(link, AV_PERM_WRITE, link->w, link->h);
av_image_copy(picref->data, picref->linesize, av_image_copy(picref->data, picref->linesize,
(const uint8_t **)(void **)priv->frame->data, priv->frame->linesize, priv->frame->data, priv->frame->linesize,
picref->format, priv->frame->width, priv->frame->height); picref->format, link->w, link->h);
} }
av_free_packet(&pkt); av_free_packet(&pkt);
avfilter_copy_frame_props(picref, priv->frame); avfilter_copy_frame_props(picref, priv->frame);
picref->video->sample_aspect_ratio = av_guess_sample_aspect_ratio(priv->is->ic, priv->is->video_st, priv->frame);
picref->pts = pts; picref->pts = pts;
avfilter_start_frame(link, picref); avfilter_start_frame(link, picref);
avfilter_draw_slice(link, 0, picref->video->h, 1); avfilter_draw_slice(link, 0, link->h, 1);
avfilter_end_frame(link); avfilter_end_frame(link);
return 0; return 0;
@@ -1760,11 +1734,11 @@ static AVFilter input_filter =
static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const char *vfilters) static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const char *vfilters)
{ {
static const enum PixelFormat pix_fmts[] = { PIX_FMT_YUV420P, PIX_FMT_NONE };
char sws_flags_str[128]; char sws_flags_str[128];
int ret; int ret;
enum PixelFormat pix_fmts[] = { PIX_FMT_YUV420P, PIX_FMT_NONE };
AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc(); AVBufferSinkParams *buffersink_params = av_buffersink_params_alloc();
AVFilterContext *filt_src = NULL, *filt_out = NULL, *filt_format;; AVFilterContext *filt_src = NULL, *filt_out = NULL;
snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%d", sws_flags); snprintf(sws_flags_str, sizeof(sws_flags_str), "flags=%d", sws_flags);
graph->scale_sws_opts = av_strdup(sws_flags_str); graph->scale_sws_opts = av_strdup(sws_flags_str);
@@ -1773,27 +1747,17 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
return ret; return ret;
#if FF_API_OLD_VSINK_API #if FF_API_OLD_VSINK_API
ret = avfilter_graph_create_filter(&filt_out, ret = avfilter_graph_create_filter(&filt_out, avfilter_get_by_name("buffersink"), "out",
avfilter_get_by_name("buffersink"), NULL, pix_fmts, graph);
"out", NULL, pix_fmts, graph);
#else #else
buffersink_params->pixel_fmts = pix_fmts; buffersink_params->pixel_fmts = pix_fmts;
ret = avfilter_graph_create_filter(&filt_out, ret = avfilter_graph_create_filter(&filt_out, avfilter_get_by_name("buffersink"), "out",
avfilter_get_by_name("buffersink"), NULL, buffersink_params, graph);
"out", NULL, buffersink_params, graph);
#endif #endif
av_freep(&buffersink_params); av_freep(&buffersink_params);
if (ret < 0) if (ret < 0)
return ret; return ret;
if ((ret = avfilter_graph_create_filter(&filt_format,
avfilter_get_by_name("format"),
"format", "yuv420p", NULL, graph)) < 0)
return ret;
if ((ret = avfilter_link(filt_format, 0, filt_out, 0)) < 0)
return ret;
if (vfilters) { if (vfilters) {
AVFilterInOut *outputs = avfilter_inout_alloc(); AVFilterInOut *outputs = avfilter_inout_alloc();
AVFilterInOut *inputs = avfilter_inout_alloc(); AVFilterInOut *inputs = avfilter_inout_alloc();
@@ -1804,14 +1768,14 @@ static int configure_video_filters(AVFilterGraph *graph, VideoState *is, const c
outputs->next = NULL; outputs->next = NULL;
inputs->name = av_strdup("out"); inputs->name = av_strdup("out");
inputs->filter_ctx = filt_format; inputs->filter_ctx = filt_out;
inputs->pad_idx = 0; inputs->pad_idx = 0;
inputs->next = NULL; inputs->next = NULL;
if ((ret = avfilter_graph_parse(graph, vfilters, &inputs, &outputs, NULL)) < 0) if ((ret = avfilter_graph_parse(graph, vfilters, &inputs, &outputs, NULL)) < 0)
return ret; return ret;
} else { } else {
if ((ret = avfilter_link(filt_src, 0, filt_format, 0)) < 0) if ((ret = avfilter_link(filt_src, 0, filt_out, 0)) < 0)
return ret; return ret;
} }
@@ -1839,13 +1803,8 @@ static int video_thread(void *arg)
int last_w = is->video_st->codec->width; int last_w = is->video_st->codec->width;
int last_h = is->video_st->codec->height; int last_h = is->video_st->codec->height;
if ((ret = configure_video_filters(graph, is, vfilters)) < 0) { if ((ret = configure_video_filters(graph, is, vfilters)) < 0)
SDL_Event event;
event.type = FF_QUIT_EVENT;
event.user.data1 = is;
SDL_PushEvent(&event);
goto the_end; goto the_end;
}
filt_out = is->out_video_filter; filt_out = is->out_video_filter;
#endif #endif
@@ -1875,14 +1834,11 @@ static int video_thread(void *arg)
if (picref) { if (picref) {
avfilter_fill_frame_from_video_buffer_ref(frame, picref); avfilter_fill_frame_from_video_buffer_ref(frame, picref);
pts_int = picref->pts; pts_int = picref->pts;
tb = filt_out->inputs[0]->time_base;
pos = picref->pos; pos = picref->pos;
frame->opaque = picref; frame->opaque = picref;
ret = 1;
} }
if (ret >= 0 && av_cmp_q(tb, is->video_st->time_base)) { if (av_cmp_q(tb, is->video_st->time_base)) {
av_unused int64_t pts1 = pts_int; av_unused int64_t pts1 = pts_int;
pts_int = av_rescale_q(pts_int, tb, is->video_st->time_base); pts_int = av_rescale_q(pts_int, tb, is->video_st->time_base);
av_dlog(NULL, "video_thread(): " av_dlog(NULL, "video_thread(): "
@@ -1894,8 +1850,6 @@ static int video_thread(void *arg)
ret = get_video_frame(is, frame, &pts_int, &pkt); ret = get_video_frame(is, frame, &pts_int, &pkt);
pos = pkt.pos; pos = pkt.pos;
av_free_packet(&pkt); av_free_packet(&pkt);
if (ret == 0)
continue;
#endif #endif
if (ret < 0) if (ret < 0)
@@ -1921,9 +1875,7 @@ static int video_thread(void *arg)
stream_toggle_pause(is); stream_toggle_pause(is);
} }
the_end: the_end:
avcodec_flush_buffers(is->video_st->codec);
#if CONFIG_AVFILTER #if CONFIG_AVFILTER
av_freep(&vfilters);
avfilter_graph_free(&graph); avfilter_graph_free(&graph);
#endif #endif
av_free(frame); av_free(frame);
@@ -2167,8 +2119,7 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
/* if no pts, then compute it */ /* if no pts, then compute it */
pts = is->audio_clock; pts = is->audio_clock;
*pts_ptr = pts; *pts_ptr = pts;
is->audio_clock += (double)data_size / is->audio_clock += (double)data_size / (dec->channels * dec->sample_rate * av_get_bytes_per_sample(dec->sample_fmt));
(dec->channels * dec->sample_rate * av_get_bytes_per_sample(dec->sample_fmt));
#ifdef DEBUG #ifdef DEBUG
{ {
static double last_clock; static double last_clock;
@@ -2194,10 +2145,8 @@ static int audio_decode_frame(VideoState *is, double *pts_ptr)
if ((new_packet = packet_queue_get(&is->audioq, pkt, 1)) < 0) if ((new_packet = packet_queue_get(&is->audioq, pkt, 1)) < 0)
return -1; return -1;
if (pkt->data == flush_pkt.data) { if (pkt->data == flush_pkt.data)
avcodec_flush_buffers(dec); avcodec_flush_buffers(dec);
flush_complete = 0;
}
*pkt_temp = *pkt; *pkt_temp = *pkt;
@@ -2269,9 +2218,9 @@ static int stream_component_open(VideoState *is, int stream_index)
opts = filter_codec_opts(codec_opts, codec, ic, ic->streams[stream_index]); opts = filter_codec_opts(codec_opts, codec, ic, ic->streams[stream_index]);
switch(avctx->codec_type){ switch(avctx->codec_type){
case AVMEDIA_TYPE_AUDIO : is->last_audio_stream = stream_index; if(audio_codec_name ) codec= avcodec_find_decoder_by_name( audio_codec_name); break; case AVMEDIA_TYPE_AUDIO : if(audio_codec_name ) codec= avcodec_find_decoder_by_name( audio_codec_name); break;
case AVMEDIA_TYPE_SUBTITLE: is->last_subtitle_stream = stream_index; if(subtitle_codec_name) codec= avcodec_find_decoder_by_name(subtitle_codec_name); break; case AVMEDIA_TYPE_SUBTITLE: if(subtitle_codec_name) codec= avcodec_find_decoder_by_name(subtitle_codec_name); break;
case AVMEDIA_TYPE_VIDEO : is->last_video_stream = stream_index; if(video_codec_name ) codec= avcodec_find_decoder_by_name( video_codec_name); break; case AVMEDIA_TYPE_VIDEO : if(video_codec_name ) codec= avcodec_find_decoder_by_name( video_codec_name); break;
} }
if (!codec) if (!codec)
return -1; return -1;
@@ -2295,7 +2244,6 @@ static int stream_component_open(VideoState *is, int stream_index)
avctx->flags |= CODEC_FLAG_EMU_EDGE; avctx->flags |= CODEC_FLAG_EMU_EDGE;
if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) { if (avctx->codec_type == AVMEDIA_TYPE_AUDIO) {
memset(&is->audio_pkt_temp, 0, sizeof(is->audio_pkt_temp));
env = SDL_getenv("SDL_AUDIO_CHANNELS"); env = SDL_getenv("SDL_AUDIO_CHANNELS");
if (env) if (env)
wanted_channel_layout = av_get_default_channel_layout(SDL_atoi(env)); wanted_channel_layout = av_get_default_channel_layout(SDL_atoi(env));
@@ -2372,20 +2320,20 @@ static int stream_component_open(VideoState *is, int stream_index)
is->audio_diff_threshold = 2.0 * SDL_AUDIO_BUFFER_SIZE / wanted_spec.freq; is->audio_diff_threshold = 2.0 * SDL_AUDIO_BUFFER_SIZE / wanted_spec.freq;
memset(&is->audio_pkt, 0, sizeof(is->audio_pkt)); memset(&is->audio_pkt, 0, sizeof(is->audio_pkt));
packet_queue_start(&is->audioq); packet_queue_init(&is->audioq);
SDL_PauseAudio(0); SDL_PauseAudio(0);
break; break;
case AVMEDIA_TYPE_VIDEO: case AVMEDIA_TYPE_VIDEO:
is->video_stream = stream_index; is->video_stream = stream_index;
is->video_st = ic->streams[stream_index]; is->video_st = ic->streams[stream_index];
packet_queue_start(&is->videoq); packet_queue_init(&is->videoq);
is->video_tid = SDL_CreateThread(video_thread, is); is->video_tid = SDL_CreateThread(video_thread, is);
break; break;
case AVMEDIA_TYPE_SUBTITLE: case AVMEDIA_TYPE_SUBTITLE:
is->subtitle_stream = stream_index; is->subtitle_stream = stream_index;
is->subtitle_st = ic->streams[stream_index]; is->subtitle_st = ic->streams[stream_index];
packet_queue_start(&is->subtitleq); packet_queue_init(&is->subtitleq);
is->subtitle_tid = SDL_CreateThread(subtitle_thread, is); is->subtitle_tid = SDL_CreateThread(subtitle_thread, is);
break; break;
@@ -2410,10 +2358,10 @@ static void stream_component_close(VideoState *is, int stream_index)
SDL_CloseAudio(); SDL_CloseAudio();
packet_queue_flush(&is->audioq); packet_queue_end(&is->audioq);
av_free_packet(&is->audio_pkt);
if (is->swr_ctx) if (is->swr_ctx)
swr_free(&is->swr_ctx); swr_free(&is->swr_ctx);
av_free_packet(&is->audio_pkt);
av_freep(&is->audio_buf1); av_freep(&is->audio_buf1);
is->audio_buf = NULL; is->audio_buf = NULL;
av_freep(&is->frame); av_freep(&is->frame);
@@ -2436,7 +2384,7 @@ static void stream_component_close(VideoState *is, int stream_index)
SDL_WaitThread(is->video_tid, NULL); SDL_WaitThread(is->video_tid, NULL);
packet_queue_flush(&is->videoq); packet_queue_end(&is->videoq);
break; break;
case AVMEDIA_TYPE_SUBTITLE: case AVMEDIA_TYPE_SUBTITLE:
packet_queue_abort(&is->subtitleq); packet_queue_abort(&is->subtitleq);
@@ -2451,7 +2399,7 @@ static void stream_component_close(VideoState *is, int stream_index)
SDL_WaitThread(is->subtitle_tid, NULL); SDL_WaitThread(is->subtitle_tid, NULL);
packet_queue_flush(&is->subtitleq); packet_queue_end(&is->subtitleq);
break; break;
default: default:
break; break;
@@ -2498,9 +2446,9 @@ static int read_thread(void *arg)
int orig_nb_streams; int orig_nb_streams;
memset(st_index, -1, sizeof(st_index)); memset(st_index, -1, sizeof(st_index));
is->last_video_stream = is->video_stream = -1; is->video_stream = -1;
is->last_audio_stream = is->audio_stream = -1; is->audio_stream = -1;
is->last_subtitle_stream = is->subtitle_stream = -1; is->subtitle_stream = -1;
ic = avformat_alloc_context(); ic = avformat_alloc_context();
ic->interrupt_callback.callback = decode_interrupt_cb; ic->interrupt_callback.callback = decode_interrupt_cb;
@@ -2654,9 +2602,9 @@ static int read_thread(void *arg)
/* if the queue are full, no need to read more */ /* if the queue are full, no need to read more */
if ( is->audioq.size + is->videoq.size + is->subtitleq.size > MAX_QUEUE_SIZE if ( is->audioq.size + is->videoq.size + is->subtitleq.size > MAX_QUEUE_SIZE
|| ( (is->audioq .nb_packets > MIN_FRAMES || is->audio_stream < 0 || is->audioq.abort_request) || ( (is->audioq .size > MIN_AUDIOQ_SIZE || is->audio_stream < 0)
&& (is->videoq .nb_packets > MIN_FRAMES || is->video_stream < 0 || is->videoq.abort_request) && (is->videoq .nb_packets > MIN_FRAMES || is->video_stream < 0)
&& (is->subtitleq.nb_packets > MIN_FRAMES || is->subtitle_stream < 0 || is->subtitleq.abort_request))) { && (is->subtitleq.nb_packets > MIN_FRAMES || is->subtitle_stream < 0))) {
/* wait 10 ms */ /* wait 10 ms */
SDL_Delay(10); SDL_Delay(10);
continue; continue;
@@ -2761,10 +2709,6 @@ static VideoState *stream_open(const char *filename, AVInputFormat *iformat)
is->subpq_mutex = SDL_CreateMutex(); is->subpq_mutex = SDL_CreateMutex();
is->subpq_cond = SDL_CreateCond(); is->subpq_cond = SDL_CreateCond();
packet_queue_init(&is->videoq);
packet_queue_init(&is->audioq);
packet_queue_init(&is->subtitleq);
is->av_sync_type = av_sync_type; is->av_sync_type = av_sync_type;
is->read_tid = SDL_CreateThread(read_thread, is); is->read_tid = SDL_CreateThread(read_thread, is);
if (!is->read_tid) { if (!is->read_tid) {
@@ -2778,19 +2722,16 @@ static void stream_cycle_channel(VideoState *is, int codec_type)
{ {
AVFormatContext *ic = is->ic; AVFormatContext *ic = is->ic;
int start_index, stream_index; int start_index, stream_index;
int old_index;
AVStream *st; AVStream *st;
if (codec_type == AVMEDIA_TYPE_VIDEO) { if (codec_type == AVMEDIA_TYPE_VIDEO)
start_index = is->last_video_stream; start_index = is->video_stream;
old_index = is->video_stream; else if (codec_type == AVMEDIA_TYPE_AUDIO)
} else if (codec_type == AVMEDIA_TYPE_AUDIO) { start_index = is->audio_stream;
start_index = is->last_audio_stream; else
old_index = is->audio_stream; start_index = is->subtitle_stream;
} else { if (start_index < (codec_type == AVMEDIA_TYPE_SUBTITLE ? -1 : 0))
start_index = is->last_subtitle_stream; return;
old_index = is->subtitle_stream;
}
stream_index = start_index; stream_index = start_index;
for (;;) { for (;;) {
if (++stream_index >= is->ic->nb_streams) if (++stream_index >= is->ic->nb_streams)
@@ -2798,11 +2739,8 @@ static void stream_cycle_channel(VideoState *is, int codec_type)
if (codec_type == AVMEDIA_TYPE_SUBTITLE) if (codec_type == AVMEDIA_TYPE_SUBTITLE)
{ {
stream_index = -1; stream_index = -1;
is->last_subtitle_stream = -1;
goto the_end; goto the_end;
} } else
if (start_index == -1)
return;
stream_index = 0; stream_index = 0;
} }
if (stream_index == start_index) if (stream_index == start_index)
@@ -2825,7 +2763,7 @@ static void stream_cycle_channel(VideoState *is, int codec_type)
} }
} }
the_end: the_end:
stream_component_close(is, old_index); stream_component_close(is, start_index);
stream_component_open(is, stream_index); stream_component_open(is, stream_index);
} }
@@ -2889,7 +2827,6 @@ static void event_loop(VideoState *cur_stream)
break; break;
case SDLK_f: case SDLK_f:
toggle_full_screen(cur_stream); toggle_full_screen(cur_stream);
cur_stream->force_refresh = 1;
break; break;
case SDLK_p: case SDLK_p:
case SDLK_SPACE: case SDLK_SPACE:
@@ -2909,7 +2846,6 @@ static void event_loop(VideoState *cur_stream)
break; break;
case SDLK_w: case SDLK_w:
toggle_audio_display(cur_stream); toggle_audio_display(cur_stream);
cur_stream->force_refresh = 1;
break; break;
case SDLK_PAGEUP: case SDLK_PAGEUP:
incr = 600.0; incr = 600.0;
@@ -2952,9 +2888,6 @@ static void event_loop(VideoState *cur_stream)
break; break;
} }
break; break;
case SDL_VIDEOEXPOSE:
cur_stream->force_refresh = 1;
break;
case SDL_MOUSEBUTTONDOWN: case SDL_MOUSEBUTTONDOWN:
if (exit_on_mousedown) { if (exit_on_mousedown) {
do_exit(cur_stream); do_exit(cur_stream);
@@ -2997,13 +2930,13 @@ static void event_loop(VideoState *cur_stream)
SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_HWACCEL); SDL_HWSURFACE|SDL_RESIZABLE|SDL_ASYNCBLIT|SDL_HWACCEL);
screen_width = cur_stream->width = event.resize.w; screen_width = cur_stream->width = event.resize.w;
screen_height = cur_stream->height = event.resize.h; screen_height = cur_stream->height = event.resize.h;
cur_stream->force_refresh = 1;
break; break;
case SDL_QUIT: case SDL_QUIT:
case FF_QUIT_EVENT: case FF_QUIT_EVENT:
do_exit(cur_stream); do_exit(cur_stream);
break; break;
case FF_ALLOC_EVENT: case FF_ALLOC_EVENT:
video_open(event.user.data1, 0);
alloc_picture(event.user.data1); alloc_picture(event.user.data1);
break; break;
case FF_REFRESH_EVENT: case FF_REFRESH_EVENT:
@@ -3282,7 +3215,7 @@ int main(int argc, char **argv)
} }
av_init_packet(&flush_pkt); av_init_packet(&flush_pkt);
flush_pkt.data = (char *)(intptr_t)"FLUSH"; flush_pkt.data = "FLUSH";
is = stream_open(input_filename, file_iformat); is = stream_open(input_filename, file_iformat);
if (!is) { if (!is) {

View File

@@ -0,0 +1,17 @@
vcodec=libvpx
g=120
rc_lookahead=16
quality=good
speed=0
profile=1
qmax=51
qmin=11
slices=4
vb=2M
#ignored unless using -pass 2
maxrate=24M
minrate=100k
arnr_max_frames=7
arnr_strength=5
arnr_type=3

View File

@@ -0,0 +1,17 @@
vcodec=libvpx
g=120
rc_lookahead=25
quality=good
speed=0
profile=1
qmax=51
qmin=11
slices=4
vb=2M
#ignored unless using -pass 2
maxrate=24M
minrate=100k
arnr_max_frames=7
arnr_strength=5
arnr_type=3

View File

@@ -0,0 +1,16 @@
vcodec=libvpx
g=120
rc_lookahead=16
quality=good
speed=0
profile=0
qmax=63
qmin=0
vb=768k
#ignored unless using -pass 2
maxrate=1.5M
minrate=40k
arnr_max_frames=7
arnr_strength=5
arnr_type=3

View File

@@ -0,0 +1,17 @@
vcodec=libvpx
g=120
rc_lookahead=16
quality=good
speed=0
profile=0
qmax=51
qmin=11
slices=4
vb=2M
#ignored unless using -pass 2
maxrate=24M
minrate=100k
arnr_max_frames=7
arnr_strength=5
arnr_type=3

View File

@@ -0,0 +1,17 @@
vcodec=libvpx
g=120
rc_lookahead=25
quality=good
speed=0
profile=0
qmax=51
qmin=11
slices=4
vb=2M
#ignored unless using -pass 2
maxrate=24M
minrate=100k
arnr_max_frames=7
arnr_strength=5
arnr_type=3

530
ffprobe.c
View File

@@ -29,11 +29,9 @@
#include "libavformat/avformat.h" #include "libavformat/avformat.h"
#include "libavcodec/avcodec.h" #include "libavcodec/avcodec.h"
#include "libavutil/avstring.h" #include "libavutil/avstring.h"
#include "libavutil/bprint.h"
#include "libavutil/opt.h" #include "libavutil/opt.h"
#include "libavutil/pixdesc.h" #include "libavutil/pixdesc.h"
#include "libavutil/dict.h" #include "libavutil/dict.h"
#include "libavutil/timecode.h"
#include "libavdevice/avdevice.h" #include "libavdevice/avdevice.h"
#include "libswscale/swscale.h" #include "libswscale/swscale.h"
#include "libswresample/swresample.h" #include "libswresample/swresample.h"
@@ -43,14 +41,9 @@
const char program_name[] = "ffprobe"; const char program_name[] = "ffprobe";
const int program_birth_year = 2007; const int program_birth_year = 2007;
static int do_count_frames = 0;
static int do_count_packets = 0;
static int do_read_frames = 0;
static int do_read_packets = 0;
static int do_show_error = 0; static int do_show_error = 0;
static int do_show_format = 0; static int do_show_format = 0;
static int do_show_frames = 0; static int do_show_frames = 0;
static AVDictionary *fmt_entries_to_show = NULL;
static int do_show_packets = 0; static int do_show_packets = 0;
static int do_show_streams = 0; static int do_show_streams = 0;
static int do_show_program_version = 0; static int do_show_program_version = 0;
@@ -70,19 +63,16 @@ static const OptionDef options[];
static const char *input_filename; static const char *input_filename;
static AVInputFormat *iformat = NULL; static AVInputFormat *iformat = NULL;
static const char *const binary_unit_prefixes [] = { "", "Ki", "Mi", "Gi", "Ti", "Pi" }; static const char *binary_unit_prefixes [] = { "", "Ki", "Mi", "Gi", "Ti", "Pi" };
static const char *const decimal_unit_prefixes[] = { "", "K" , "M" , "G" , "T" , "P" }; static const char *decimal_unit_prefixes[] = { "", "K" , "M" , "G" , "T" , "P" };
static const char unit_second_str[] = "s" ; static const char *unit_second_str = "s" ;
static const char unit_hertz_str[] = "Hz" ; static const char *unit_hertz_str = "Hz" ;
static const char unit_byte_str[] = "byte" ; static const char *unit_byte_str = "byte" ;
static const char unit_bit_per_second_str[] = "bit/s"; static const char *unit_bit_per_second_str = "bit/s";
static uint64_t *nb_streams_packets;
static uint64_t *nb_streams_frames;
void av_noreturn exit_program(int ret) void av_noreturn exit_program(int ret)
{ {
av_dict_free(&fmt_entries_to_show);
exit(ret); exit(ret);
} }
@@ -178,8 +168,6 @@ struct WriterContext {
unsigned int nb_item; ///< number of the item printed in the given section, starting at 0 unsigned int nb_item; ///< number of the item printed in the given section, starting at 0
unsigned int nb_section; ///< number of the section printed in the given section sequence, starting at 0 unsigned int nb_section; ///< number of the section printed in the given section sequence, starting at 0
unsigned int nb_chapter; ///< number of the chapter, starting at 0 unsigned int nb_chapter; ///< number of the chapter, starting at 0
int is_fmt_chapter; ///< tells if the current chapter is "format", required by the print_format_entry option
}; };
static const char *writer_get_name(void *p) static const char *writer_get_name(void *p)
@@ -254,8 +242,6 @@ static inline void writer_print_chapter_header(WriterContext *wctx,
if (wctx->writer->print_chapter_header) if (wctx->writer->print_chapter_header)
wctx->writer->print_chapter_header(wctx, chapter); wctx->writer->print_chapter_header(wctx, chapter);
wctx->nb_section = 0; wctx->nb_section = 0;
wctx->is_fmt_chapter = !strcmp(chapter, "format");
} }
static inline void writer_print_chapter_footer(WriterContext *wctx, static inline void writer_print_chapter_footer(WriterContext *wctx,
@@ -285,29 +271,24 @@ static inline void writer_print_section_footer(WriterContext *wctx,
static inline void writer_print_integer(WriterContext *wctx, static inline void writer_print_integer(WriterContext *wctx,
const char *key, long long int val) const char *key, long long int val)
{ {
if (!wctx->is_fmt_chapter || !fmt_entries_to_show || av_dict_get(fmt_entries_to_show, key, NULL, 0)) {
wctx->writer->print_integer(wctx, key, val); wctx->writer->print_integer(wctx, key, val);
wctx->nb_item++; wctx->nb_item++;
} }
}
static inline void writer_print_string(WriterContext *wctx, static inline void writer_print_string(WriterContext *wctx,
const char *key, const char *val, int opt) const char *key, const char *val, int opt)
{ {
if (opt && !(wctx->writer->flags & WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS)) if (opt && !(wctx->writer->flags & WRITER_FLAG_DISPLAY_OPTIONAL_FIELDS))
return; return;
if (!wctx->is_fmt_chapter || !fmt_entries_to_show || av_dict_get(fmt_entries_to_show, key, NULL, 0)) {
wctx->writer->print_string(wctx, key, val); wctx->writer->print_string(wctx, key, val);
wctx->nb_item++; wctx->nb_item++;
} }
}
static void writer_print_time(WriterContext *wctx, const char *key, static void writer_print_time(WriterContext *wctx, const char *key,
int64_t ts, const AVRational *time_base) int64_t ts, const AVRational *time_base)
{ {
char buf[128]; char buf[128];
if (!wctx->is_fmt_chapter || !fmt_entries_to_show || av_dict_get(fmt_entries_to_show, key, NULL, 0)) {
if (ts == AV_NOPTS_VALUE) { if (ts == AV_NOPTS_VALUE) {
writer_print_string(wctx, key, "N/A", 1); writer_print_string(wctx, key, "N/A", 1);
} else { } else {
@@ -316,7 +297,6 @@ static void writer_print_time(WriterContext *wctx, const char *key,
writer_print_string(wctx, key, buf, 0); writer_print_string(wctx, key, buf, 0);
} }
} }
}
static void writer_print_ts(WriterContext *wctx, const char *key, int64_t ts) static void writer_print_ts(WriterContext *wctx, const char *key, int64_t ts)
{ {
@@ -358,68 +338,82 @@ static const Writer *writer_get_by_name(const char *name)
return NULL; return NULL;
} }
/* Print helpers */
struct print_buf {
char *s;
int len;
};
static char *fast_asprintf(struct print_buf *pbuf, const char *fmt, ...)
{
va_list va;
int len;
va_start(va, fmt);
len = vsnprintf(NULL, 0, fmt, va);
va_end(va);
if (len < 0)
goto fail;
if (pbuf->len < len) {
char *p = av_realloc(pbuf->s, len + 1);
if (!p)
goto fail;
pbuf->s = p;
pbuf->len = len;
}
va_start(va, fmt);
len = vsnprintf(pbuf->s, len + 1, fmt, va);
va_end(va);
if (len < 0)
goto fail;
return pbuf->s;
fail:
av_freep(&pbuf->s);
pbuf->len = 0;
return NULL;
}
#define ESCAPE_INIT_BUF_SIZE 256
#define ESCAPE_CHECK_SIZE(src, size, max_size) \
if (size > max_size) { \
char buf[64]; \
snprintf(buf, sizeof(buf), "%s", src); \
av_log(log_ctx, AV_LOG_WARNING, \
"String '%s...' with is too big\n", buf); \
return "FFPROBE_TOO_BIG_STRING"; \
}
#define ESCAPE_REALLOC_BUF(dst_size_p, dst_p, src, size) \
if (*dst_size_p < size) { \
char *q = av_realloc(*dst_p, size); \
if (!q) { \
char buf[64]; \
snprintf(buf, sizeof(buf), "%s", src); \
av_log(log_ctx, AV_LOG_WARNING, \
"String '%s...' could not be escaped\n", buf); \
return "FFPROBE_THIS_STRING_COULD_NOT_BE_ESCAPED"; \
} \
*dst_size_p = size; \
*dst = q; \
}
/* WRITERS */ /* WRITERS */
/* Default output */ /* Default output */
typedef struct DefaultContext {
const AVClass *class;
int nokey;
int noprint_wrappers;
} DefaultContext;
#define OFFSET(x) offsetof(DefaultContext, x)
static const AVOption default_options[] = {
{ "noprint_wrappers", "do not print headers and footers", OFFSET(noprint_wrappers), AV_OPT_TYPE_INT, {.dbl=0}, 0, 1 },
{ "nw", "do not print headers and footers", OFFSET(noprint_wrappers), AV_OPT_TYPE_INT, {.dbl=0}, 0, 1 },
{ "nokey", "force no key printing", OFFSET(nokey), AV_OPT_TYPE_INT, {.dbl=0}, 0, 1 },
{ "nk", "force no key printing", OFFSET(nokey), AV_OPT_TYPE_INT, {.dbl=0}, 0, 1 },
{NULL},
};
static const char *default_get_name(void *ctx)
{
return "default";
}
static const AVClass default_class = {
"DefaultContext",
default_get_name,
default_options
};
static av_cold int default_init(WriterContext *wctx, const char *args, void *opaque)
{
DefaultContext *def = wctx->priv;
int err;
def->class = &default_class;
av_opt_set_defaults(def);
if (args &&
(err = (av_set_options_string(def, args, "=", ":"))) < 0) {
av_log(wctx, AV_LOG_ERROR, "Error parsing options string: '%s'\n", args);
return err;
}
return 0;
}
static void default_print_footer(WriterContext *wctx) static void default_print_footer(WriterContext *wctx)
{ {
DefaultContext *def = wctx->priv;
if (!def->noprint_wrappers)
printf("\n"); printf("\n");
} }
static void default_print_chapter_header(WriterContext *wctx, const char *chapter) static void default_print_chapter_header(WriterContext *wctx, const char *chapter)
{ {
DefaultContext *def = wctx->priv; if (wctx->nb_chapter)
if (!def->noprint_wrappers && wctx->nb_chapter)
printf("\n"); printf("\n");
} }
@@ -435,46 +429,34 @@ static inline char *upcase_string(char *dst, size_t dst_size, const char *src)
static void default_print_section_header(WriterContext *wctx, const char *section) static void default_print_section_header(WriterContext *wctx, const char *section)
{ {
DefaultContext *def = wctx->priv;
char buf[32]; char buf[32];
if (wctx->nb_section) if (wctx->nb_section)
printf("\n"); printf("\n");
if (!def->noprint_wrappers)
printf("[%s]\n", upcase_string(buf, sizeof(buf), section)); printf("[%s]\n", upcase_string(buf, sizeof(buf), section));
} }
static void default_print_section_footer(WriterContext *wctx, const char *section) static void default_print_section_footer(WriterContext *wctx, const char *section)
{ {
DefaultContext *def = wctx->priv;
char buf[32]; char buf[32];
if (!def->noprint_wrappers)
printf("[/%s]", upcase_string(buf, sizeof(buf), section)); printf("[/%s]", upcase_string(buf, sizeof(buf), section));
} }
static void default_print_str(WriterContext *wctx, const char *key, const char *value) static void default_print_str(WriterContext *wctx, const char *key, const char *value)
{ {
DefaultContext *def = wctx->priv; printf("%s=%s\n", key, value);
if (!def->nokey)
printf("%s=", key);
printf("%s\n", value);
} }
static void default_print_int(WriterContext *wctx, const char *key, long long int value) static void default_print_int(WriterContext *wctx, const char *key, long long int value)
{ {
DefaultContext *def = wctx->priv; printf("%s=%lld\n", key, value);
if (!def->nokey)
printf("%s=", key);
printf("%lld\n", value);
} }
static void default_show_tags(WriterContext *wctx, AVDictionary *dict) static void default_show_tags(WriterContext *wctx, AVDictionary *dict)
{ {
AVDictionaryEntry *tag = NULL; AVDictionaryEntry *tag = NULL;
while ((tag = av_dict_get(dict, "", tag, AV_DICT_IGNORE_SUFFIX))) { while ((tag = av_dict_get(dict, "", tag, AV_DICT_IGNORE_SUFFIX))) {
if (!fmt_entries_to_show || (tag->key && av_dict_get(fmt_entries_to_show, tag->key, NULL, 0)))
printf("TAG:"); printf("TAG:");
writer_print_string(wctx, tag->key, tag->value, 0); writer_print_string(wctx, tag->key, tag->value, 0);
} }
@@ -482,8 +464,6 @@ static void default_show_tags(WriterContext *wctx, AVDictionary *dict)
static const Writer default_writer = { static const Writer default_writer = {
.name = "default", .name = "default",
.priv_size = sizeof(DefaultContext),
.init = default_init,
.print_footer = default_print_footer, .print_footer = default_print_footer,
.print_chapter_header = default_print_chapter_header, .print_chapter_header = default_print_chapter_header,
.print_section_header = default_print_section_header, .print_section_header = default_print_section_header,
@@ -500,51 +480,81 @@ static const Writer default_writer = {
* Escape \n, \r, \\ and sep characters contained in s, and print the * Escape \n, \r, \\ and sep characters contained in s, and print the
* resulting string. * resulting string.
*/ */
static const char *c_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx) static const char *c_escape_str(char **dst, size_t *dst_size,
const char *src, const char sep, void *log_ctx)
{ {
const char *p; const char *p;
char *q;
size_t size = 1;
/* precompute size */
for (p = src; *p; p++, size++) {
ESCAPE_CHECK_SIZE(src, size, SIZE_MAX-2);
if (*p == '\n' || *p == '\r' || *p == '\\')
size++;
}
ESCAPE_REALLOC_BUF(dst_size, dst, src, size);
q = *dst;
for (p = src; *p; p++) { for (p = src; *p; p++) {
switch (*src) { switch (*src) {
case '\n': av_bprintf(dst, "%s", "\\n"); break; case '\n': *q++ = '\\'; *q++ = 'n'; break;
case '\r': av_bprintf(dst, "%s", "\\r"); break; case '\r': *q++ = '\\'; *q++ = 'r'; break;
case '\\': av_bprintf(dst, "%s", "\\\\"); break; case '\\': *q++ = '\\'; *q++ = '\\'; break;
default: default:
if (*p == sep) if (*p == sep)
av_bprint_chars(dst, '\\', 1); *q++ = '\\';
av_bprint_chars(dst, *p, 1); *q++ = *p;
} }
} }
return dst->str; *q = 0;
return *dst;
} }
/** /**
* Quote fields containing special characters, check RFC4180. * Quote fields containing special characters, check RFC4180.
*/ */
static const char *csv_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx) static const char *csv_escape_str(char **dst, size_t *dst_size,
const char *src, const char sep, void *log_ctx)
{ {
const char *p; const char *p;
char *q;
size_t size = 1;
int quote = 0; int quote = 0;
/* check if input needs quoting */ /* precompute size */
for (p = src; *p; p++) for (p = src; *p; p++, size++) {
ESCAPE_CHECK_SIZE(src, size, SIZE_MAX-4);
if (*p == '"' || *p == sep || *p == '\n' || *p == '\r') if (*p == '"' || *p == sep || *p == '\n' || *p == '\r')
if (!quote) {
quote = 1; quote = 1;
size += 2;
if (quote) }
av_bprint_chars(dst, '\"', 1);
for (p = src; *p; p++) {
if (*p == '"') if (*p == '"')
av_bprint_chars(dst, '\"', 1); size++;
av_bprint_chars(dst, *p, 1);
}
if (quote)
av_bprint_chars(dst, '\"', 1);
return dst->str;
} }
static const char *none_escape_str(AVBPrint *dst, const char *src, const char sep, void *log_ctx) ESCAPE_REALLOC_BUF(dst_size, dst, src, size);
q = *dst;
p = src;
if (quote)
*q++ = '\"';
while (*p) {
if (*p == '"')
*q++ = '\"';
*q++ = *p++;
}
if (quote)
*q++ = '\"';
*q = 0;
return *dst;
}
static const char *none_escape_str(char **dst, size_t *dst_size,
const char *src, const char sep, void *log_ctx)
{ {
return src; return src;
} }
@@ -554,11 +564,13 @@ typedef struct CompactContext {
char *item_sep_str; char *item_sep_str;
char item_sep; char item_sep;
int nokey; int nokey;
char *buf;
size_t buf_size;
char *escape_mode_str; char *escape_mode_str;
const char * (*escape_str)(AVBPrint *dst, const char *src, const char sep, void *log_ctx); const char * (*escape_str)(char **dst, size_t *dst_size,
const char *src, const char sep, void *log_ctx);
} CompactContext; } CompactContext;
#undef OFFSET
#define OFFSET(x) offsetof(CompactContext, x) #define OFFSET(x) offsetof(CompactContext, x)
static const AVOption compact_options[]= { static const AVOption compact_options[]= {
@@ -602,6 +614,10 @@ static av_cold int compact_init(WriterContext *wctx, const char *args, void *opa
} }
compact->item_sep = compact->item_sep_str[0]; compact->item_sep = compact->item_sep_str[0];
compact->buf_size = ESCAPE_INIT_BUF_SIZE;
if (!(compact->buf = av_malloc(compact->buf_size)))
return AVERROR(ENOMEM);
if (!strcmp(compact->escape_mode_str, "none")) compact->escape_str = none_escape_str; if (!strcmp(compact->escape_mode_str, "none")) compact->escape_str = none_escape_str;
else if (!strcmp(compact->escape_mode_str, "c" )) compact->escape_str = c_escape_str; else if (!strcmp(compact->escape_mode_str, "c" )) compact->escape_str = c_escape_str;
else if (!strcmp(compact->escape_mode_str, "csv" )) compact->escape_str = csv_escape_str; else if (!strcmp(compact->escape_mode_str, "csv" )) compact->escape_str = csv_escape_str;
@@ -618,6 +634,7 @@ static av_cold void compact_uninit(WriterContext *wctx)
CompactContext *compact = wctx->priv; CompactContext *compact = wctx->priv;
av_freep(&compact->item_sep_str); av_freep(&compact->item_sep_str);
av_freep(&compact->buf);
av_freep(&compact->escape_mode_str); av_freep(&compact->escape_mode_str);
} }
@@ -636,14 +653,12 @@ static void compact_print_section_footer(WriterContext *wctx, const char *sectio
static void compact_print_str(WriterContext *wctx, const char *key, const char *value) static void compact_print_str(WriterContext *wctx, const char *key, const char *value)
{ {
CompactContext *compact = wctx->priv; CompactContext *compact = wctx->priv;
AVBPrint buf;
if (wctx->nb_item) printf("%c", compact->item_sep); if (wctx->nb_item) printf("%c", compact->item_sep);
if (!compact->nokey) if (!compact->nokey)
printf("%s=", key); printf("%s=", key);
av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED); printf("%s", compact->escape_str(&compact->buf, &compact->buf_size,
printf("%s", compact->escape_str(&buf, value, compact->item_sep, wctx)); value, compact->item_sep, wctx));
av_bprint_finalize(&buf, NULL);
} }
static void compact_print_int(WriterContext *wctx, const char *key, long long int value) static void compact_print_int(WriterContext *wctx, const char *key, long long int value)
@@ -660,20 +675,14 @@ static void compact_show_tags(WriterContext *wctx, AVDictionary *dict)
{ {
CompactContext *compact = wctx->priv; CompactContext *compact = wctx->priv;
AVDictionaryEntry *tag = NULL; AVDictionaryEntry *tag = NULL;
AVBPrint buf;
while ((tag = av_dict_get(dict, "", tag, AV_DICT_IGNORE_SUFFIX))) { while ((tag = av_dict_get(dict, "", tag, AV_DICT_IGNORE_SUFFIX))) {
if (wctx->nb_item) printf("%c", compact->item_sep); if (wctx->nb_item) printf("%c", compact->item_sep);
if (!compact->nokey)
if (!compact->nokey) { printf("tag:%s=", compact->escape_str(&compact->buf, &compact->buf_size,
av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED); tag->key, compact->item_sep, wctx));
printf("tag:%s=", compact->escape_str(&buf, tag->key, compact->item_sep, wctx)); printf("%s", compact->escape_str(&compact->buf, &compact->buf_size,
av_bprint_finalize(&buf, NULL); tag->value, compact->item_sep, wctx));
}
av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
printf("%s", compact->escape_str(&buf, tag->value, compact->item_sep, wctx));
av_bprint_finalize(&buf, NULL);
} }
} }
@@ -715,6 +724,8 @@ static const Writer csv_writer = {
typedef struct { typedef struct {
const AVClass *class; const AVClass *class;
int multiple_entries; ///< tells if the given chapter requires multiple entries int multiple_entries; ///< tells if the given chapter requires multiple entries
char *buf;
size_t buf_size;
int print_packets_and_frames; int print_packets_and_frames;
int indent_level; int indent_level;
int compact; int compact;
@@ -758,27 +769,52 @@ static av_cold int json_init(WriterContext *wctx, const char *args, void *opaque
json->item_sep = json->compact ? ", " : ",\n"; json->item_sep = json->compact ? ", " : ",\n";
json->item_start_end = json->compact ? " " : "\n"; json->item_start_end = json->compact ? " " : "\n";
json->buf_size = ESCAPE_INIT_BUF_SIZE;
if (!(json->buf = av_malloc(json->buf_size)))
return AVERROR(ENOMEM);
return 0; return 0;
} }
static const char *json_escape_str(AVBPrint *dst, const char *src, void *log_ctx) static av_cold void json_uninit(WriterContext *wctx)
{
JSONContext *json = wctx->priv;
av_freep(&json->buf);
}
static const char *json_escape_str(char **dst, size_t *dst_size, const char *src,
void *log_ctx)
{ {
static const char json_escape[] = {'"', '\\', '\b', '\f', '\n', '\r', '\t', 0}; static const char json_escape[] = {'"', '\\', '\b', '\f', '\n', '\r', '\t', 0};
static const char json_subst[] = {'"', '\\', 'b', 'f', 'n', 'r', 't', 0}; static const char json_subst[] = {'"', '\\', 'b', 'f', 'n', 'r', 't', 0};
const char *p; const char *p;
char *q;
size_t size = 1;
// compute the length of the escaped string
for (p = src; *p; p++) {
ESCAPE_CHECK_SIZE(src, size, SIZE_MAX-6);
if (strchr(json_escape, *p)) size += 2; // simple escape
else if ((unsigned char)*p < 32) size += 6; // handle non-printable chars
else size += 1; // char copy
}
ESCAPE_REALLOC_BUF(dst_size, dst, src, size);
q = *dst;
for (p = src; *p; p++) { for (p = src; *p; p++) {
char *s = strchr(json_escape, *p); char *s = strchr(json_escape, *p);
if (s) { if (s) {
av_bprint_chars(dst, '\\', 1); *q++ = '\\';
av_bprint_chars(dst, json_subst[s - json_escape], 1); *q++ = json_subst[s - json_escape];
} else if ((unsigned char)*p < 32) { } else if ((unsigned char)*p < 32) {
av_bprintf(dst, "\\u00%02x", *p & 0xff); snprintf(q, 7, "\\u00%02x", *p & 0xff);
q += 6;
} else { } else {
av_bprint_chars(dst, *p, 1); *q++ = *p;
} }
} }
return dst->str; *q = 0;
return *dst;
} }
static void json_print_header(WriterContext *wctx) static void json_print_header(WriterContext *wctx)
@@ -800,7 +836,6 @@ static void json_print_footer(WriterContext *wctx)
static void json_print_chapter_header(WriterContext *wctx, const char *chapter) static void json_print_chapter_header(WriterContext *wctx, const char *chapter)
{ {
JSONContext *json = wctx->priv; JSONContext *json = wctx->priv;
AVBPrint buf;
if (wctx->nb_chapter) if (wctx->nb_chapter)
printf(","); printf(",");
@@ -810,9 +845,7 @@ static void json_print_chapter_header(WriterContext *wctx, const char *chapter)
!strcmp(chapter, "streams") || !strcmp(chapter, "library_versions"); !strcmp(chapter, "streams") || !strcmp(chapter, "library_versions");
if (json->multiple_entries) { if (json->multiple_entries) {
JSON_INDENT(); JSON_INDENT();
av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED); printf("\"%s\": [\n", json_escape_str(&json->buf, &json->buf_size, chapter, wctx));
printf("\"%s\": [\n", json_escape_str(&buf, chapter, wctx));
av_bprint_finalize(&buf, NULL);
json->print_packets_and_frames = !strcmp(chapter, "packets_and_frames"); json->print_packets_and_frames = !strcmp(chapter, "packets_and_frames");
json->indent_level++; json->indent_level++;
} }
@@ -863,15 +896,10 @@ static void json_print_section_footer(WriterContext *wctx, const char *section)
static inline void json_print_item_str(WriterContext *wctx, static inline void json_print_item_str(WriterContext *wctx,
const char *key, const char *value) const char *key, const char *value)
{ {
AVBPrint buf; JSONContext *json = wctx->priv;
av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED); printf("\"%s\":", json_escape_str(&json->buf, &json->buf_size, key, wctx));
printf("\"%s\":", json_escape_str(&buf, key, wctx)); printf(" \"%s\"", json_escape_str(&json->buf, &json->buf_size, value, wctx));
av_bprint_finalize(&buf, NULL);
av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
printf(" \"%s\"", json_escape_str(&buf, value, wctx));
av_bprint_finalize(&buf, NULL);
} }
static void json_print_str(WriterContext *wctx, const char *key, const char *value) static void json_print_str(WriterContext *wctx, const char *key, const char *value)
@@ -887,15 +915,12 @@ static void json_print_str(WriterContext *wctx, const char *key, const char *val
static void json_print_int(WriterContext *wctx, const char *key, long long int value) static void json_print_int(WriterContext *wctx, const char *key, long long int value)
{ {
JSONContext *json = wctx->priv; JSONContext *json = wctx->priv;
AVBPrint buf;
if (wctx->nb_item) printf("%s", json->item_sep); if (wctx->nb_item) printf("%s", json->item_sep);
if (!json->compact) if (!json->compact)
JSON_INDENT(); JSON_INDENT();
printf("\"%s\": %lld",
av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED); json_escape_str(&json->buf, &json->buf_size, key, wctx), value);
printf("\"%s\": %lld", json_escape_str(&buf, key, wctx), value);
av_bprint_finalize(&buf, NULL);
} }
static void json_show_tags(WriterContext *wctx, AVDictionary *dict) static void json_show_tags(WriterContext *wctx, AVDictionary *dict)
@@ -928,6 +953,7 @@ static const Writer json_writer = {
.name = "json", .name = "json",
.priv_size = sizeof(JSONContext), .priv_size = sizeof(JSONContext),
.init = json_init, .init = json_init,
.uninit = json_uninit,
.print_header = json_print_header, .print_header = json_print_header,
.print_footer = json_print_footer, .print_footer = json_print_footer,
.print_chapter_header = json_print_chapter_header, .print_chapter_header = json_print_chapter_header,
@@ -949,6 +975,8 @@ typedef struct {
int indent_level; int indent_level;
int fully_qualified; int fully_qualified;
int xsd_strict; int xsd_strict;
char *buf;
size_t buf_size;
} XMLContext; } XMLContext;
#undef OFFSET #undef OFFSET
@@ -1008,25 +1036,61 @@ static av_cold int xml_init(WriterContext *wctx, const char *args, void *opaque)
} }
} }
xml->buf_size = ESCAPE_INIT_BUF_SIZE;
if (!(xml->buf = av_malloc(xml->buf_size)))
return AVERROR(ENOMEM);
return 0; return 0;
} }
static const char *xml_escape_str(AVBPrint *dst, const char *src, void *log_ctx) static av_cold void xml_uninit(WriterContext *wctx)
{
XMLContext *xml = wctx->priv;
av_freep(&xml->buf);
}
static const char *xml_escape_str(char **dst, size_t *dst_size, const char *src,
void *log_ctx)
{ {
const char *p; const char *p;
char *q;
size_t size = 1;
for (p = src; *p; p++) { /* precompute size */
for (p = src; *p; p++, size++) {
ESCAPE_CHECK_SIZE(src, size, SIZE_MAX-10);
switch (*p) { switch (*p) {
case '&' : av_bprintf(dst, "%s", "&amp;"); break; case '&' : size += strlen("&amp;"); break;
case '<' : av_bprintf(dst, "%s", "&lt;"); break; case '<' : size += strlen("&lt;"); break;
case '>' : av_bprintf(dst, "%s", "&gt;"); break; case '>' : size += strlen("&gt;"); break;
case '\"': av_bprintf(dst, "%s", "&quot;"); break; case '\"': size += strlen("&quot;"); break;
case '\'': av_bprintf(dst, "%s", "&apos;"); break; case '\'': size += strlen("&apos;"); break;
default: av_bprint_chars(dst, *p, 1); default: size++;
} }
} }
ESCAPE_REALLOC_BUF(dst_size, dst, src, size);
#define COPY_STR(str) { \
const char *s = str; \
while (*s) \
*q++ = *s++; \
}
return dst->str; p = src;
q = *dst;
while (*p) {
switch (*p) {
case '&' : COPY_STR("&amp;"); break;
case '<' : COPY_STR("&lt;"); break;
case '>' : COPY_STR("&gt;"); break;
case '\"': COPY_STR("&quot;"); break;
case '\'': COPY_STR("&apos;"); break;
default: *q++ = *p;
}
p++;
}
*q = 0;
return *dst;
} }
static void xml_print_header(WriterContext *wctx) static void xml_print_header(WriterContext *wctx)
@@ -1101,13 +1165,11 @@ static void xml_print_section_footer(WriterContext *wctx, const char *section)
static void xml_print_str(WriterContext *wctx, const char *key, const char *value) static void xml_print_str(WriterContext *wctx, const char *key, const char *value)
{ {
AVBPrint buf; XMLContext *xml = wctx->priv;
if (wctx->nb_item) if (wctx->nb_item)
printf(" "); printf(" ");
av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED); printf("%s=\"%s\"", key, xml_escape_str(&xml->buf, &xml->buf_size, value, wctx));
printf("%s=\"%s\"", key, xml_escape_str(&buf, value, wctx));
av_bprint_finalize(&buf, NULL);
} }
static void xml_print_int(WriterContext *wctx, const char *key, long long int value) static void xml_print_int(WriterContext *wctx, const char *key, long long int value)
@@ -1122,7 +1184,6 @@ static void xml_show_tags(WriterContext *wctx, AVDictionary *dict)
XMLContext *xml = wctx->priv; XMLContext *xml = wctx->priv;
AVDictionaryEntry *tag = NULL; AVDictionaryEntry *tag = NULL;
int is_first = 1; int is_first = 1;
AVBPrint buf;
xml->indent_level++; xml->indent_level++;
while ((tag = av_dict_get(dict, "", tag, AV_DICT_IGNORE_SUFFIX))) { while ((tag = av_dict_get(dict, "", tag, AV_DICT_IGNORE_SUFFIX))) {
@@ -1133,14 +1194,10 @@ static void xml_show_tags(WriterContext *wctx, AVDictionary *dict)
is_first = 0; is_first = 0;
} }
XML_INDENT(); XML_INDENT();
printf("<tag key=\"%s\"",
av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED); xml_escape_str(&xml->buf, &xml->buf_size, tag->key, wctx));
printf("<tag key=\"%s\"", xml_escape_str(&buf, tag->key, wctx)); printf(" value=\"%s\"/>\n",
av_bprint_finalize(&buf, NULL); xml_escape_str(&xml->buf, &xml->buf_size, tag->value, wctx));
av_bprint_init(&buf, 1, AV_BPRINT_SIZE_UNLIMITED);
printf(" value=\"%s\"/>\n", xml_escape_str(&buf, tag->value, wctx));
av_bprint_finalize(&buf, NULL);
} }
xml->indent_level--; xml->indent_level--;
} }
@@ -1149,6 +1206,7 @@ static Writer xml_writer = {
.name = "xml", .name = "xml",
.priv_size = sizeof(XMLContext), .priv_size = sizeof(XMLContext),
.init = xml_init, .init = xml_init,
.uninit = xml_uninit,
.print_header = xml_print_header, .print_header = xml_print_header,
.print_footer = xml_print_footer, .print_footer = xml_print_footer,
.print_chapter_header = xml_print_chapter_header, .print_chapter_header = xml_print_chapter_header,
@@ -1177,9 +1235,13 @@ static void writer_register_all(void)
} }
#define print_fmt(k, f, ...) do { \ #define print_fmt(k, f, ...) do { \
av_bprint_clear(&pbuf); \ if (fast_asprintf(&pbuf, f, __VA_ARGS__)) \
av_bprintf(&pbuf, f, __VA_ARGS__); \ writer_print_string(w, k, pbuf.s, 0); \
writer_print_string(w, k, pbuf.str, 0); \ } while (0)
#define print_fmt_opt(k, f, ...) do { \
if (fast_asprintf(&pbuf, f, __VA_ARGS__)) \
writer_print_string(w, k, pbuf.s, 1); \
} while (0) } while (0)
#define print_int(k, v) writer_print_integer(w, k, v) #define print_int(k, v) writer_print_integer(w, k, v)
@@ -1197,11 +1259,9 @@ static void show_packet(WriterContext *w, AVFormatContext *fmt_ctx, AVPacket *pk
{ {
char val_str[128]; char val_str[128];
AVStream *st = fmt_ctx->streams[pkt->stream_index]; AVStream *st = fmt_ctx->streams[pkt->stream_index];
AVBPrint pbuf; struct print_buf pbuf = {.s = NULL};
const char *s; const char *s;
av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED);
print_section_header("packet"); print_section_header("packet");
s = av_get_media_type_string(st->codec->codec_type); s = av_get_media_type_string(st->codec->codec_type);
if (s) print_str ("codec_type", s); if (s) print_str ("codec_type", s);
@@ -1219,17 +1279,15 @@ static void show_packet(WriterContext *w, AVFormatContext *fmt_ctx, AVPacket *pk
print_fmt("flags", "%c", pkt->flags & AV_PKT_FLAG_KEY ? 'K' : '_'); print_fmt("flags", "%c", pkt->flags & AV_PKT_FLAG_KEY ? 'K' : '_');
print_section_footer("packet"); print_section_footer("packet");
av_bprint_finalize(&pbuf, NULL); av_free(pbuf.s);
fflush(stdout); fflush(stdout);
} }
static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream) static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream)
{ {
AVBPrint pbuf; struct print_buf pbuf = {.s = NULL};
const char *s; const char *s;
av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED);
print_section_header("frame"); print_section_header("frame");
s = av_get_media_type_string(stream->codec->codec_type); s = av_get_media_type_string(stream->codec->codec_type);
@@ -1276,7 +1334,7 @@ static void show_frame(WriterContext *w, AVFrame *frame, AVStream *stream)
print_section_footer("frame"); print_section_footer("frame");
av_bprint_finalize(&pbuf, NULL); av_free(pbuf.s);
fflush(stdout); fflush(stdout);
} }
@@ -1301,7 +1359,7 @@ static av_always_inline int get_decoded_frame(AVFormatContext *fmt_ctx,
return ret; return ret;
} }
static void read_packets(WriterContext *w, AVFormatContext *fmt_ctx) static void show_packets(WriterContext *w, AVFormatContext *fmt_ctx)
{ {
AVPacket pkt, pkt1; AVPacket pkt, pkt1;
AVFrame frame; AVFrame frame;
@@ -1310,23 +1368,18 @@ static void read_packets(WriterContext *w, AVFormatContext *fmt_ctx)
av_init_packet(&pkt); av_init_packet(&pkt);
while (!av_read_frame(fmt_ctx, &pkt)) { while (!av_read_frame(fmt_ctx, &pkt)) {
if (do_read_packets) {
if (do_show_packets) if (do_show_packets)
show_packet(w, fmt_ctx, &pkt, i++); show_packet(w, fmt_ctx, &pkt, i++);
nb_streams_packets[pkt.stream_index]++; if (do_show_frames) {
}
if (do_read_frames) {
pkt1 = pkt; pkt1 = pkt;
while (pkt1.size) { while (1) {
avcodec_get_frame_defaults(&frame); avcodec_get_frame_defaults(&frame);
ret = get_decoded_frame(fmt_ctx, &frame, &got_frame, &pkt1); ret = get_decoded_frame(fmt_ctx, &frame, &got_frame, &pkt1);
if (ret < 0 || !got_frame) if (ret < 0 || !got_frame)
break; break;
if (do_show_frames)
show_frame(w, &frame, fmt_ctx->streams[pkt.stream_index]); show_frame(w, &frame, fmt_ctx->streams[pkt.stream_index]);
pkt1.data += ret; pkt1.data += ret;
pkt1.size -= ret; pkt1.size -= ret;
nb_streams_frames[pkt.stream_index]++;
} }
} }
av_free_packet(&pkt); av_free_packet(&pkt);
@@ -1337,13 +1390,8 @@ static void read_packets(WriterContext *w, AVFormatContext *fmt_ctx)
//Flush remaining frames that are cached in the decoder //Flush remaining frames that are cached in the decoder
for (i = 0; i < fmt_ctx->nb_streams; i++) { for (i = 0; i < fmt_ctx->nb_streams; i++) {
pkt.stream_index = i; pkt.stream_index = i;
while (get_decoded_frame(fmt_ctx, &frame, &got_frame, &pkt) >= 0 && got_frame) { while (get_decoded_frame(fmt_ctx, &frame, &got_frame, &pkt) >= 0 && got_frame)
if (do_read_frames) {
if (do_show_frames)
show_frame(w, &frame, fmt_ctx->streams[pkt.stream_index]); show_frame(w, &frame, fmt_ctx->streams[pkt.stream_index]);
nb_streams_frames[pkt.stream_index]++;
}
}
} }
} }
@@ -1355,9 +1403,7 @@ static void show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_i
char val_str[128]; char val_str[128];
const char *s; const char *s;
AVRational display_aspect_ratio; AVRational display_aspect_ratio;
AVBPrint pbuf; struct print_buf pbuf = {.s = NULL};
av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED);
print_section_header("stream"); print_section_header("stream");
@@ -1407,9 +1453,13 @@ static void show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_i
else print_str_opt("pix_fmt", "unknown"); else print_str_opt("pix_fmt", "unknown");
print_int("level", dec_ctx->level); print_int("level", dec_ctx->level);
if (dec_ctx->timecode_frame_start >= 0) { if (dec_ctx->timecode_frame_start >= 0) {
char tcbuf[AV_TIMECODE_STR_SIZE]; uint32_t tc = dec_ctx->timecode_frame_start;
av_timecode_make_mpeg_tc_string(tcbuf, dec_ctx->timecode_frame_start); print_fmt("timecode", "%02d:%02d:%02d%c%02d",
print_str("timecode", tcbuf); tc>>19 & 0x1f, // hours
tc>>13 & 0x3f, // minutes
tc>>6 & 0x3f, // seconds
tc & 1<<24 ? ';' : ':', // drop
tc & 0x3f); // frames
} else { } else {
print_str_opt("timecode", "N/A"); print_str_opt("timecode", "N/A");
} }
@@ -1446,18 +1496,12 @@ static void show_stream(WriterContext *w, AVFormatContext *fmt_ctx, int stream_i
print_fmt("time_base", "%d/%d", stream->time_base.num, stream->time_base.den); print_fmt("time_base", "%d/%d", stream->time_base.num, stream->time_base.den);
print_time("start_time", stream->start_time, &stream->time_base); print_time("start_time", stream->start_time, &stream->time_base);
print_time("duration", stream->duration, &stream->time_base); print_time("duration", stream->duration, &stream->time_base);
if (dec_ctx->bit_rate > 0) print_val ("bit_rate", dec_ctx->bit_rate, unit_bit_per_second_str);
else print_str_opt("bit_rate", "N/A");
if (stream->nb_frames) print_fmt ("nb_frames", "%"PRId64, stream->nb_frames); if (stream->nb_frames) print_fmt ("nb_frames", "%"PRId64, stream->nb_frames);
else print_str_opt("nb_frames", "N/A"); else print_str_opt("nb_frames", "N/A");
if (nb_streams_frames[stream_idx]) print_fmt ("nb_read_frames", "%"PRIu64, nb_streams_frames[stream_idx]);
else print_str_opt("nb_read_frames", "N/A");
if (nb_streams_packets[stream_idx]) print_fmt ("nb_read_packets", "%"PRIu64, nb_streams_packets[stream_idx]);
else print_str_opt("nb_read_packets", "N/A");
show_tags(stream->metadata); show_tags(stream->metadata);
print_section_footer("stream"); print_section_footer("stream");
av_bprint_finalize(&pbuf, NULL); av_free(pbuf.s);
fflush(stdout); fflush(stdout);
} }
@@ -1549,19 +1593,6 @@ static int open_input_file(AVFormatContext **fmt_ctx_ptr, const char *filename)
return 0; return 0;
} }
static void close_input_file(AVFormatContext **ctx_ptr)
{
int i;
AVFormatContext *fmt_ctx = *ctx_ptr;
/* close decoder for each stream */
for (i = 0; i < fmt_ctx->nb_streams; i++)
if (fmt_ctx->streams[i]->codec->codec_id != CODEC_ID_NONE)
avcodec_close(fmt_ctx->streams[i]->codec);
avformat_close_input(ctx_ptr);
}
#define PRINT_CHAPTER(name) do { \ #define PRINT_CHAPTER(name) do { \
if (do_show_ ## name) { \ if (do_show_ ## name) { \
writer_print_chapter_header(wctx, #name); \ writer_print_chapter_header(wctx, #name); \
@@ -1573,16 +1604,11 @@ static void close_input_file(AVFormatContext **ctx_ptr)
static int probe_file(WriterContext *wctx, const char *filename) static int probe_file(WriterContext *wctx, const char *filename)
{ {
AVFormatContext *fmt_ctx; AVFormatContext *fmt_ctx;
int ret; int ret, i;
do_read_frames = do_show_frames || do_count_frames;
do_read_packets = do_show_packets || do_count_packets;
ret = open_input_file(&fmt_ctx, filename); ret = open_input_file(&fmt_ctx, filename);
if (ret >= 0) { if (ret >= 0) {
nb_streams_frames = av_calloc(fmt_ctx->nb_streams, sizeof(*nb_streams_frames)); if (do_show_packets || do_show_frames) {
nb_streams_packets = av_calloc(fmt_ctx->nb_streams, sizeof(*nb_streams_packets));
if (do_read_frames || do_read_packets) {
const char *chapter; const char *chapter;
if (do_show_frames && do_show_packets && if (do_show_frames && do_show_packets &&
wctx->writer->flags & WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER) wctx->writer->flags & WRITER_FLAG_PUT_PACKETS_AND_FRAMES_IN_SAME_CHAPTER)
@@ -1591,18 +1617,18 @@ static int probe_file(WriterContext *wctx, const char *filename)
chapter = "packets"; chapter = "packets";
else // (!do_show_packets && do_show_frames) else // (!do_show_packets && do_show_frames)
chapter = "frames"; chapter = "frames";
if (do_show_frames || do_show_packets)
writer_print_chapter_header(wctx, chapter); writer_print_chapter_header(wctx, chapter);
read_packets(wctx, fmt_ctx); show_packets(wctx, fmt_ctx);
if (do_show_frames || do_show_packets)
writer_print_chapter_footer(wctx, chapter); writer_print_chapter_footer(wctx, chapter);
} }
PRINT_CHAPTER(streams); PRINT_CHAPTER(streams);
PRINT_CHAPTER(format); PRINT_CHAPTER(format);
close_input_file(&fmt_ctx); for (i = 0; i < fmt_ctx->nb_streams; i++)
av_freep(&nb_streams_frames); if (fmt_ctx->streams[i]->codec->codec_id != CODEC_ID_NONE)
av_freep(&nb_streams_packets); avcodec_close(fmt_ctx->streams[i]->codec);
avformat_close_input(&fmt_ctx);
} }
return ret; return ret;
} }
@@ -1615,8 +1641,7 @@ static void show_usage(void)
static void ffprobe_show_program_version(WriterContext *w) static void ffprobe_show_program_version(WriterContext *w)
{ {
AVBPrint pbuf; struct print_buf pbuf = {.s = NULL};
av_bprint_init(&pbuf, 1, AV_BPRINT_SIZE_UNLIMITED);
writer_print_chapter_header(w, "program_version"); writer_print_chapter_header(w, "program_version");
print_section_header("program_version"); print_section_header("program_version");
@@ -1631,7 +1656,7 @@ static void ffprobe_show_program_version(WriterContext *w)
print_section_footer("program_version"); print_section_footer("program_version");
writer_print_chapter_footer(w, "program_version"); writer_print_chapter_footer(w, "program_version");
av_bprint_finalize(&pbuf, NULL); av_free(pbuf.s);
} }
#define SHOW_LIB_VERSION(libname, LIBNAME) \ #define SHOW_LIB_VERSION(libname, LIBNAME) \
@@ -1672,13 +1697,6 @@ static int opt_format(const char *opt, const char *arg)
return 0; return 0;
} }
static int opt_show_format_entry(const char *opt, const char *arg)
{
do_show_format = 1;
av_dict_set(&fmt_entries_to_show, arg, "", 0);
return 0;
}
static void opt_input_file(void *optctx, const char *arg) static void opt_input_file(void *optctx, const char *arg)
{ {
if (input_filename) { if (input_filename) {
@@ -1736,12 +1754,8 @@ static const OptionDef options[] = {
{ "show_error", OPT_BOOL, {(void*)&do_show_error} , "show probing error" }, { "show_error", OPT_BOOL, {(void*)&do_show_error} , "show probing error" },
{ "show_format", OPT_BOOL, {(void*)&do_show_format} , "show format/container info" }, { "show_format", OPT_BOOL, {(void*)&do_show_format} , "show format/container info" },
{ "show_frames", OPT_BOOL, {(void*)&do_show_frames} , "show frames info" }, { "show_frames", OPT_BOOL, {(void*)&do_show_frames} , "show frames info" },
{ "show_format_entry", HAS_ARG, {(void*)opt_show_format_entry},
"show a particular entry from the format/container info", "entry" },
{ "show_packets", OPT_BOOL, {(void*)&do_show_packets}, "show packets info" }, { "show_packets", OPT_BOOL, {(void*)&do_show_packets}, "show packets info" },
{ "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" }, { "show_streams", OPT_BOOL, {(void*)&do_show_streams}, "show streams info" },
{ "count_frames", OPT_BOOL, {(void*)&do_count_frames}, "count the number of frames per stream" },
{ "count_packets", OPT_BOOL, {(void*)&do_count_packets}, "count the number of packets per stream" },
{ "show_program_version", OPT_BOOL, {(void*)&do_show_program_version}, "show ffprobe version" }, { "show_program_version", OPT_BOOL, {(void*)&do_show_program_version}, "show ffprobe version" },
{ "show_library_versions", OPT_BOOL, {(void*)&do_show_library_versions}, "show library versions" }, { "show_library_versions", OPT_BOOL, {(void*)&do_show_library_versions}, "show library versions" },
{ "show_versions", 0, {(void*)&opt_show_versions}, "show program and library versions" }, { "show_versions", 0, {(void*)&opt_show_versions}, "show program and library versions" },
@@ -1776,6 +1790,10 @@ int main(int argc, char **argv)
if (!print_format) if (!print_format)
print_format = av_strdup("default"); print_format = av_strdup("default");
if (!print_format) {
ret = AVERROR(ENOMEM);
goto end;
}
w_name = av_strtok(print_format, "=", &buf); w_name = av_strtok(print_format, "=", &buf);
w_args = buf; w_args = buf;
@@ -1813,10 +1831,6 @@ int main(int argc, char **argv)
end: end:
av_freep(&print_format); av_freep(&print_format);
uninit_opts();
av_dict_free(&fmt_entries_to_show);
avformat_network_deinit(); avformat_network_deinit();
return ret; return ret;

View File

@@ -30,7 +30,7 @@
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include "libavformat/avformat.h" #include "libavformat/avformat.h"
// FIXME those are internal headers, ffserver _really_ shouldn't use them // FIXME those are internal headers, avserver _really_ shouldn't use them
#include "libavformat/ffm.h" #include "libavformat/ffm.h"
#include "libavformat/network.h" #include "libavformat/network.h"
#include "libavformat/os_support.h" #include "libavformat/os_support.h"
@@ -339,7 +339,8 @@ static int resolve_host(struct in_addr *sin_addr, const char *hostname)
if (!ff_inet_aton(hostname, sin_addr)) { if (!ff_inet_aton(hostname, sin_addr)) {
#if HAVE_GETADDRINFO #if HAVE_GETADDRINFO
struct addrinfo *ai, *cur; struct addrinfo *ai, *cur;
struct addrinfo hints = { 0 }; struct addrinfo hints;
memset(&hints, 0, sizeof(hints));
hints.ai_family = AF_INET; hints.ai_family = AF_INET;
if (getaddrinfo(hostname, NULL, &hints, &ai)) if (getaddrinfo(hostname, NULL, &hints, &ai))
return -1; return -1;
@@ -561,9 +562,11 @@ static void start_multicast(void)
default_port = 6000; default_port = 6000;
for(stream = first_stream; stream != NULL; stream = stream->next) { for(stream = first_stream; stream != NULL; stream = stream->next) {
if (stream->is_multicast) { if (stream->is_multicast) {
unsigned random0 = av_lfg_get(&random_state);
unsigned random1 = av_lfg_get(&random_state);
/* open the RTP connection */ /* open the RTP connection */
snprintf(session_id, sizeof(session_id), "%08x%08x", snprintf(session_id, sizeof(session_id), "%08x%08x",
av_lfg_get(&random_state), av_lfg_get(&random_state)); random0, random1);
/* choose a port if none given */ /* choose a port if none given */
if (stream->multicast_port == 0) { if (stream->multicast_port == 0) {
@@ -1871,7 +1874,7 @@ static int http_parse_request(HTTPContext *c)
static void fmt_bytecount(AVIOContext *pb, int64_t count) static void fmt_bytecount(AVIOContext *pb, int64_t count)
{ {
static const char suffix[] = " kMGTP"; static const char *suffix = " kMGTP";
const char *s; const char *s;
for (s = suffix; count >= 100000 && s[1]; count /= 1000, s++); for (s = suffix; count >= 100000 && s[1]; count /= 1000, s++);
@@ -2126,13 +2129,12 @@ static int open_input_stream(HTTPContext *c, const char *info)
char buf[128]; char buf[128];
char input_filename[1024]; char input_filename[1024];
AVFormatContext *s = NULL; AVFormatContext *s = NULL;
int buf_size, i, ret; int i, ret;
int64_t stream_pos; int64_t stream_pos;
/* find file name */ /* find file name */
if (c->stream->feed) { if (c->stream->feed) {
strcpy(input_filename, c->stream->feed->feed_filename); strcpy(input_filename, c->stream->feed->feed_filename);
buf_size = FFM_PACKET_SIZE;
/* compute position (absolute time) */ /* compute position (absolute time) */
if (av_find_info_tag(buf, sizeof(buf), "date", info)) { if (av_find_info_tag(buf, sizeof(buf), "date", info)) {
if ((ret = av_parse_time(&stream_pos, buf, 0)) < 0) if ((ret = av_parse_time(&stream_pos, buf, 0)) < 0)
@@ -2144,7 +2146,6 @@ static int open_input_stream(HTTPContext *c, const char *info)
stream_pos = av_gettime() - c->stream->prebuffer * (int64_t)1000; stream_pos = av_gettime() - c->stream->prebuffer * (int64_t)1000;
} else { } else {
strcpy(input_filename, c->stream->feed_filename); strcpy(input_filename, c->stream->feed_filename);
buf_size = 0;
/* compute position (relative time) */ /* compute position (relative time) */
if (av_find_info_tag(buf, sizeof(buf), "date", info)) { if (av_find_info_tag(buf, sizeof(buf), "date", info)) {
if ((ret = av_parse_time(&stream_pos, buf, 1)) < 0) if ((ret = av_parse_time(&stream_pos, buf, 1)) < 0)
@@ -2160,10 +2161,6 @@ static int open_input_stream(HTTPContext *c, const char *info)
http_log("could not open %s: %d\n", input_filename, ret); http_log("could not open %s: %d\n", input_filename, ret);
return -1; return -1;
} }
/* set buffer size */
if (buf_size > 0) ffio_set_buf_size(s->pb, buf_size);
s->flags |= AVFMT_FLAG_GENPTS; s->flags |= AVFMT_FLAG_GENPTS;
c->fmt_in = s; c->fmt_in = s;
if (strcmp(s->iformat->name, "ffm") && avformat_find_stream_info(c->fmt_in, NULL) < 0) { if (strcmp(s->iformat->name, "ffm") && avformat_find_stream_info(c->fmt_in, NULL) < 0) {
@@ -2585,11 +2582,8 @@ static int http_start_receive_data(HTTPContext *c)
if (c->stream->truncate) { if (c->stream->truncate) {
/* truncate feed file */ /* truncate feed file */
ffm_write_write_index(c->feed_fd, FFM_PACKET_SIZE); ffm_write_write_index(c->feed_fd, FFM_PACKET_SIZE);
ftruncate(c->feed_fd, FFM_PACKET_SIZE);
http_log("Truncating feed file '%s'\n", c->stream->feed_filename); http_log("Truncating feed file '%s'\n", c->stream->feed_filename);
if (ftruncate(c->feed_fd, FFM_PACKET_SIZE) < 0) {
http_log("Error truncating feed file: %s\n", strerror(errno));
return -1;
}
} else { } else {
if ((c->stream->feed_write_index = ffm_read_write_index(fd)) < 0) { if ((c->stream->feed_write_index = ffm_read_write_index(fd)) < 0) {
http_log("Error reading write index from feed file: %s\n", strerror(errno)); http_log("Error reading write index from feed file: %s\n", strerror(errno));
@@ -2837,7 +2831,7 @@ static int rtsp_parse_request(HTTPContext *c)
char protocol[32]; char protocol[32];
char line[1024]; char line[1024];
int len; int len;
RTSPMessageHeader header1 = { 0 }, *header = &header1; RTSPMessageHeader header1, *header = &header1;
c->buffer_ptr[0] = '\0'; c->buffer_ptr[0] = '\0';
p = c->buffer; p = c->buffer;
@@ -2863,6 +2857,7 @@ static int rtsp_parse_request(HTTPContext *c)
} }
/* parse each header line */ /* parse each header line */
memset(header, 0, sizeof(*header));
/* skip to next line */ /* skip to next line */
while (*p != '\n' && *p != '\0') while (*p != '\n' && *p != '\0')
p++; p++;
@@ -3093,9 +3088,12 @@ static void rtsp_cmd_setup(HTTPContext *c, const char *url,
found: found:
/* generate session id if needed */ /* generate session id if needed */
if (h->session_id[0] == '\0') if (h->session_id[0] == '\0') {
unsigned random0 = av_lfg_get(&random_state);
unsigned random1 = av_lfg_get(&random_state);
snprintf(h->session_id, sizeof(h->session_id), "%08x%08x", snprintf(h->session_id, sizeof(h->session_id), "%08x%08x",
av_lfg_get(&random_state), av_lfg_get(&random_state)); random0, random1);
}
/* find rtp session, and create it if none found */ /* find rtp session, and create it if none found */
rtp_c = find_rtp_session(h->session_id); rtp_c = find_rtp_session(h->session_id);
@@ -3464,6 +3462,9 @@ static AVStream *add_av_stream1(FFStream *stream, AVCodecContext *codec, int cop
{ {
AVStream *fst; AVStream *fst;
if(stream->nb_streams >= FF_ARRAY_ELEMS(stream->streams))
return NULL;
fst = av_mallocz(sizeof(AVStream)); fst = av_mallocz(sizeof(AVStream));
if (!fst) if (!fst)
return NULL; return NULL;
@@ -3669,8 +3670,6 @@ static void build_feed_streams(void)
int matches = 0; int matches = 0;
if (avformat_open_input(&s, feed->feed_filename, NULL, NULL) >= 0) { if (avformat_open_input(&s, feed->feed_filename, NULL, NULL) >= 0) {
/* set buffer size */
ffio_set_buf_size(s->pb, FFM_PACKET_SIZE);
/* Now see if it matches */ /* Now see if it matches */
if (s->nb_streams == feed->nb_streams) { if (s->nb_streams == feed->nb_streams) {
matches = 1; matches = 1;
@@ -3811,6 +3810,9 @@ static void add_codec(FFStream *stream, AVCodecContext *av)
{ {
AVStream *st; AVStream *st;
if(stream->nb_streams >= FF_ARRAY_ELEMS(stream->streams))
return;
/* compute default parameters */ /* compute default parameters */
switch(av->codec_type) { switch(av->codec_type) {
case AVMEDIA_TYPE_AUDIO: case AVMEDIA_TYPE_AUDIO:
@@ -4230,8 +4232,8 @@ static int parse_ffconfig(const char *filename)
} }
stream->fmt = ffserver_guess_format(NULL, stream->filename, NULL); stream->fmt = ffserver_guess_format(NULL, stream->filename, NULL);
avcodec_get_context_defaults3(&video_enc, NULL); avcodec_get_context_defaults2(&video_enc, AVMEDIA_TYPE_VIDEO);
avcodec_get_context_defaults3(&audio_enc, NULL); avcodec_get_context_defaults2(&audio_enc, AVMEDIA_TYPE_AUDIO);
audio_id = CODEC_ID_NONE; audio_id = CODEC_ID_NONE;
video_id = CODEC_ID_NONE; video_id = CODEC_ID_NONE;
@@ -4665,7 +4667,7 @@ static const OptionDef options[] = {
int main(int argc, char **argv) int main(int argc, char **argv)
{ {
struct sigaction sigact = { { 0 } }; struct sigaction sigact;
parse_loglevel(argc, argv, options); parse_loglevel(argc, argv, options);
av_register_all(); av_register_all();
@@ -4683,6 +4685,7 @@ int main(int argc, char **argv)
av_lfg_init(&random_state, av_get_random_seed()); av_lfg_init(&random_state, av_get_random_seed());
memset(&sigact, 0, sizeof(sigact));
sigact.sa_handler = handle_child_exit; sigact.sa_handler = handle_child_exit;
sigact.sa_flags = SA_NOCLDSTOP | SA_RESTART; sigact.sa_flags = SA_NOCLDSTOP | SA_RESTART;
sigaction(SIGCHLD, &sigact, 0); sigaction(SIGCHLD, &sigact, 0);

View File

@@ -25,10 +25,11 @@
*/ */
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#include "libavutil/avassert.h"
#include "avcodec.h" #include "avcodec.h"
#include "bytestream.h"
#include "dsputil.h" #include "dsputil.h"
#include "get_bits.h" #include "get_bits.h"
#include "bytestream.h"
//#undef NDEBUG //#undef NDEBUG
//#include <assert.h> //#include <assert.h>
@@ -104,8 +105,7 @@ static const int8_t mv[256][2] = {
{-29, 18},{-16,-31},{-28,-22},{ 21,-30},{-25, 28},{ 26,-29},{ 25,-32},{-32,-32} {-29, 18},{-16,-31},{-28,-22},{ 21,-30},{-25, 28},{ 26,-29},{ 25,-32},{-32,-32}
}; };
/* This is simply the scaled down elementwise product of the standard JPEG // this is simply the scaled down elementwise product of the standard jpeg quantizer table and the AAN premul table
* quantizer table and the AAN premul table. */
static const uint8_t dequant_table[64]={ static const uint8_t dequant_table[64]={
16, 15, 13, 19, 24, 31, 28, 17, 16, 15, 13, 19, 24, 31, 28, 17,
17, 23, 25, 31, 36, 63, 45, 21, 17, 23, 25, 31, 36, 63, 45, 21,
@@ -153,8 +153,7 @@ typedef struct FourXContext {
#define MULTIPLY(var,const) (((var)*(const)) >> 16) #define MULTIPLY(var,const) (((var)*(const)) >> 16)
static void idct(DCTELEM block[64]) static void idct(DCTELEM block[64]){
{
int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7; int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
int tmp10, tmp11, tmp12, tmp13; int tmp10, tmp11, tmp12, tmp13;
int z5, z10, z11, z12, z13; int z5, z10, z11, z12, z13;
@@ -238,25 +237,20 @@ static void idct(DCTELEM block[64])
} }
} }
static av_cold void init_vlcs(FourXContext *f) static av_cold void init_vlcs(FourXContext *f){
{ static VLC_TYPE table[8][32][2];
static VLC_TYPE table[2][4][32][2]; int i;
int i, j;
for (i = 0; i < 2; i++) { for(i=0; i<8; i++){
for (j = 0; j < 4; j++) { block_type_vlc[0][i].table= table[i];
block_type_vlc[i][j].table = table[i][j]; block_type_vlc[0][i].table_allocated= 32;
block_type_vlc[i][j].table_allocated = 32; init_vlc(&block_type_vlc[0][i], BLOCK_TYPE_VLC_BITS, 7,
init_vlc(&block_type_vlc[i][j], BLOCK_TYPE_VLC_BITS, 7, &block_type_tab[0][i][0][1], 2, 1,
&block_type_tab[i][j][0][1], 2, 1, &block_type_tab[0][i][0][0], 2, 1, INIT_VLC_USE_NEW_STATIC);
&block_type_tab[i][j][0][0], 2, 1,
INIT_VLC_USE_NEW_STATIC);
}
} }
} }
static void init_mv(FourXContext *f) static void init_mv(FourXContext *f){
{
int i; int i;
for(i=0; i<256; i++){ for(i=0; i<256; i++){
@@ -284,9 +278,7 @@ static void init_mv(FourXContext *f)
} }
#endif #endif
static inline void mcdc(uint16_t *dst, const uint16_t *src, int log2w, static inline void mcdc(uint16_t *dst, uint16_t *src, int log2w, int h, int stride, int scale, unsigned dc){
int h, int stride, int scale, unsigned dc)
{
int i; int i;
dc*= 0x10001; dc*= 0x10001;
@@ -294,16 +286,14 @@ static inline void mcdc(uint16_t *dst, const uint16_t *src, int log2w,
case 0: case 0:
for(i=0; i<h; i++){ for(i=0; i<h; i++){
dst[0] = scale*src[0] + dc; dst[0] = scale*src[0] + dc;
if (scale) if(scale) src += stride;
src += stride;
dst += stride; dst += stride;
} }
break; break;
case 1: case 1:
for(i=0; i<h; i++){ for(i=0; i<h; i++){
LE_CENTRIC_MUL(dst, src, scale, dc); LE_CENTRIC_MUL(dst, src, scale, dc);
if (scale) if(scale) src += stride;
src += stride;
dst += stride; dst += stride;
} }
break; break;
@@ -311,8 +301,7 @@ static inline void mcdc(uint16_t *dst, const uint16_t *src, int log2w,
for(i=0; i<h; i++){ for(i=0; i<h; i++){
LE_CENTRIC_MUL(dst, src, scale, dc); LE_CENTRIC_MUL(dst, src, scale, dc);
LE_CENTRIC_MUL(dst + 2, src + 2, scale, dc); LE_CENTRIC_MUL(dst + 2, src + 2, scale, dc);
if (scale) if(scale) src += stride;
src += stride;
dst += stride; dst += stride;
} }
break; break;
@@ -322,24 +311,18 @@ static inline void mcdc(uint16_t *dst, const uint16_t *src, int log2w,
LE_CENTRIC_MUL(dst + 2, src + 2, scale, dc); LE_CENTRIC_MUL(dst + 2, src + 2, scale, dc);
LE_CENTRIC_MUL(dst + 4, src + 4, scale, dc); LE_CENTRIC_MUL(dst + 4, src + 4, scale, dc);
LE_CENTRIC_MUL(dst + 6, src + 6, scale, dc); LE_CENTRIC_MUL(dst + 6, src + 6, scale, dc);
if (scale) if(scale) src += stride;
src += stride;
dst += stride; dst += stride;
} }
break; break;
default: default: assert(0);
assert(0);
} }
} }
static void decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src, static void decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src, int log2w, int log2h, int stride){
int log2w, int log2h, int stride)
{
const int index= size2index[log2h][log2w]; const int index= size2index[log2h][log2w];
const int h= 1<<log2h; const int h= 1<<log2h;
int code = get_vlc2(&f->gb, int code= get_vlc2(&f->gb, block_type_vlc[1-(f->version>1)][index].table, BLOCK_TYPE_VLC_BITS, 1);
block_type_vlc[1 - (f->version > 1)][index].table,
BLOCK_TYPE_VLC_BITS, 1);
uint16_t *start= (uint16_t*)f->last_picture.data[0]; uint16_t *start= (uint16_t*)f->last_picture.data[0];
uint16_t *end= start + stride*(f->avctx->height-h+1) - (1<<log2w); uint16_t *end= start + stride*(f->avctx->height-h+1) - (1<<log2w);
@@ -350,7 +333,7 @@ static void decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src,
av_log(f->avctx, AV_LOG_ERROR, "bytestream overread\n"); av_log(f->avctx, AV_LOG_ERROR, "bytestream overread\n");
return; return;
} }
src += f->mv[bytestream2_get_byte(&f->g)]; src += f->mv[ *f->g.buffer++ ];
if(start > src || src > end){ if(start > src || src > end){
av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n"); av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
return; return;
@@ -359,21 +342,23 @@ static void decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src,
}else if(code == 1){ }else if(code == 1){
log2h--; log2h--;
decode_p_block(f, dst , src , log2w, log2h, stride); decode_p_block(f, dst , src , log2w, log2h, stride);
decode_p_block(f, dst + (stride << log2h), decode_p_block(f, dst + (stride<<log2h), src + (stride<<log2h), log2w, log2h, stride);
src + (stride << log2h), log2w, log2h, stride);
}else if(code == 2){ }else if(code == 2){
log2w--; log2w--;
decode_p_block(f, dst , src , log2w, log2h, stride); decode_p_block(f, dst , src , log2w, log2h, stride);
decode_p_block(f, dst + (1 << log2w), decode_p_block(f, dst + (1<<log2w), src + (1<<log2w), log2w, log2h, stride);
src + (1 << log2w), log2w, log2h, stride);
}else if(code == 3 && f->version<2){ }else if(code == 3 && f->version<2){
if (start > src || src > end) {
av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
return;
}
mcdc(dst, src, log2w, h, stride, 1, 0); mcdc(dst, src, log2w, h, stride, 1, 0);
}else if(code == 4){ }else if(code == 4){
if (f->g.buffer_end - f->g.buffer < 1){ if (f->g.buffer_end - f->g.buffer < 1){
av_log(f->avctx, AV_LOG_ERROR, "bytestream overread\n"); av_log(f->avctx, AV_LOG_ERROR, "bytestream overread\n");
return; return;
} }
src += f->mv[bytestream2_get_byte(&f->g)]; src += f->mv[ *f->g.buffer++ ];
if(start > src || src > end){ if(start > src || src > end){
av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n"); av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
return; return;
@@ -388,6 +373,10 @@ static void decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src,
av_log(f->avctx, AV_LOG_ERROR, "wordstream overread\n"); av_log(f->avctx, AV_LOG_ERROR, "wordstream overread\n");
return; return;
} }
if (start > src || src > end) {
av_log(f->avctx, AV_LOG_ERROR, "mv out of pic\n");
return;
}
mcdc(dst, src, log2w, h, stride, 0, bytestream2_get_le16(&f->g2)); mcdc(dst, src, log2w, h, stride, 0, bytestream2_get_le16(&f->g2));
}else if(code == 6){ }else if(code == 6){
if (f->g2.buffer_end - f->g2.buffer < 2){ if (f->g2.buffer_end - f->g2.buffer < 2){
@@ -404,18 +393,18 @@ static void decode_p_block(FourXContext *f, uint16_t *dst, uint16_t *src,
} }
} }
static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length) static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length){
{
int x, y; int x, y;
const int width= f->avctx->width; const int width= f->avctx->width;
const int height= f->avctx->height; const int height= f->avctx->height;
uint16_t *src= (uint16_t*)f->last_picture.data[0]; uint16_t *src= (uint16_t*)f->last_picture.data[0];
uint16_t *dst= (uint16_t*)f->current_picture.data[0]; uint16_t *dst= (uint16_t*)f->current_picture.data[0];
const int stride= f->current_picture.linesize[0]>>1; const int stride= f->current_picture.linesize[0]>>1;
unsigned int bitstream_size, bytestream_size, wordstream_size, extra, unsigned int bitstream_size, bytestream_size, wordstream_size, extra, bytestream_offset, wordstream_offset;
bytestream_offset, wordstream_offset;
if(f->version>1){ if(f->version>1){
if (length < 20)
return AVERROR_INVALIDDATA;
extra=20; extra=20;
if (length < extra) if (length < extra)
return -1; return -1;
@@ -438,28 +427,24 @@ static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length)
return -1; return -1;
} }
av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size, av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size, bitstream_size + FF_INPUT_BUFFER_PADDING_SIZE);
bitstream_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!f->bitstream_buffer) if (!f->bitstream_buffer)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)(buf + extra), f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)(buf + extra), bitstream_size/4);
bitstream_size / 4); memset((uint8_t*)f->bitstream_buffer + bitstream_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
memset((uint8_t*)f->bitstream_buffer + bitstream_size,
0, FF_INPUT_BUFFER_PADDING_SIZE);
init_get_bits(&f->gb, f->bitstream_buffer, 8*bitstream_size); init_get_bits(&f->gb, f->bitstream_buffer, 8*bitstream_size);
wordstream_offset = extra + bitstream_size; wordstream_offset = extra + bitstream_size;
bytestream_offset = extra + bitstream_size + wordstream_size; bytestream_offset = extra + bitstream_size + wordstream_size;
bytestream2_init(&f->g2, buf + wordstream_offset, bytestream2_init(&f->g2, buf + wordstream_offset, length - wordstream_offset);
length - wordstream_offset); bytestream2_init(&f->g, buf + bytestream_offset, length - bytestream_offset);
bytestream2_init(&f->g, buf + bytestream_offset,
length - bytestream_offset);
init_mv(f); init_mv(f);
for(y=0; y<height; y+=8){ for(y=0; y<height; y+=8){
for (x = 0; x < width; x += 8) for(x=0; x<width; x+=8){
decode_p_block(f, dst + x, src + x, 3, 3, stride); decode_p_block(f, dst + x, src + x, 3, 3, stride);
}
src += 8*stride; src += 8*stride;
dst += 8*stride; dst += 8*stride;
} }
@@ -471,8 +456,7 @@ static int decode_p_frame(FourXContext *f, const uint8_t *buf, int length)
* decode block and dequantize. * decode block and dequantize.
* Note this is almost identical to MJPEG. * Note this is almost identical to MJPEG.
*/ */
static int decode_i_block(FourXContext *f, DCTELEM *block) static int decode_i_block(FourXContext *f, DCTELEM *block){
{
int code, i, j, level, val; int code, i, j, level, val;
if(get_bits_left(&f->gb) < 2){ if(get_bits_left(&f->gb) < 2){
@@ -482,14 +466,16 @@ static int decode_i_block(FourXContext *f, DCTELEM *block)
/* DC coef */ /* DC coef */
val = get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3); val = get_vlc2(&f->pre_gb, f->pre_vlc.table, ACDC_VLC_BITS, 3);
if (val >> 4) if (val>>4){
av_log(f->avctx, AV_LOG_ERROR, "error dc run != 0\n"); av_log(f->avctx, AV_LOG_ERROR, "error dc run != 0\n");
}
if(val) if(val)
val = get_xbits(&f->gb, val); val = get_xbits(&f->gb, val);
val = val * dequant_table[0] + f->last_dc; val = val * dequant_table[0] + f->last_dc;
f->last_dc = block[0] = val; f->last_dc =
block[0] = val;
/* AC coefs */ /* AC coefs */
i = 1; i = 1;
for(;;) { for(;;) {
@@ -519,8 +505,7 @@ static int decode_i_block(FourXContext *f, DCTELEM *block)
return 0; return 0;
} }
static inline void idct_put(FourXContext *f, int x, int y) static inline void idct_put(FourXContext *f, int x, int y){
{
DCTELEM (*block)[64]= f->block; DCTELEM (*block)[64]= f->block;
int stride= f->current_picture.linesize[0]>>1; int stride= f->current_picture.linesize[0]>>1;
int i; int i;
@@ -532,18 +517,17 @@ static inline void idct_put(FourXContext *f, int x, int y)
} }
if(!(f->avctx->flags&CODEC_FLAG_GRAY)){ if(!(f->avctx->flags&CODEC_FLAG_GRAY)){
for (i = 4; i < 6; i++) for(i=4; i<6; i++) idct(block[i]);
idct(block[i]);
} }
/* Note transform is: /* Note transform is:
* y = ( 1b + 4g + 2r) / 14 y= ( 1b + 4g + 2r)/14
* cb = ( 3b - 2g - 1r) / 14 cb=( 3b - 2g - 1r)/14
* cr = (-1b - 4g + 5r) / 14 */ cr=(-1b - 4g + 5r)/14
*/
for(y=0; y<8; y++){ for(y=0; y<8; y++){
for(x=0; x<8; x++){ for(x=0; x<8; x++){
DCTELEM *temp = block[(x >> 2) + 2 * (y >> 2)] + DCTELEM *temp= block[(x>>2) + 2*(y>>2)] + 2*(x&3) + 2*8*(y&3); //FIXME optimize
2 * (x & 3) + 2 * 8 * (y & 3); // FIXME optimize
int cb= block[4][x + 8*y]; int cb= block[4][x + 8*y];
int cr= block[5][x + 8*y]; int cr= block[5][x + 8*y];
int cg= (cb + cr)>>1; int cg= (cb + cr)>>1;
@@ -565,23 +549,24 @@ static inline void idct_put(FourXContext *f, int x, int y)
} }
} }
static int decode_i_mb(FourXContext *f) static int decode_i_mb(FourXContext *f){
{
int i; int i;
f->dsp.clear_blocks(f->block[0]); f->dsp.clear_blocks(f->block[0]);
for (i = 0; i < 6; i++) for(i=0; i<6; i++){
if(decode_i_block(f, f->block[i]) < 0) if(decode_i_block(f, f->block[i]) < 0)
return -1; return -1;
}
return 0; return 0;
} }
static const uint8_t *read_huffman_tables(FourXContext *f, static const uint8_t *read_huffman_tables(FourXContext *f,
const uint8_t * const buf, int buf_size) const uint8_t * const buf,
int buf_size)
{ {
int frequency[512] = { 0 }; int frequency[512];
uint8_t flag[512]; uint8_t flag[512];
int up[512]; int up[512];
uint8_t len_tab[257]; uint8_t len_tab[257];
@@ -591,6 +576,7 @@ static const uint8_t *read_huffman_tables(FourXContext *f,
const uint8_t *ptr_end = buf + buf_size; const uint8_t *ptr_end = buf + buf_size;
int j; int j;
memset(frequency, 0, sizeof(frequency));
memset(up, -1, sizeof(up)); memset(up, -1, sizeof(up));
start= *ptr++; start= *ptr++;
@@ -600,40 +586,37 @@ static const uint8_t *read_huffman_tables(FourXContext *f,
if (start <= end && ptr_end - ptr < end - start + 1 + 1) if (start <= end && ptr_end - ptr < end - start + 1 + 1)
return NULL; return NULL;
for (i = start; i <= end; i++) if (end < start || buf_size < 0)
return NULL;
for(i=start; i<=end; i++){
frequency[i]= *ptr++; frequency[i]= *ptr++;
}
start= *ptr++; start= *ptr++;
if (start == 0) if(start==0) break;
break;
end= *ptr++; end= *ptr++;
} }
frequency[256]=1; frequency[256]=1;
while ((ptr - buf) & 3) while((ptr - buf)&3) ptr++; // 4byte align
ptr++; // 4byte align
for(j=257; j<512; j++){ for(j=257; j<512; j++){
int min_freq[2]= {256*256, 256*256}; int min_freq[2]= {256*256, 256*256};
int smallest[2]= {0, 0}; int smallest[2]= {0, 0};
int i; int i;
for(i=0; i<j; i++){ for(i=0; i<j; i++){
if (frequency[i] == 0) if(frequency[i] == 0) continue;
continue;
if(frequency[i] < min_freq[1]){ if(frequency[i] < min_freq[1]){
if(frequency[i] < min_freq[0]){ if(frequency[i] < min_freq[0]){
min_freq[1] = min_freq[0]; min_freq[1]= min_freq[0]; smallest[1]= smallest[0];
smallest[1] = smallest[0]; min_freq[0]= frequency[i];smallest[0]= i;
min_freq[0] = frequency[i];
smallest[0] = i;
}else{ }else{
min_freq[1] = frequency[i]; min_freq[1]= frequency[i];smallest[1]= i;
smallest[1] = i;
} }
} }
} }
if (min_freq[1] == 256 * 256) if(min_freq[1] == 256*256) break;
break;
frequency[j]= min_freq[0] + min_freq[1]; frequency[j]= min_freq[0] + min_freq[1];
flag[ smallest[0] ]= 0; flag[ smallest[0] ]= 0;
@@ -644,38 +627,36 @@ static const uint8_t *read_huffman_tables(FourXContext *f,
} }
for(j=0; j<257; j++){ for(j=0; j<257; j++){
int node, len = 0, bits = 0; int node;
int len=0;
int bits=0;
for(node= j; up[node] != -1; node= up[node]){ for(node= j; up[node] != -1; node= up[node]){
bits += flag[node]<<len; bits += flag[node]<<len;
len++; len++;
if (len > 31) if(len > 31) av_log(f->avctx, AV_LOG_ERROR, "vlc length overflow\n"); //can this happen at all ?
// can this happen at all ?
av_log(f->avctx, AV_LOG_ERROR,
"vlc length overflow\n");
} }
bits_tab[j]= bits; bits_tab[j]= bits;
len_tab[j]= len; len_tab[j]= len;
} }
if (init_vlc(&f->pre_vlc, ACDC_VLC_BITS, 257, len_tab, 1, 1, if (init_vlc(&f->pre_vlc, ACDC_VLC_BITS, 257,
len_tab , 1, 1,
bits_tab, 4, 4, 0)) bits_tab, 4, 4, 0))
return NULL; return NULL;
return ptr; return ptr;
} }
static int mix(int c0, int c1) static int mix(int c0, int c1){
{
int blue = 2*(c0&0x001F) + (c1&0x001F); int blue = 2*(c0&0x001F) + (c1&0x001F);
int green= (2*(c0&0x03E0) + (c1&0x03E0))>>5; int green= (2*(c0&0x03E0) + (c1&0x03E0))>>5;
int red = 2*(c0>>10) + (c1>>10); int red = 2*(c0>>10) + (c1>>10);
return red/3*1024 + green/3*32 + blue/3; return red/3*1024 + green/3*32 + blue/3;
} }
static int decode_i2_frame(FourXContext *f, const uint8_t *buf, int length) static int decode_i2_frame(FourXContext *f, const uint8_t *buf, int length){
{
int x, y, x2, y2; int x, y, x2, y2;
const int width= f->avctx->width; const int width= f->avctx->width;
const int height= f->avctx->height; const int height= f->avctx->height;
@@ -693,17 +674,16 @@ static int decode_i2_frame(FourXContext *f, const uint8_t *buf, int length)
for(y=0; y<height; y+=16){ for(y=0; y<height; y+=16){
for(x=0; x<width; x+=16){ for(x=0; x<width; x+=16){
unsigned int color[4] = { 0 }, bits; unsigned int color[4], bits;
if (buf_end - buf < 8) if (buf_end - buf < 8)
return -1; return -1;
memset(color, 0, sizeof(color));
//warning following is purely guessed ... //warning following is purely guessed ...
color[0]= bytestream2_get_le16u(&g3); color[0]= bytestream2_get_le16u(&g3);
color[1]= bytestream2_get_le16u(&g3); color[1]= bytestream2_get_le16u(&g3);
if (color[0] & 0x8000) if(color[0]&0x8000) av_log(f->avctx, AV_LOG_ERROR, "unk bit 1\n");
av_log(NULL, AV_LOG_ERROR, "unk bit 1\n"); if(color[1]&0x8000) av_log(f->avctx, AV_LOG_ERROR, "unk bit 2\n");
if (color[1] & 0x8000)
av_log(NULL, AV_LOG_ERROR, "unk bit 2\n");
color[2]= mix(color[0], color[1]); color[2]= mix(color[0], color[1]);
color[3]= mix(color[1], color[0]); color[3]= mix(color[1], color[0]);
@@ -723,8 +703,7 @@ static int decode_i2_frame(FourXContext *f, const uint8_t *buf, int length)
return 0; return 0;
} }
static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length) static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length){
{
int x, y; int x, y;
const int width= f->avctx->width; const int width= f->avctx->width;
const int height= f->avctx->height; const int height= f->avctx->height;
@@ -732,7 +711,10 @@ static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length)
unsigned int prestream_size; unsigned int prestream_size;
const uint8_t *prestream; const uint8_t *prestream;
if (bitstream_size > (1<<26) || length < bitstream_size + 12) { if (bitstream_size > (1 << 26))
return AVERROR_INVALIDDATA;
if (length < bitstream_size + 12) {
av_log(f->avctx, AV_LOG_ERROR, "packet size too small\n"); av_log(f->avctx, AV_LOG_ERROR, "packet size too small\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
@@ -741,29 +723,28 @@ static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length)
prestream = buf + bitstream_size + 12; prestream = buf + bitstream_size + 12;
if(prestream_size + bitstream_size + 12 != length if(prestream_size + bitstream_size + 12 != length
|| bitstream_size > (1 << 26)
|| prestream_size > (1<<26)){ || prestream_size > (1<<26)){
av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d %d\n", av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d %d\n", prestream_size, bitstream_size, length);
prestream_size, bitstream_size, length);
return -1; return -1;
} }
prestream = read_huffman_tables(f, prestream, buf + length - prestream); prestream = read_huffman_tables(f, prestream, prestream_size);
if (!prestream) if (!prestream) {
return -1; av_log(f->avctx, AV_LOG_ERROR, "Error reading Huffman tables.\n");
return AVERROR_INVALIDDATA;
}
av_assert0(prestream <= buf + length);
init_get_bits(&f->gb, buf + 4, 8*bitstream_size); init_get_bits(&f->gb, buf + 4, 8*bitstream_size);
prestream_size= length + buf - prestream; prestream_size= length + buf - prestream;
av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size, av_fast_malloc(&f->bitstream_buffer, &f->bitstream_buffer_size, prestream_size + FF_INPUT_BUFFER_PADDING_SIZE);
prestream_size + FF_INPUT_BUFFER_PADDING_SIZE);
if (!f->bitstream_buffer) if (!f->bitstream_buffer)
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)prestream, f->dsp.bswap_buf(f->bitstream_buffer, (const uint32_t*)prestream, prestream_size/4);
prestream_size / 4); memset((uint8_t*)f->bitstream_buffer + prestream_size, 0, FF_INPUT_BUFFER_PADDING_SIZE);
memset((uint8_t*)f->bitstream_buffer + prestream_size,
0, FF_INPUT_BUFFER_PADDING_SIZE);
init_get_bits(&f->pre_gb, f->bitstream_buffer, 8*prestream_size); init_get_bits(&f->pre_gb, f->bitstream_buffer, 8*prestream_size);
f->last_dc= 0*128*8*8; f->last_dc= 0*128*8*8;
@@ -783,8 +764,9 @@ static int decode_i_frame(FourXContext *f, const uint8_t *buf, int length)
return 0; return 0;
} }
static int decode_frame(AVCodecContext *avctx, void *data, static int decode_frame(AVCodecContext *avctx,
int *data_size, AVPacket *avpkt) void *data, int *data_size,
AVPacket *avpkt)
{ {
const uint8_t *buf = avpkt->data; const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size; int buf_size = avpkt->size;
@@ -793,35 +775,43 @@ static int decode_frame(AVCodecContext *avctx, void *data,
AVFrame *p, temp; AVFrame *p, temp;
int i, frame_4cc, frame_size; int i, frame_4cc, frame_size;
if (buf_size < 12) if (buf_size < 20)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
if (avctx->width % 16 || avctx->height % 16) {
av_log(avctx, AV_LOG_ERROR,
"Dimensions non-multiple of 16 are invalid.\n");
return AVERROR_INVALIDDATA;
}
if (buf_size < AV_RL32(buf + 4) + 8) {
av_log(f->avctx, AV_LOG_ERROR,
"size mismatch %d %d\n", buf_size, AV_RL32(buf + 4));
}
frame_4cc = AV_RL32(buf); frame_4cc = AV_RL32(buf);
if (buf_size != AV_RL32(buf + 4) + 8 || buf_size < 20)
av_log(f->avctx, AV_LOG_ERROR, "size mismatch %d %d\n",
buf_size, AV_RL32(buf + 4));
if(frame_4cc == AV_RL32("cfrm")){ if(frame_4cc == AV_RL32("cfrm")){
int free_index=-1; int free_index=-1;
int id, whole_size;
const int data_size = buf_size - 20; const int data_size = buf_size - 20;
const int id = AV_RL32(buf + 12);
const int whole_size = AV_RL32(buf + 16);
CFrameBuffer *cfrm; CFrameBuffer *cfrm;
id = AV_RL32(buf + 12);
whole_size = AV_RL32(buf + 16);
if (data_size < 0 || whole_size < 0){ if (data_size < 0 || whole_size < 0){
av_log(f->avctx, AV_LOG_ERROR, "sizes invalid\n"); av_log(f->avctx, AV_LOG_ERROR, "sizes invalid\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
for(i=0; i<CFRAME_BUFFER_COUNT; i++){
for (i = 0; i < CFRAME_BUFFER_COUNT; i++)
if(f->cfrm[i].id && f->cfrm[i].id < avctx->frame_number) if(f->cfrm[i].id && f->cfrm[i].id < avctx->frame_number)
av_log(f->avctx, AV_LOG_ERROR, "lost c frame %d\n", av_log(f->avctx, AV_LOG_ERROR, "lost c frame %d\n", f->cfrm[i].id);
f->cfrm[i].id); }
for(i=0; i<CFRAME_BUFFER_COUNT; i++){ for(i=0; i<CFRAME_BUFFER_COUNT; i++){
if (f->cfrm[i].id == id) if(f->cfrm[i].id == id) break;
break; if(f->cfrm[i].size == 0 ) free_index= i;
if (f->cfrm[i].size == 0)
free_index = i;
} }
if(i>=CFRAME_BUFFER_COUNT){ if(i>=CFRAME_BUFFER_COUNT){
@@ -832,11 +822,8 @@ static int decode_frame(AVCodecContext *avctx, void *data,
if (data_size > UINT_MAX - cfrm->size - FF_INPUT_BUFFER_PADDING_SIZE) if (data_size > UINT_MAX - cfrm->size - FF_INPUT_BUFFER_PADDING_SIZE)
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
cfrm->data= av_fast_realloc(cfrm->data, &cfrm->allocated_size, cfrm->size + data_size + FF_INPUT_BUFFER_PADDING_SIZE);
cfrm->data = av_fast_realloc(cfrm->data, &cfrm->allocated_size, if(!cfrm->data){ //explicit check needed as memcpy below might not catch a NULL
cfrm->size + data_size + FF_INPUT_BUFFER_PADDING_SIZE);
// explicit check needed as memcpy below might not catch a NULL
if (!cfrm->data) {
av_log(f->avctx, AV_LOG_ERROR, "realloc falure"); av_log(f->avctx, AV_LOG_ERROR, "realloc falure");
return -1; return -1;
} }
@@ -848,9 +835,12 @@ static int decode_frame(AVCodecContext *avctx, void *data,
buf= cfrm->data; buf= cfrm->data;
frame_size= cfrm->size; frame_size= cfrm->size;
if (id != avctx->frame_number) if(id != avctx->frame_number){
av_log(f->avctx, AV_LOG_ERROR, "cframe id mismatch %d %d\n", av_log(f->avctx, AV_LOG_ERROR, "cframe id mismatch %d %d\n", id, avctx->frame_number);
id, avctx->frame_number); }
if (f->version <= 1)
return AVERROR_INVALIDDATA;
cfrm->size= cfrm->id= 0; cfrm->size= cfrm->id= 0;
frame_4cc= AV_RL32("pfrm"); frame_4cc= AV_RL32("pfrm");
@@ -868,8 +858,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
p= &f->current_picture; p= &f->current_picture;
avctx->coded_frame= p; avctx->coded_frame= p;
// alternatively we would have to use our own buffer management avctx->flags |= CODEC_FLAG_EMU_EDGE; // alternatively we would have to use our own buffer management
avctx->flags |= CODEC_FLAG_EMU_EDGE;
p->reference= 3; p->reference= 3;
if (avctx->reget_buffer(avctx, p) < 0) { if (avctx->reget_buffer(avctx, p) < 0) {
@@ -896,6 +885,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return -1; return -1;
} }
memset(f->last_picture.data[0], 0, avctx->height * FFABS(f->last_picture.linesize[0]));
} }
p->pict_type= AV_PICTURE_TYPE_P; p->pict_type= AV_PICTURE_TYPE_P;
@@ -904,11 +894,9 @@ static int decode_frame(AVCodecContext *avctx, void *data,
return -1; return -1;
} }
}else if(frame_4cc == AV_RL32("snd_")){ }else if(frame_4cc == AV_RL32("snd_")){
av_log(avctx, AV_LOG_ERROR, "ignoring snd_ chunk length:%d\n", av_log(avctx, AV_LOG_ERROR, "ignoring snd_ chunk length:%d\n", buf_size);
buf_size);
}else{ }else{
av_log(avctx, AV_LOG_ERROR, "ignoring unknown chunk length:%d\n", av_log(avctx, AV_LOG_ERROR, "ignoring unknown chunk length:%d\n", buf_size);
buf_size);
} }
p->key_frame= p->pict_type == AV_PICTURE_TYPE_I; p->key_frame= p->pict_type == AV_PICTURE_TYPE_I;
@@ -922,17 +910,15 @@ static int decode_frame(AVCodecContext *avctx, void *data,
} }
static av_cold void common_init(AVCodecContext *avctx) static av_cold void common_init(AVCodecContext *avctx){
{
FourXContext * const f = avctx->priv_data; FourXContext * const f = avctx->priv_data;
ff_dsputil_init(&f->dsp, avctx); dsputil_init(&f->dsp, avctx);
f->avctx= avctx; f->avctx= avctx;
} }
static av_cold int decode_init(AVCodecContext *avctx) static av_cold int decode_init(AVCodecContext *avctx){
{
FourXContext * const f = avctx->priv_data; FourXContext * const f = avctx->priv_data;
if(avctx->extradata_size != 4 || !avctx->extradata) { if(avctx->extradata_size != 4 || !avctx->extradata) {
@@ -950,17 +936,14 @@ static av_cold int decode_init(AVCodecContext *avctx)
common_init(avctx); common_init(avctx);
init_vlcs(f); init_vlcs(f);
if (f->version > 2) if(f->version>2) avctx->pix_fmt= PIX_FMT_RGB565;
avctx->pix_fmt = PIX_FMT_RGB565; else avctx->pix_fmt= PIX_FMT_BGR555;
else
avctx->pix_fmt = PIX_FMT_BGR555;
return 0; return 0;
} }
static av_cold int decode_end(AVCodecContext *avctx) static av_cold int decode_end(AVCodecContext *avctx){
{
FourXContext * const f = avctx->priv_data; FourXContext * const f = avctx->priv_data;
int i; int i;
@@ -990,3 +973,4 @@ AVCodec ff_fourxm_decoder = {
.capabilities = CODEC_CAP_DR1, .capabilities = CODEC_CAP_DR1,
.long_name = NULL_IF_CONFIG_SMALL("4X Movie"), .long_name = NULL_IF_CONFIG_SMALL("4X Movie"),
}; };

View File

@@ -38,13 +38,13 @@
#include "avcodec.h" #include "avcodec.h"
static const enum PixelFormat pixfmt_rgb24[] = { static const enum PixelFormat pixfmt_rgb24[] = {PIX_FMT_BGR24, PIX_FMT_RGB32, PIX_FMT_NONE};
PIX_FMT_BGR24, PIX_FMT_RGB32, PIX_FMT_NONE };
/* /*
* Decoder context * Decoder context
*/ */
typedef struct EightBpsContext { typedef struct EightBpsContext {
AVCodecContext *avctx; AVCodecContext *avctx;
AVFrame pic; AVFrame pic;
@@ -60,8 +60,7 @@ typedef struct EightBpsContext {
* Decode a frame * Decode a frame
* *
*/ */
static int decode_frame(AVCodecContext *avctx, void *data, static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt)
int *data_size, AVPacket *avpkt)
{ {
const uint8_t *buf = avpkt->data; const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size; int buf_size = avpkt->size;
@@ -70,7 +69,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
unsigned char *pixptr, *pixptr_end; unsigned char *pixptr, *pixptr_end;
unsigned int height = avctx->height; // Real image height unsigned int height = avctx->height; // Real image height
unsigned int dlen, p, row; unsigned int dlen, p, row;
const unsigned char *lp, *dp; const unsigned char *lp, *dp, *ep;
unsigned char count; unsigned char count;
unsigned int planes = c->planes; unsigned int planes = c->planes;
unsigned char *planemap = c->planemap; unsigned char *planemap = c->planemap;
@@ -85,6 +84,8 @@ static int decode_frame(AVCodecContext *avctx, void *data,
return -1; return -1;
} }
ep = encoded + buf_size;
/* Set data pointer after line lengths */ /* Set data pointer after line lengths */
dp = encoded + planes * (height << 1); dp = encoded + planes * (height << 1);
@@ -96,18 +97,18 @@ static int decode_frame(AVCodecContext *avctx, void *data,
for(row = 0; row < height; row++) { for(row = 0; row < height; row++) {
pixptr = c->pic.data[0] + row * c->pic.linesize[0] + planemap[p]; pixptr = c->pic.data[0] + row * c->pic.linesize[0] + planemap[p];
pixptr_end = pixptr + c->pic.linesize[0]; pixptr_end = pixptr + c->pic.linesize[0];
if (ep - lp < row * 2 + 2)
return AVERROR_INVALIDDATA;
dlen = av_be2ne16(*(const unsigned short *)(lp+row*2)); dlen = av_be2ne16(*(const unsigned short *)(lp+row*2));
/* Decode a row of this plane */ /* Decode a row of this plane */
while(dlen > 0) { while(dlen > 0) {
if (dp + 1 >= buf + buf_size) if(ep - dp <= 1) return -1;
return -1;
if ((count = *dp++) <= 127) { if ((count = *dp++) <= 127) {
count++; count++;
dlen -= count + 1; dlen -= count + 1;
if (pixptr + count * planes > pixptr_end) if (pixptr + count * planes > pixptr_end)
break; break;
if (dp + count > buf + buf_size) if(ep - dp < count) return -1;
return -1;
while(count--) { while(count--) {
*pixptr = *dp++; *pixptr = *dp++;
pixptr += planes; pixptr += planes;
@@ -157,9 +158,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
EightBpsContext * const c = avctx->priv_data; EightBpsContext * const c = avctx->priv_data;
c->avctx = avctx; c->avctx = avctx;
c->pic.data[0] = NULL;
avcodec_get_frame_defaults(&c->pic); avcodec_get_frame_defaults(&c->pic);
c->pic.data[0] = NULL;
switch (avctx->bits_per_coded_sample) { switch (avctx->bits_per_coded_sample) {
case 8: case 8:
avctx->pix_fmt = PIX_FMT_PAL8; avctx->pix_fmt = PIX_FMT_PAL8;
@@ -189,8 +191,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
#endif #endif
break; break;
default: default:
av_log(avctx, AV_LOG_ERROR, "Error: Unsupported color depth: %u.\n", av_log(avctx, AV_LOG_ERROR, "Error: Unsupported color depth: %u.\n", avctx->bits_per_coded_sample);
avctx->bits_per_coded_sample);
return -1; return -1;
} }

View File

@@ -38,6 +38,7 @@
*/ */
#include "avcodec.h" #include "avcodec.h"
#include "internal.h"
/** decoder context */ /** decoder context */
typedef struct EightSvxContext { typedef struct EightSvxContext {
@@ -151,7 +152,7 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
/* get output buffer */ /* get output buffer */
esc->frame.nb_samples = (FFMIN(MAX_FRAME_SIZE, esc->samples_size - esc->samples_idx) +avctx->channels-1) / avctx->channels; esc->frame.nb_samples = (FFMIN(MAX_FRAME_SIZE, esc->samples_size - esc->samples_idx) +avctx->channels-1) / avctx->channels;
if ((ret = avctx->get_buffer(avctx, &esc->frame)) < 0) { if ((ret = ff_get_buffer(avctx, &esc->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret; return ret;
} }

View File

@@ -3,14 +3,7 @@ include $(SUBDIR)../config.mak
NAME = avcodec NAME = avcodec
FFLIBS = avutil FFLIBS = avutil
HEADERS = avcodec.h \ HEADERS = avcodec.h avfft.h dxva2.h opt.h vaapi.h vda.h vdpau.h version.h xvmc.h
avfft.h \
dxva2.h \
vaapi.h \
vda.h \
vdpau.h \
version.h \
xvmc.h \
OBJS = allcodecs.o \ OBJS = allcodecs.o \
audioconvert.o \ audioconvert.o \
@@ -46,7 +39,6 @@ OBJS-$(CONFIG_GOLOMB) += golomb.o
OBJS-$(CONFIG_H264DSP) += h264dsp.o h264idct.o OBJS-$(CONFIG_H264DSP) += h264dsp.o h264idct.o
OBJS-$(CONFIG_H264PRED) += h264pred.o OBJS-$(CONFIG_H264PRED) += h264pred.o
OBJS-$(CONFIG_HUFFMAN) += huffman.o OBJS-$(CONFIG_HUFFMAN) += huffman.o
OBJS-$(CONFIG_LIBXVID) += libxvid_rc.o
OBJS-$(CONFIG_LPC) += lpc.o OBJS-$(CONFIG_LPC) += lpc.o
OBJS-$(CONFIG_LSP) += lsp.o OBJS-$(CONFIG_LSP) += lsp.o
OBJS-$(CONFIG_MDCT) += mdct_fixed.o mdct_float.o OBJS-$(CONFIG_MDCT) += mdct_fixed.o mdct_float.o
@@ -64,13 +56,11 @@ OBJS-$(CONFIG_VDPAU) += vdpau.o
OBJS-$(CONFIG_A64MULTI_ENCODER) += a64multienc.o elbg.o OBJS-$(CONFIG_A64MULTI_ENCODER) += a64multienc.o elbg.o
OBJS-$(CONFIG_A64MULTI5_ENCODER) += a64multienc.o elbg.o OBJS-$(CONFIG_A64MULTI5_ENCODER) += a64multienc.o elbg.o
OBJS-$(CONFIG_AAC_DECODER) += aacdec.o aactab.o aacsbr.o aacps.o \ OBJS-$(CONFIG_AAC_DECODER) += aacdec.o aactab.o aacsbr.o aacps.o \
aacadtsdec.o mpeg4audio.o kbdwin.o \ aacadtsdec.o mpeg4audio.o kbdwin.o
sbrdsp.o aacpsdsp.o
OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o \ OBJS-$(CONFIG_AAC_ENCODER) += aacenc.o aaccoder.o \
aacpsy.o aactab.o \ aacpsy.o aactab.o \
psymodel.o iirfilter.o \ psymodel.o iirfilter.o \
mpeg4audio.o kbdwin.o \ mpeg4audio.o kbdwin.o
audio_frame_queue.o
OBJS-$(CONFIG_AASC_DECODER) += aasc.o msrledec.o OBJS-$(CONFIG_AASC_DECODER) += aasc.o msrledec.o
OBJS-$(CONFIG_AC3_DECODER) += ac3dec.o ac3dec_data.o ac3.o kbdwin.o OBJS-$(CONFIG_AC3_DECODER) += ac3dec.o ac3dec_data.o ac3.o kbdwin.o
OBJS-$(CONFIG_AC3_ENCODER) += ac3enc_float.o ac3enc.o ac3tab.o \ OBJS-$(CONFIG_AC3_ENCODER) += ac3enc_float.o ac3enc.o ac3tab.o \
@@ -104,15 +94,11 @@ OBJS-$(CONFIG_AURA2_DECODER) += aura.o
OBJS-$(CONFIG_AVRP_DECODER) += r210dec.o OBJS-$(CONFIG_AVRP_DECODER) += r210dec.o
OBJS-$(CONFIG_AVRP_ENCODER) += r210enc.o OBJS-$(CONFIG_AVRP_ENCODER) += r210enc.o
OBJS-$(CONFIG_AVS_DECODER) += avs.o OBJS-$(CONFIG_AVS_DECODER) += avs.o
OBJS-$(CONFIG_AVUI_DECODER) += avuidec.o
OBJS-$(CONFIG_AVUI_ENCODER) += avuienc.o
OBJS-$(CONFIG_AYUV_DECODER) += v408dec.o
OBJS-$(CONFIG_AYUV_ENCODER) += v408enc.o
OBJS-$(CONFIG_BETHSOFTVID_DECODER) += bethsoftvideo.o OBJS-$(CONFIG_BETHSOFTVID_DECODER) += bethsoftvideo.o
OBJS-$(CONFIG_BFI_DECODER) += bfi.o OBJS-$(CONFIG_BFI_DECODER) += bfi.o
OBJS-$(CONFIG_BINK_DECODER) += bink.o binkdsp.o OBJS-$(CONFIG_BINK_DECODER) += bink.o binkdsp.o
OBJS-$(CONFIG_BINKAUDIO_DCT_DECODER) += binkaudio.o wma.o wma_common.o OBJS-$(CONFIG_BINKAUDIO_DCT_DECODER) += binkaudio.o wma.o
OBJS-$(CONFIG_BINKAUDIO_RDFT_DECODER) += binkaudio.o wma.o wma_common.o OBJS-$(CONFIG_BINKAUDIO_RDFT_DECODER) += binkaudio.o wma.o
OBJS-$(CONFIG_BINTEXT_DECODER) += bintext.o cga_data.o OBJS-$(CONFIG_BINTEXT_DECODER) += bintext.o cga_data.o
OBJS-$(CONFIG_BMP_DECODER) += bmp.o msrledec.o OBJS-$(CONFIG_BMP_DECODER) += bmp.o msrledec.o
OBJS-$(CONFIG_BMP_ENCODER) += bmpenc.o OBJS-$(CONFIG_BMP_ENCODER) += bmpenc.o
@@ -122,15 +108,13 @@ OBJS-$(CONFIG_C93_DECODER) += c93.o
OBJS-$(CONFIG_CAVS_DECODER) += cavs.o cavsdec.o cavsdsp.o \ OBJS-$(CONFIG_CAVS_DECODER) += cavs.o cavsdec.o cavsdsp.o \
mpeg12data.o mpegvideo.o mpeg12data.o mpegvideo.o
OBJS-$(CONFIG_CDGRAPHICS_DECODER) += cdgraphics.o OBJS-$(CONFIG_CDGRAPHICS_DECODER) += cdgraphics.o
OBJS-$(CONFIG_CDXL_DECODER) += cdxl.o
OBJS-$(CONFIG_CINEPAK_DECODER) += cinepak.o OBJS-$(CONFIG_CINEPAK_DECODER) += cinepak.o
OBJS-$(CONFIG_CLJR_DECODER) += cljr.o OBJS-$(CONFIG_CLJR_DECODER) += cljr.o
OBJS-$(CONFIG_CLJR_ENCODER) += cljr.o OBJS-$(CONFIG_CLJR_ENCODER) += cljr.o
OBJS-$(CONFIG_COOK_DECODER) += cook.o OBJS-$(CONFIG_COOK_DECODER) += cook.o
OBJS-$(CONFIG_CSCD_DECODER) += cscd.o OBJS-$(CONFIG_CSCD_DECODER) += cscd.o
OBJS-$(CONFIG_CYUV_DECODER) += cyuv.o OBJS-$(CONFIG_CYUV_DECODER) += cyuv.o
OBJS-$(CONFIG_DCA_DECODER) += dca.o synth_filter.o dcadsp.o \ OBJS-$(CONFIG_DCA_DECODER) += dca.o synth_filter.o dcadsp.o
dca_parser.o
OBJS-$(CONFIG_DCA_ENCODER) += dcaenc.o OBJS-$(CONFIG_DCA_ENCODER) += dcaenc.o
OBJS-$(CONFIG_DIRAC_DECODER) += diracdec.o dirac.o diracdsp.o \ OBJS-$(CONFIG_DIRAC_DECODER) += diracdec.o dirac.o diracdsp.o \
dirac_arith.o mpeg12data.o dwt.o dirac_arith.o mpeg12data.o dwt.o
@@ -148,8 +132,8 @@ OBJS-$(CONFIG_DVBSUB_DECODER) += dvbsubdec.o
OBJS-$(CONFIG_DVBSUB_ENCODER) += dvbsub.o OBJS-$(CONFIG_DVBSUB_ENCODER) += dvbsub.o
OBJS-$(CONFIG_DVDSUB_DECODER) += dvdsubdec.o OBJS-$(CONFIG_DVDSUB_DECODER) += dvdsubdec.o
OBJS-$(CONFIG_DVDSUB_ENCODER) += dvdsubenc.o OBJS-$(CONFIG_DVDSUB_ENCODER) += dvdsubenc.o
OBJS-$(CONFIG_DVVIDEO_DECODER) += dvdec.o dv.o dvdata.o dv_profile.o OBJS-$(CONFIG_DVVIDEO_DECODER) += dv.o dvdata.o
OBJS-$(CONFIG_DVVIDEO_ENCODER) += dv.o dvdata.o dv_profile.o OBJS-$(CONFIG_DVVIDEO_ENCODER) += dv.o dvdata.o
OBJS-$(CONFIG_DXA_DECODER) += dxa.o OBJS-$(CONFIG_DXA_DECODER) += dxa.o
OBJS-$(CONFIG_DXTORY_DECODER) += dxtory.o OBJS-$(CONFIG_DXTORY_DECODER) += dxtory.o
OBJS-$(CONFIG_EAC3_DECODER) += eac3dec.o eac3_data.o OBJS-$(CONFIG_EAC3_DECODER) += eac3dec.o eac3_data.o
@@ -170,13 +154,12 @@ OBJS-$(CONFIG_EIGHTSVX_FIB_DECODER) += 8svx.o
OBJS-$(CONFIG_EIGHTSVX_RAW_DECODER) += 8svx.o OBJS-$(CONFIG_EIGHTSVX_RAW_DECODER) += 8svx.o
OBJS-$(CONFIG_ESCAPE124_DECODER) += escape124.o OBJS-$(CONFIG_ESCAPE124_DECODER) += escape124.o
OBJS-$(CONFIG_ESCAPE130_DECODER) += escape130.o OBJS-$(CONFIG_ESCAPE130_DECODER) += escape130.o
OBJS-$(CONFIG_EXR_DECODER) += exr.o
OBJS-$(CONFIG_FFV1_DECODER) += ffv1.o rangecoder.o OBJS-$(CONFIG_FFV1_DECODER) += ffv1.o rangecoder.o
OBJS-$(CONFIG_FFV1_ENCODER) += ffv1.o rangecoder.o OBJS-$(CONFIG_FFV1_ENCODER) += ffv1.o rangecoder.o
OBJS-$(CONFIG_FFVHUFF_DECODER) += huffyuv.o OBJS-$(CONFIG_FFVHUFF_DECODER) += huffyuv.o
OBJS-$(CONFIG_FFVHUFF_ENCODER) += huffyuv.o OBJS-$(CONFIG_FFVHUFF_ENCODER) += huffyuv.o
OBJS-$(CONFIG_FFWAVESYNTH_DECODER) += ffwavesynth.o OBJS-$(CONFIG_FFWAVESYNTH_DECODER) += ffwavesynth.o
OBJS-$(CONFIG_FLAC_DECODER) += flacdec.o flacdata.o flac.o OBJS-$(CONFIG_FLAC_DECODER) += flacdec.o flacdata.o flac.o vorbis_data.o
OBJS-$(CONFIG_FLAC_ENCODER) += flacenc.o flacdata.o flac.o vorbis_data.o OBJS-$(CONFIG_FLAC_ENCODER) += flacenc.o flacdata.o flac.o vorbis_data.o
OBJS-$(CONFIG_FLASHSV_DECODER) += flashsv.o OBJS-$(CONFIG_FLASHSV_DECODER) += flashsv.o
OBJS-$(CONFIG_FLASHSV_ENCODER) += flashsvenc.o OBJS-$(CONFIG_FLASHSV_ENCODER) += flashsvenc.o
@@ -188,15 +171,15 @@ OBJS-$(CONFIG_FRAPS_DECODER) += fraps.o
OBJS-$(CONFIG_FRWU_DECODER) += frwu.o OBJS-$(CONFIG_FRWU_DECODER) += frwu.o
OBJS-$(CONFIG_G723_1_DECODER) += g723_1.o acelp_vectors.o \ OBJS-$(CONFIG_G723_1_DECODER) += g723_1.o acelp_vectors.o \
celp_filters.o celp_math.o celp_filters.o celp_math.o
OBJS-$(CONFIG_G723_1_ENCODER) += g723_1.o acelp_vectors.o celp_math.o OBJS-$(CONFIG_G723_1_ENCODER) += g723_1.o
OBJS-$(CONFIG_G729_DECODER) += g729dec.o lsp.o celp_math.o acelp_filters.o acelp_pitch_delay.o acelp_vectors.o g729postfilter.o OBJS-$(CONFIG_G729_DECODER) += g729dec.o lsp.o celp_math.o acelp_filters.o acelp_pitch_delay.o acelp_vectors.o g729postfilter.o
OBJS-$(CONFIG_GIF_DECODER) += gifdec.o lzw.o OBJS-$(CONFIG_GIF_DECODER) += gifdec.o lzw.o
OBJS-$(CONFIG_GIF_ENCODER) += gif.o lzwenc.o OBJS-$(CONFIG_GIF_ENCODER) += gif.o lzwenc.o
OBJS-$(CONFIG_GSM_DECODER) += gsmdec.o gsmdec_data.o msgsmdec.o OBJS-$(CONFIG_GSM_DECODER) += gsmdec.o gsmdec_data.o msgsmdec.o
OBJS-$(CONFIG_GSM_MS_DECODER) += gsmdec.o gsmdec_data.o msgsmdec.o OBJS-$(CONFIG_GSM_MS_DECODER) += gsmdec.o gsmdec_data.o msgsmdec.o
OBJS-$(CONFIG_H261_DECODER) += h261dec.o h261.o h261data.o \ OBJS-$(CONFIG_H261_DECODER) += h261dec.o h261.o \
mpegvideo.o error_resilience.o mpegvideo.o error_resilience.o
OBJS-$(CONFIG_H261_ENCODER) += h261enc.o h261.o h261data.o \ OBJS-$(CONFIG_H261_ENCODER) += h261enc.o h261.o \
mpegvideo_enc.o motion_est.o \ mpegvideo_enc.o motion_est.o \
ratecontrol.o mpeg12data.o \ ratecontrol.o mpeg12data.o \
mpegvideo.o mpegvideo.o
@@ -231,7 +214,6 @@ OBJS-$(CONFIG_INDEO4_DECODER) += indeo4.o ivi_common.o ivi_dsp.o
OBJS-$(CONFIG_INDEO5_DECODER) += indeo5.o ivi_common.o ivi_dsp.o OBJS-$(CONFIG_INDEO5_DECODER) += indeo5.o ivi_common.o ivi_dsp.o
OBJS-$(CONFIG_INTERPLAY_DPCM_DECODER) += dpcm.o OBJS-$(CONFIG_INTERPLAY_DPCM_DECODER) += dpcm.o
OBJS-$(CONFIG_INTERPLAY_VIDEO_DECODER) += interplayvideo.o OBJS-$(CONFIG_INTERPLAY_VIDEO_DECODER) += interplayvideo.o
OBJS-$(CONFIG_JACOSUB_DECODER) += jacosubdec.o ass.o
OBJS-$(CONFIG_JPEG2000_DECODER) += j2kdec.o mqcdec.o mqc.o j2k.o j2k_dwt.o OBJS-$(CONFIG_JPEG2000_DECODER) += j2kdec.o mqcdec.o mqc.o j2k.o j2k_dwt.o
OBJS-$(CONFIG_JPEG2000_ENCODER) += j2kenc.o mqcenc.o mqc.o j2k.o j2k_dwt.o OBJS-$(CONFIG_JPEG2000_ENCODER) += j2kenc.o mqcenc.o mqc.o j2k.o j2k_dwt.o
OBJS-$(CONFIG_JPEGLS_DECODER) += jpeglsdec.o jpegls.o \ OBJS-$(CONFIG_JPEGLS_DECODER) += jpeglsdec.o jpegls.o \
@@ -250,7 +232,6 @@ OBJS-$(CONFIG_MACE3_DECODER) += mace.o
OBJS-$(CONFIG_MACE6_DECODER) += mace.o OBJS-$(CONFIG_MACE6_DECODER) += mace.o
OBJS-$(CONFIG_MDEC_DECODER) += mdec.o mpeg12.o mpeg12data.o \ OBJS-$(CONFIG_MDEC_DECODER) += mdec.o mpeg12.o mpeg12data.o \
mpegvideo.o error_resilience.o mpegvideo.o error_resilience.o
OBJS-$(CONFIG_MICRODVD_DECODER) += microdvddec.o ass.o
OBJS-$(CONFIG_MIMIC_DECODER) += mimic.o OBJS-$(CONFIG_MIMIC_DECODER) += mimic.o
OBJS-$(CONFIG_MJPEG_DECODER) += mjpegdec.o mjpeg.o OBJS-$(CONFIG_MJPEG_DECODER) += mjpegdec.o mjpeg.o
OBJS-$(CONFIG_MJPEG_ENCODER) += mjpegenc.o mjpeg.o \ OBJS-$(CONFIG_MJPEG_ENCODER) += mjpegenc.o mjpeg.o \
@@ -314,22 +295,19 @@ OBJS-$(CONFIG_MPEG4_VAAPI_HWACCEL) += vaapi_mpeg4.o
OBJS-$(CONFIG_MSMPEG4V1_DECODER) += msmpeg4.o msmpeg4data.o OBJS-$(CONFIG_MSMPEG4V1_DECODER) += msmpeg4.o msmpeg4data.o
OBJS-$(CONFIG_MSMPEG4V2_DECODER) += msmpeg4.o msmpeg4data.o h263dec.o \ OBJS-$(CONFIG_MSMPEG4V2_DECODER) += msmpeg4.o msmpeg4data.o h263dec.o \
h263.o ituh263dec.o mpeg4videodec.o h263.o ituh263dec.o mpeg4videodec.o
OBJS-$(CONFIG_MSMPEG4V2_ENCODER) += msmpeg4.o msmpeg4enc.o msmpeg4data.o \ OBJS-$(CONFIG_MSMPEG4V2_ENCODER) += msmpeg4.o msmpeg4data.o h263dec.o \
h263dec.o h263.o ituh263dec.o \ h263.o ituh263dec.o mpeg4videodec.o
mpeg4videodec.o
OBJS-$(CONFIG_MSMPEG4V3_DECODER) += msmpeg4.o msmpeg4data.o h263dec.o \ OBJS-$(CONFIG_MSMPEG4V3_DECODER) += msmpeg4.o msmpeg4data.o h263dec.o \
h263.o ituh263dec.o mpeg4videodec.o h263.o ituh263dec.o mpeg4videodec.o
OBJS-$(CONFIG_MSMPEG4V3_ENCODER) += msmpeg4.o msmpeg4enc.o msmpeg4data.o \ OBJS-$(CONFIG_MSMPEG4V3_ENCODER) += msmpeg4.o msmpeg4data.o h263dec.o \
h263dec.o h263.o ituh263dec.o \ h263.o ituh263dec.o mpeg4videodec.o
mpeg4videodec.o
OBJS-$(CONFIG_MSRLE_DECODER) += msrle.o msrledec.o OBJS-$(CONFIG_MSRLE_DECODER) += msrle.o msrledec.o
OBJS-$(CONFIG_MSVIDEO1_DECODER) += msvideo1.o OBJS-$(CONFIG_MSVIDEO1_DECODER) += msvideo1.o
OBJS-$(CONFIG_MSVIDEO1_ENCODER) += msvideo1enc.o elbg.o OBJS-$(CONFIG_MSVIDEO1_ENCODER) += msvideo1enc.o elbg.o
OBJS-$(CONFIG_MSZH_DECODER) += lcldec.o OBJS-$(CONFIG_MSZH_DECODER) += lcldec.o
OBJS-$(CONFIG_MXPEG_DECODER) += mxpegdec.o mjpegdec.o mjpeg.o OBJS-$(CONFIG_MXPEG_DECODER) += mxpegdec.o mjpegdec.o mjpeg.o
OBJS-$(CONFIG_NELLYMOSER_DECODER) += nellymoserdec.o nellymoser.o OBJS-$(CONFIG_NELLYMOSER_DECODER) += nellymoserdec.o nellymoser.o
OBJS-$(CONFIG_NELLYMOSER_ENCODER) += nellymoserenc.o nellymoser.o \ OBJS-$(CONFIG_NELLYMOSER_ENCODER) += nellymoserenc.o nellymoser.o
audio_frame_queue.o
OBJS-$(CONFIG_NUV_DECODER) += nuv.o rtjpeg.o OBJS-$(CONFIG_NUV_DECODER) += nuv.o rtjpeg.o
OBJS-$(CONFIG_PAM_DECODER) += pnmdec.o pnm.o OBJS-$(CONFIG_PAM_DECODER) += pnmdec.o pnm.o
OBJS-$(CONFIG_PAM_ENCODER) += pamenc.o pnm.o OBJS-$(CONFIG_PAM_ENCODER) += pamenc.o pnm.o
@@ -343,15 +321,13 @@ OBJS-$(CONFIG_PGMYUV_DECODER) += pnmdec.o pnm.o
OBJS-$(CONFIG_PGMYUV_ENCODER) += pnmenc.o pnm.o OBJS-$(CONFIG_PGMYUV_ENCODER) += pnmenc.o pnm.o
OBJS-$(CONFIG_PGSSUB_DECODER) += pgssubdec.o OBJS-$(CONFIG_PGSSUB_DECODER) += pgssubdec.o
OBJS-$(CONFIG_PICTOR_DECODER) += pictordec.o cga_data.o OBJS-$(CONFIG_PICTOR_DECODER) += pictordec.o cga_data.o
OBJS-$(CONFIG_PNG_DECODER) += png.o pngdec.o pngdsp.o OBJS-$(CONFIG_PNG_DECODER) += png.o pngdec.o
OBJS-$(CONFIG_PNG_ENCODER) += png.o pngenc.o OBJS-$(CONFIG_PNG_ENCODER) += png.o pngenc.o
OBJS-$(CONFIG_PPM_DECODER) += pnmdec.o pnm.o OBJS-$(CONFIG_PPM_DECODER) += pnmdec.o pnm.o
OBJS-$(CONFIG_PPM_ENCODER) += pnmenc.o pnm.o OBJS-$(CONFIG_PPM_ENCODER) += pnmenc.o pnm.o
OBJS-$(CONFIG_PRORES_DECODER) += proresdec2.o proresdsp.o OBJS-$(CONFIG_PRORES_DECODER) += proresdec2.o
OBJS-$(CONFIG_PRORES_LGPL_DECODER) += proresdec_lgpl.o proresdsp.o proresdata.o OBJS-$(CONFIG_PRORES_LGPL_DECODER) += proresdec_lgpl.o proresdsp.o
OBJS-$(CONFIG_PRORES_ENCODER) += proresenc_anatoliy.o OBJS-$(CONFIG_PRORES_ENCODER) += proresenc.o
OBJS-$(CONFIG_PRORES_ANATOLIY_ENCODER) += proresenc_anatoliy.o
OBJS-$(CONFIG_PRORES_KOSTYA_ENCODER) += proresenc_kostya.o proresdata.o proresdsp.o
OBJS-$(CONFIG_PTX_DECODER) += ptx.o OBJS-$(CONFIG_PTX_DECODER) += ptx.o
OBJS-$(CONFIG_QCELP_DECODER) += qcelpdec.o celp_math.o \ OBJS-$(CONFIG_QCELP_DECODER) += qcelpdec.o celp_math.o \
celp_filters.o acelp_vectors.o \ celp_filters.o acelp_vectors.o \
@@ -368,10 +344,8 @@ OBJS-$(CONFIG_R10K_ENCODER) += r210enc.o
OBJS-$(CONFIG_R210_DECODER) += r210dec.o OBJS-$(CONFIG_R210_DECODER) += r210dec.o
OBJS-$(CONFIG_R210_ENCODER) += r210enc.o OBJS-$(CONFIG_R210_ENCODER) += r210enc.o
OBJS-$(CONFIG_RA_144_DECODER) += ra144dec.o ra144.o celp_filters.o OBJS-$(CONFIG_RA_144_DECODER) += ra144dec.o ra144.o celp_filters.o
OBJS-$(CONFIG_RA_144_ENCODER) += ra144enc.o ra144.o celp_filters.o \ OBJS-$(CONFIG_RA_144_ENCODER) += ra144enc.o ra144.o celp_filters.o
audio_frame_queue.o
OBJS-$(CONFIG_RA_288_DECODER) += ra288.o celp_math.o celp_filters.o OBJS-$(CONFIG_RA_288_DECODER) += ra288.o celp_math.o celp_filters.o
OBJS-$(CONFIG_RALF_DECODER) += ralf.o
OBJS-$(CONFIG_RAWVIDEO_DECODER) += rawdec.o OBJS-$(CONFIG_RAWVIDEO_DECODER) += rawdec.o
OBJS-$(CONFIG_RAWVIDEO_ENCODER) += rawenc.o OBJS-$(CONFIG_RAWVIDEO_ENCODER) += rawenc.o
OBJS-$(CONFIG_RL2_DECODER) += rl2.o OBJS-$(CONFIG_RL2_DECODER) += rl2.o
@@ -413,7 +387,6 @@ OBJS-$(CONFIG_SP5X_DECODER) += sp5xdec.o mjpegdec.o mjpeg.o
OBJS-$(CONFIG_SRT_DECODER) += srtdec.o ass.o OBJS-$(CONFIG_SRT_DECODER) += srtdec.o ass.o
OBJS-$(CONFIG_SRT_ENCODER) += srtenc.o ass_split.o OBJS-$(CONFIG_SRT_ENCODER) += srtenc.o ass_split.o
OBJS-$(CONFIG_SUNRAST_DECODER) += sunrast.o OBJS-$(CONFIG_SUNRAST_DECODER) += sunrast.o
OBJS-$(CONFIG_SUNRAST_ENCODER) += sunrastenc.o
OBJS-$(CONFIG_SVQ1_DECODER) += svq1dec.o svq1.o h263.o \ OBJS-$(CONFIG_SVQ1_DECODER) += svq1dec.o svq1.o h263.o \
mpegvideo.o error_resilience.o mpegvideo.o error_resilience.o
OBJS-$(CONFIG_SVQ1_ENCODER) += svq1enc.o svq1.o \ OBJS-$(CONFIG_SVQ1_ENCODER) += svq1enc.o svq1.o \
@@ -448,8 +421,6 @@ OBJS-$(CONFIG_V210_DECODER) += v210dec.o
OBJS-$(CONFIG_V210_ENCODER) += v210enc.o OBJS-$(CONFIG_V210_ENCODER) += v210enc.o
OBJS-$(CONFIG_V308_DECODER) += v308dec.o OBJS-$(CONFIG_V308_DECODER) += v308dec.o
OBJS-$(CONFIG_V308_ENCODER) += v308enc.o OBJS-$(CONFIG_V308_ENCODER) += v308enc.o
OBJS-$(CONFIG_V408_DECODER) += v408dec.o
OBJS-$(CONFIG_V408_ENCODER) += v408enc.o
OBJS-$(CONFIG_V410_DECODER) += v410dec.o OBJS-$(CONFIG_V410_DECODER) += v410dec.o
OBJS-$(CONFIG_V410_ENCODER) += v410enc.o OBJS-$(CONFIG_V410_ENCODER) += v410enc.o
OBJS-$(CONFIG_V210X_DECODER) += v210x.o OBJS-$(CONFIG_V210X_DECODER) += v210x.o
@@ -477,12 +448,12 @@ OBJS-$(CONFIG_VP6_DECODER) += vp6.o vp56.o vp56data.o vp56dsp.o \
OBJS-$(CONFIG_VP8_DECODER) += vp8.o vp8dsp.o vp56rac.o OBJS-$(CONFIG_VP8_DECODER) += vp8.o vp8dsp.o vp56rac.o
OBJS-$(CONFIG_VQA_DECODER) += vqavideo.o OBJS-$(CONFIG_VQA_DECODER) += vqavideo.o
OBJS-$(CONFIG_WAVPACK_DECODER) += wavpack.o OBJS-$(CONFIG_WAVPACK_DECODER) += wavpack.o
OBJS-$(CONFIG_WMALOSSLESS_DECODER) += wmalosslessdec.o wma_common.o OBJS-$(CONFIG_WMALOSSLESS_DECODER) += wmalosslessdec.o wma.o
OBJS-$(CONFIG_WMAPRO_DECODER) += wmaprodec.o wma.o wma_common.o OBJS-$(CONFIG_WMAPRO_DECODER) += wmaprodec.o wma.o
OBJS-$(CONFIG_WMAV1_DECODER) += wmadec.o wma.o wma_common.o aactab.o OBJS-$(CONFIG_WMAV1_DECODER) += wmadec.o wma.o aactab.o
OBJS-$(CONFIG_WMAV1_ENCODER) += wmaenc.o wma.o wma_common.o aactab.o OBJS-$(CONFIG_WMAV1_ENCODER) += wmaenc.o wma.o aactab.o
OBJS-$(CONFIG_WMAV2_DECODER) += wmadec.o wma.o wma_common.o aactab.o OBJS-$(CONFIG_WMAV2_DECODER) += wmadec.o wma.o aactab.o
OBJS-$(CONFIG_WMAV2_ENCODER) += wmaenc.o wma.o wma_common.o aactab.o OBJS-$(CONFIG_WMAV2_ENCODER) += wmaenc.o wma.o aactab.o
OBJS-$(CONFIG_WMAVOICE_DECODER) += wmavoice.o \ OBJS-$(CONFIG_WMAVOICE_DECODER) += wmavoice.o \
celp_math.o celp_filters.o \ celp_math.o celp_filters.o \
acelp_vectors.o acelp_filters.o acelp_vectors.o acelp_filters.o
@@ -491,7 +462,7 @@ OBJS-$(CONFIG_WMV2_DECODER) += wmv2dec.o wmv2.o \
msmpeg4.o msmpeg4data.o \ msmpeg4.o msmpeg4data.o \
intrax8.o intrax8dsp.o intrax8.o intrax8dsp.o
OBJS-$(CONFIG_WMV2_ENCODER) += wmv2enc.o wmv2.o \ OBJS-$(CONFIG_WMV2_ENCODER) += wmv2enc.o wmv2.o \
msmpeg4.o msmpeg4enc.o msmpeg4data.o \ msmpeg4.o msmpeg4data.o \
mpeg4videodec.o ituh263dec.o h263dec.o mpeg4videodec.o ituh263dec.o h263dec.o
OBJS-$(CONFIG_WNV1_DECODER) += wnv1.o OBJS-$(CONFIG_WNV1_DECODER) += wnv1.o
OBJS-$(CONFIG_WS_SND1_DECODER) += ws-snd1.o OBJS-$(CONFIG_WS_SND1_DECODER) += ws-snd1.o
@@ -499,8 +470,6 @@ OBJS-$(CONFIG_XAN_DPCM_DECODER) += dpcm.o
OBJS-$(CONFIG_XAN_WC3_DECODER) += xan.o OBJS-$(CONFIG_XAN_WC3_DECODER) += xan.o
OBJS-$(CONFIG_XAN_WC4_DECODER) += xxan.o OBJS-$(CONFIG_XAN_WC4_DECODER) += xxan.o
OBJS-$(CONFIG_XBIN_DECODER) += bintext.o cga_data.o OBJS-$(CONFIG_XBIN_DECODER) += bintext.o cga_data.o
OBJS-$(CONFIG_XBM_DECODER) += xbmdec.o
OBJS-$(CONFIG_XBM_ENCODER) += xbmenc.o
OBJS-$(CONFIG_XL_DECODER) += xl.o OBJS-$(CONFIG_XL_DECODER) += xl.o
OBJS-$(CONFIG_XSUB_DECODER) += xsubdec.o OBJS-$(CONFIG_XSUB_DECODER) += xsubdec.o
OBJS-$(CONFIG_XSUB_ENCODER) += xsubenc.o OBJS-$(CONFIG_XSUB_ENCODER) += xsubenc.o
@@ -511,7 +480,6 @@ OBJS-$(CONFIG_Y41P_ENCODER) += y41penc.o
OBJS-$(CONFIG_YOP_DECODER) += yop.o OBJS-$(CONFIG_YOP_DECODER) += yop.o
OBJS-$(CONFIG_YUV4_DECODER) += yuv4dec.o OBJS-$(CONFIG_YUV4_DECODER) += yuv4dec.o
OBJS-$(CONFIG_YUV4_ENCODER) += yuv4enc.o OBJS-$(CONFIG_YUV4_ENCODER) += yuv4enc.o
OBJS-$(CONFIG_ZEROCODEC_DECODER) += zerocodec.o
OBJS-$(CONFIG_ZLIB_DECODER) += lcldec.o OBJS-$(CONFIG_ZLIB_DECODER) += lcldec.o
OBJS-$(CONFIG_ZLIB_ENCODER) += lclenc.o OBJS-$(CONFIG_ZLIB_ENCODER) += lclenc.o
OBJS-$(CONFIG_ZMBV_DECODER) += zmbv.o OBJS-$(CONFIG_ZMBV_DECODER) += zmbv.o
@@ -610,11 +578,11 @@ OBJS-$(CONFIG_ADPCM_YAMAHA_ENCODER) += adpcmenc.o adpcm_data.o
# libavformat dependencies # libavformat dependencies
OBJS-$(CONFIG_ADTS_MUXER) += mpeg4audio.o OBJS-$(CONFIG_ADTS_MUXER) += mpeg4audio.o
OBJS-$(CONFIG_ADX_DEMUXER) += adx.o OBJS-$(CONFIG_ADX_DEMUXER) += adx.o
OBJS-$(CONFIG_CAF_DEMUXER) += mpeg4audio.o mpegaudiodata.o OBJS-$(CONFIG_CAF_DEMUXER) += mpeg4audio.o mpegaudiodata.o \
OBJS-$(CONFIG_DV_DEMUXER) += dv_profile.o ac3tab.o
OBJS-$(CONFIG_DV_MUXER) += dv_profile.o timecode.o OBJS-$(CONFIG_DV_DEMUXER) += dvdata.o
OBJS-$(CONFIG_FLAC_DEMUXER) += flacdec.o flacdata.o flac.o vorbis_data.o \ OBJS-$(CONFIG_DV_MUXER) += dvdata.o timecode.o
vorbis_parser.o xiph.o OBJS-$(CONFIG_FLAC_DEMUXER) += flacdec.o flacdata.o flac.o vorbis_data.o
OBJS-$(CONFIG_FLAC_MUXER) += flacdec.o flacdata.o flac.o vorbis_data.o OBJS-$(CONFIG_FLAC_MUXER) += flacdec.o flacdata.o flac.o vorbis_data.o
OBJS-$(CONFIG_FLV_DEMUXER) += mpeg4audio.o OBJS-$(CONFIG_FLV_DEMUXER) += mpeg4audio.o
OBJS-$(CONFIG_GXF_DEMUXER) += mpeg12data.o OBJS-$(CONFIG_GXF_DEMUXER) += mpeg12data.o
@@ -626,7 +594,6 @@ OBJS-$(CONFIG_MATROSKA_DEMUXER) += mpeg4audio.o mpegaudiodata.o
OBJS-$(CONFIG_MATROSKA_MUXER) += xiph.o mpeg4audio.o \ OBJS-$(CONFIG_MATROSKA_MUXER) += xiph.o mpeg4audio.o \
flacdec.o flacdata.o flac.o \ flacdec.o flacdata.o flac.o \
mpegaudiodata.o vorbis_data.o mpegaudiodata.o vorbis_data.o
OBJS-$(CONFIG_MP2_MUXER) += mpegaudiodata.o mpegaudiodecheader.o
OBJS-$(CONFIG_MP3_MUXER) += mpegaudiodata.o mpegaudiodecheader.o OBJS-$(CONFIG_MP3_MUXER) += mpegaudiodata.o mpegaudiodecheader.o
OBJS-$(CONFIG_MOV_DEMUXER) += mpeg4audio.o mpegaudiodata.o ac3tab.o timecode.o OBJS-$(CONFIG_MOV_DEMUXER) += mpeg4audio.o mpegaudiodata.o ac3tab.o timecode.o
OBJS-$(CONFIG_MOV_MUXER) += mpeg4audio.o mpegaudiodata.o OBJS-$(CONFIG_MOV_MUXER) += mpeg4audio.o mpegaudiodata.o
@@ -635,8 +602,7 @@ OBJS-$(CONFIG_MPEGTS_DEMUXER) += mpeg4audio.o mpegaudiodata.o
OBJS-$(CONFIG_MXF_MUXER) += timecode.o OBJS-$(CONFIG_MXF_MUXER) += timecode.o
OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o OBJS-$(CONFIG_NUT_MUXER) += mpegaudiodata.o
OBJS-$(CONFIG_OGG_DEMUXER) += flacdec.o flacdata.o flac.o \ OBJS-$(CONFIG_OGG_DEMUXER) += flacdec.o flacdata.o flac.o \
dirac.o mpeg12data.o vorbis_parser.o \ dirac.o mpeg12data.o vorbis_data.o
xiph.o vorbis_data.o
OBJS-$(CONFIG_OGG_MUXER) += xiph.o flacdec.o flacdata.o flac.o \ OBJS-$(CONFIG_OGG_MUXER) += xiph.o flacdec.o flacdata.o flac.o \
vorbis_data.o vorbis_data.o
OBJS-$(CONFIG_RTP_MUXER) += mpeg4audio.o mpegvideo.o xiph.o OBJS-$(CONFIG_RTP_MUXER) += mpeg4audio.o mpegvideo.o xiph.o
@@ -649,40 +615,38 @@ OBJS-$(CONFIG_WTV_DEMUXER) += mpeg4audio.o mpegaudiodata.o
# external codec libraries # external codec libraries
OBJS-$(CONFIG_LIBAACPLUS_ENCODER) += libaacplus.o OBJS-$(CONFIG_LIBAACPLUS_ENCODER) += libaacplus.o
OBJS-$(CONFIG_LIBCELT_DECODER) += libcelt_dec.o OBJS-$(CONFIG_LIBCELT_DECODER) += libcelt_dec.o
OBJS-$(CONFIG_LIBFAAC_ENCODER) += libfaac.o audio_frame_queue.o OBJS-$(CONFIG_LIBDIRAC_DECODER) += libdiracdec.o
OBJS-$(CONFIG_LIBDIRAC_ENCODER) += libdiracenc.o libdirac_libschro.o
OBJS-$(CONFIG_LIBFAAC_ENCODER) += libfaac.o
OBJS-$(CONFIG_LIBGSM_DECODER) += libgsm.o OBJS-$(CONFIG_LIBGSM_DECODER) += libgsm.o
OBJS-$(CONFIG_LIBGSM_ENCODER) += libgsm.o OBJS-$(CONFIG_LIBGSM_ENCODER) += libgsm.o
OBJS-$(CONFIG_LIBGSM_MS_DECODER) += libgsm.o OBJS-$(CONFIG_LIBGSM_MS_DECODER) += libgsm.o
OBJS-$(CONFIG_LIBGSM_MS_ENCODER) += libgsm.o OBJS-$(CONFIG_LIBGSM_MS_ENCODER) += libgsm.o
OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o mpegaudiodecheader.o \ OBJS-$(CONFIG_LIBMP3LAME_ENCODER) += libmp3lame.o
audio_frame_queue.o OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER) += libopencore-amr.o
OBJS-$(CONFIG_LIBOPENCORE_AMRNB_DECODER) += libopencore-amr.o \ OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER) += libopencore-amr.o
audio_frame_queue.o
OBJS-$(CONFIG_LIBOPENCORE_AMRNB_ENCODER) += libopencore-amr.o \
audio_frame_queue.o
OBJS-$(CONFIG_LIBOPENCORE_AMRWB_DECODER) += libopencore-amr.o OBJS-$(CONFIG_LIBOPENCORE_AMRWB_DECODER) += libopencore-amr.o
OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpegdec.o OBJS-$(CONFIG_LIBOPENJPEG_DECODER) += libopenjpegdec.o
OBJS-$(CONFIG_LIBOPENJPEG_ENCODER) += libopenjpegenc.o OBJS-$(CONFIG_LIBOPENJPEG_ENCODER) += libopenjpegenc.o
OBJS-$(CONFIG_LIBSCHROEDINGER_DECODER) += libschroedingerdec.o \ OBJS-$(CONFIG_LIBSCHROEDINGER_DECODER) += libschroedingerdec.o \
libschroedinger.o libschroedinger.o \
libdirac_libschro.o
OBJS-$(CONFIG_LIBSCHROEDINGER_ENCODER) += libschroedingerenc.o \ OBJS-$(CONFIG_LIBSCHROEDINGER_ENCODER) += libschroedingerenc.o \
libschroedinger.o libschroedinger.o \
libdirac_libschro.o
OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o OBJS-$(CONFIG_LIBSPEEX_DECODER) += libspeexdec.o
OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o audio_frame_queue.o OBJS-$(CONFIG_LIBSPEEX_ENCODER) += libspeexenc.o
OBJS-$(CONFIG_LIBSTAGEFRIGHT_H264_DECODER)+= libstagefright.o OBJS-$(CONFIG_LIBSTAGEFRIGHT_H264_DECODER)+= libstagefright.o
OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o OBJS-$(CONFIG_LIBTHEORA_ENCODER) += libtheoraenc.o
OBJS-$(CONFIG_LIBUTVIDEO_DECODER) += libutvideodec.o OBJS-$(CONFIG_LIBUTVIDEO_DECODER) += libutvideo.o
OBJS-$(CONFIG_LIBUTVIDEO_ENCODER) += libutvideoenc.o OBJS-$(CONFIG_LIBVO_AACENC_ENCODER) += libvo-aacenc.o mpeg4audio.o
OBJS-$(CONFIG_LIBVO_AACENC_ENCODER) += libvo-aacenc.o mpeg4audio.o \
audio_frame_queue.o
OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o OBJS-$(CONFIG_LIBVO_AMRWBENC_ENCODER) += libvo-amrwbenc.o
OBJS-$(CONFIG_LIBVORBIS_ENCODER) += libvorbis.o audio_frame_queue.o \ OBJS-$(CONFIG_LIBVORBIS_ENCODER) += libvorbis.o vorbis_data.o
vorbis_data.o vorbis_parser.o
OBJS-$(CONFIG_LIBVPX_DECODER) += libvpxdec.o OBJS-$(CONFIG_LIBVPX_DECODER) += libvpxdec.o
OBJS-$(CONFIG_LIBVPX_ENCODER) += libvpxenc.o OBJS-$(CONFIG_LIBVPX_ENCODER) += libvpxenc.o
OBJS-$(CONFIG_LIBX264_ENCODER) += libx264.o OBJS-$(CONFIG_LIBX264_ENCODER) += libx264.o
OBJS-$(CONFIG_LIBXAVS_ENCODER) += libxavs.o OBJS-$(CONFIG_LIBXAVS_ENCODER) += libxavs.o
OBJS-$(CONFIG_LIBXVID_ENCODER) += libxvid.o OBJS-$(CONFIG_LIBXVID) += libxvidff.o libxvid_rc.o
# parsers # parsers
OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o \ OBJS-$(CONFIG_AAC_PARSER) += aac_parser.o aac_ac3_parser.o \
@@ -691,7 +655,6 @@ OBJS-$(CONFIG_AC3_PARSER) += ac3_parser.o ac3tab.o \
aac_ac3_parser.o aac_ac3_parser.o
OBJS-$(CONFIG_ADX_PARSER) += adx_parser.o adx.o OBJS-$(CONFIG_ADX_PARSER) += adx_parser.o adx.o
OBJS-$(CONFIG_CAVSVIDEO_PARSER) += cavs_parser.o OBJS-$(CONFIG_CAVSVIDEO_PARSER) += cavs_parser.o
OBJS-$(CONFIG_COOK_PARSER) += cook_parser.o
OBJS-$(CONFIG_DCA_PARSER) += dca_parser.o OBJS-$(CONFIG_DCA_PARSER) += dca_parser.o
OBJS-$(CONFIG_DIRAC_PARSER) += dirac_parser.o OBJS-$(CONFIG_DIRAC_PARSER) += dirac_parser.o
OBJS-$(CONFIG_DNXHD_PARSER) += dnxhd_parser.o OBJS-$(CONFIG_DNXHD_PARSER) += dnxhd_parser.o
@@ -715,7 +678,6 @@ OBJS-$(CONFIG_MPEG4VIDEO_PARSER) += mpeg4video_parser.o h263.o \
mpegvideo.o error_resilience.o \ mpegvideo.o error_resilience.o \
mpeg4videodec.o mpeg4video.o \ mpeg4videodec.o mpeg4video.o \
ituh263dec.o h263dec.o ituh263dec.o h263dec.o
OBJS-$(CONFIG_PNG_PARSER) += png_parser.o
OBJS-$(CONFIG_MPEGAUDIO_PARSER) += mpegaudio_parser.o \ OBJS-$(CONFIG_MPEGAUDIO_PARSER) += mpegaudio_parser.o \
mpegaudiodecheader.o mpegaudiodata.o mpegaudiodecheader.o mpegaudiodata.o
OBJS-$(CONFIG_MPEGVIDEO_PARSER) += mpegvideo_parser.o \ OBJS-$(CONFIG_MPEGVIDEO_PARSER) += mpegvideo_parser.o \
@@ -727,7 +689,6 @@ OBJS-$(CONFIG_RV40_PARSER) += rv34_parser.o
OBJS-$(CONFIG_VC1_PARSER) += vc1_parser.o vc1.o vc1data.o \ OBJS-$(CONFIG_VC1_PARSER) += vc1_parser.o vc1.o vc1data.o \
msmpeg4.o msmpeg4data.o mpeg4video.o \ msmpeg4.o msmpeg4data.o mpeg4video.o \
h263.o mpegvideo.o error_resilience.o h263.o mpegvideo.o error_resilience.o
OBJS-$(CONFIG_VORBIS_PARSER) += vorbis_parser.o xiph.o
OBJS-$(CONFIG_VP3_PARSER) += vp3_parser.o OBJS-$(CONFIG_VP3_PARSER) += vp3_parser.o
OBJS-$(CONFIG_VP8_PARSER) += vp8_parser.o OBJS-$(CONFIG_VP8_PARSER) += vp8_parser.o
@@ -753,6 +714,8 @@ OBJS-$(HAVE_PTHREADS) += pthread.o
OBJS-$(HAVE_W32THREADS) += pthread.o OBJS-$(HAVE_W32THREADS) += pthread.o
OBJS-$(HAVE_OS2THREADS) += pthread.o OBJS-$(HAVE_OS2THREADS) += pthread.o
OBJS-$(CONFIG_MLIB) += mlib/dsputil_mlib.o \
# inverse.o contains the ff_inverse table definition, which is used by # inverse.o contains the ff_inverse table definition, which is used by
# the FASTDIV macro (from libavutil); since referencing the external # the FASTDIV macro (from libavutil); since referencing the external
# table has a negative effect on performance, copy it in libavcodec as # table has a negative effect on performance, copy it in libavcodec as
@@ -762,43 +725,27 @@ OBJS-$(!CONFIG_SMALL) += inverse.o
SKIPHEADERS += %_tablegen.h \ SKIPHEADERS += %_tablegen.h \
%_tables.h \ %_tables.h \
aac_tablegen_decl.h \ aac_tablegen_decl.h \
codec_names.h \
fft-internal.h \ fft-internal.h \
tableprint.h \ tableprint.h \
$(ARCH)/vp56_arith.h \ $(ARCH)/vp56_arith.h
SKIPHEADERS-$(CONFIG_DXVA2) += dxva2.h dxva2_internal.h SKIPHEADERS-$(CONFIG_DXVA2) += dxva2.h dxva2_internal.h
SKIPHEADERS-$(CONFIG_LIBDIRAC) += libdirac.h
SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h SKIPHEADERS-$(CONFIG_LIBSCHROEDINGER) += libschroedinger.h
SKIPHEADERS-$(CONFIG_LIBUTVIDEO) += libutvideo.h
SKIPHEADERS-$(CONFIG_MPEG_XVMC_DECODER) += xvmc.h
SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_internal.h SKIPHEADERS-$(CONFIG_VAAPI) += vaapi_internal.h
SKIPHEADERS-$(CONFIG_VDA) += vda.h vda_internal.h SKIPHEADERS-$(CONFIG_VDA) += vda_internal.h
SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h SKIPHEADERS-$(CONFIG_VDPAU) += vdpau.h
SKIPHEADERS-$(HAVE_OS2THREADS) += os2threads.h SKIPHEADERS-$(CONFIG_XVMC) += xvmc.h
SKIPHEADERS-$(HAVE_W32THREADS) += w32pthreads.h SKIPHEADERS-$(HAVE_W32THREADS) += w32pthreads.h
TESTPROGS = cabac \ TESTPROGS = cabac dct fft fft-fixed h264 iirfilter rangecoder snowenc
dct \
fft \
fft-fixed \
golomb \
iirfilter \
rangecoder \
snowenc \
TESTPROGS-$(HAVE_MMX) += motion TESTPROGS-$(HAVE_MMX) += motion
TESTOBJS = dctref.o TESTOBJS = dctref.o
HOSTPROGS = aac_tablegen \ HOSTPROGS = aac_tablegen aacps_tablegen cbrt_tablegen cos_tablegen \
aacps_tablegen \ dv_tablegen motionpixels_tablegen mpegaudio_tablegen \
cbrt_tablegen \ pcm_tablegen qdm2_tablegen sinewin_tablegen
cos_tablegen \
dv_tablegen \ DIRS = alpha arm bfin mlib ppc ps2 sh4 sparc x86
motionpixels_tablegen \
mpegaudio_tablegen \
pcm_tablegen \
qdm2_tablegen \
sinewin_tablegen \
CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF) CLEANFILES = *_tables.c *_tables.h *_tablegen$(HOSTEXESUF)

View File

@@ -50,9 +50,6 @@ typedef struct A64Context {
uint8_t *mc_colram; uint8_t *mc_colram;
uint8_t *mc_palette; uint8_t *mc_palette;
int mc_pal_size; int mc_pal_size;
/* pts of the next packet that will be output */
int64_t next_pts;
} A64Context; } A64Context;
#endif /* AVCODEC_A64ENC_H */ #endif /* AVCODEC_A64ENC_H */

View File

@@ -28,7 +28,6 @@
#include "a64colors.h" #include "a64colors.h"
#include "a64tables.h" #include "a64tables.h"
#include "elbg.h" #include "elbg.h"
#include "internal.h"
#include "libavutil/intreadwrite.h" #include "libavutil/intreadwrite.h"
#define DITHERSTEPS 8 #define DITHERSTEPS 8
@@ -222,8 +221,6 @@ static av_cold int a64multi_init_encoder(AVCodecContext *avctx)
if (!avctx->codec_tag) if (!avctx->codec_tag)
avctx->codec_tag = AV_RL32("a64m"); avctx->codec_tag = AV_RL32("a64m");
c->next_pts = AV_NOPTS_VALUE;
return 0; return 0;
} }
@@ -242,19 +239,19 @@ static void a64_compress_colram(unsigned char *buf, int *charmap, uint8_t *colra
} }
} }
static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt, static int a64multi_encode_frame(AVCodecContext *avctx, unsigned char *buf,
const AVFrame *pict, int *got_packet) int buf_size, void *data)
{ {
A64Context *c = avctx->priv_data; A64Context *c = avctx->priv_data;
AVFrame *const p = &c->picture; AVFrame *pict = data;
AVFrame *const p = (AVFrame *) & c->picture;
int frame; int frame;
int x, y; int x, y;
int b_height; int b_height;
int b_width; int b_width;
int req_size, ret; int req_size;
uint8_t *buf = NULL;
int *charmap = c->mc_charmap; int *charmap = c->mc_charmap;
uint8_t *colram = c->mc_colram; uint8_t *colram = c->mc_colram;
@@ -277,7 +274,7 @@ static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
} }
/* no data, means end encoding asap */ /* no data, means end encoding asap */
if (!pict) { if (!data) {
/* all done, end encoding */ /* all done, end encoding */
if (!c->mc_lifetime) return 0; if (!c->mc_lifetime) return 0;
/* no more frames in queue, prepare to flush remaining frames */ /* no more frames in queue, prepare to flush remaining frames */
@@ -295,8 +292,6 @@ static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
p->key_frame = 1; p->key_frame = 1;
to_meta_with_crop(avctx, p, meta + 32000 * c->mc_frame_counter); to_meta_with_crop(avctx, p, meta + 32000 * c->mc_frame_counter);
c->mc_frame_counter++; c->mc_frame_counter++;
if (c->next_pts == AV_NOPTS_VALUE)
c->next_pts = pict->pts;
/* lifetime is not reached so wait for next frame first */ /* lifetime is not reached so wait for next frame first */
return 0; return 0;
} }
@@ -307,11 +302,6 @@ static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
req_size = 0; req_size = 0;
/* any frames to encode? */ /* any frames to encode? */
if (c->mc_lifetime) { if (c->mc_lifetime) {
req_size = charset_size + c->mc_lifetime*(screen_size + colram_size);
if ((ret = ff_alloc_packet2(avctx, pkt, req_size)) < 0)
return ret;
buf = pkt->data;
/* calc optimal new charset + charmaps */ /* calc optimal new charset + charmaps */
ff_init_elbg(meta, 32, 1000 * c->mc_lifetime, best_cb, CHARSET_CHARS, 50, charmap, &c->randctx); ff_init_elbg(meta, 32, 1000 * c->mc_lifetime, best_cb, CHARSET_CHARS, 50, charmap, &c->randctx);
ff_do_elbg (meta, 32, 1000 * c->mc_lifetime, best_cb, CHARSET_CHARS, 50, charmap, &c->randctx); ff_do_elbg (meta, 32, 1000 * c->mc_lifetime, best_cb, CHARSET_CHARS, 50, charmap, &c->randctx);
@@ -325,7 +315,10 @@ static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
/* advance pointers */ /* advance pointers */
buf += charset_size; buf += charset_size;
charset += charset_size; charset += charset_size;
req_size += charset_size;
} }
/* no charset so clean buf */
else memset(buf, 0, charset_size);
/* write x frames to buf */ /* write x frames to buf */
for (frame = 0; frame < c->mc_lifetime; frame++) { for (frame = 0; frame < c->mc_lifetime; frame++) {
@@ -358,12 +351,11 @@ static int a64multi_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
/* reset counter */ /* reset counter */
c->mc_frame_counter = 0; c->mc_frame_counter = 0;
pkt->pts = pkt->dts = c->next_pts; if (req_size > buf_size) {
c->next_pts = AV_NOPTS_VALUE; av_log(avctx, AV_LOG_ERROR, "buf size too small (need %d, got %d)\n", req_size, buf_size);
return -1;
pkt->size = req_size; }
pkt->flags |= AV_PKT_FLAG_KEY; return req_size;
*got_packet = !!req_size;
} }
return 0; return 0;
} }
@@ -374,7 +366,7 @@ AVCodec ff_a64multi_encoder = {
.id = CODEC_ID_A64_MULTI, .id = CODEC_ID_A64_MULTI,
.priv_data_size = sizeof(A64Context), .priv_data_size = sizeof(A64Context),
.init = a64multi_init_encoder, .init = a64multi_init_encoder,
.encode2 = a64multi_encode_frame, .encode = a64multi_encode_frame,
.close = a64multi_close_encoder, .close = a64multi_close_encoder,
.pix_fmts = (const enum PixelFormat[]) {PIX_FMT_GRAY8, PIX_FMT_NONE}, .pix_fmts = (const enum PixelFormat[]) {PIX_FMT_GRAY8, PIX_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64"), .long_name = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64"),
@@ -387,7 +379,7 @@ AVCodec ff_a64multi5_encoder = {
.id = CODEC_ID_A64_MULTI5, .id = CODEC_ID_A64_MULTI5,
.priv_data_size = sizeof(A64Context), .priv_data_size = sizeof(A64Context),
.init = a64multi_init_encoder, .init = a64multi_init_encoder,
.encode2 = a64multi_encode_frame, .encode = a64multi_encode_frame,
.close = a64multi_close_encoder, .close = a64multi_close_encoder,
.pix_fmts = (const enum PixelFormat[]) {PIX_FMT_GRAY8, PIX_FMT_NONE}, .pix_fmts = (const enum PixelFormat[]) {PIX_FMT_GRAY8, PIX_FMT_NONE},
.long_name = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64, extended with 5th color (colram)"), .long_name = NULL_IF_CONFIG_SMALL("Multicolor charset for Commodore 64, extended with 5th color (colram)"),

View File

@@ -112,15 +112,6 @@ enum OCStatus {
OC_LOCKED, ///< Output configuration locked in place OC_LOCKED, ///< Output configuration locked in place
}; };
typedef struct {
MPEG4AudioConfig m4ac;
uint8_t layout_map[MAX_ELEM_ID*4][3];
int layout_map_tags;
int channels;
uint64_t channel_layout;
enum OCStatus status;
} OutputConfiguration;
/** /**
* Predictor State * Predictor State
*/ */
@@ -263,6 +254,8 @@ typedef struct {
AVCodecContext *avctx; AVCodecContext *avctx;
AVFrame frame; AVFrame frame;
MPEG4AudioConfig m4ac;
int is_saved; ///< Set if elements have stored overlap from previous frame. int is_saved; ///< Set if elements have stored overlap from previous frame.
DynamicRangeControl che_drc; DynamicRangeControl che_drc;
@@ -270,6 +263,9 @@ typedef struct {
* @name Channel element related data * @name Channel element related data
* @{ * @{
*/ */
enum ChannelPosition che_pos[4][MAX_ELEM_ID]; /**< channel element channel mapping with the
* first index as the first 4 raw data block types
*/
ChannelElement *che[4][MAX_ELEM_ID]; ChannelElement *che[4][MAX_ELEM_ID];
ChannelElement *tag_che_map[4][MAX_ELEM_ID]; ChannelElement *tag_che_map[4][MAX_ELEM_ID];
int tags_mapped; int tags_mapped;
@@ -304,7 +300,7 @@ typedef struct {
DECLARE_ALIGNED(32, float, temp)[128]; DECLARE_ALIGNED(32, float, temp)[128];
OutputConfiguration oc[2]; enum OCStatus output_configured;
int warned_num_aac_frames; int warned_num_aac_frames;
} AACContext; } AACContext;

View File

@@ -93,7 +93,7 @@ get_next:
avctx->channels = s->channels; avctx->channels = s->channels;
avctx->channel_layout = s->channel_layout; avctx->channel_layout = s->channel_layout;
} }
s1->duration = s->samples; avctx->frame_size = s->samples;
avctx->audio_service_type = s->service_type; avctx->audio_service_type = s->service_type;
} }

View File

@@ -28,13 +28,13 @@
#include "parser.h" #include "parser.h"
typedef enum { typedef enum {
AAC_AC3_PARSE_ERROR_SYNC = -1, AAC_AC3_PARSE_ERROR_SYNC = -0x1030c0a,
AAC_AC3_PARSE_ERROR_BSID = -2, AAC_AC3_PARSE_ERROR_BSID = -0x2030c0a,
AAC_AC3_PARSE_ERROR_SAMPLE_RATE = -3, AAC_AC3_PARSE_ERROR_SAMPLE_RATE = -0x3030c0a,
AAC_AC3_PARSE_ERROR_FRAME_SIZE = -4, AAC_AC3_PARSE_ERROR_FRAME_SIZE = -0x4030c0a,
AAC_AC3_PARSE_ERROR_FRAME_TYPE = -5, AAC_AC3_PARSE_ERROR_FRAME_TYPE = -0x5030c0a,
AAC_AC3_PARSE_ERROR_CRC = -6, AAC_AC3_PARSE_ERROR_CRC = -0x6030c0a,
AAC_AC3_PARSE_ERROR_CHANNEL_CFG = -7, AAC_AC3_PARSE_ERROR_CHANNEL_CFG = -0x7030c0a,
} AACAC3ParseError; } AACAC3ParseError;
typedef struct AACAC3ParseContext { typedef struct AACAC3ParseContext {

View File

@@ -714,17 +714,15 @@ static void search_for_quantizers_twoloop(AVCodecContext *avctx,
{ {
int start = 0, i, w, w2, g; int start = 0, i, w, w2, g;
int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels * (lambda / 120.f); int destbits = avctx->bit_rate * 1024.0 / avctx->sample_rate / avctx->channels * (lambda / 120.f);
float dists[128] = { 0 }, uplims[128]; float dists[128], uplims[128];
float maxvals[128]; float maxvals[128];
int fflag, minscaler; int fflag, minscaler;
int its = 0; int its = 0;
int allz = 0; int allz = 0;
float minthr = INFINITY; float minthr = INFINITY;
// for values above this the decoder might end up in an endless loop
// due to always having more bits than what can be encoded.
destbits = FFMIN(destbits, 5800);
//XXX: some heuristic to determine initial quantizers will reduce search time //XXX: some heuristic to determine initial quantizers will reduce search time
memset(dists, 0, sizeof(dists));
//determine zero bands and upper limits //determine zero bands and upper limits
for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) { for (w = 0; w < sce->ics.num_windows; w += sce->ics.group_len[w]) {
for (g = 0; g < sce->ics.num_swb; g++) { for (g = 0; g < sce->ics.num_swb; g++) {
@@ -878,7 +876,7 @@ static void search_for_quantizers_faac(AVCodecContext *avctx, AACEncContext *s,
} else { } else {
for (w = 0; w < 8; w++) { for (w = 0; w < 8; w++) {
const float *coeffs = sce->coeffs + w*128; const float *coeffs = sce->coeffs + w*128;
curband = start = 0; start = 0;
for (i = 0; i < 128; i++) { for (i = 0; i < 128; i++) {
if (i - start >= sce->ics.swb_sizes[curband]) { if (i - start >= sce->ics.swb_sizes[curband]) {
start += sce->ics.swb_sizes[curband]; start += sce->ics.swb_sizes[curband];

File diff suppressed because it is too large Load Diff

View File

@@ -80,14 +80,14 @@ static const float * const tns_tmp2_map[4] = {
static const int8_t tags_per_config[16] = { 0, 1, 1, 2, 3, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0 }; static const int8_t tags_per_config[16] = { 0, 1, 1, 2, 3, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0 };
static const uint8_t aac_channel_layout_map[7][5][3] = { static const uint8_t aac_channel_layout_map[7][5][2] = {
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, }, { { TYPE_SCE, 0 }, },
{ { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, }, { { TYPE_CPE, 0 }, },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, }, { { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_SCE, 1, AAC_CHANNEL_BACK }, }, { { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_SCE, 1 }, },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, }, { { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_CPE, 1 }, },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, }, { { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_LFE, 0 }, { TYPE_CPE, 1 }, },
{ { TYPE_SCE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 0, AAC_CHANNEL_FRONT }, { TYPE_CPE, 1, AAC_CHANNEL_FRONT }, { TYPE_CPE, 2, AAC_CHANNEL_BACK }, { TYPE_LFE, 0, AAC_CHANNEL_LFE }, }, { { TYPE_CPE, 0 }, { TYPE_SCE, 0 }, { TYPE_LFE, 0 }, { TYPE_CPE, 2 }, { TYPE_CPE, 1 }, },
}; };
static const uint64_t aac_channel_layout[8] = { static const uint64_t aac_channel_layout[8] = {
@@ -97,7 +97,7 @@ static const uint64_t aac_channel_layout[8] = {
AV_CH_LAYOUT_4POINT0, AV_CH_LAYOUT_4POINT0,
AV_CH_LAYOUT_5POINT0_BACK, AV_CH_LAYOUT_5POINT0_BACK,
AV_CH_LAYOUT_5POINT1_BACK, AV_CH_LAYOUT_5POINT1_BACK,
AV_CH_LAYOUT_7POINT1_WIDE_BACK, AV_CH_LAYOUT_7POINT1_WIDE,
0, 0,
}; };

View File

@@ -34,7 +34,6 @@
#include "avcodec.h" #include "avcodec.h"
#include "put_bits.h" #include "put_bits.h"
#include "dsputil.h" #include "dsputil.h"
#include "internal.h"
#include "mpeg4audio.h" #include "mpeg4audio.h"
#include "kbdwin.h" #include "kbdwin.h"
#include "sinewin.h" #include "sinewin.h"
@@ -145,7 +144,7 @@ static const uint8_t aac_chan_configs[6][5] = {
}; };
/** /**
* Table to remap channels from libavcodec's default order to AAC order. * Table to remap channels from Libav's default order to AAC order.
*/ */
static const uint8_t aac_chan_maps[AAC_MAX_CHANNELS][AAC_MAX_CHANNELS] = { static const uint8_t aac_chan_maps[AAC_MAX_CHANNELS][AAC_MAX_CHANNELS] = {
{ 0 }, { 0 },
@@ -224,9 +223,8 @@ WINDOW_FUNC(eight_short)
const float *pwindow = sce->ics.use_kb_window[1] ? ff_aac_kbd_short_128 : ff_sine_128; const float *pwindow = sce->ics.use_kb_window[1] ? ff_aac_kbd_short_128 : ff_sine_128;
const float *in = audio + 448; const float *in = audio + 448;
float *out = sce->ret; float *out = sce->ret;
int w;
for (w = 0; w < 8; w++) { for (int w = 0; w < 8; w++) {
dsp->vector_fmul (out, in, w ? pwindow : swindow, 128); dsp->vector_fmul (out, in, w ? pwindow : swindow, 128);
out += 128; out += 128;
in += 128; in += 128;
@@ -475,9 +473,10 @@ static void put_bitstream_info(AVCodecContext *avctx, AACEncContext *s,
/* /*
* Deinterleave input samples. * Deinterleave input samples.
* Channels are reordered from libavcodec's default order to AAC order. * Channels are reordered from Libav's default order to AAC order.
*/ */
static void deinterleave_input_samples(AACEncContext *s, const AVFrame *frame) static void deinterleave_input_samples(AACEncContext *s,
const float *samples)
{ {
int ch, i; int ch, i;
const int sinc = s->channels; const int sinc = s->channels;
@@ -485,45 +484,37 @@ static void deinterleave_input_samples(AACEncContext *s, const AVFrame *frame)
/* deinterleave and remap input samples */ /* deinterleave and remap input samples */
for (ch = 0; ch < sinc; ch++) { for (ch = 0; ch < sinc; ch++) {
const float *sptr = samples + channel_map[ch];
/* copy last 1024 samples of previous frame to the start of the current frame */ /* copy last 1024 samples of previous frame to the start of the current frame */
memcpy(&s->planar_samples[ch][1024], &s->planar_samples[ch][2048], 1024 * sizeof(s->planar_samples[0][0])); memcpy(&s->planar_samples[ch][1024], &s->planar_samples[ch][2048], 1024 * sizeof(s->planar_samples[0][0]));
/* deinterleave */ /* deinterleave */
i = 2048; for (i = 2048; i < 3072; i++) {
if (frame) {
const float *sptr = ((const float *)frame->data[0]) + channel_map[ch];
for (; i < 2048 + frame->nb_samples; i++) {
s->planar_samples[ch][i] = *sptr; s->planar_samples[ch][i] = *sptr;
sptr += sinc; sptr += sinc;
} }
} }
memset(&s->planar_samples[ch][i], 0,
(3072 - i) * sizeof(s->planar_samples[0][0]));
}
} }
static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, static int aac_encode_frame(AVCodecContext *avctx,
const AVFrame *frame, int *got_packet_ptr) uint8_t *frame, int buf_size, void *data)
{ {
AACEncContext *s = avctx->priv_data; AACEncContext *s = avctx->priv_data;
float **samples = s->planar_samples, *samples2, *la, *overlap; float **samples = s->planar_samples, *samples2, *la, *overlap;
ChannelElement *cpe; ChannelElement *cpe;
int i, ch, w, g, chans, tag, start_ch, ret; int i, ch, w, g, chans, tag, start_ch;
int chan_el_counter[4]; int chan_el_counter[4];
FFPsyWindowInfo windows[AAC_MAX_CHANNELS]; FFPsyWindowInfo windows[AAC_MAX_CHANNELS];
if (s->last_frame == 2) if (s->last_frame)
return 0; return 0;
/* add current frame to queue */ if (data) {
if (frame) { deinterleave_input_samples(s, data);
if ((ret = ff_af_queue_add(&s->afq, frame) < 0))
return ret;
}
deinterleave_input_samples(s, frame);
if (s->psypp) if (s->psypp)
ff_psy_preprocess(s->psypp, s->planar_samples, s->channels); ff_psy_preprocess(s->psypp, s->planar_samples, s->channels);
}
if (!avctx->frame_number) if (!avctx->frame_number)
return 0; return 0;
@@ -540,7 +531,7 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
overlap = &samples[cur_channel][0]; overlap = &samples[cur_channel][0];
samples2 = overlap + 1024; samples2 = overlap + 1024;
la = samples2 + (448+64); la = samples2 + (448+64);
if (!frame) if (!data)
la = NULL; la = NULL;
if (tag == TYPE_LFE) { if (tag == TYPE_LFE) {
wi[ch].window_type[0] = ONLY_LONG_SEQUENCE; wi[ch].window_type[0] = ONLY_LONG_SEQUENCE;
@@ -571,15 +562,9 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
} }
start_ch += chans; start_ch += chans;
} }
if ((ret = ff_alloc_packet2(avctx, avpkt, 768 * s->channels))) {
av_log(avctx, AV_LOG_ERROR, "Error getting output packet\n");
return ret;
}
do { do {
int frame_bits; int frame_bits;
init_put_bits(&s->pb, frame, buf_size*8);
init_put_bits(&s->pb, avpkt->data, avpkt->size);
if ((avctx->frame_number & 0xFF)==1 && !(avctx->flags & CODEC_FLAG_BITEXACT)) if ((avctx->frame_number & 0xFF)==1 && !(avctx->flags & CODEC_FLAG_BITEXACT))
put_bitstream_info(avctx, s, LIBAVCODEC_IDENT); put_bitstream_info(avctx, s, LIBAVCODEC_IDENT);
start_ch = 0; start_ch = 0;
@@ -659,15 +644,10 @@ static int aac_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
s->lambda = FFMIN(s->lambda, 65536.f); s->lambda = FFMIN(s->lambda, 65536.f);
} }
if (!frame) if (!data)
s->last_frame++; s->last_frame = 1;
ff_af_queue_remove(&s->afq, avctx->frame_size, &avpkt->pts, return put_bits_count(&s->pb)>>3;
&avpkt->duration);
avpkt->size = put_bits_count(&s->pb) >> 3;
*got_packet_ptr = 1;
return 0;
} }
static av_cold int aac_encode_end(AVCodecContext *avctx) static av_cold int aac_encode_end(AVCodecContext *avctx)
@@ -681,10 +661,6 @@ static av_cold int aac_encode_end(AVCodecContext *avctx)
ff_psy_preprocess_end(s->psypp); ff_psy_preprocess_end(s->psypp);
av_freep(&s->buffer.samples); av_freep(&s->buffer.samples);
av_freep(&s->cpe); av_freep(&s->cpe);
ff_af_queue_close(&s->afq);
#if FF_API_OLD_ENCODE_AUDIO
av_freep(&avctx->coded_frame);
#endif
return 0; return 0;
} }
@@ -692,7 +668,7 @@ static av_cold int dsp_init(AVCodecContext *avctx, AACEncContext *s)
{ {
int ret = 0; int ret = 0;
ff_dsputil_init(&s->dsp, avctx); dsputil_init(&s->dsp, avctx);
// window init // window init
ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024); ff_kbd_window_init(ff_aac_kbd_long_1024, 4.0, 1024);
@@ -710,19 +686,13 @@ static av_cold int dsp_init(AVCodecContext *avctx, AACEncContext *s)
static av_cold int alloc_buffers(AVCodecContext *avctx, AACEncContext *s) static av_cold int alloc_buffers(AVCodecContext *avctx, AACEncContext *s)
{ {
int ch;
FF_ALLOCZ_OR_GOTO(avctx, s->buffer.samples, 3 * 1024 * s->channels * sizeof(s->buffer.samples[0]), alloc_fail); FF_ALLOCZ_OR_GOTO(avctx, s->buffer.samples, 3 * 1024 * s->channels * sizeof(s->buffer.samples[0]), alloc_fail);
FF_ALLOCZ_OR_GOTO(avctx, s->cpe, sizeof(ChannelElement) * s->chan_map[0], alloc_fail); FF_ALLOCZ_OR_GOTO(avctx, s->cpe, sizeof(ChannelElement) * s->chan_map[0], alloc_fail);
FF_ALLOCZ_OR_GOTO(avctx, avctx->extradata, 5 + FF_INPUT_BUFFER_PADDING_SIZE, alloc_fail); FF_ALLOCZ_OR_GOTO(avctx, avctx->extradata, 5 + FF_INPUT_BUFFER_PADDING_SIZE, alloc_fail);
for(ch = 0; ch < s->channels; ch++) for(int ch = 0; ch < s->channels; ch++)
s->planar_samples[ch] = s->buffer.samples + 3 * 1024 * ch; s->planar_samples[ch] = s->buffer.samples + 3 * 1024 * ch;
#if FF_API_OLD_ENCODE_AUDIO
if (!(avctx->coded_frame = avcodec_alloc_frame()))
goto alloc_fail;
#endif
return 0; return 0;
alloc_fail: alloc_fail:
return AVERROR(ENOMEM); return AVERROR(ENOMEM);
@@ -784,9 +754,6 @@ static av_cold int aac_encode_init(AVCodecContext *avctx)
for (i = 0; i < 428; i++) for (i = 0; i < 428; i++)
ff_aac_pow34sf_tab[i] = sqrt(ff_aac_pow2sf_tab[i] * sqrt(ff_aac_pow2sf_tab[i])); ff_aac_pow34sf_tab[i] = sqrt(ff_aac_pow2sf_tab[i] * sqrt(ff_aac_pow2sf_tab[i]));
avctx->delay = 1024;
ff_af_queue_init(avctx, &s->afq);
return 0; return 0;
fail: fail:
aac_encode_end(avctx); aac_encode_end(avctx);
@@ -816,13 +783,10 @@ AVCodec ff_aac_encoder = {
.id = CODEC_ID_AAC, .id = CODEC_ID_AAC,
.priv_data_size = sizeof(AACEncContext), .priv_data_size = sizeof(AACEncContext),
.init = aac_encode_init, .init = aac_encode_init,
.encode2 = aac_encode_frame, .encode = aac_encode_frame,
.close = aac_encode_end, .close = aac_encode_end,
.supported_samplerates = avpriv_mpeg4audio_sample_rates, .capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY | CODEC_CAP_EXPERIMENTAL,
.capabilities = CODEC_CAP_SMALL_LAST_FRAME | CODEC_CAP_DELAY | .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE},
CODEC_CAP_EXPERIMENTAL,
.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLT,
AV_SAMPLE_FMT_NONE },
.long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"), .long_name = NULL_IF_CONFIG_SMALL("Advanced Audio Coding"),
.priv_class = &aacenc_class, .priv_class = &aacenc_class,
}; };

View File

@@ -27,7 +27,7 @@
#include "dsputil.h" #include "dsputil.h"
#include "aac.h" #include "aac.h"
#include "audio_frame_queue.h"
#include "psymodel.h" #include "psymodel.h"
#define AAC_CODER_NB 4 #define AAC_CODER_NB 4
@@ -74,7 +74,6 @@ typedef struct AACEncContext {
int cur_channel; int cur_channel;
int last_frame; int last_frame;
float lambda; float lambda;
AudioFrameQueue afq;
DECLARE_ALIGNED(16, int, qcoefs)[96]; ///< quantized coefficients DECLARE_ALIGNED(16, int, qcoefs)[96]; ///< quantized coefficients
DECLARE_ALIGNED(32, float, scoefs)[1024]; ///< scaled coefficients DECLARE_ALIGNED(32, float, scoefs)[1024]; ///< scaled coefficients

View File

@@ -27,7 +27,6 @@
#include "aacps.h" #include "aacps.h"
#include "aacps_tablegen.h" #include "aacps_tablegen.h"
#include "aacpsdata.c" #include "aacpsdata.c"
#include "dsputil.h"
#define PS_BASELINE 0 ///< Operate in Baseline PS mode #define PS_BASELINE 0 ///< Operate in Baseline PS mode
///< Baseline implies 10 or 20 stereo bands, ///< Baseline implies 10 or 20 stereo bands,
@@ -285,7 +284,7 @@ err:
/** Split one subband into 2 subsubbands with a symmetric real filter. /** Split one subband into 2 subsubbands with a symmetric real filter.
* The filter must have its non-center even coefficients equal to zero. */ * The filter must have its non-center even coefficients equal to zero. */
static void hybrid2_re(float (*in)[2], float (*out)[32][2], const float filter[8], int len, int reverse) static void hybrid2_re(float (*in)[2], float (*out)[32][2], const float filter[7], int len, int reverse)
{ {
int i, j; int i, j;
for (i = 0; i < len; i++, in++) { for (i = 0; i < len; i++, in++) {
@@ -305,14 +304,26 @@ static void hybrid2_re(float (*in)[2], float (*out)[32][2], const float filter[8
} }
/** Split one subband into 6 subsubbands with a complex filter */ /** Split one subband into 6 subsubbands with a complex filter */
static void hybrid6_cx(PSDSPContext *dsp, float (*in)[2], float (*out)[32][2], const float (*filter)[8][2], int len) static void hybrid6_cx(float (*in)[2], float (*out)[32][2], const float (*filter)[7][2], int len)
{ {
int i; int i, j, ssb;
int N = 8; int N = 8;
LOCAL_ALIGNED_16(float, temp, [8], [2]); float temp[8][2];
for (i = 0; i < len; i++, in++) { for (i = 0; i < len; i++, in++) {
dsp->hybrid_analysis(temp, in, filter, 1, N); for (ssb = 0; ssb < N; ssb++) {
float sum_re = filter[ssb][6][0] * in[6][0], sum_im = filter[ssb][6][0] * in[6][1];
for (j = 0; j < 6; j++) {
float in0_re = in[j][0];
float in0_im = in[j][1];
float in1_re = in[12-j][0];
float in1_im = in[12-j][1];
sum_re += filter[ssb][j][0] * (in0_re + in1_re) - filter[ssb][j][1] * (in0_im - in1_im);
sum_im += filter[ssb][j][0] * (in0_im + in1_im) + filter[ssb][j][1] * (in0_re - in1_re);
}
temp[ssb][0] = sum_re;
temp[ssb][1] = sum_im;
}
out[0][i][0] = temp[6][0]; out[0][i][0] = temp[6][0];
out[0][i][1] = temp[6][1]; out[0][i][1] = temp[6][1];
out[1][i][0] = temp[7][0]; out[1][i][0] = temp[7][0];
@@ -328,18 +339,28 @@ static void hybrid6_cx(PSDSPContext *dsp, float (*in)[2], float (*out)[32][2], c
} }
} }
static void hybrid4_8_12_cx(PSDSPContext *dsp, float (*in)[2], float (*out)[32][2], const float (*filter)[8][2], int N, int len) static void hybrid4_8_12_cx(float (*in)[2], float (*out)[32][2], const float (*filter)[7][2], int N, int len)
{ {
int i; int i, j, ssb;
for (i = 0; i < len; i++, in++) { for (i = 0; i < len; i++, in++) {
dsp->hybrid_analysis(out[0] + i, in, filter, 32, N); for (ssb = 0; ssb < N; ssb++) {
float sum_re = filter[ssb][6][0] * in[6][0], sum_im = filter[ssb][6][0] * in[6][1];
for (j = 0; j < 6; j++) {
float in0_re = in[j][0];
float in0_im = in[j][1];
float in1_re = in[12-j][0];
float in1_im = in[12-j][1];
sum_re += filter[ssb][j][0] * (in0_re + in1_re) - filter[ssb][j][1] * (in0_im - in1_im);
sum_im += filter[ssb][j][0] * (in0_im + in1_im) + filter[ssb][j][1] * (in0_re - in1_re);
}
out[ssb][i][0] = sum_re;
out[ssb][i][1] = sum_im;
}
} }
} }
static void hybrid_analysis(PSDSPContext *dsp, float out[91][32][2], static void hybrid_analysis(float out[91][32][2], float in[5][44][2], float L[2][38][64], int is34, int len)
float in[5][44][2], float L[2][38][64],
int is34, int len)
{ {
int i, j; int i, j;
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
@@ -349,17 +370,27 @@ static void hybrid_analysis(PSDSPContext *dsp, float out[91][32][2],
} }
} }
if (is34) { if (is34) {
hybrid4_8_12_cx(dsp, in[0], out, f34_0_12, 12, len); hybrid4_8_12_cx(in[0], out, f34_0_12, 12, len);
hybrid4_8_12_cx(dsp, in[1], out+12, f34_1_8, 8, len); hybrid4_8_12_cx(in[1], out+12, f34_1_8, 8, len);
hybrid4_8_12_cx(dsp, in[2], out+20, f34_2_4, 4, len); hybrid4_8_12_cx(in[2], out+20, f34_2_4, 4, len);
hybrid4_8_12_cx(dsp, in[3], out+24, f34_2_4, 4, len); hybrid4_8_12_cx(in[3], out+24, f34_2_4, 4, len);
hybrid4_8_12_cx(dsp, in[4], out+28, f34_2_4, 4, len); hybrid4_8_12_cx(in[4], out+28, f34_2_4, 4, len);
dsp->hybrid_analysis_ileave(out + 27, L, 5, len); for (i = 0; i < 59; i++) {
for (j = 0; j < len; j++) {
out[i+32][j][0] = L[0][j][i+5];
out[i+32][j][1] = L[1][j][i+5];
}
}
} else { } else {
hybrid6_cx(dsp, in[0], out, f20_0_8, len); hybrid6_cx(in[0], out, f20_0_8, len);
hybrid2_re(in[1], out+6, g1_Q2, len, 1); hybrid2_re(in[1], out+6, g1_Q2, len, 1);
hybrid2_re(in[2], out+8, g1_Q2, len, 0); hybrid2_re(in[2], out+8, g1_Q2, len, 0);
dsp->hybrid_analysis_ileave(out + 7, L, 3, len); for (i = 0; i < 61; i++) {
for (j = 0; j < len; j++) {
out[i+10][j][0] = L[0][j][i+3];
out[i+10][j][1] = L[1][j][i+3];
}
}
} }
//update in_buf //update in_buf
for (i = 0; i < 5; i++) { for (i = 0; i < 5; i++) {
@@ -367,8 +398,7 @@ static void hybrid_analysis(PSDSPContext *dsp, float out[91][32][2],
} }
} }
static void hybrid_synthesis(PSDSPContext *dsp, float out[2][38][64], static void hybrid_synthesis(float out[2][38][64], float in[91][32][2], int is34, int len)
float in[91][32][2], int is34, int len)
{ {
int i, n; int i, n;
if (is34) { if (is34) {
@@ -392,7 +422,12 @@ static void hybrid_synthesis(PSDSPContext *dsp, float out[2][38][64],
out[1][n][4] += in[28+i][n][1]; out[1][n][4] += in[28+i][n][1];
} }
} }
dsp->hybrid_synthesis_deint(out, in + 27, 5, len); for (i = 0; i < 59; i++) {
for (n = 0; n < len; n++) {
out[0][n][i+5] = in[i+32][n][0];
out[1][n][i+5] = in[i+32][n][1];
}
}
} else { } else {
for (n = 0; n < len; n++) { for (n = 0; n < len; n++) {
out[0][n][0] = in[0][n][0] + in[1][n][0] + in[2][n][0] + out[0][n][0] = in[0][n][0] + in[1][n][0] + in[2][n][0] +
@@ -404,7 +439,12 @@ static void hybrid_synthesis(PSDSPContext *dsp, float out[2][38][64],
out[0][n][2] = in[8][n][0] + in[9][n][0]; out[0][n][2] = in[8][n][0] + in[9][n][0];
out[1][n][2] = in[8][n][1] + in[9][n][1]; out[1][n][2] = in[8][n][1] + in[9][n][1];
} }
dsp->hybrid_synthesis_deint(out, in + 7, 3, len); for (i = 0; i < 61; i++) {
for (n = 0; n < len; n++) {
out[0][n][i+3] = in[i+10][n][0];
out[1][n][i+3] = in[i+10][n][1];
}
}
} }
} }
@@ -608,8 +648,8 @@ static void map_val_20_to_34(float par[PS_MAX_NR_IIDICC])
static void decorrelation(PSContext *ps, float (*out)[32][2], const float (*s)[32][2], int is34) static void decorrelation(PSContext *ps, float (*out)[32][2], const float (*s)[32][2], int is34)
{ {
LOCAL_ALIGNED_16(float, power, [34], [PS_QMF_TIME_SLOTS]); float power[34][PS_QMF_TIME_SLOTS] = {{0}};
LOCAL_ALIGNED_16(float, transient_gain, [34], [PS_QMF_TIME_SLOTS]); float transient_gain[34][PS_QMF_TIME_SLOTS];
float *peak_decay_nrg = ps->peak_decay_nrg; float *peak_decay_nrg = ps->peak_decay_nrg;
float *power_smooth = ps->power_smooth; float *power_smooth = ps->power_smooth;
float *peak_decay_diff_smooth = ps->peak_decay_diff_smooth; float *peak_decay_diff_smooth = ps->peak_decay_diff_smooth;
@@ -621,8 +661,10 @@ static void decorrelation(PSContext *ps, float (*out)[32][2], const float (*s)[3
const float a_smooth = 0.25f; ///< Smoothing coefficient const float a_smooth = 0.25f; ///< Smoothing coefficient
int i, k, m, n; int i, k, m, n;
int n0 = 0, nL = 32; int n0 = 0, nL = 32;
static const int link_delay[] = { 3, 4, 5 };
memset(power, 0, 34 * sizeof(*power)); static const float a[] = { 0.65143905753106f,
0.56471812200776f,
0.48954165955695f };
if (is34 != ps->is34bands_old) { if (is34 != ps->is34bands_old) {
memset(ps->peak_decay_nrg, 0, sizeof(ps->peak_decay_nrg)); memset(ps->peak_decay_nrg, 0, sizeof(ps->peak_decay_nrg));
@@ -632,9 +674,11 @@ static void decorrelation(PSContext *ps, float (*out)[32][2], const float (*s)[3
memset(ps->ap_delay, 0, sizeof(ps->ap_delay)); memset(ps->ap_delay, 0, sizeof(ps->ap_delay));
} }
for (n = n0; n < nL; n++) {
for (k = 0; k < NR_BANDS[is34]; k++) { for (k = 0; k < NR_BANDS[is34]; k++) {
int i = k_to_i[k]; int i = k_to_i[k];
ps->dsp.add_squares(power[i], s[k], nL - n0); power[i][n] += s[k][n][0] * s[k][n][0] + s[k][n][1] * s[k][n][1];
}
} }
//Transient detection //Transient detection
@@ -662,31 +706,54 @@ static void decorrelation(PSContext *ps, float (*out)[32][2], const float (*s)[3
for (k = 0; k < NR_ALLPASS_BANDS[is34]; k++) { for (k = 0; k < NR_ALLPASS_BANDS[is34]; k++) {
int b = k_to_i[k]; int b = k_to_i[k];
float g_decay_slope = 1.f - DECAY_SLOPE * (k - DECAY_CUTOFF[is34]); float g_decay_slope = 1.f - DECAY_SLOPE * (k - DECAY_CUTOFF[is34]);
float ag[PS_AP_LINKS];
g_decay_slope = av_clipf(g_decay_slope, 0.f, 1.f); g_decay_slope = av_clipf(g_decay_slope, 0.f, 1.f);
memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0])); memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0]));
memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0])); memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0]));
for (m = 0; m < PS_AP_LINKS; m++) { for (m = 0; m < PS_AP_LINKS; m++) {
memcpy(ap_delay[k][m], ap_delay[k][m]+numQMFSlots, 5*sizeof(ap_delay[k][m][0])); memcpy(ap_delay[k][m], ap_delay[k][m]+numQMFSlots, 5*sizeof(ap_delay[k][m][0]));
ag[m] = a[m] * g_decay_slope;
}
for (n = n0; n < nL; n++) {
float in_re = delay[k][n+PS_MAX_DELAY-2][0] * phi_fract[is34][k][0] -
delay[k][n+PS_MAX_DELAY-2][1] * phi_fract[is34][k][1];
float in_im = delay[k][n+PS_MAX_DELAY-2][0] * phi_fract[is34][k][1] +
delay[k][n+PS_MAX_DELAY-2][1] * phi_fract[is34][k][0];
for (m = 0; m < PS_AP_LINKS; m++) {
float a_re = ag[m] * in_re;
float a_im = ag[m] * in_im;
float link_delay_re = ap_delay[k][m][n+5-link_delay[m]][0];
float link_delay_im = ap_delay[k][m][n+5-link_delay[m]][1];
float fractional_delay_re = Q_fract_allpass[is34][k][m][0];
float fractional_delay_im = Q_fract_allpass[is34][k][m][1];
ap_delay[k][m][n+5][0] = in_re;
ap_delay[k][m][n+5][1] = in_im;
in_re = link_delay_re * fractional_delay_re - link_delay_im * fractional_delay_im - a_re;
in_im = link_delay_re * fractional_delay_im + link_delay_im * fractional_delay_re - a_im;
ap_delay[k][m][n+5][0] += ag[m] * in_re;
ap_delay[k][m][n+5][1] += ag[m] * in_im;
}
out[k][n][0] = transient_gain[b][n] * in_re;
out[k][n][1] = transient_gain[b][n] * in_im;
} }
ps->dsp.decorrelate(out[k], delay[k] + PS_MAX_DELAY - 2, ap_delay[k],
phi_fract[is34][k], Q_fract_allpass[is34][k],
transient_gain[b], g_decay_slope, nL - n0);
} }
for (; k < SHORT_DELAY_BAND[is34]; k++) { for (; k < SHORT_DELAY_BAND[is34]; k++) {
int i = k_to_i[k];
memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0])); memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0]));
memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0])); memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0]));
for (n = n0; n < nL; n++) {
//H = delay 14 //H = delay 14
ps->dsp.mul_pair_single(out[k], delay[k] + PS_MAX_DELAY - 14, out[k][n][0] = transient_gain[k_to_i[k]][n] * delay[k][n+PS_MAX_DELAY-14][0];
transient_gain[i], nL - n0); out[k][n][1] = transient_gain[k_to_i[k]][n] * delay[k][n+PS_MAX_DELAY-14][1];
}
} }
for (; k < NR_BANDS[is34]; k++) { for (; k < NR_BANDS[is34]; k++) {
int i = k_to_i[k];
memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0])); memcpy(delay[k], delay[k]+nL, PS_MAX_DELAY*sizeof(delay[k][0]));
memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0])); memcpy(delay[k]+PS_MAX_DELAY, s[k], numQMFSlots*sizeof(delay[k][0]));
for (n = n0; n < nL; n++) {
//H = delay 1 //H = delay 1
ps->dsp.mul_pair_single(out[k], delay[k] + PS_MAX_DELAY - 1, out[k][n][0] = transient_gain[k_to_i[k]][n] * delay[k][n+PS_MAX_DELAY-1][0];
transient_gain[i], nL - n0); out[k][n][1] = transient_gain[k_to_i[k]][n] * delay[k][n+PS_MAX_DELAY-1][1];
}
} }
} }
@@ -730,7 +797,7 @@ static void remap20(int8_t (**p_par_mapped)[PS_MAX_NR_IIDICC],
static void stereo_processing(PSContext *ps, float (*l)[32][2], float (*r)[32][2], int is34) static void stereo_processing(PSContext *ps, float (*l)[32][2], float (*r)[32][2], int is34)
{ {
int e, b, k; int e, b, k, n;
float (*H11)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H11; float (*H11)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H11;
float (*H12)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H12; float (*H12)[PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC] = ps->H12;
@@ -842,52 +909,78 @@ static void stereo_processing(PSContext *ps, float (*l)[32][2], float (*r)[32][2
H22[0][e+1][b] = h22; H22[0][e+1][b] = h22;
} }
for (k = 0; k < NR_BANDS[is34]; k++) { for (k = 0; k < NR_BANDS[is34]; k++) {
float h[2][4]; float h11r, h12r, h21r, h22r;
float h_step[2][4]; float h11i, h12i, h21i, h22i;
float h11r_step, h12r_step, h21r_step, h22r_step;
float h11i_step, h12i_step, h21i_step, h22i_step;
int start = ps->border_position[e]; int start = ps->border_position[e];
int stop = ps->border_position[e+1]; int stop = ps->border_position[e+1];
float width = 1.f / (stop - start); float width = 1.f / (stop - start);
b = k_to_i[k]; b = k_to_i[k];
h[0][0] = H11[0][e][b]; h11r = H11[0][e][b];
h[0][1] = H12[0][e][b]; h12r = H12[0][e][b];
h[0][2] = H21[0][e][b]; h21r = H21[0][e][b];
h[0][3] = H22[0][e][b]; h22r = H22[0][e][b];
if (!PS_BASELINE && ps->enable_ipdopd) { if (!PS_BASELINE && ps->enable_ipdopd) {
//Is this necessary? ps_04_new seems unchanged //Is this necessary? ps_04_new seems unchanged
if ((is34 && k <= 13 && k >= 9) || (!is34 && k <= 1)) { if ((is34 && k <= 13 && k >= 9) || (!is34 && k <= 1)) {
h[1][0] = -H11[1][e][b]; h11i = -H11[1][e][b];
h[1][1] = -H12[1][e][b]; h12i = -H12[1][e][b];
h[1][2] = -H21[1][e][b]; h21i = -H21[1][e][b];
h[1][3] = -H22[1][e][b]; h22i = -H22[1][e][b];
} else { } else {
h[1][0] = H11[1][e][b]; h11i = H11[1][e][b];
h[1][1] = H12[1][e][b]; h12i = H12[1][e][b];
h[1][2] = H21[1][e][b]; h21i = H21[1][e][b];
h[1][3] = H22[1][e][b]; h22i = H22[1][e][b];
} }
} }
//Interpolation //Interpolation
h_step[0][0] = (H11[0][e+1][b] - h[0][0]) * width; h11r_step = (H11[0][e+1][b] - h11r) * width;
h_step[0][1] = (H12[0][e+1][b] - h[0][1]) * width; h12r_step = (H12[0][e+1][b] - h12r) * width;
h_step[0][2] = (H21[0][e+1][b] - h[0][2]) * width; h21r_step = (H21[0][e+1][b] - h21r) * width;
h_step[0][3] = (H22[0][e+1][b] - h[0][3]) * width; h22r_step = (H22[0][e+1][b] - h22r) * width;
if (!PS_BASELINE && ps->enable_ipdopd) { if (!PS_BASELINE && ps->enable_ipdopd) {
h_step[1][0] = (H11[1][e+1][b] - h[1][0]) * width; h11i_step = (H11[1][e+1][b] - h11i) * width;
h_step[1][1] = (H12[1][e+1][b] - h[1][1]) * width; h12i_step = (H12[1][e+1][b] - h12i) * width;
h_step[1][2] = (H21[1][e+1][b] - h[1][2]) * width; h21i_step = (H21[1][e+1][b] - h21i) * width;
h_step[1][3] = (H22[1][e+1][b] - h[1][3]) * width; h22i_step = (H22[1][e+1][b] - h22i) * width;
}
for (n = start + 1; n <= stop; n++) {
//l is s, r is d
float l_re = l[k][n][0];
float l_im = l[k][n][1];
float r_re = r[k][n][0];
float r_im = r[k][n][1];
h11r += h11r_step;
h12r += h12r_step;
h21r += h21r_step;
h22r += h22r_step;
if (!PS_BASELINE && ps->enable_ipdopd) {
h11i += h11i_step;
h12i += h12i_step;
h21i += h21i_step;
h22i += h22i_step;
l[k][n][0] = h11r*l_re + h21r*r_re - h11i*l_im - h21i*r_im;
l[k][n][1] = h11r*l_im + h21r*r_im + h11i*l_re + h21i*r_re;
r[k][n][0] = h12r*l_re + h22r*r_re - h12i*l_im - h22i*r_im;
r[k][n][1] = h12r*l_im + h22r*r_im + h12i*l_re + h22i*r_re;
} else {
l[k][n][0] = h11r*l_re + h21r*r_re;
l[k][n][1] = h11r*l_im + h21r*r_im;
r[k][n][0] = h12r*l_re + h22r*r_re;
r[k][n][1] = h12r*l_im + h22r*r_im;
}
} }
ps->dsp.stereo_interpolate[!PS_BASELINE && ps->enable_ipdopd](
l[k] + start + 1, r[k] + start + 1,
h, h_step, stop - start);
} }
} }
} }
int ff_ps_apply(AVCodecContext *avctx, PSContext *ps, float L[2][38][64], float R[2][38][64], int top) int ff_ps_apply(AVCodecContext *avctx, PSContext *ps, float L[2][38][64], float R[2][38][64], int top)
{ {
LOCAL_ALIGNED_16(float, Lbuf, [91], [32][2]); float Lbuf[91][32][2];
LOCAL_ALIGNED_16(float, Rbuf, [91], [32][2]); float Rbuf[91][32][2];
const int len = 32; const int len = 32;
int is34 = ps->is34bands; int is34 = ps->is34bands;
@@ -896,11 +989,11 @@ int ff_ps_apply(AVCodecContext *avctx, PSContext *ps, float L[2][38][64], float
if (top < NR_ALLPASS_BANDS[is34]) if (top < NR_ALLPASS_BANDS[is34])
memset(ps->ap_delay + top, 0, (NR_ALLPASS_BANDS[is34] - top)*sizeof(ps->ap_delay[0])); memset(ps->ap_delay + top, 0, (NR_ALLPASS_BANDS[is34] - top)*sizeof(ps->ap_delay[0]));
hybrid_analysis(&ps->dsp, Lbuf, ps->in_buf, L, is34, len); hybrid_analysis(Lbuf, ps->in_buf, L, is34, len);
decorrelation(ps, Rbuf, Lbuf, is34); decorrelation(ps, Rbuf, Lbuf, is34);
stereo_processing(ps, Lbuf, Rbuf, is34); stereo_processing(ps, Lbuf, Rbuf, is34);
hybrid_synthesis(&ps->dsp, L, Lbuf, is34, len); hybrid_synthesis(L, Lbuf, is34, len);
hybrid_synthesis(&ps->dsp, R, Rbuf, is34, len); hybrid_synthesis(R, Rbuf, is34, len);
return 0; return 0;
} }
@@ -948,5 +1041,4 @@ av_cold void ff_ps_init(void) {
av_cold void ff_ps_ctx_init(PSContext *ps) av_cold void ff_ps_ctx_init(PSContext *ps)
{ {
ff_psdsp_init(&ps->dsp);
} }

View File

@@ -24,7 +24,6 @@
#include <stdint.h> #include <stdint.h>
#include "aacpsdsp.h"
#include "avcodec.h" #include "avcodec.h"
#include "get_bits.h" #include "get_bits.h"
@@ -61,19 +60,18 @@ typedef struct {
int is34bands; int is34bands;
int is34bands_old; int is34bands_old;
DECLARE_ALIGNED(16, float, in_buf)[5][44][2]; float in_buf[5][44][2];
DECLARE_ALIGNED(16, float, delay)[PS_MAX_SSB][PS_QMF_TIME_SLOTS + PS_MAX_DELAY][2]; float delay[PS_MAX_SSB][PS_QMF_TIME_SLOTS + PS_MAX_DELAY][2];
DECLARE_ALIGNED(16, float, ap_delay)[PS_MAX_AP_BANDS][PS_AP_LINKS][PS_QMF_TIME_SLOTS + PS_MAX_AP_DELAY][2]; float ap_delay[PS_MAX_AP_BANDS][PS_AP_LINKS][PS_QMF_TIME_SLOTS + PS_MAX_AP_DELAY][2];
DECLARE_ALIGNED(16, float, peak_decay_nrg)[34]; float peak_decay_nrg[34];
DECLARE_ALIGNED(16, float, power_smooth)[34]; float power_smooth[34];
DECLARE_ALIGNED(16, float, peak_decay_diff_smooth)[34]; float peak_decay_diff_smooth[34];
DECLARE_ALIGNED(16, float, H11)[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]; float H11[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC];
DECLARE_ALIGNED(16, float, H12)[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]; float H12[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC];
DECLARE_ALIGNED(16, float, H21)[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]; float H21[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC];
DECLARE_ALIGNED(16, float, H22)[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC]; float H22[2][PS_MAX_NUM_ENV+1][PS_MAX_NR_IIDICC];
int8_t opd_hist[PS_MAX_NR_IIDICC]; int8_t opd_hist[PS_MAX_NR_IIDICC];
int8_t ipd_hist[PS_MAX_NR_IIDICC]; int8_t ipd_hist[PS_MAX_NR_IIDICC];
PSDSPContext dsp;
} PSContext; } PSContext;
void ff_ps_init(void); void ff_ps_init(void);

View File

@@ -69,23 +69,23 @@ int main(void)
write_float_3d_array(HB, 46, 8, 4); write_float_3d_array(HB, 46, 8, 4);
printf("};\n"); printf("};\n");
printf("static const DECLARE_ALIGNED(16, float, f20_0_8)[8][8][2] = {\n"); printf("static const float f20_0_8[8][7][2] = {\n");
write_float_3d_array(f20_0_8, 8, 8, 2); write_float_3d_array(f20_0_8, 8, 7, 2);
printf("};\n"); printf("};\n");
printf("static const DECLARE_ALIGNED(16, float, f34_0_12)[12][8][2] = {\n"); printf("static const float f34_0_12[12][7][2] = {\n");
write_float_3d_array(f34_0_12, 12, 8, 2); write_float_3d_array(f34_0_12, 12, 7, 2);
printf("};\n"); printf("};\n");
printf("static const DECLARE_ALIGNED(16, float, f34_1_8)[8][8][2] = {\n"); printf("static const float f34_1_8[8][7][2] = {\n");
write_float_3d_array(f34_1_8, 8, 8, 2); write_float_3d_array(f34_1_8, 8, 7, 2);
printf("};\n"); printf("};\n");
printf("static const DECLARE_ALIGNED(16, float, f34_2_4)[4][8][2] = {\n"); printf("static const float f34_2_4[4][7][2] = {\n");
write_float_3d_array(f34_2_4, 4, 8, 2); write_float_3d_array(f34_2_4, 4, 7, 2);
printf("};\n"); printf("};\n");
printf("static const DECLARE_ALIGNED(16, float, Q_fract_allpass)[2][50][3][2] = {\n"); printf("static const float Q_fract_allpass[2][50][3][2] = {\n");
write_float_4d_array(Q_fract_allpass, 2, 50, 3, 2); write_float_4d_array(Q_fract_allpass, 2, 50, 3, 2);
printf("};\n"); printf("};\n");
printf("static const DECLARE_ALIGNED(16, float, phi_fract)[2][50][2] = {\n"); printf("static const float phi_fract[2][50][2] = {\n");
write_float_3d_array(phi_fract, 2, 50, 2); write_float_3d_array(phi_fract, 2, 50, 2);
printf("};\n"); printf("};\n");

View File

@@ -31,7 +31,6 @@
#else #else
#include "libavutil/common.h" #include "libavutil/common.h"
#include "libavutil/mathematics.h" #include "libavutil/mathematics.h"
#include "libavutil/mem.h"
#define NR_ALLPASS_BANDS20 30 #define NR_ALLPASS_BANDS20 30
#define NR_ALLPASS_BANDS34 50 #define NR_ALLPASS_BANDS34 50
#define PS_AP_LINKS 3 #define PS_AP_LINKS 3
@@ -39,12 +38,12 @@ static float pd_re_smooth[8*8*8];
static float pd_im_smooth[8*8*8]; static float pd_im_smooth[8*8*8];
static float HA[46][8][4]; static float HA[46][8][4];
static float HB[46][8][4]; static float HB[46][8][4];
static DECLARE_ALIGNED(16, float, f20_0_8) [ 8][8][2]; static float f20_0_8 [ 8][7][2];
static DECLARE_ALIGNED(16, float, f34_0_12)[12][8][2]; static float f34_0_12[12][7][2];
static DECLARE_ALIGNED(16, float, f34_1_8) [ 8][8][2]; static float f34_1_8 [ 8][7][2];
static DECLARE_ALIGNED(16, float, f34_2_4) [ 4][8][2]; static float f34_2_4 [ 4][7][2];
static DECLARE_ALIGNED(16, float, Q_fract_allpass)[2][50][3][2]; static float Q_fract_allpass[2][50][3][2];
static DECLARE_ALIGNED(16, float, phi_fract)[2][50][2]; static float phi_fract[2][50][2];
static const float g0_Q8[] = { static const float g0_Q8[] = {
0.00746082949812f, 0.02270420949825f, 0.04546865930473f, 0.07266113929591f, 0.00746082949812f, 0.02270420949825f, 0.04546865930473f, 0.07266113929591f,
@@ -66,7 +65,7 @@ static const float g2_Q4[] = {
0.16486303567403f, 0.23279856662996f, 0.25f 0.16486303567403f, 0.23279856662996f, 0.25f
}; };
static void make_filters_from_proto(float (*filter)[8][2], const float *proto, int bands) static void make_filters_from_proto(float (*filter)[7][2], const float *proto, int bands)
{ {
int q, n; int q, n;
for (q = 0; q < bands; q++) { for (q = 0; q < bands; q++) {

View File

@@ -1,214 +0,0 @@
/*
* Copyright (c) 2010 Alex Converse <alex.converse@gmail.com>
*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#include "config.h"
#include "libavutil/attributes.h"
#include "aacpsdsp.h"
static void ps_add_squares_c(float *dst, const float (*src)[2], int n)
{
int i;
for (i = 0; i < n; i++)
dst[i] += src[i][0] * src[i][0] + src[i][1] * src[i][1];
}
static void ps_mul_pair_single_c(float (*dst)[2], float (*src0)[2], float *src1,
int n)
{
int i;
for (i = 0; i < n; i++) {
dst[i][0] = src0[i][0] * src1[i];
dst[i][1] = src0[i][1] * src1[i];
}
}
static void ps_hybrid_analysis_c(float (*out)[2], float (*in)[2],
const float (*filter)[8][2],
int stride, int n)
{
int i, j;
for (i = 0; i < n; i++) {
float sum_re = filter[i][6][0] * in[6][0];
float sum_im = filter[i][6][0] * in[6][1];
for (j = 0; j < 6; j++) {
float in0_re = in[j][0];
float in0_im = in[j][1];
float in1_re = in[12-j][0];
float in1_im = in[12-j][1];
sum_re += filter[i][j][0] * (in0_re + in1_re) -
filter[i][j][1] * (in0_im - in1_im);
sum_im += filter[i][j][0] * (in0_im + in1_im) +
filter[i][j][1] * (in0_re - in1_re);
}
out[i * stride][0] = sum_re;
out[i * stride][1] = sum_im;
}
}
static void ps_hybrid_analysis_ileave_c(float (*out)[32][2], float L[2][38][64],
int i, int len)
{
int j;
for (; i < 64; i++) {
for (j = 0; j < len; j++) {
out[i][j][0] = L[0][j][i];
out[i][j][1] = L[1][j][i];
}
}
}
static void ps_hybrid_synthesis_deint_c(float out[2][38][64],
float (*in)[32][2],
int i, int len)
{
int n;
for (; i < 64; i++) {
for (n = 0; n < len; n++) {
out[0][n][i] = in[i][n][0];
out[1][n][i] = in[i][n][1];
}
}
}
static void ps_decorrelate_c(float (*out)[2], float (*delay)[2],
float (*ap_delay)[PS_QMF_TIME_SLOTS + PS_MAX_AP_DELAY][2],
const float phi_fract[2], float (*Q_fract)[2],
const float *transient_gain,
float g_decay_slope,
int len)
{
static const float a[] = { 0.65143905753106f,
0.56471812200776f,
0.48954165955695f };
float ag[PS_AP_LINKS];
int m, n;
for (m = 0; m < PS_AP_LINKS; m++)
ag[m] = a[m] * g_decay_slope;
for (n = 0; n < len; n++) {
float in_re = delay[n][0] * phi_fract[0] - delay[n][1] * phi_fract[1];
float in_im = delay[n][0] * phi_fract[1] + delay[n][1] * phi_fract[0];
for (m = 0; m < PS_AP_LINKS; m++) {
float a_re = ag[m] * in_re;
float a_im = ag[m] * in_im;
float link_delay_re = ap_delay[m][n+2-m][0];
float link_delay_im = ap_delay[m][n+2-m][1];
float fractional_delay_re = Q_fract[m][0];
float fractional_delay_im = Q_fract[m][1];
float apd_re = in_re;
float apd_im = in_im;
in_re = link_delay_re * fractional_delay_re -
link_delay_im * fractional_delay_im - a_re;
in_im = link_delay_re * fractional_delay_im +
link_delay_im * fractional_delay_re - a_im;
ap_delay[m][n+5][0] = apd_re + ag[m] * in_re;
ap_delay[m][n+5][1] = apd_im + ag[m] * in_im;
}
out[n][0] = transient_gain[n] * in_re;
out[n][1] = transient_gain[n] * in_im;
}
}
static void ps_stereo_interpolate_c(float (*l)[2], float (*r)[2],
float h[2][4], float h_step[2][4],
int len)
{
float h0 = h[0][0];
float h1 = h[0][1];
float h2 = h[0][2];
float h3 = h[0][3];
float hs0 = h_step[0][0];
float hs1 = h_step[0][1];
float hs2 = h_step[0][2];
float hs3 = h_step[0][3];
int n;
for (n = 0; n < len; n++) {
//l is s, r is d
float l_re = l[n][0];
float l_im = l[n][1];
float r_re = r[n][0];
float r_im = r[n][1];
h0 += hs0;
h1 += hs1;
h2 += hs2;
h3 += hs3;
l[n][0] = h0 * l_re + h2 * r_re;
l[n][1] = h0 * l_im + h2 * r_im;
r[n][0] = h1 * l_re + h3 * r_re;
r[n][1] = h1 * l_im + h3 * r_im;
}
}
static void ps_stereo_interpolate_ipdopd_c(float (*l)[2], float (*r)[2],
float h[2][4], float h_step[2][4],
int len)
{
float h00 = h[0][0], h10 = h[1][0];
float h01 = h[0][1], h11 = h[1][1];
float h02 = h[0][2], h12 = h[1][2];
float h03 = h[0][3], h13 = h[1][3];
float hs00 = h_step[0][0], hs10 = h_step[1][0];
float hs01 = h_step[0][1], hs11 = h_step[1][1];
float hs02 = h_step[0][2], hs12 = h_step[1][2];
float hs03 = h_step[0][3], hs13 = h_step[1][3];
int n;
for (n = 0; n < len; n++) {
//l is s, r is d
float l_re = l[n][0];
float l_im = l[n][1];
float r_re = r[n][0];
float r_im = r[n][1];
h00 += hs00;
h01 += hs01;
h02 += hs02;
h03 += hs03;
h10 += hs10;
h11 += hs11;
h12 += hs12;
h13 += hs13;
l[n][0] = h00 * l_re + h02 * r_re - h10 * l_im - h12 * r_im;
l[n][1] = h00 * l_im + h02 * r_im + h10 * l_re + h12 * r_re;
r[n][0] = h01 * l_re + h03 * r_re - h11 * l_im - h13 * r_im;
r[n][1] = h01 * l_im + h03 * r_im + h11 * l_re + h13 * r_re;
}
}
av_cold void ff_psdsp_init(PSDSPContext *s)
{
s->add_squares = ps_add_squares_c;
s->mul_pair_single = ps_mul_pair_single_c;
s->hybrid_analysis = ps_hybrid_analysis_c;
s->hybrid_analysis_ileave = ps_hybrid_analysis_ileave_c;
s->hybrid_synthesis_deint = ps_hybrid_synthesis_deint_c;
s->decorrelate = ps_decorrelate_c;
s->stereo_interpolate[0] = ps_stereo_interpolate_c;
s->stereo_interpolate[1] = ps_stereo_interpolate_ipdopd_c;
if (ARCH_ARM)
ff_psdsp_init_arm(s);
}

View File

@@ -1,53 +0,0 @@
/*
* Copyright (c) 2012 Mans Rullgard
*
* This file is part of Libav.
*
* Libav is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* Libav is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with Libav; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
#ifndef LIBAVCODEC_AACPSDSP_H
#define LIBAVCODEC_AACPSDSP_H
#define PS_QMF_TIME_SLOTS 32
#define PS_AP_LINKS 3
#define PS_MAX_AP_DELAY 5
typedef struct PSDSPContext {
void (*add_squares)(float *dst, const float (*src)[2], int n);
void (*mul_pair_single)(float (*dst)[2], float (*src0)[2], float *src1,
int n);
void (*hybrid_analysis)(float (*out)[2], float (*in)[2],
const float (*filter)[8][2],
int stride, int n);
void (*hybrid_analysis_ileave)(float (*out)[32][2], float L[2][38][64],
int i, int len);
void (*hybrid_synthesis_deint)(float out[2][38][64], float (*in)[32][2],
int i, int len);
void (*decorrelate)(float (*out)[2], float (*delay)[2],
float (*ap_delay)[PS_QMF_TIME_SLOTS+PS_MAX_AP_DELAY][2],
const float phi_fract[2], float (*Q_fract)[2],
const float *transient_gain,
float g_decay_slope,
int len);
void (*stereo_interpolate[2])(float (*l)[2], float (*r)[2],
float h[2][4], float h_step[2][4],
int len);
} PSDSPContext;
void ff_psdsp_init(PSDSPContext *s);
void ff_psdsp_init_arm(PSDSPContext *s);
#endif /* LIBAVCODEC_AACPSDSP_H */

View File

@@ -389,8 +389,9 @@ static av_unused FFPsyWindowInfo psy_3gpp_window(FFPsyContext *ctx,
AacPsyChannel *pch = &pctx->ch[channel]; AacPsyChannel *pch = &pctx->ch[channel];
uint8_t grouping = 0; uint8_t grouping = 0;
int next_type = pch->next_window_seq; int next_type = pch->next_window_seq;
FFPsyWindowInfo wi = { { 0 } }; FFPsyWindowInfo wi;
memset(&wi, 0, sizeof(wi));
if (la) { if (la) {
float s[8], v; float s[8], v;
int switch_to_eight = 0; int switch_to_eight = 0;
@@ -784,8 +785,9 @@ static FFPsyWindowInfo psy_lame_window(FFPsyContext *ctx, const float *audio,
int uselongblock = 1; int uselongblock = 1;
int attacks[AAC_NUM_BLOCKS_SHORT + 1] = { 0 }; int attacks[AAC_NUM_BLOCKS_SHORT + 1] = { 0 };
int i; int i;
FFPsyWindowInfo wi = { { 0 } }; FFPsyWindowInfo wi;
memset(&wi, 0, sizeof(wi));
if (la) { if (la) {
float hpfsmpl[AAC_BLOCK_SIZE_LONG]; float hpfsmpl[AAC_BLOCK_SIZE_LONG];
float const *pf = hpfsmpl; float const *pf = hpfsmpl;

View File

@@ -32,7 +32,6 @@
#include "aacsbrdata.h" #include "aacsbrdata.h"
#include "fft.h" #include "fft.h"
#include "aacps.h" #include "aacps.h"
#include "sbrdsp.h"
#include "libavutil/libm.h" #include "libavutil/libm.h"
#include "libavutil/avassert.h" #include "libavutil/avassert.h"
@@ -129,24 +128,13 @@ av_cold void ff_aac_sbr_init(void)
ff_ps_init(); ff_ps_init();
} }
/** Places SBR in pure upsampling mode. */
static void sbr_turnoff(SpectralBandReplication *sbr) {
sbr->start = 0;
// Init defults used in pure upsampling mode
sbr->kx[1] = 32; //Typo in spec, kx' inits to 32
sbr->m[1] = 0;
// Reset values for first SBR header
sbr->data[0].e_a[1] = sbr->data[1].e_a[1] = -1;
memset(&sbr->spectrum_params, -1, sizeof(SpectrumParameters));
}
av_cold void ff_aac_sbr_ctx_init(AACContext *ac, SpectralBandReplication *sbr) av_cold void ff_aac_sbr_ctx_init(AACContext *ac, SpectralBandReplication *sbr)
{ {
float mdct_scale; float mdct_scale;
if(sbr->mdct.mdct_bits) if(sbr->mdct.mdct_bits)
return; return;
sbr->kx[0] = sbr->kx[1]; sbr->kx[0] = sbr->kx[1] = 32; //Typo in spec, kx' inits to 32
sbr_turnoff(sbr); sbr->data[0].e_a[1] = sbr->data[1].e_a[1] = -1;
sbr->data[0].synthesis_filterbank_samples_offset = SBR_SYNTHESIS_BUF_SIZE - (1280 - 128); sbr->data[0].synthesis_filterbank_samples_offset = SBR_SYNTHESIS_BUF_SIZE - (1280 - 128);
sbr->data[1].synthesis_filterbank_samples_offset = SBR_SYNTHESIS_BUF_SIZE - (1280 - 128); sbr->data[1].synthesis_filterbank_samples_offset = SBR_SYNTHESIS_BUF_SIZE - (1280 - 128);
/* SBR requires samples to be scaled to +/-32768.0 to work correctly. /* SBR requires samples to be scaled to +/-32768.0 to work correctly.
@@ -156,7 +144,6 @@ av_cold void ff_aac_sbr_ctx_init(AACContext *ac, SpectralBandReplication *sbr)
ff_mdct_init(&sbr->mdct, 7, 1, 1.0 / (64 * mdct_scale)); ff_mdct_init(&sbr->mdct, 7, 1, 1.0 / (64 * mdct_scale));
ff_mdct_init(&sbr->mdct_ana, 7, 1, -2.0 * mdct_scale); ff_mdct_init(&sbr->mdct_ana, 7, 1, -2.0 * mdct_scale);
ff_ps_ctx_init(&sbr->ps); ff_ps_ctx_init(&sbr->ps);
ff_sbrdsp_init(&sbr->dsp);
} }
av_cold void ff_aac_sbr_ctx_close(SpectralBandReplication *sbr) av_cold void ff_aac_sbr_ctx_close(SpectralBandReplication *sbr)
@@ -555,7 +542,7 @@ static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr)
k = sbr->n_master; k = sbr->n_master;
} while (sb != sbr->kx[1] + sbr->m[1]); } while (sb != sbr->kx[1] + sbr->m[1]);
if (sbr->patch_num_subbands[sbr->num_patches-1] < 3 && sbr->num_patches > 1) if (sbr->num_patches > 1 && sbr->patch_num_subbands[sbr->num_patches-1] < 3)
sbr->num_patches--; sbr->num_patches--;
return 0; return 0;
@@ -918,7 +905,7 @@ static void read_sbr_extension(AACContext *ac, SpectralBandReplication *sbr,
{ {
switch (bs_extension_id) { switch (bs_extension_id) {
case EXTENSION_ID_PS: case EXTENSION_ID_PS:
if (!ac->oc[1].m4ac.ps) { if (!ac->m4ac.ps) {
av_log(ac->avctx, AV_LOG_ERROR, "Parametric Stereo signaled to be not-present but was found in the bitstream.\n"); av_log(ac->avctx, AV_LOG_ERROR, "Parametric Stereo signaled to be not-present but was found in the bitstream.\n");
skip_bits_long(gb, *num_bits_left); // bs_fill_bits skip_bits_long(gb, *num_bits_left); // bs_fill_bits
*num_bits_left = 0; *num_bits_left = 0;
@@ -933,8 +920,6 @@ static void read_sbr_extension(AACContext *ac, SpectralBandReplication *sbr,
} }
break; break;
default: default:
// some files contain 0-padding
if (bs_extension_id || *num_bits_left > 16 || show_bits(gb, *num_bits_left))
av_log_missing_feature(ac->avctx, "Reserved SBR extensions are", 1); av_log_missing_feature(ac->avctx, "Reserved SBR extensions are", 1);
skip_bits_long(gb, *num_bits_left); // bs_fill_bits skip_bits_long(gb, *num_bits_left); // bs_fill_bits
*num_bits_left = 0; *num_bits_left = 0;
@@ -1011,18 +996,18 @@ static unsigned int read_sbr_data(AACContext *ac, SpectralBandReplication *sbr,
if (id_aac == TYPE_SCE || id_aac == TYPE_CCE) { if (id_aac == TYPE_SCE || id_aac == TYPE_CCE) {
if (read_sbr_single_channel_element(ac, sbr, gb)) { if (read_sbr_single_channel_element(ac, sbr, gb)) {
sbr_turnoff(sbr); sbr->start = 0;
return get_bits_count(gb) - cnt; return get_bits_count(gb) - cnt;
} }
} else if (id_aac == TYPE_CPE) { } else if (id_aac == TYPE_CPE) {
if (read_sbr_channel_pair_element(ac, sbr, gb)) { if (read_sbr_channel_pair_element(ac, sbr, gb)) {
sbr_turnoff(sbr); sbr->start = 0;
return get_bits_count(gb) - cnt; return get_bits_count(gb) - cnt;
} }
} else { } else {
av_log(ac->avctx, AV_LOG_ERROR, av_log(ac->avctx, AV_LOG_ERROR,
"Invalid bitstream - cannot apply SBR to element type %d\n", id_aac); "Invalid bitstream - cannot apply SBR to element type %d\n", id_aac);
sbr_turnoff(sbr); sbr->start = 0;
return get_bits_count(gb) - cnt; return get_bits_count(gb) - cnt;
} }
if (get_bits1(gb)) { // bs_extended_data if (get_bits1(gb)) { // bs_extended_data
@@ -1054,7 +1039,7 @@ static void sbr_reset(AACContext *ac, SpectralBandReplication *sbr)
if (err < 0) { if (err < 0) {
av_log(ac->avctx, AV_LOG_ERROR, av_log(ac->avctx, AV_LOG_ERROR,
"SBR reset failed. Switching SBR to pure upsampling mode.\n"); "SBR reset failed. Switching SBR to pure upsampling mode.\n");
sbr_turnoff(sbr); sbr->start = 0;
} }
} }
@@ -1077,9 +1062,9 @@ int ff_decode_sbr_extension(AACContext *ac, SpectralBandReplication *sbr,
sbr->reset = 0; sbr->reset = 0;
if (!sbr->sample_rate) if (!sbr->sample_rate)
sbr->sample_rate = 2 * ac->oc[1].m4ac.sample_rate; //TODO use the nominal sample rate for arbitrary sample rate support sbr->sample_rate = 2 * ac->m4ac.sample_rate; //TODO use the nominal sample rate for arbitrary sample rate support
if (!ac->oc[1].m4ac.ext_sample_rate) if (!ac->m4ac.ext_sample_rate)
ac->oc[1].m4ac.ext_sample_rate = 2 * ac->oc[1].m4ac.sample_rate; ac->m4ac.ext_sample_rate = 2 * ac->m4ac.sample_rate;
if (crc) { if (crc) {
skip_bits(gb, 10); // bs_sbr_crc_bits; TODO - implement CRC check skip_bits(gb, 10); // bs_sbr_crc_bits; TODO - implement CRC check
@@ -1089,7 +1074,6 @@ int ff_decode_sbr_extension(AACContext *ac, SpectralBandReplication *sbr,
//Save some state from the previous frame. //Save some state from the previous frame.
sbr->kx[0] = sbr->kx[1]; sbr->kx[0] = sbr->kx[1];
sbr->m[0] = sbr->m[1]; sbr->m[0] = sbr->m[1];
sbr->kx_and_m_pushed = 1;
num_sbr_bits++; num_sbr_bits++;
if (get_bits1(gb)) // bs_header_flag if (get_bits1(gb)) // bs_header_flag
@@ -1124,12 +1108,7 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
for (k = 0; k < sbr->n[sbr->data[0].bs_freq_res[e]]; k++) { for (k = 0; k < sbr->n[sbr->data[0].bs_freq_res[e]]; k++) {
float temp1 = exp2f(sbr->data[0].env_facs[e][k] * alpha + 7.0f); float temp1 = exp2f(sbr->data[0].env_facs[e][k] * alpha + 7.0f);
float temp2 = exp2f((pan_offset - sbr->data[1].env_facs[e][k]) * alpha); float temp2 = exp2f((pan_offset - sbr->data[1].env_facs[e][k]) * alpha);
float fac; float fac = temp1 / (1.0f + temp2);
if (temp1 > 1E20) {
av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n");
temp1 = 1;
}
fac = temp1 / (1.0f + temp2);
sbr->data[0].env_facs[e][k] = fac; sbr->data[0].env_facs[e][k] = fac;
sbr->data[1].env_facs[e][k] = fac * temp2; sbr->data[1].env_facs[e][k] = fac * temp2;
} }
@@ -1138,12 +1117,7 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
for (k = 0; k < sbr->n_q; k++) { for (k = 0; k < sbr->n_q; k++) {
float temp1 = exp2f(NOISE_FLOOR_OFFSET - sbr->data[0].noise_facs[e][k] + 1); float temp1 = exp2f(NOISE_FLOOR_OFFSET - sbr->data[0].noise_facs[e][k] + 1);
float temp2 = exp2f(12 - sbr->data[1].noise_facs[e][k]); float temp2 = exp2f(12 - sbr->data[1].noise_facs[e][k]);
float fac; float fac = temp1 / (1.0f + temp2);
if (temp1 > 1E20) {
av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n");
temp1 = 1;
}
fac = temp1 / (1.0f + temp2);
sbr->data[0].noise_facs[e][k] = fac; sbr->data[0].noise_facs[e][k] = fac;
sbr->data[1].noise_facs[e][k] = fac * temp2; sbr->data[1].noise_facs[e][k] = fac * temp2;
} }
@@ -1152,15 +1126,9 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
for (ch = 0; ch < (id_aac == TYPE_CPE) + 1; ch++) { for (ch = 0; ch < (id_aac == TYPE_CPE) + 1; ch++) {
float alpha = sbr->data[ch].bs_amp_res ? 1.0f : 0.5f; float alpha = sbr->data[ch].bs_amp_res ? 1.0f : 0.5f;
for (e = 1; e <= sbr->data[ch].bs_num_env; e++) for (e = 1; e <= sbr->data[ch].bs_num_env; e++)
for (k = 0; k < sbr->n[sbr->data[ch].bs_freq_res[e]]; k++){ for (k = 0; k < sbr->n[sbr->data[ch].bs_freq_res[e]]; k++)
sbr->data[ch].env_facs[e][k] = sbr->data[ch].env_facs[e][k] =
exp2f(alpha * sbr->data[ch].env_facs[e][k] + 6.0f); exp2f(alpha * sbr->data[ch].env_facs[e][k] + 6.0f);
if (sbr->data[ch].env_facs[e][k] > 1E20) {
av_log(NULL, AV_LOG_ERROR, "envelope scalefactor overflow in dequant\n");
sbr->data[ch].env_facs[e][k] = 1;
}
}
for (e = 1; e <= sbr->data[ch].bs_num_noise; e++) for (e = 1; e <= sbr->data[ch].bs_num_noise; e++)
for (k = 0; k < sbr->n_q; k++) for (k = 0; k < sbr->n_q; k++)
sbr->data[ch].noise_facs[e][k] = sbr->data[ch].noise_facs[e][k] =
@@ -1175,21 +1143,33 @@ static void sbr_dequant(SpectralBandReplication *sbr, int id_aac)
* @param x pointer to the beginning of the first sample window * @param x pointer to the beginning of the first sample window
* @param W array of complex-valued samples split into subbands * @param W array of complex-valued samples split into subbands
*/ */
static void sbr_qmf_analysis(DSPContext *dsp, FFTContext *mdct, static void sbr_qmf_analysis(DSPContext *dsp, FFTContext *mdct, const float *in, float *x,
SBRDSPContext *sbrdsp, const float *in, float *x,
float z[320], float W[2][32][32][2]) float z[320], float W[2][32][32][2])
{ {
int i; int i, k;
memcpy(W[0], W[1], sizeof(W[0])); memcpy(W[0], W[1], sizeof(W[0]));
memcpy(x , x+1024, (320-32)*sizeof(x[0])); memcpy(x , x+1024, (320-32)*sizeof(x[0]));
memcpy(x+288, in, 1024*sizeof(x[0])); memcpy(x+288, in, 1024*sizeof(x[0]));
for (i = 0; i < 32; i++) { // numTimeSlots*RATE = 16*2 as 960 sample frames for (i = 0; i < 32; i++) { // numTimeSlots*RATE = 16*2 as 960 sample frames
// are not supported // are not supported
dsp->vector_fmul_reverse(z, sbr_qmf_window_ds, x, 320); dsp->vector_fmul_reverse(z, sbr_qmf_window_ds, x, 320);
sbrdsp->sum64x5(z); for (k = 0; k < 64; k++) {
sbrdsp->qmf_pre_shuffle(z); float f = z[k] + z[k + 64] + z[k + 128] + z[k + 192] + z[k + 256];
z[k] = f;
}
//Shuffle to IMDCT
z[64] = z[0];
for (k = 1; k < 32; k++) {
z[64+2*k-1] = z[ k];
z[64+2*k ] = -z[64-k];
}
z[64+63] = z[32];
mdct->imdct_half(mdct, z, z+64); mdct->imdct_half(mdct, z, z+64);
sbrdsp->qmf_post_shuffle(W[1][i], z); for (k = 0; k < 32; k++) {
W[1][i][k][0] = -z[63-k];
W[1][i][k][1] = z[k];
}
x += 32; x += 32;
} }
} }
@@ -1199,7 +1179,6 @@ static void sbr_qmf_analysis(DSPContext *dsp, FFTContext *mdct,
* (14496-3 sp04 p206) * (14496-3 sp04 p206)
*/ */
static void sbr_qmf_synthesis(DSPContext *dsp, FFTContext *mdct, static void sbr_qmf_synthesis(DSPContext *dsp, FFTContext *mdct,
SBRDSPContext *sbrdsp,
float *out, float X[2][38][64], float *out, float X[2][38][64],
float mdct_buf[2][64], float mdct_buf[2][64],
float *v0, int *v_off, const unsigned int div) float *v0, int *v_off, const unsigned int div)
@@ -1223,12 +1202,20 @@ static void sbr_qmf_synthesis(DSPContext *dsp, FFTContext *mdct,
X[0][i][32+n] = X[1][i][31-n]; X[0][i][32+n] = X[1][i][31-n];
} }
mdct->imdct_half(mdct, mdct_buf[0], X[0][i]); mdct->imdct_half(mdct, mdct_buf[0], X[0][i]);
sbrdsp->qmf_deint_neg(v, mdct_buf[0]); for (n = 0; n < 32; n++) {
v[ n] = mdct_buf[0][63 - 2*n];
v[63 - n] = -mdct_buf[0][62 - 2*n];
}
} else { } else {
sbrdsp->neg_odd_64(X[1][i]); for (n = 1; n < 64; n+=2) {
X[1][i][n] = -X[1][i][n];
}
mdct->imdct_half(mdct, mdct_buf[0], X[0][i]); mdct->imdct_half(mdct, mdct_buf[0], X[0][i]);
mdct->imdct_half(mdct, mdct_buf[1], X[1][i]); mdct->imdct_half(mdct, mdct_buf[1], X[1][i]);
sbrdsp->qmf_deint_bfly(v, mdct_buf[1], mdct_buf[0]); for (n = 0; n < 64; n++) {
v[ n] = -mdct_buf[0][63 - n] + mdct_buf[1][ n ];
v[127 - n] = mdct_buf[0][63 - n] + mdct_buf[1][ n ];
}
} }
dsp->vector_fmul_add(out, v , sbr_qmf_window , zero64, 64 >> div); dsp->vector_fmul_add(out, v , sbr_qmf_window , zero64, 64 >> div);
dsp->vector_fmul_add(out, v + ( 192 >> div), sbr_qmf_window + ( 64 >> div), out , 64 >> div); dsp->vector_fmul_add(out, v + ( 192 >> div), sbr_qmf_window + ( 64 >> div), out , 64 >> div);
@@ -1244,20 +1231,45 @@ static void sbr_qmf_synthesis(DSPContext *dsp, FFTContext *mdct,
} }
} }
static void autocorrelate(const float x[40][2], float phi[3][2][2], int lag)
{
int i;
float real_sum = 0.0f;
float imag_sum = 0.0f;
if (lag) {
for (i = 1; i < 38; i++) {
real_sum += x[i][0] * x[i+lag][0] + x[i][1] * x[i+lag][1];
imag_sum += x[i][0] * x[i+lag][1] - x[i][1] * x[i+lag][0];
}
phi[2-lag][1][0] = real_sum + x[ 0][0] * x[lag][0] + x[ 0][1] * x[lag][1];
phi[2-lag][1][1] = imag_sum + x[ 0][0] * x[lag][1] - x[ 0][1] * x[lag][0];
if (lag == 1) {
phi[0][0][0] = real_sum + x[38][0] * x[39][0] + x[38][1] * x[39][1];
phi[0][0][1] = imag_sum + x[38][0] * x[39][1] - x[38][1] * x[39][0];
}
} else {
for (i = 1; i < 38; i++) {
real_sum += x[i][0] * x[i][0] + x[i][1] * x[i][1];
}
phi[2][1][0] = real_sum + x[ 0][0] * x[ 0][0] + x[ 0][1] * x[ 0][1];
phi[1][0][0] = real_sum + x[38][0] * x[38][0] + x[38][1] * x[38][1];
}
}
/** High Frequency Generation (14496-3 sp04 p214+) and Inverse Filtering /** High Frequency Generation (14496-3 sp04 p214+) and Inverse Filtering
* (14496-3 sp04 p214) * (14496-3 sp04 p214)
* Warning: This routine does not seem numerically stable. * Warning: This routine does not seem numerically stable.
*/ */
static void sbr_hf_inverse_filter(SBRDSPContext *dsp, static void sbr_hf_inverse_filter(float (*alpha0)[2], float (*alpha1)[2],
float (*alpha0)[2], float (*alpha1)[2],
const float X_low[32][40][2], int k0) const float X_low[32][40][2], int k0)
{ {
int k; int k;
for (k = 0; k < k0; k++) { for (k = 0; k < k0; k++) {
LOCAL_ALIGNED_16(float, phi, [3], [2][2]); float phi[3][2][2], dk;
float dk;
dsp->autocorrelate(X_low[k], phi); autocorrelate(X_low[k], phi, 0);
autocorrelate(X_low[k], phi, 1);
autocorrelate(X_low[k], phi, 2);
dk = phi[2][1][0] * phi[1][0][0] - dk = phi[2][1][0] * phi[1][0][0] -
(phi[1][1][0] * phi[1][1][0] + phi[1][1][1] * phi[1][1][1]) / 1.000001f; (phi[1][1][0] * phi[1][1][0] + phi[1][1][1] * phi[1][1][1]) / 1.000001f;
@@ -1353,11 +1365,12 @@ static int sbr_hf_gen(AACContext *ac, SpectralBandReplication *sbr,
const float bw_array[5], const uint8_t *t_env, const float bw_array[5], const uint8_t *t_env,
int bs_num_env) int bs_num_env)
{ {
int j, x; int i, j, x;
int g = 0; int g = 0;
int k = sbr->kx[1]; int k = sbr->kx[1];
for (j = 0; j < sbr->num_patches; j++) { for (j = 0; j < sbr->num_patches; j++) {
for (x = 0; x < sbr->patch_num_subbands[j]; x++, k++) { for (x = 0; x < sbr->patch_num_subbands[j]; x++, k++) {
float alpha[4];
const int p = sbr->patch_start_subband[j] + x; const int p = sbr->patch_start_subband[j] + x;
while (g <= sbr->n_q && k >= sbr->f_tablenoise[g]) while (g <= sbr->n_q && k >= sbr->f_tablenoise[g])
g++; g++;
@@ -1369,10 +1382,26 @@ static int sbr_hf_gen(AACContext *ac, SpectralBandReplication *sbr,
return -1; return -1;
} }
sbr->dsp.hf_gen(X_high[k] + ENVELOPE_ADJUSTMENT_OFFSET, alpha[0] = alpha1[p][0] * bw_array[g] * bw_array[g];
X_low[p] + ENVELOPE_ADJUSTMENT_OFFSET, alpha[1] = alpha1[p][1] * bw_array[g] * bw_array[g];
alpha0[p], alpha1[p], bw_array[g], alpha[2] = alpha0[p][0] * bw_array[g];
2 * t_env[0], 2 * t_env[bs_num_env]); alpha[3] = alpha0[p][1] * bw_array[g];
for (i = 2 * t_env[0]; i < 2 * t_env[bs_num_env]; i++) {
const int idx = i + ENVELOPE_ADJUSTMENT_OFFSET;
X_high[k][idx][0] =
X_low[p][idx - 2][0] * alpha[0] -
X_low[p][idx - 2][1] * alpha[1] +
X_low[p][idx - 1][0] * alpha[2] -
X_low[p][idx - 1][1] * alpha[3] +
X_low[p][idx][0];
X_high[k][idx][1] =
X_low[p][idx - 2][1] * alpha[0] +
X_low[p][idx - 2][0] * alpha[1] +
X_low[p][idx - 1][1] * alpha[2] +
X_low[p][idx - 1][0] * alpha[3] +
X_low[p][idx][1];
}
} }
} }
if (k < sbr->m[1] + sbr->kx[1]) if (k < sbr->m[1] + sbr->kx[1])
@@ -1383,8 +1412,8 @@ static int sbr_hf_gen(AACContext *ac, SpectralBandReplication *sbr,
/// Generate the subband filtered lowband /// Generate the subband filtered lowband
static int sbr_x_gen(SpectralBandReplication *sbr, float X[2][38][64], static int sbr_x_gen(SpectralBandReplication *sbr, float X[2][38][64],
const float Y0[38][64][2], const float Y1[38][64][2], const float X_low[32][40][2], const float Y[2][38][64][2],
const float X_low[32][40][2], int ch) int ch)
{ {
int k, i; int k, i;
const int i_f = 32; const int i_f = 32;
@@ -1398,8 +1427,8 @@ static int sbr_x_gen(SpectralBandReplication *sbr, float X[2][38][64],
} }
for (; k < sbr->kx[0] + sbr->m[0]; k++) { for (; k < sbr->kx[0] + sbr->m[0]; k++) {
for (i = 0; i < i_Temp; i++) { for (i = 0; i < i_Temp; i++) {
X[0][i][k] = Y0[i + i_f][k][0]; X[0][i][k] = Y[0][i + i_f][k][0];
X[1][i][k] = Y0[i + i_f][k][1]; X[1][i][k] = Y[0][i + i_f][k][1];
} }
} }
@@ -1411,8 +1440,8 @@ static int sbr_x_gen(SpectralBandReplication *sbr, float X[2][38][64],
} }
for (; k < sbr->kx[1] + sbr->m[1]; k++) { for (; k < sbr->kx[1] + sbr->m[1]; k++) {
for (i = i_Temp; i < i_f; i++) { for (i = i_Temp; i < i_f; i++) {
X[0][i][k] = Y1[i][k][0]; X[0][i][k] = Y[1][i][k][0];
X[1][i][k] = Y1[i][k][1]; X[1][i][k] = Y[1][i][k][1];
} }
} }
return 0; return 0;
@@ -1421,7 +1450,7 @@ static int sbr_x_gen(SpectralBandReplication *sbr, float X[2][38][64],
/** High Frequency Adjustment (14496-3 sp04 p217) and Mapping /** High Frequency Adjustment (14496-3 sp04 p217) and Mapping
* (14496-3 sp04 p217) * (14496-3 sp04 p217)
*/ */
static int sbr_mapping(AACContext *ac, SpectralBandReplication *sbr, static void sbr_mapping(AACContext *ac, SpectralBandReplication *sbr,
SBRData *ch_data, int e_a[2]) SBRData *ch_data, int e_a[2])
{ {
int e, i, m; int e, i, m;
@@ -1432,12 +1461,7 @@ static int sbr_mapping(AACContext *ac, SpectralBandReplication *sbr,
uint16_t *table = ch_data->bs_freq_res[e + 1] ? sbr->f_tablehigh : sbr->f_tablelow; uint16_t *table = ch_data->bs_freq_res[e + 1] ? sbr->f_tablehigh : sbr->f_tablelow;
int k; int k;
if (sbr->kx[1] != table[0]) { av_assert0(sbr->kx[1] <= table[0]);
av_log(ac->avctx, AV_LOG_ERROR, "kx != f_table{high,low}[0]. "
"Derived frequency tables were not regenerated.\n");
sbr_turnoff(sbr);
return AVERROR_BUG;
}
for (i = 0; i < ilim; i++) for (i = 0; i < ilim; i++)
for (m = table[i]; m < table[i + 1]; m++) for (m = table[i]; m < table[i + 1]; m++)
sbr->e_origmapped[e][m - sbr->kx[1]] = ch_data->env_facs[e+1][i]; sbr->e_origmapped[e][m - sbr->kx[1]] = ch_data->env_facs[e+1][i];
@@ -1472,15 +1496,13 @@ static int sbr_mapping(AACContext *ac, SpectralBandReplication *sbr,
} }
memcpy(ch_data->s_indexmapped[0], ch_data->s_indexmapped[ch_data->bs_num_env], sizeof(ch_data->s_indexmapped[0])); memcpy(ch_data->s_indexmapped[0], ch_data->s_indexmapped[ch_data->bs_num_env], sizeof(ch_data->s_indexmapped[0]));
return 0;
} }
/// Estimation of current envelope (14496-3 sp04 p218) /// Estimation of current envelope (14496-3 sp04 p218)
static void sbr_env_estimate(float (*e_curr)[48], float X_high[64][40][2], static void sbr_env_estimate(float (*e_curr)[48], float X_high[64][40][2],
SpectralBandReplication *sbr, SBRData *ch_data) SpectralBandReplication *sbr, SBRData *ch_data)
{ {
int e, m; int e, i, m;
int kx1 = sbr->kx[1];
if (sbr->bs_interpol_freq) { if (sbr->bs_interpol_freq) {
for (e = 0; e < ch_data->bs_num_env; e++) { for (e = 0; e < ch_data->bs_num_env; e++) {
@@ -1489,7 +1511,12 @@ static void sbr_env_estimate(float (*e_curr)[48], float X_high[64][40][2],
int iub = ch_data->t_env[e + 1] * 2 + ENVELOPE_ADJUSTMENT_OFFSET; int iub = ch_data->t_env[e + 1] * 2 + ENVELOPE_ADJUSTMENT_OFFSET;
for (m = 0; m < sbr->m[1]; m++) { for (m = 0; m < sbr->m[1]; m++) {
float sum = sbr->dsp.sum_square(X_high[m+kx1] + ilb, iub - ilb); float sum = 0.0f;
for (i = ilb; i < iub; i++) {
sum += X_high[m + sbr->kx[1]][i][0] * X_high[m + sbr->kx[1]][i][0] +
X_high[m + sbr->kx[1]][i][1] * X_high[m + sbr->kx[1]][i][1];
}
e_curr[e][m] = sum * recip_env_size; e_curr[e][m] = sum * recip_env_size;
} }
} }
@@ -1507,11 +1534,14 @@ static void sbr_env_estimate(float (*e_curr)[48], float X_high[64][40][2],
const int den = env_size * (table[p + 1] - table[p]); const int den = env_size * (table[p + 1] - table[p]);
for (k = table[p]; k < table[p + 1]; k++) { for (k = table[p]; k < table[p + 1]; k++) {
sum += sbr->dsp.sum_square(X_high[k] + ilb, iub - ilb); for (i = ilb; i < iub; i++) {
sum += X_high[k][i][0] * X_high[k][i][0] +
X_high[k][i][1] * X_high[k][i][1];
}
} }
sum /= den; sum /= den;
for (k = table[p]; k < table[p + 1]; k++) { for (k = table[p]; k < table[p + 1]; k++) {
e_curr[e][k - kx1] = sum; e_curr[e][k - sbr->kx[1]] = sum;
} }
} }
} }
@@ -1578,8 +1608,7 @@ static void sbr_gain_calc(AACContext *ac, SpectralBandReplication *sbr,
} }
/// Assembling HF Signals (14496-3 sp04 p220) /// Assembling HF Signals (14496-3 sp04 p220)
static void sbr_hf_assemble(float Y1[38][64][2], static void sbr_hf_assemble(float Y[2][38][64][2], const float X_high[64][40][2],
const float X_high[64][40][2],
SpectralBandReplication *sbr, SBRData *ch_data, SpectralBandReplication *sbr, SBRData *ch_data,
const int e_a[2]) const int e_a[2])
{ {
@@ -1601,6 +1630,7 @@ static void sbr_hf_assemble(float Y1[38][64][2],
float (*g_temp)[48] = ch_data->g_temp, (*q_temp)[48] = ch_data->q_temp; float (*g_temp)[48] = ch_data->g_temp, (*q_temp)[48] = ch_data->q_temp;
int indexnoise = ch_data->f_indexnoise; int indexnoise = ch_data->f_indexnoise;
int indexsine = ch_data->f_indexsine; int indexsine = ch_data->f_indexsine;
memcpy(Y[0], Y[1], sizeof(Y[0]));
if (sbr->reset) { if (sbr->reset) {
for (i = 0; i < h_SL; i++) { for (i = 0; i < h_SL; i++) {
@@ -1622,44 +1652,63 @@ static void sbr_hf_assemble(float Y1[38][64][2],
for (e = 0; e < ch_data->bs_num_env; e++) { for (e = 0; e < ch_data->bs_num_env; e++) {
for (i = 2 * ch_data->t_env[e]; i < 2 * ch_data->t_env[e + 1]; i++) { for (i = 2 * ch_data->t_env[e]; i < 2 * ch_data->t_env[e + 1]; i++) {
int phi_sign = (1 - 2*(kx & 1)); int phi_sign = (1 - 2*(kx & 1));
LOCAL_ALIGNED_16(float, g_filt_tab, [48]);
LOCAL_ALIGNED_16(float, q_filt_tab, [48]);
float *g_filt, *q_filt;
if (h_SL && e != e_a[0] && e != e_a[1]) { if (h_SL && e != e_a[0] && e != e_a[1]) {
g_filt = g_filt_tab;
q_filt = q_filt_tab;
for (m = 0; m < m_max; m++) { for (m = 0; m < m_max; m++) {
const int idx1 = i + h_SL; const int idx1 = i + h_SL;
g_filt[m] = 0.0f; float g_filt = 0.0f;
q_filt[m] = 0.0f; for (j = 0; j <= h_SL; j++)
for (j = 0; j <= h_SL; j++) { g_filt += g_temp[idx1 - j][m] * h_smooth[j];
g_filt[m] += g_temp[idx1 - j][m] * h_smooth[j]; Y[1][i][m + kx][0] =
q_filt[m] += q_temp[idx1 - j][m] * h_smooth[j]; X_high[m + kx][i + ENVELOPE_ADJUSTMENT_OFFSET][0] * g_filt;
Y[1][i][m + kx][1] =
X_high[m + kx][i + ENVELOPE_ADJUSTMENT_OFFSET][1] * g_filt;
} }
}
} else {
g_filt = g_temp[i + h_SL];
q_filt = q_temp[i];
}
sbr->dsp.hf_g_filt(Y1[i] + kx, X_high + kx, g_filt, m_max,
i + ENVELOPE_ADJUSTMENT_OFFSET);
if (e != e_a[0] && e != e_a[1]) {
sbr->dsp.hf_apply_noise[indexsine](Y1[i] + kx, sbr->s_m[e],
q_filt, indexnoise,
kx, m_max);
} else { } else {
for (m = 0; m < m_max; m++) { for (m = 0; m < m_max; m++) {
Y1[i][m + kx][0] += const float g_filt = g_temp[i + h_SL][m];
Y[1][i][m + kx][0] =
X_high[m + kx][i + ENVELOPE_ADJUSTMENT_OFFSET][0] * g_filt;
Y[1][i][m + kx][1] =
X_high[m + kx][i + ENVELOPE_ADJUSTMENT_OFFSET][1] * g_filt;
}
}
if (e != e_a[0] && e != e_a[1]) {
for (m = 0; m < m_max; m++) {
indexnoise = (indexnoise + 1) & 0x1ff;
if (sbr->s_m[e][m]) {
Y[1][i][m + kx][0] +=
sbr->s_m[e][m] * phi[0][indexsine]; sbr->s_m[e][m] * phi[0][indexsine];
Y1[i][m + kx][1] += Y[1][i][m + kx][1] +=
sbr->s_m[e][m] * (phi[1][indexsine] * phi_sign);
} else {
float q_filt;
if (h_SL) {
const int idx1 = i + h_SL;
q_filt = 0.0f;
for (j = 0; j <= h_SL; j++)
q_filt += q_temp[idx1 - j][m] * h_smooth[j];
} else {
q_filt = q_temp[i][m];
}
Y[1][i][m + kx][0] +=
q_filt * sbr_noise_table[indexnoise][0];
Y[1][i][m + kx][1] +=
q_filt * sbr_noise_table[indexnoise][1];
}
phi_sign = -phi_sign;
}
} else {
indexnoise = (indexnoise + m_max) & 0x1ff;
for (m = 0; m < m_max; m++) {
Y[1][i][m + kx][0] +=
sbr->s_m[e][m] * phi[0][indexsine];
Y[1][i][m + kx][1] +=
sbr->s_m[e][m] * (phi[1][indexsine] * phi_sign); sbr->s_m[e][m] * (phi[1][indexsine] * phi_sign);
phi_sign = -phi_sign; phi_sign = -phi_sign;
} }
} }
indexnoise = (indexnoise + m_max) & 0x1ff;
indexsine = (indexsine + 1) & 3; indexsine = (indexsine + 1) & 3;
} }
} }
@@ -1670,54 +1719,39 @@ static void sbr_hf_assemble(float Y1[38][64][2],
void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac, void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac,
float* L, float* R) float* L, float* R)
{ {
int downsampled = ac->oc[1].m4ac.ext_sample_rate < sbr->sample_rate; int downsampled = ac->m4ac.ext_sample_rate < sbr->sample_rate;
int ch; int ch;
int nch = (id_aac == TYPE_CPE) ? 2 : 1; int nch = (id_aac == TYPE_CPE) ? 2 : 1;
int err;
if (!sbr->kx_and_m_pushed) {
sbr->kx[0] = sbr->kx[1];
sbr->m[0] = sbr->m[1];
} else {
sbr->kx_and_m_pushed = 0;
}
if (sbr->start) { if (sbr->start) {
sbr_dequant(sbr, id_aac); sbr_dequant(sbr, id_aac);
} }
for (ch = 0; ch < nch; ch++) { for (ch = 0; ch < nch; ch++) {
/* decode channel */ /* decode channel */
sbr_qmf_analysis(&ac->dsp, &sbr->mdct_ana, &sbr->dsp, ch ? R : L, sbr->data[ch].analysis_filterbank_samples, sbr_qmf_analysis(&ac->dsp, &sbr->mdct_ana, ch ? R : L, sbr->data[ch].analysis_filterbank_samples,
(float*)sbr->qmf_filter_scratch, (float*)sbr->qmf_filter_scratch,
sbr->data[ch].W); sbr->data[ch].W);
sbr_lf_gen(ac, sbr, sbr->X_low, sbr->data[ch].W); sbr_lf_gen(ac, sbr, sbr->X_low, sbr->data[ch].W);
sbr->data[ch].Ypos ^= 1;
if (sbr->start) { if (sbr->start) {
sbr_hf_inverse_filter(&sbr->dsp, sbr->alpha0, sbr->alpha1, sbr->X_low, sbr->k[0]); sbr_hf_inverse_filter(sbr->alpha0, sbr->alpha1, sbr->X_low, sbr->k[0]);
sbr_chirp(sbr, &sbr->data[ch]); sbr_chirp(sbr, &sbr->data[ch]);
sbr_hf_gen(ac, sbr, sbr->X_high, sbr->X_low, sbr->alpha0, sbr->alpha1, sbr_hf_gen(ac, sbr, sbr->X_high, sbr->X_low, sbr->alpha0, sbr->alpha1,
sbr->data[ch].bw_array, sbr->data[ch].t_env, sbr->data[ch].bw_array, sbr->data[ch].t_env,
sbr->data[ch].bs_num_env); sbr->data[ch].bs_num_env);
// hf_adj // hf_adj
err = sbr_mapping(ac, sbr, &sbr->data[ch], sbr->data[ch].e_a); sbr_mapping(ac, sbr, &sbr->data[ch], sbr->data[ch].e_a);
if (!err) {
sbr_env_estimate(sbr->e_curr, sbr->X_high, sbr, &sbr->data[ch]); sbr_env_estimate(sbr->e_curr, sbr->X_high, sbr, &sbr->data[ch]);
sbr_gain_calc(ac, sbr, &sbr->data[ch], sbr->data[ch].e_a); sbr_gain_calc(ac, sbr, &sbr->data[ch], sbr->data[ch].e_a);
sbr_hf_assemble(sbr->data[ch].Y[sbr->data[ch].Ypos], sbr_hf_assemble(sbr->data[ch].Y, sbr->X_high, sbr, &sbr->data[ch],
sbr->X_high, sbr, &sbr->data[ch],
sbr->data[ch].e_a); sbr->data[ch].e_a);
} }
}
/* synthesis */ /* synthesis */
sbr_x_gen(sbr, sbr->X[ch], sbr_x_gen(sbr, sbr->X[ch], sbr->X_low, sbr->data[ch].Y, ch);
sbr->data[ch].Y[1-sbr->data[ch].Ypos],
sbr->data[ch].Y[ sbr->data[ch].Ypos],
sbr->X_low, ch);
} }
if (ac->oc[1].m4ac.ps == 1) { if (ac->m4ac.ps == 1) {
if (sbr->ps.start) { if (sbr->ps.start) {
ff_ps_apply(ac->avctx, &sbr->ps, sbr->X[0], sbr->X[1], sbr->kx[1] + sbr->m[1]); ff_ps_apply(ac->avctx, &sbr->ps, sbr->X[0], sbr->X[1], sbr->kx[1] + sbr->m[1]);
} else { } else {
@@ -1726,12 +1760,12 @@ void ff_sbr_apply(AACContext *ac, SpectralBandReplication *sbr, int id_aac,
nch = 2; nch = 2;
} }
sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, &sbr->dsp, L, sbr->X[0], sbr->qmf_filter_scratch, sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, L, sbr->X[0], sbr->qmf_filter_scratch,
sbr->data[0].synthesis_filterbank_samples, sbr->data[0].synthesis_filterbank_samples,
&sbr->data[0].synthesis_filterbank_samples_offset, &sbr->data[0].synthesis_filterbank_samples_offset,
downsampled); downsampled);
if (nch == 2) if (nch == 2)
sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, &sbr->dsp, R, sbr->X[1], sbr->qmf_filter_scratch, sbr_qmf_synthesis(&ac->dsp, &sbr->mdct, R, sbr->X[1], sbr->qmf_filter_scratch,
sbr->data[1].synthesis_filterbank_samples, sbr->data[1].synthesis_filterbank_samples,
&sbr->data[1].synthesis_filterbank_samples_offset, &sbr->data[1].synthesis_filterbank_samples_offset,
downsampled); downsampled);

View File

@@ -267,8 +267,8 @@ static const int8_t sbr_offset[6][16] = {
}; };
///< window coefficients for analysis/synthesis QMF banks ///< window coefficients for analysis/synthesis QMF banks
static DECLARE_ALIGNED(32, float, sbr_qmf_window_ds)[320]; static DECLARE_ALIGNED(16, float, sbr_qmf_window_ds)[320];
static DECLARE_ALIGNED(32, float, sbr_qmf_window_us)[640] = { static DECLARE_ALIGNED(16, float, sbr_qmf_window_us)[640] = {
0.0000000000, -0.0005525286, -0.0005617692, -0.0004947518, 0.0000000000, -0.0005525286, -0.0005617692, -0.0004947518,
-0.0004875227, -0.0004893791, -0.0005040714, -0.0005226564, -0.0004875227, -0.0004893791, -0.0005040714, -0.0005226564,
-0.0005466565, -0.0005677802, -0.0005870930, -0.0006132747, -0.0005466565, -0.0005677802, -0.0005870930, -0.0006132747,
@@ -352,8 +352,7 @@ static DECLARE_ALIGNED(32, float, sbr_qmf_window_us)[640] = {
0.8537385600, 0.8537385600,
}; };
/* First two entries repeated at end to simplify SIMD implementations. */ static const float sbr_noise_table[512][2] = {
const DECLARE_ALIGNED(16, float, ff_sbr_noise_table)[][2] = {
{-0.99948153278296, -0.59483417516607}, { 0.97113454393991, -0.67528515225647}, {-0.99948153278296, -0.59483417516607}, { 0.97113454393991, -0.67528515225647},
{ 0.14130051758487, -0.95090983575689}, {-0.47005496701697, -0.37340549728647}, { 0.14130051758487, -0.95090983575689}, {-0.47005496701697, -0.37340549728647},
{ 0.80705063769351, 0.29653668284408}, {-0.38981478896926, 0.89572605717087}, { 0.80705063769351, 0.29653668284408}, {-0.38981478896926, 0.89572605717087},
@@ -610,7 +609,6 @@ const DECLARE_ALIGNED(16, float, ff_sbr_noise_table)[][2] = {
{-0.93412041758744, 0.41374052024363}, { 0.96063943315511, 0.93116709541280}, {-0.93412041758744, 0.41374052024363}, { 0.96063943315511, 0.93116709541280},
{ 0.97534253457837, 0.86150930812689}, { 0.99642466504163, 0.70190043427512}, { 0.97534253457837, 0.86150930812689}, { 0.99642466504163, 0.70190043427512},
{-0.94705089665984, -0.29580042814306}, { 0.91599807087376, -0.98147830385781}, {-0.94705089665984, -0.29580042814306}, { 0.91599807087376, -0.98147830385781},
{-0.99948153278296, -0.59483417516607}, { 0.97113454393991, -0.67528515225647},
}; };
#endif /* AVCODEC_AACSBRDATA_H */ #endif /* AVCODEC_AACSBRDATA_H */

View File

@@ -33,8 +33,8 @@
#include <stdint.h> #include <stdint.h>
DECLARE_ALIGNED(32, float, ff_aac_kbd_long_1024)[1024]; DECLARE_ALIGNED(16, float, ff_aac_kbd_long_1024)[1024];
DECLARE_ALIGNED(32, float, ff_aac_kbd_short_128)[128]; DECLARE_ALIGNED(16, float, ff_aac_kbd_short_128)[128];
const uint8_t ff_aac_num_swb_1024[] = { const uint8_t ff_aac_num_swb_1024[] = {
41, 41, 47, 49, 49, 51, 47, 47, 43, 43, 43, 40, 40 41, 41, 47, 49, 49, 51, 47, 47, 43, 43, 43, 40, 40

View File

@@ -44,8 +44,8 @@
/* @name window coefficients /* @name window coefficients
* @{ * @{
*/ */
DECLARE_ALIGNED(32, extern float, ff_aac_kbd_long_1024)[1024]; DECLARE_ALIGNED(16, extern float, ff_aac_kbd_long_1024)[1024];
DECLARE_ALIGNED(32, extern float, ff_aac_kbd_short_128)[128]; DECLARE_ALIGNED(16, extern float, ff_aac_kbd_short_128)[128];
// @} // @}
/* @name number of scalefactor window bands for long and short transform windows respectively /* @name number of scalefactor window bands for long and short transform windows respectively

View File

@@ -43,17 +43,7 @@ static av_cold int aasc_decode_init(AVCodecContext *avctx)
AascContext *s = avctx->priv_data; AascContext *s = avctx->priv_data;
s->avctx = avctx; s->avctx = avctx;
switch (avctx->bits_per_coded_sample) {
case 16:
avctx->pix_fmt = PIX_FMT_RGB555;
break;
case 24:
avctx->pix_fmt = PIX_FMT_BGR24; avctx->pix_fmt = PIX_FMT_BGR24;
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unsupported bit depth: %d\n", avctx->bits_per_coded_sample);
return -1;
}
avcodec_get_frame_defaults(&s->frame); avcodec_get_frame_defaults(&s->frame);
return 0; return 0;
@@ -66,7 +56,7 @@ static int aasc_decode_frame(AVCodecContext *avctx,
const uint8_t *buf = avpkt->data; const uint8_t *buf = avpkt->data;
int buf_size = avpkt->size; int buf_size = avpkt->size;
AascContext *s = avctx->priv_data; AascContext *s = avctx->priv_data;
int compr, i, stride, psize; int compr, i, stride;
s->frame.reference = 3; s->frame.reference = 3;
s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE; s->frame.buffer_hints = FF_BUFFER_HINTS_VALID | FF_BUFFER_HINTS_PRESERVE | FF_BUFFER_HINTS_REUSABLE;
@@ -78,39 +68,27 @@ static int aasc_decode_frame(AVCodecContext *avctx,
compr = AV_RL32(buf); compr = AV_RL32(buf);
buf += 4; buf += 4;
buf_size -= 4; buf_size -= 4;
psize = avctx->bits_per_coded_sample / 8;
switch (avctx->codec_tag) {
case MKTAG('A', 'A', 'S', '4'):
bytestream2_init(&s->gb, buf - 4, buf_size + 4);
ff_msrle_decode(avctx, (AVPicture*)&s->frame, 8, &s->gb);
break;
case MKTAG('A', 'A', 'S', 'C'):
switch(compr){ switch(compr){
case 0: case 0:
stride = (avctx->width * psize + psize) & ~psize; stride = (avctx->width * 3 + 3) & ~3;
for(i = avctx->height - 1; i >= 0; i--){ for(i = avctx->height - 1; i >= 0; i--){
if(avctx->width * psize > buf_size){ if(avctx->width*3 > buf_size){
av_log(avctx, AV_LOG_ERROR, "Next line is beyond buffer bounds\n"); av_log(avctx, AV_LOG_ERROR, "Next line is beyond buffer bounds\n");
break; break;
} }
memcpy(s->frame.data[0] + i*s->frame.linesize[0], buf, avctx->width * psize); memcpy(s->frame.data[0] + i*s->frame.linesize[0], buf, avctx->width*3);
buf += stride; buf += stride;
buf_size -= stride; buf_size -= stride;
} }
break; break;
case 1: case 1:
bytestream2_init(&s->gb, buf, buf_size); bytestream2_init(&s->gb, buf - 4, buf_size + 4);
ff_msrle_decode(avctx, (AVPicture*)&s->frame, 8, &s->gb); ff_msrle_decode(avctx, (AVPicture*)&s->frame, 8, &s->gb);
break; break;
default: default:
av_log(avctx, AV_LOG_ERROR, "Unknown compression type %d\n", compr); av_log(avctx, AV_LOG_ERROR, "Unknown compression type %d\n", compr);
return -1; return -1;
} }
break;
default:
av_log(avctx, AV_LOG_ERROR, "Unknown FourCC: %X\n", avctx->codec_tag);
return -1;
}
*data_size = sizeof(AVFrame); *data_size = sizeof(AVFrame);
*(AVFrame*)data = s->frame; *(AVFrame*)data = s->frame;

View File

@@ -162,12 +162,17 @@ static av_cold int ac3_decode_init(AVCodecContext *avctx)
AC3DecodeContext *s = avctx->priv_data; AC3DecodeContext *s = avctx->priv_data;
s->avctx = avctx; s->avctx = avctx;
#if FF_API_DRC_SCALE
if (avctx->drc_scale)
s->drc_scale = avctx->drc_scale;
#endif
ff_ac3_common_init(); ff_ac3_common_init();
ac3_tables_init(); ac3_tables_init();
ff_mdct_init(&s->imdct_256, 8, 1, 1.0); ff_mdct_init(&s->imdct_256, 8, 1, 1.0);
ff_mdct_init(&s->imdct_512, 9, 1, 1.0); ff_mdct_init(&s->imdct_512, 9, 1, 1.0);
ff_kbd_window_init(s->window, 5.0, 256); ff_kbd_window_init(s->window, 5.0, 256);
ff_dsputil_init(&s->dsp, avctx); dsputil_init(&s->dsp, avctx);
ff_ac3dsp_init(&s->ac3dsp, avctx->flags & CODEC_FLAG_BITEXACT); ff_ac3dsp_init(&s->ac3dsp, avctx->flags & CODEC_FLAG_BITEXACT);
ff_fmt_convert_init(&s->fmt_conv, avctx); ff_fmt_convert_init(&s->fmt_conv, avctx);
av_lfg_init(&s->dith_state, 0); av_lfg_init(&s->dith_state, 0);
@@ -292,7 +297,7 @@ static int parse_frame_header(AC3DecodeContext *s)
return ff_eac3_parse_header(s); return ff_eac3_parse_header(s);
} else { } else {
av_log(s->avctx, AV_LOG_ERROR, "E-AC-3 support not compiled in\n"); av_log(s->avctx, AV_LOG_ERROR, "E-AC-3 support not compiled in\n");
return -1; return AVERROR(ENOSYS);
} }
} }
@@ -753,7 +758,9 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
int downmix_output; int downmix_output;
int cpl_in_use; int cpl_in_use;
GetBitContext *gbc = &s->gbc; GetBitContext *gbc = &s->gbc;
uint8_t bit_alloc_stages[AC3_MAX_CHANNELS] = { 0 }; uint8_t bit_alloc_stages[AC3_MAX_CHANNELS];
memset(bit_alloc_stages, 0, AC3_MAX_CHANNELS);
/* block switch flags */ /* block switch flags */
different_transforms = 0; different_transforms = 0;
@@ -815,12 +822,12 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
if (start_subband >= end_subband) { if (start_subband >= end_subband) {
av_log(s->avctx, AV_LOG_ERROR, "invalid spectral extension " av_log(s->avctx, AV_LOG_ERROR, "invalid spectral extension "
"range (%d >= %d)\n", start_subband, end_subband); "range (%d >= %d)\n", start_subband, end_subband);
return -1; return AVERROR_INVALIDDATA;
} }
if (dst_start_freq >= src_start_freq) { if (dst_start_freq >= src_start_freq) {
av_log(s->avctx, AV_LOG_ERROR, "invalid spectral extension " av_log(s->avctx, AV_LOG_ERROR, "invalid spectral extension "
"copy start bin (%d >= %d)\n", dst_start_freq, src_start_freq); "copy start bin (%d >= %d)\n", dst_start_freq, src_start_freq);
return -1; return AVERROR_INVALIDDATA;
} }
s->spx_dst_start_freq = dst_start_freq; s->spx_dst_start_freq = dst_start_freq;
@@ -897,7 +904,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
if (channel_mode < AC3_CHMODE_STEREO) { if (channel_mode < AC3_CHMODE_STEREO) {
av_log(s->avctx, AV_LOG_ERROR, "coupling not allowed in mono or dual-mono\n"); av_log(s->avctx, AV_LOG_ERROR, "coupling not allowed in mono or dual-mono\n");
return -1; return AVERROR_INVALIDDATA;
} }
/* check for enhanced coupling */ /* check for enhanced coupling */
@@ -927,7 +934,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
if (cpl_start_subband >= cpl_end_subband) { if (cpl_start_subband >= cpl_end_subband) {
av_log(s->avctx, AV_LOG_ERROR, "invalid coupling range (%d >= %d)\n", av_log(s->avctx, AV_LOG_ERROR, "invalid coupling range (%d >= %d)\n",
cpl_start_subband, cpl_end_subband); cpl_start_subband, cpl_end_subband);
return -1; return AVERROR_INVALIDDATA;
} }
s->start_freq[CPL_CH] = cpl_start_subband * 12 + 37; s->start_freq[CPL_CH] = cpl_start_subband * 12 + 37;
s->end_freq[CPL_CH] = cpl_end_subband * 12 + 37; s->end_freq[CPL_CH] = cpl_end_subband * 12 + 37;
@@ -949,7 +956,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
if (!blk) { if (!blk) {
av_log(s->avctx, AV_LOG_ERROR, "new coupling strategy must " av_log(s->avctx, AV_LOG_ERROR, "new coupling strategy must "
"be present in block 0\n"); "be present in block 0\n");
return -1; return AVERROR_INVALIDDATA;
} else { } else {
s->cpl_in_use[blk] = s->cpl_in_use[blk-1]; s->cpl_in_use[blk] = s->cpl_in_use[blk-1];
} }
@@ -979,7 +986,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
} else if (!blk) { } else if (!blk) {
av_log(s->avctx, AV_LOG_ERROR, "new coupling coordinates must " av_log(s->avctx, AV_LOG_ERROR, "new coupling coordinates must "
"be present in block 0\n"); "be present in block 0\n");
return -1; return AVERROR_INVALIDDATA;
} }
} else { } else {
/* channel not in coupling */ /* channel not in coupling */
@@ -1034,7 +1041,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
int bandwidth_code = get_bits(gbc, 6); int bandwidth_code = get_bits(gbc, 6);
if (bandwidth_code > 60) { if (bandwidth_code > 60) {
av_log(s->avctx, AV_LOG_ERROR, "bandwidth code = %d > 60\n", bandwidth_code); av_log(s->avctx, AV_LOG_ERROR, "bandwidth code = %d > 60\n", bandwidth_code);
return -1; return AVERROR_INVALIDDATA;
} }
s->end_freq[ch] = bandwidth_code * 3 + 73; s->end_freq[ch] = bandwidth_code * 3 + 73;
} }
@@ -1057,7 +1064,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
s->num_exp_groups[ch], s->dexps[ch][0], s->num_exp_groups[ch], s->dexps[ch][0],
&s->dexps[ch][s->start_freq[ch]+!!ch])) { &s->dexps[ch][s->start_freq[ch]+!!ch])) {
av_log(s->avctx, AV_LOG_ERROR, "exponent out-of-range\n"); av_log(s->avctx, AV_LOG_ERROR, "exponent out-of-range\n");
return -1; return AVERROR_INVALIDDATA;
} }
if (ch != CPL_CH && ch != s->lfe_ch) if (ch != CPL_CH && ch != s->lfe_ch)
skip_bits(gbc, 2); /* skip gainrng */ skip_bits(gbc, 2); /* skip gainrng */
@@ -1077,7 +1084,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
} else if (!blk) { } else if (!blk) {
av_log(s->avctx, AV_LOG_ERROR, "new bit allocation info must " av_log(s->avctx, AV_LOG_ERROR, "new bit allocation info must "
"be present in block 0\n"); "be present in block 0\n");
return -1; return AVERROR_INVALIDDATA;
} }
} }
@@ -1108,7 +1115,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
} }
} else if (!s->eac3 && !blk) { } else if (!s->eac3 && !blk) {
av_log(s->avctx, AV_LOG_ERROR, "new snr offsets must be present in block 0\n"); av_log(s->avctx, AV_LOG_ERROR, "new snr offsets must be present in block 0\n");
return -1; return AVERROR_INVALIDDATA;
} }
} }
@@ -1147,7 +1154,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
} else if (!s->eac3 && !blk) { } else if (!s->eac3 && !blk) {
av_log(s->avctx, AV_LOG_ERROR, "new coupling leak info must " av_log(s->avctx, AV_LOG_ERROR, "new coupling leak info must "
"be present in block 0\n"); "be present in block 0\n");
return -1; return AVERROR_INVALIDDATA;
} }
s->first_cpl_leak = 0; s->first_cpl_leak = 0;
} }
@@ -1159,7 +1166,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
s->dba_mode[ch] = get_bits(gbc, 2); s->dba_mode[ch] = get_bits(gbc, 2);
if (s->dba_mode[ch] == DBA_RESERVED) { if (s->dba_mode[ch] == DBA_RESERVED) {
av_log(s->avctx, AV_LOG_ERROR, "delta bit allocation strategy reserved\n"); av_log(s->avctx, AV_LOG_ERROR, "delta bit allocation strategy reserved\n");
return -1; return AVERROR_INVALIDDATA;
} }
bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2); bit_alloc_stages[ch] = FFMAX(bit_alloc_stages[ch], 2);
} }
@@ -1200,7 +1207,7 @@ static int decode_audio_block(AC3DecodeContext *s, int blk)
s->dba_offsets[ch], s->dba_lengths[ch], s->dba_offsets[ch], s->dba_lengths[ch],
s->dba_values[ch], s->mask[ch])) { s->dba_values[ch], s->mask[ch])) {
av_log(s->avctx, AV_LOG_ERROR, "error in bit allocation\n"); av_log(s->avctx, AV_LOG_ERROR, "error in bit allocation\n");
return -1; return AVERROR_INVALIDDATA;
} }
} }
if (bit_alloc_stages[ch] > 0) { if (bit_alloc_stages[ch] > 0) {
@@ -1321,7 +1328,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
switch (err) { switch (err) {
case AAC_AC3_PARSE_ERROR_SYNC: case AAC_AC3_PARSE_ERROR_SYNC:
av_log(avctx, AV_LOG_ERROR, "frame sync error\n"); av_log(avctx, AV_LOG_ERROR, "frame sync error\n");
return -1; return AVERROR_INVALIDDATA;
case AAC_AC3_PARSE_ERROR_BSID: case AAC_AC3_PARSE_ERROR_BSID:
av_log(avctx, AV_LOG_ERROR, "invalid bitstream id\n"); av_log(avctx, AV_LOG_ERROR, "invalid bitstream id\n");
break; break;
@@ -1335,17 +1342,20 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
/* skip frame if CRC is ok. otherwise use error concealment. */ /* skip frame if CRC is ok. otherwise use error concealment. */
/* TODO: add support for substreams and dependent frames */ /* TODO: add support for substreams and dependent frames */
if (s->frame_type == EAC3_FRAME_TYPE_DEPENDENT || s->substreamid) { if (s->frame_type == EAC3_FRAME_TYPE_DEPENDENT || s->substreamid) {
av_log(avctx, AV_LOG_ERROR, "unsupported frame type : " av_log(avctx, AV_LOG_WARNING, "unsupported frame type : "
"skipping frame\n"); "skipping frame\n");
*got_frame_ptr = 0; *got_frame_ptr = 0;
return s->frame_size; return buf_size;
} else { } else {
av_log(avctx, AV_LOG_ERROR, "invalid frame type\n"); av_log(avctx, AV_LOG_ERROR, "invalid frame type\n");
} }
break; break;
default: case AAC_AC3_PARSE_ERROR_CRC:
av_log(avctx, AV_LOG_ERROR, "invalid header\n"); case AAC_AC3_PARSE_ERROR_CHANNEL_CFG:
break; break;
default: // Normal AVERROR do not try to recover.
*got_frame_ptr = 0;
return err;
} }
} else { } else {
/* check that reported frame size fits in input buffer */ /* check that reported frame size fits in input buffer */
@@ -1366,8 +1376,10 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
if (!err) { if (!err) {
avctx->sample_rate = s->sample_rate; avctx->sample_rate = s->sample_rate;
avctx->bit_rate = s->bit_rate; avctx->bit_rate = s->bit_rate;
}
/* channel config */ /* channel config */
if (!err || (s->channels && s->out_channels != s->channels)) {
s->out_channels = s->channels; s->out_channels = s->channels;
s->output_mode = s->channel_mode; s->output_mode = s->channel_mode;
if (s->lfe_on) if (s->lfe_on)
@@ -1390,15 +1402,12 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
s->fbw_channels == s->out_channels)) { s->fbw_channels == s->out_channels)) {
set_downmix_coeffs(s); set_downmix_coeffs(s);
} }
} else if (!s->out_channels) { } else if (!s->channels) {
s->out_channels = avctx->channels; av_log(avctx, AV_LOG_ERROR, "unable to determine channel mode\n");
if (s->out_channels < s->channels)
s->output_mode = s->out_channels == 1 ? AC3_CHMODE_MONO : AC3_CHMODE_STEREO;
}
if (avctx->channels != s->out_channels) {
av_log(avctx, AV_LOG_ERROR, "channel number mismatching on damaged frame\n");
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
avctx->channels = s->out_channels;
/* set audio service type based on bitstream mode for AC-3 */ /* set audio service type based on bitstream mode for AC-3 */
avctx->audio_service_type = s->bitstream_mode; avctx->audio_service_type = s->bitstream_mode;
if (s->bitstream_mode == 0x7 && s->channels > 1) if (s->bitstream_mode == 0x7 && s->channels > 1)
@@ -1406,7 +1415,7 @@ static int ac3_decode_frame(AVCodecContext * avctx, void *data,
/* get output buffer */ /* get output buffer */
s->frame.nb_samples = s->num_blocks * 256; s->frame.nb_samples = s->num_blocks * 256;
if ((ret = avctx->get_buffer(avctx, &s->frame)) < 0) { if ((ret = ff_get_buffer(avctx, &s->frame)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
return ret; return ret;
} }

View File

@@ -1383,7 +1383,8 @@ static void ac3_output_frame_header(AC3EncodeContext *s)
*/ */
static void output_audio_block(AC3EncodeContext *s, int blk) static void output_audio_block(AC3EncodeContext *s, int blk)
{ {
int ch, i, baie, bnd, got_cpl, ch0; int ch, i, baie, bnd, got_cpl;
int av_uninit(ch0);
AC3Block *block = &s->blocks[blk]; AC3Block *block = &s->blocks[blk];
/* block switching */ /* block switching */
@@ -2050,9 +2051,7 @@ av_cold int ff_ac3_encode_close(AVCodecContext *avctx)
s->mdct_end(s); s->mdct_end(s);
#if FF_API_OLD_ENCODE_AUDIO
av_freep(&avctx->coded_frame); av_freep(&avctx->coded_frame);
#endif
return 0; return 0;
} }
@@ -2071,7 +2070,7 @@ static av_cold int set_channel_info(AC3EncodeContext *s, int channels,
return AVERROR(EINVAL); return AVERROR(EINVAL);
ch_layout = *channel_layout; ch_layout = *channel_layout;
if (!ch_layout) if (!ch_layout)
ch_layout = av_get_default_channel_layout(channels); ch_layout = avcodec_guess_channel_layout(channels, CODEC_ID_AC3, NULL);
s->lfe_on = !!(ch_layout & AV_CH_LOW_FREQUENCY); s->lfe_on = !!(ch_layout & AV_CH_LOW_FREQUENCY);
s->channels = channels; s->channels = channels;
@@ -2140,17 +2139,6 @@ static av_cold int validate_options(AC3EncodeContext *s)
s->bit_alloc.sr_code = i % 3; s->bit_alloc.sr_code = i % 3;
s->bitstream_id = s->eac3 ? 16 : 8 + s->bit_alloc.sr_shift; s->bitstream_id = s->eac3 ? 16 : 8 + s->bit_alloc.sr_shift;
/* select a default bit rate if not set by the user */
if (!avctx->bit_rate) {
switch (s->fbw_channels) {
case 1: avctx->bit_rate = 96000; break;
case 2: avctx->bit_rate = 192000; break;
case 3: avctx->bit_rate = 320000; break;
case 4: avctx->bit_rate = 384000; break;
case 5: avctx->bit_rate = 448000; break;
}
}
/* validate bit rate */ /* validate bit rate */
if (s->eac3) { if (s->eac3) {
int max_br, min_br, wpf, min_br_dist, min_br_code; int max_br, min_br, wpf, min_br_dist, min_br_code;
@@ -2199,20 +2187,15 @@ static av_cold int validate_options(AC3EncodeContext *s)
wpf--; wpf--;
s->frame_size_min = 2 * wpf; s->frame_size_min = 2 * wpf;
} else { } else {
int best_br = 0, best_code = 0, best_diff = INT_MAX;
for (i = 0; i < 19; i++) { for (i = 0; i < 19; i++) {
int br = (ff_ac3_bitrate_tab[i] >> s->bit_alloc.sr_shift) * 1000; if ((ff_ac3_bitrate_tab[i] >> s->bit_alloc.sr_shift)*1000 == avctx->bit_rate)
int diff = abs(br - avctx->bit_rate);
if (diff < best_diff) {
best_br = br;
best_code = i;
best_diff = diff;
}
if (!best_diff)
break; break;
} }
avctx->bit_rate = best_br; if (i == 19) {
s->frame_size_code = best_code << 1; av_log(avctx, AV_LOG_ERROR, "invalid bit rate\n");
return AVERROR(EINVAL);
}
s->frame_size_code = i << 1;
s->frame_size_min = 2 * ff_ac3_frame_size_tab[s->frame_size_code][s->bit_alloc.sr_code]; s->frame_size_min = 2 * ff_ac3_frame_size_tab[s->frame_size_code][s->bit_alloc.sr_code];
s->num_blks_code = 0x3; s->num_blks_code = 0x3;
s->num_blocks = 6; s->num_blocks = 6;
@@ -2250,7 +2233,8 @@ static av_cold int validate_options(AC3EncodeContext *s)
*/ */
static av_cold void set_bandwidth(AC3EncodeContext *s) static av_cold void set_bandwidth(AC3EncodeContext *s)
{ {
int blk, ch, cpl_start; int blk, ch;
int av_uninit(cpl_start);
if (s->cutoff) { if (s->cutoff) {
/* calculate bandwidth based on user-specified cutoff frequency */ /* calculate bandwidth based on user-specified cutoff frequency */
@@ -2436,7 +2420,6 @@ av_cold int ff_ac3_encode_init(AVCodecContext *avctx)
return ret; return ret;
avctx->frame_size = AC3_BLOCK_SIZE * s->num_blocks; avctx->frame_size = AC3_BLOCK_SIZE * s->num_blocks;
avctx->delay = AC3_BLOCK_SIZE;
s->bitstream_mode = avctx->audio_service_type; s->bitstream_mode = avctx->audio_service_type;
if (s->bitstream_mode == AV_AUDIO_SERVICE_TYPE_KARAOKE) if (s->bitstream_mode == AV_AUDIO_SERVICE_TYPE_KARAOKE)
@@ -2482,15 +2465,9 @@ av_cold int ff_ac3_encode_init(AVCodecContext *avctx)
if (ret) if (ret)
goto init_fail; goto init_fail;
#if FF_API_OLD_ENCODE_AUDIO
avctx->coded_frame= avcodec_alloc_frame(); avctx->coded_frame= avcodec_alloc_frame();
if (!avctx->coded_frame) {
ret = AVERROR(ENOMEM);
goto init_fail;
}
#endif
ff_dsputil_init(&s->dsp, avctx); dsputil_init(&s->dsp, avctx);
ff_ac3dsp_init(&s->ac3dsp, avctx->flags & CODEC_FLAG_BITEXACT); ff_ac3dsp_init(&s->ac3dsp, avctx->flags & CODEC_FLAG_BITEXACT);
dprint_options(s); dprint_options(s);

View File

@@ -297,9 +297,9 @@ int ff_ac3_float_mdct_init(AC3EncodeContext *s);
int ff_ac3_fixed_allocate_sample_buffers(AC3EncodeContext *s); int ff_ac3_fixed_allocate_sample_buffers(AC3EncodeContext *s);
int ff_ac3_float_allocate_sample_buffers(AC3EncodeContext *s); int ff_ac3_float_allocate_sample_buffers(AC3EncodeContext *s);
int ff_ac3_fixed_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, int ff_ac3_fixed_encode_frame(AVCodecContext *avctx, unsigned char *frame,
const AVFrame *frame, int *got_packet_ptr); int buf_size, void *data);
int ff_ac3_float_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, int ff_ac3_float_encode_frame(AVCodecContext *avctx, unsigned char *frame,
const AVFrame *frame, int *got_packet_ptr); int buf_size, void *data);
#endif /* AVCODEC_AC3ENC_H */ #endif /* AVCODEC_AC3ENC_H */

View File

@@ -28,7 +28,6 @@
#define CONFIG_FFT_FLOAT 0 #define CONFIG_FFT_FLOAT 0
#undef CONFIG_AC3ENC_FLOAT #undef CONFIG_AC3ENC_FLOAT
#include "internal.h"
#include "ac3enc.h" #include "ac3enc.h"
#include "eac3enc.h" #include "eac3enc.h"
@@ -152,12 +151,10 @@ AVCodec ff_ac3_fixed_encoder = {
.id = CODEC_ID_AC3, .id = CODEC_ID_AC3,
.priv_data_size = sizeof(AC3EncodeContext), .priv_data_size = sizeof(AC3EncodeContext),
.init = ac3_fixed_encode_init, .init = ac3_fixed_encode_init,
.encode2 = ff_ac3_fixed_encode_frame, .encode = ff_ac3_fixed_encode_frame,
.close = ff_ac3_encode_close, .close = ff_ac3_encode_close,
.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16, .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_S16,AV_SAMPLE_FMT_NONE},
AV_SAMPLE_FMT_NONE },
.long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"), .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
.priv_class = &ac3enc_class, .priv_class = &ac3enc_class,
.channel_layouts = ff_ac3_channel_layouts, .channel_layouts = ff_ac3_channel_layouts,
.defaults = ac3_defaults,
}; };

View File

@@ -27,7 +27,6 @@
*/ */
#define CONFIG_AC3ENC_FLOAT 1 #define CONFIG_AC3ENC_FLOAT 1
#include "internal.h"
#include "ac3enc.h" #include "ac3enc.h"
#include "eac3enc.h" #include "eac3enc.h"
#include "kbdwin.h" #include "kbdwin.h"
@@ -150,13 +149,11 @@ AVCodec ff_ac3_encoder = {
.id = CODEC_ID_AC3, .id = CODEC_ID_AC3,
.priv_data_size = sizeof(AC3EncodeContext), .priv_data_size = sizeof(AC3EncodeContext),
.init = ff_ac3_encode_init, .init = ff_ac3_encode_init,
.encode2 = ff_ac3_float_encode_frame, .encode = ff_ac3_float_encode_frame,
.close = ff_ac3_encode_close, .close = ff_ac3_encode_close,
.sample_fmts = (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_FLT, .sample_fmts = (const enum AVSampleFormat[]){AV_SAMPLE_FMT_FLT,AV_SAMPLE_FMT_NONE},
AV_SAMPLE_FMT_NONE },
.long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"), .long_name = NULL_IF_CONFIG_SMALL("ATSC A/52A (AC-3)"),
.priv_class = &ac3enc_class, .priv_class = &ac3enc_class,
.channel_layouts = ff_ac3_channel_layouts, .channel_layouts = ff_ac3_channel_layouts,
.defaults = ac3_defaults,
}; };
#endif #endif

View File

@@ -20,7 +20,6 @@
*/ */
#include "libavutil/opt.h" #include "libavutil/opt.h"
#include "internal.h"
#include "ac3.h" #include "ac3.h"
#if AC3ENC_TYPE == AC3ENC_TYPE_AC3_FIXED #if AC3ENC_TYPE == AC3ENC_TYPE_AC3_FIXED
@@ -79,8 +78,3 @@ static const AVOption eac3_options[] = {
{"auto", "Selected by the Encoder", 0, AV_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_AUTO }, INT_MIN, INT_MAX, AC3ENC_PARAM, "cpl_start_band"}, {"auto", "Selected by the Encoder", 0, AV_OPT_TYPE_CONST, {.dbl = AC3ENC_OPT_AUTO }, INT_MIN, INT_MAX, AC3ENC_PARAM, "cpl_start_band"},
{NULL} {NULL}
}; };
static const AVCodecDefault ac3_defaults[] = {
{ "b", "0" },
{ NULL }
};

View File

@@ -338,7 +338,7 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s)
{ {
int nb_coefs; int nb_coefs;
int blk, bnd; int blk, bnd;
AC3Block *block, *block0; AC3Block *block, *av_uninit(block0);
if (s->channel_mode != AC3_CHMODE_STEREO) if (s->channel_mode != AC3_CHMODE_STEREO)
return; return;
@@ -386,11 +386,11 @@ static void compute_rematrixing_strategy(AC3EncodeContext *s)
} }
int AC3_NAME(encode_frame)(AVCodecContext *avctx, AVPacket *avpkt, int AC3_NAME(encode_frame)(AVCodecContext *avctx, unsigned char *frame,
const AVFrame *frame, int *got_packet_ptr) int buf_size, void *data)
{ {
AC3EncodeContext *s = avctx->priv_data; AC3EncodeContext *s = avctx->priv_data;
const SampleType *samples = (const SampleType *)frame->data[0]; const SampleType *samples = data;
int ret; int ret;
if (s->options.allow_per_frame_metadata) { if (s->options.allow_per_frame_metadata) {
@@ -437,13 +437,7 @@ int AC3_NAME(encode_frame)(AVCodecContext *avctx, AVPacket *avpkt,
ff_ac3_quantize_mantissas(s); ff_ac3_quantize_mantissas(s);
if ((ret = ff_alloc_packet2(avctx, avpkt, s->frame_size))) ff_ac3_output_frame(s, frame);
return ret;
ff_ac3_output_frame(s, avpkt->data);
if (frame->pts != AV_NOPTS_VALUE) return s->frame_size;
avpkt->pts = frame->pts - ff_samples_to_time_base(avctx, avctx->delay);
*got_packet_ptr = 1;
return 0;
} }

View File

@@ -142,3 +142,4 @@ void ff_tilt_compensation(float *mem, float tilt, float *samples, int size)
samples[0] -= tilt * *mem; samples[0] -= tilt * *mem;
*mem = new_tilt_mem; *mem = new_tilt_mem;
} }

View File

@@ -116,7 +116,7 @@ int16_t ff_acelp_decode_gain_code(
); );
#else #else
mr_energy = gain_corr_factor * exp(M_LN10 / (20 << 23) * mr_energy) / mr_energy = gain_corr_factor * exp(M_LN10 / (20 << 23) * mr_energy) /
sqrt(dsp->scalarproduct_int16(fc_v, fc_v, subframe_size)); sqrt(dsp->scalarproduct_int16(fc_v, fc_v, subframe_size, 0));
return mr_energy >> 12; return mr_energy >> 12;
#endif #endif
} }

File diff suppressed because it is too large Load Diff

View File

@@ -26,20 +26,18 @@
#ifndef AVCODEC_ADPCM_H #ifndef AVCODEC_ADPCM_H
#define AVCODEC_ADPCM_H #define AVCODEC_ADPCM_H
#include <stdint.h>
#define BLKSIZE 1024 #define BLKSIZE 1024
typedef struct ADPCMChannelStatus { typedef struct ADPCMChannelStatus {
int predictor; int predictor;
int16_t step_index; short int step_index;
int step; int step;
/* for encoding */ /* for encoding */
int prev_sample; int prev_sample;
/* MS version */ /* MS version */
int16_t sample1; short sample1;
int16_t sample2; short sample2;
int coeff1; int coeff1;
int coeff2; int coeff2;
int idelta; int idelta;

View File

@@ -24,7 +24,6 @@
#include "bytestream.h" #include "bytestream.h"
#include "adpcm.h" #include "adpcm.h"
#include "adpcm_data.h" #include "adpcm_data.h"
#include "internal.h"
/** /**
* @file * @file
@@ -59,23 +58,17 @@ typedef struct ADPCMEncodeContext {
#define FREEZE_INTERVAL 128 #define FREEZE_INTERVAL 128
static av_cold int adpcm_encode_close(AVCodecContext *avctx);
static av_cold int adpcm_encode_init(AVCodecContext *avctx) static av_cold int adpcm_encode_init(AVCodecContext *avctx)
{ {
ADPCMEncodeContext *s = avctx->priv_data; ADPCMEncodeContext *s = avctx->priv_data;
uint8_t *extradata; uint8_t *extradata;
int i; int i;
int ret = AVERROR(ENOMEM); if (avctx->channels > 2)
return -1; /* only stereo or mono =) */
if (avctx->channels > 2) {
av_log(avctx, AV_LOG_ERROR, "only stereo or mono is supported\n");
return AVERROR(EINVAL);
}
if (avctx->trellis && (unsigned)avctx->trellis > 16U) { if (avctx->trellis && (unsigned)avctx->trellis > 16U) {
av_log(avctx, AV_LOG_ERROR, "invalid trellis size\n"); av_log(avctx, AV_LOG_ERROR, "invalid trellis size\n");
return AVERROR(EINVAL); return -1;
} }
if (avctx->trellis) { if (avctx->trellis) {
@@ -112,12 +105,12 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
/* each 16 bits sample gives one nibble /* each 16 bits sample gives one nibble
and we have 7 bytes per channel overhead */ and we have 7 bytes per channel overhead */
avctx->frame_size = (BLKSIZE - 7 * avctx->channels) * 2 / avctx->channels + 2; avctx->frame_size = (BLKSIZE - 7 * avctx->channels) * 2 / avctx->channels + 2;
avctx->bits_per_coded_sample = 4;
avctx->block_align = BLKSIZE; avctx->block_align = BLKSIZE;
if (!(avctx->extradata = av_malloc(32 + FF_INPUT_BUFFER_PADDING_SIZE))) avctx->bits_per_coded_sample = 4;
goto error;
avctx->extradata_size = 32; avctx->extradata_size = 32;
extradata = avctx->extradata; extradata = avctx->extradata = av_malloc(avctx->extradata_size);
if (!extradata)
return AVERROR(ENOMEM);
bytestream_put_le16(&extradata, avctx->frame_size); bytestream_put_le16(&extradata, avctx->frame_size);
bytestream_put_le16(&extradata, 7); /* wNumCoef */ bytestream_put_le16(&extradata, 7); /* wNumCoef */
for (i = 0; i < 7; i++) { for (i = 0; i < 7; i++) {
@@ -126,7 +119,7 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
} }
break; break;
case CODEC_ID_ADPCM_YAMAHA: case CODEC_ID_ADPCM_YAMAHA:
avctx->frame_size = BLKSIZE * 2 / avctx->channels; avctx->frame_size = BLKSIZE * avctx->channels;
avctx->block_align = BLKSIZE; avctx->block_align = BLKSIZE;
break; break;
case CODEC_ID_ADPCM_SWF: case CODEC_ID_ADPCM_SWF:
@@ -135,33 +128,30 @@ static av_cold int adpcm_encode_init(AVCodecContext *avctx)
avctx->sample_rate != 44100) { avctx->sample_rate != 44100) {
av_log(avctx, AV_LOG_ERROR, "Sample rate must be 11025, " av_log(avctx, AV_LOG_ERROR, "Sample rate must be 11025, "
"22050 or 44100\n"); "22050 or 44100\n");
ret = AVERROR(EINVAL);
goto error; goto error;
} }
avctx->frame_size = 512 * (avctx->sample_rate / 11025); avctx->frame_size = 512 * (avctx->sample_rate / 11025);
break; break;
default: default:
ret = AVERROR(EINVAL);
goto error; goto error;
} }
#if FF_API_OLD_ENCODE_AUDIO avctx->coded_frame = avcodec_alloc_frame();
if (!(avctx->coded_frame = avcodec_alloc_frame())) avctx->coded_frame->key_frame= 1;
goto error;
#endif
return 0; return 0;
error: error:
adpcm_encode_close(avctx); av_freep(&s->paths);
return ret; av_freep(&s->node_buf);
av_freep(&s->nodep_buf);
av_freep(&s->trellis_hash);
return -1;
} }
static av_cold int adpcm_encode_close(AVCodecContext *avctx) static av_cold int adpcm_encode_close(AVCodecContext *avctx)
{ {
ADPCMEncodeContext *s = avctx->priv_data; ADPCMEncodeContext *s = avctx->priv_data;
#if FF_API_OLD_ENCODE_AUDIO
av_freep(&avctx->coded_frame); av_freep(&avctx->coded_frame);
#endif
av_freep(&s->paths); av_freep(&s->paths);
av_freep(&s->node_buf); av_freep(&s->node_buf);
av_freep(&s->nodep_buf); av_freep(&s->nodep_buf);
@@ -171,8 +161,8 @@ static av_cold int adpcm_encode_close(AVCodecContext *avctx)
} }
static inline uint8_t adpcm_ima_compress_sample(ADPCMChannelStatus *c, static inline unsigned char adpcm_ima_compress_sample(ADPCMChannelStatus *c,
int16_t sample) short sample)
{ {
int delta = sample - c->prev_sample; int delta = sample - c->prev_sample;
int nibble = FFMIN(7, abs(delta) * 4 / int nibble = FFMIN(7, abs(delta) * 4 /
@@ -184,8 +174,8 @@ static inline uint8_t adpcm_ima_compress_sample(ADPCMChannelStatus *c,
return nibble; return nibble;
} }
static inline uint8_t adpcm_ima_qt_compress_sample(ADPCMChannelStatus *c, static inline unsigned char adpcm_ima_qt_compress_sample(ADPCMChannelStatus *c,
int16_t sample) short sample)
{ {
int delta = sample - c->prev_sample; int delta = sample - c->prev_sample;
int diff, step = ff_adpcm_step_table[c->step_index]; int diff, step = ff_adpcm_step_table[c->step_index];
@@ -221,8 +211,8 @@ static inline uint8_t adpcm_ima_qt_compress_sample(ADPCMChannelStatus *c,
return nibble; return nibble;
} }
static inline uint8_t adpcm_ms_compress_sample(ADPCMChannelStatus *c, static inline unsigned char adpcm_ms_compress_sample(ADPCMChannelStatus *c,
int16_t sample) short sample)
{ {
int predictor, nibble, bias; int predictor, nibble, bias;
@@ -238,20 +228,20 @@ static inline uint8_t adpcm_ms_compress_sample(ADPCMChannelStatus *c,
nibble = (nibble + bias) / c->idelta; nibble = (nibble + bias) / c->idelta;
nibble = av_clip(nibble, -8, 7) & 0x0F; nibble = av_clip(nibble, -8, 7) & 0x0F;
predictor += ((nibble & 0x08) ? (nibble - 0x10) : nibble) * c->idelta; predictor += (signed)((nibble & 0x08) ? (nibble - 0x10) : nibble) * c->idelta;
c->sample2 = c->sample1; c->sample2 = c->sample1;
c->sample1 = av_clip_int16(predictor); c->sample1 = av_clip_int16(predictor);
c->idelta = (ff_adpcm_AdaptationTable[nibble] * c->idelta) >> 8; c->idelta = (ff_adpcm_AdaptationTable[(int)nibble] * c->idelta) >> 8;
if (c->idelta < 16) if (c->idelta < 16)
c->idelta = 16; c->idelta = 16;
return nibble; return nibble;
} }
static inline uint8_t adpcm_yamaha_compress_sample(ADPCMChannelStatus *c, static inline unsigned char adpcm_yamaha_compress_sample(ADPCMChannelStatus *c,
int16_t sample) short sample)
{ {
int nibble, delta; int nibble, delta;
@@ -272,9 +262,8 @@ static inline uint8_t adpcm_yamaha_compress_sample(ADPCMChannelStatus *c,
return nibble; return nibble;
} }
static void adpcm_compress_trellis(AVCodecContext *avctx, static void adpcm_compress_trellis(AVCodecContext *avctx, const short *samples,
const int16_t *samples, uint8_t *dst, uint8_t *dst, ADPCMChannelStatus *c, int n)
ADPCMChannelStatus *c, int n)
{ {
//FIXME 6% faster if frontier is a compile-time constant //FIXME 6% faster if frontier is a compile-time constant
ADPCMEncodeContext *s = avctx->priv_data; ADPCMEncodeContext *s = avctx->priv_data;
@@ -478,41 +467,35 @@ static void adpcm_compress_trellis(AVCodecContext *avctx,
c->idelta = nodes[0]->step; c->idelta = nodes[0]->step;
} }
static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, static int adpcm_encode_frame(AVCodecContext *avctx,
const AVFrame *frame, int *got_packet_ptr) unsigned char *frame, int buf_size, void *data)
{ {
int n, i, st, pkt_size, ret; int n, i, st;
const int16_t *samples; short *samples;
uint8_t *dst; unsigned char *dst;
ADPCMEncodeContext *c = avctx->priv_data; ADPCMEncodeContext *c = avctx->priv_data;
uint8_t *buf; uint8_t *buf;
samples = (const int16_t *)frame->data[0]; dst = frame;
samples = (short *)data;
st = avctx->channels == 2; st = avctx->channels == 2;
/* n = (BLKSIZE - 4 * avctx->channels) / (2 * 8 * avctx->channels); */
if (avctx->codec_id == CODEC_ID_ADPCM_SWF)
pkt_size = (2 + avctx->channels * (22 + 4 * (frame->nb_samples - 1)) + 7) / 8;
else
pkt_size = avctx->block_align;
if ((ret = ff_alloc_packet2(avctx, avpkt, pkt_size)))
return ret;
dst = avpkt->data;
switch(avctx->codec->id) { switch(avctx->codec->id) {
case CODEC_ID_ADPCM_IMA_WAV: case CODEC_ID_ADPCM_IMA_WAV:
n = frame->nb_samples / 8; n = avctx->frame_size / 8;
c->status[0].prev_sample = samples[0]; c->status[0].prev_sample = (signed short)samples[0]; /* XXX */
/* c->status[0].step_index = 0; /* c->status[0].step_index = 0;
XXX: not sure how to init the state machine */ XXX: not sure how to init the state machine */
bytestream_put_le16(&dst, c->status[0].prev_sample); bytestream_put_le16(&dst, c->status[0].prev_sample);
*dst++ = c->status[0].step_index; *dst++ = (unsigned char)c->status[0].step_index;
*dst++ = 0; /* unknown */ *dst++ = 0; /* unknown */
samples++; samples++;
if (avctx->channels == 2) { if (avctx->channels == 2) {
c->status[1].prev_sample = samples[0]; c->status[1].prev_sample = (signed short)samples[0];
/* c->status[1].step_index = 0; */ /* c->status[1].step_index = 0; */
bytestream_put_le16(&dst, c->status[1].prev_sample); bytestream_put_le16(&dst, c->status[1].prev_sample);
*dst++ = c->status[1].step_index; *dst++ = (unsigned char)c->status[1].step_index;
*dst++ = 0; *dst++ = 0;
samples++; samples++;
} }
@@ -568,10 +551,10 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
{ {
int ch, i; int ch, i;
PutBitContext pb; PutBitContext pb;
init_put_bits(&pb, dst, pkt_size * 8); init_put_bits(&pb, dst, buf_size * 8);
for (ch = 0; ch < avctx->channels; ch++) { for (ch = 0; ch < avctx->channels; ch++) {
put_bits(&pb, 9, (c->status[ch].prev_sample & 0xFFFF) >> 7); put_bits(&pb, 9, (c->status[ch].prev_sample + 0x10000) >> 7);
put_bits(&pb, 7, c->status[ch].step_index); put_bits(&pb, 7, c->status[ch].step_index);
if (avctx->trellis > 0) { if (avctx->trellis > 0) {
uint8_t buf[64]; uint8_t buf[64];
@@ -592,15 +575,16 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
} }
flush_put_bits(&pb); flush_put_bits(&pb);
dst += put_bits_count(&pb) >> 3;
break; break;
} }
case CODEC_ID_ADPCM_SWF: case CODEC_ID_ADPCM_SWF:
{ {
int i; int i;
PutBitContext pb; PutBitContext pb;
init_put_bits(&pb, dst, pkt_size * 8); init_put_bits(&pb, dst, buf_size * 8);
n = frame->nb_samples - 1; n = avctx->frame_size - 1;
// store AdpcmCodeSize // store AdpcmCodeSize
put_bits(&pb, 2, 2); // set 4-bit flash adpcm format put_bits(&pb, 2, 2); // set 4-bit flash adpcm format
@@ -611,7 +595,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
c->status[i].step_index = av_clip(c->status[i].step_index, 0, 63); c->status[i].step_index = av_clip(c->status[i].step_index, 0, 63);
put_sbits(&pb, 16, samples[i]); put_sbits(&pb, 16, samples[i]);
put_bits(&pb, 6, c->status[i].step_index); put_bits(&pb, 6, c->status[i].step_index);
c->status[i].prev_sample = samples[i]; c->status[i].prev_sample = (signed short)samples[i];
} }
if (avctx->trellis > 0) { if (avctx->trellis > 0) {
@@ -627,7 +611,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
} }
av_free(buf); av_free(buf);
} else { } else {
for (i = 1; i < frame->nb_samples; i++) { for (i = 1; i < avctx->frame_size; i++) {
put_bits(&pb, 4, adpcm_ima_compress_sample(&c->status[0], put_bits(&pb, 4, adpcm_ima_compress_sample(&c->status[0],
samples[avctx->channels * i])); samples[avctx->channels * i]));
if (avctx->channels == 2) if (avctx->channels == 2)
@@ -636,6 +620,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
} }
} }
flush_put_bits(&pb); flush_put_bits(&pb);
dst += put_bits_count(&pb) >> 3;
break; break;
} }
case CODEC_ID_ADPCM_MS: case CODEC_ID_ADPCM_MS:
@@ -683,7 +668,7 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
} }
break; break;
case CODEC_ID_ADPCM_YAMAHA: case CODEC_ID_ADPCM_YAMAHA:
n = frame->nb_samples / 2; n = avctx->frame_size / 2;
if (avctx->trellis > 0) { if (avctx->trellis > 0) {
FF_ALLOC_OR_GOTO(avctx, buf, 2 * n * 2, error); FF_ALLOC_OR_GOTO(avctx, buf, 2 * n * 2, error);
n *= 2; n *= 2;
@@ -707,14 +692,10 @@ static int adpcm_encode_frame(AVCodecContext *avctx, AVPacket *avpkt,
} }
break; break;
default: default:
return AVERROR(EINVAL);
}
avpkt->size = pkt_size;
*got_packet_ptr = 1;
return 0;
error: error:
return AVERROR(ENOMEM); return -1;
}
return dst - frame;
} }
@@ -725,7 +706,7 @@ AVCodec ff_ ## name_ ## _encoder = { \
.id = id_, \ .id = id_, \
.priv_data_size = sizeof(ADPCMEncodeContext), \ .priv_data_size = sizeof(ADPCMEncodeContext), \
.init = adpcm_encode_init, \ .init = adpcm_encode_init, \
.encode2 = adpcm_encode_frame, \ .encode = adpcm_encode_frame, \
.close = adpcm_encode_close, \ .close = adpcm_encode_close, \
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16, \ .sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16, \
AV_SAMPLE_FMT_NONE}, \ AV_SAMPLE_FMT_NONE}, \

View File

@@ -47,7 +47,7 @@ int avpriv_adx_decode_header(AVCodecContext *avctx, const uint8_t *buf,
offset = AV_RB16(buf + 2) + 4; offset = AV_RB16(buf + 2) + 4;
/* if copyright string is within the provided data, validate it */ /* if copyright string is within the provided data, validate it */
if (bufsize >= offset && memcmp(buf + offset - 6, "(c)CRI", 6)) if (bufsize >= offset && offset >= 6 && memcmp(buf + offset - 6, "(c)CRI", 6))
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
/* check for encoding=3 block_size=18, sample_size=4 */ /* check for encoding=3 block_size=18, sample_size=4 */

Some files were not shown because too many files have changed in this diff Show More