ffmpeg.git
5 months agolavc/dpx: Support 10-bit packing method b (msbpad).
Carl Eugen Hoyos [Sat, 16 Jun 2018 15:47:46 +0000 (17:47 +0200)]
lavc/dpx: Support 10-bit packing method b (msbpad).

5 months agolavc/dpx: Support 12-bit packing method b (msbpad).
Carl Eugen Hoyos [Sat, 16 Jun 2018 15:11:58 +0000 (17:11 +0200)]
lavc/dpx: Support 12-bit packing method b (msbpad).

5 months agohwcontext_opencl: use ff_hwframe_map_replace()
Rostislav Pehlivanov [Fri, 20 Apr 2018 04:30:04 +0000 (05:30 +0100)]
hwcontext_opencl: use ff_hwframe_map_replace()

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
5 months agohwcontext_internal: add ff_hwframe_map_replace
Rostislav Pehlivanov [Fri, 20 Apr 2018 04:30:03 +0000 (05:30 +0100)]
hwcontext_internal: add ff_hwframe_map_replace

Used to fix unmapping when no direct interop exists between APIs.

Signed-off-by: Rostislav Pehlivanov <atomnuker@gmail.com>
5 months agoavformat/movenc: allow hdlr name field to be empty
Gyan Doshi [Thu, 21 Jun 2018 06:03:00 +0000 (11:33 +0530)]
avformat/movenc: allow hdlr name field to be empty

Both QTFF and the ISOBMFF standards allow it.

Fixes #7262

5 months agolavfi: make vf_colorspace use functions from colorspace.c
Ruiling Song [Tue, 19 Jun 2018 01:57:32 +0000 (09:57 +0800)]
lavfi: make vf_colorspace use functions from colorspace.c

These functions are shared among colorspace related filters.

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
5 months agolavfi: add opencl tonemap filter
Ruiling Song [Tue, 19 Jun 2018 01:57:31 +0000 (09:57 +0800)]
lavfi: add opencl tonemap filter

This filter does HDR(HDR10/HLG) to SDR conversion with tone-mapping.

An example command to use this filter with vaapi codecs:
FFMPEG -init_hw_device vaapi=va:/dev/dri/renderD128 -init_hw_device \
opencl=ocl@va -hwaccel vaapi -hwaccel_device va -hwaccel_output_format \
vaapi -i INPUT -filter_hw_device ocl -filter_complex \
'[0:v]hwmap,tonemap_opencl=t=bt2020:tonemap=linear:format=p010[x1]; \
[x1]hwmap=derive_device=vaapi:reverse=1' -c:v hevc_vaapi -profile 2 OUTPUT

Signed-off-by: Ruiling Song <ruiling.song@intel.com>
5 months agolavfi: Add boxblur_opencl filter
Danil Iashchenko [Wed, 20 Jun 2018 01:33:02 +0000 (04:33 +0300)]
lavfi: Add boxblur_opencl filter

Behaves like existing boxblur filter.

5 months agoffplay: ignore keypress events before a window is created
Marton Balint [Mon, 11 Jun 2018 21:19:37 +0000 (23:19 +0200)]
ffplay: ignore keypress events before a window is created

Current ffplay code assumes that the read thread is in its main loop before any
key events are captured, but apparently on IOS even keypresses without a window
are forwared.

Fixes ticket #7252.

Signed-off-by: Marton Balint <cus@passwd.hu>
5 months agoavcodec/libzvbi-teletextdec: propagate ERASE_PAGE flag for repeated subtitle page...
Marton Balint [Sun, 10 Jun 2018 22:53:13 +0000 (00:53 +0200)]
avcodec/libzvbi-teletextdec: propagate ERASE_PAGE flag for repeated subtitle page headers

This works around a libzvbi bug (a corner case in the teletext spec):

https://sourceforge.net/p/zapping/bugs/203/
https://sourceforge.net/p/zapping/patches/20/

Fixes samples/ffmpeg-bugs/trac/ticket2086/RBT_20100801_1835.ts.

Signed-off-by: Marton Balint <cus@passwd.hu>
5 months agolavf/mov: Do not fail hard for truncated stsz atoms.
Carl Eugen Hoyos [Sat, 16 Jun 2018 12:22:52 +0000 (14:22 +0200)]
lavf/mov: Do not fail hard for truncated stsz atoms.

Fixes ticket #6433.

6 months agoavformat/movenc: read track title from correct key
Gyan Doshi [Sat, 16 Jun 2018 10:01:51 +0000 (15:31 +0530)]
avformat/movenc: read track title from correct key

da9cc22d5bd allowed the MOV muxer to relay a custom stream handler name,
whether populated from the input stream or user-set. However, the entry
key didn't match the key set by the MOV demuxer, so it wasn't
effective. Fixed.

Due to the change, four FATE refs have to be updated. Verified that the
target payload of the tests hasn't changed in terms of CRC.

6 months agoavcodec/libx265: apply lavc maxrate, bufsize & rc_init_occupancy
Gyan Doshi [Mon, 18 Jun 2018 06:39:54 +0000 (12:09 +0530)]
avcodec/libx265: apply lavc maxrate, bufsize & rc_init_occupancy

CLI options -maxrate, -bufsize and -rc_init_occupancy can now be picked
up by the x265 wrapper.  Min. rc init has to be 1001 to avoid x265
setting it to vbv-bufsize.

6 months agoavdevice/v4l2enc: add video4linux2 name alias
Lou Logan [Thu, 14 Jun 2018 21:12:27 +0000 (13:12 -0800)]
avdevice/v4l2enc: add video4linux2 name alias

Makes the v4l2 outdev name consistent with the v4l2 indev name.

Signed-off-by: Lou Logan <lou@lrcd.com>
6 months agoavformat/mpegts: parse large PMTs with multiple tables
Aman Gupta [Mon, 11 Jun 2018 07:43:31 +0000 (00:43 -0700)]
avformat/mpegts: parse large PMTs with multiple tables

In 9152c1e4955, the mpegts parser was taught how to parse
PMT sections which contained multiple tables. That commit
fixed parsing of PMT packets from some cable providers,
which included a special SCTE table (0xc0) before the
standard program map table (0x2).

Sometimes, however, the combined 0xc0 and 0x2 tables are
larger than a single TS packet (188 bytes). The mpegts parser
already attempts to parse sections which span multiple packets,
but still assumed that the split section only contained one
table.

This patch fixes parsing of such a sample[1].

Before:

    Input #0, mpegts, from 'combined-pmt-tids-split.ts':
      Duration: 00:00:01.26, start: 39188.931756, bitrate: 597 kb/s
      Program 1
      No Program
        Stream #0:0[0xeff]: Audio: ac3, 48000 Hz, mono, fltp, 64 kb/s
        Stream #0:1[0xefd]: Audio: mp3, 0 channels, fltp
        Stream #0:2[0xefe]: Unknown: none

After:

    Input #0, mpegts, from 'combined-pmt-tids-split.ts':
      Duration: 00:00:01.27, start: 39188.931756, bitrate: 589 kb/s
      Program 1
        Stream #0:0[0xefd]: Video: h264 ([27][0][0][0] / 0x001B), none, 59.94 fps, 59.94 tbr, 90k tbn, 180k tbc
        Stream #0:1[0xefe](eng): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fltp, 384 kb/s
        Stream #0:2[0xeff](spa): Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, mono, fltp, 64 kb/s
        Stream #0:3[0xf00]: Data: scte_35
        Stream #0:4[0xf01]: Unknown: none (ETV1 / 0x31565445)
        Stream #0:5[0xf02]: Unknown: none (ETV1 / 0x31565445)
        Stream #0:6[0xf03]: Unknown: none ([192][0][0][0] / 0x00C0)

With the patch, the PMT is parsed correctly so the streams are
created in the correct order, are associated with "Program 1",
and their codecs are set correctly.

[1] https://s3.amazonaws.com/tmm1/combined-pmt-tids-split.ts

Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoRevert "avcodec/mediacodecdec: wait on first frame after input buffers are full"
Aman Gupta [Mon, 18 Jun 2018 18:53:27 +0000 (11:53 -0700)]
Revert "avcodec/mediacodecdec: wait on first frame after input buffers are full"

@xyz reported a regression on his Sony Xperia Z3 Tablet Compact where
playback would intermittently fail to start, essentially deadlocking in
the decoder. Bisecting narrowed down the issue to this commit, which was
meant as an optimization but is not necessary.

This reverts commit a75bb5496ac6e7e194f1c6fd3b87f02a52e74adb.

Signed-off-by: Aman Gupta <aman@tmm1.net>
6 months agoavcodec/videotoolboxenc: fix invalid session on iOS
Thomas Guillem [Thu, 14 Jun 2018 15:48:07 +0000 (17:48 +0200)]
avcodec/videotoolboxenc: fix invalid session on iOS

Cf. comment. Restart the VT session when the APP goes from foreground to
background and vice versa.

Signed-off-by: Aman Gupta <aman@tmm1.net>
6 months agoavcodec/videotoolboxenc: split initialization
Thomas Guillem [Mon, 11 Jun 2018 14:21:18 +0000 (16:21 +0200)]
avcodec/videotoolboxenc: split initialization

Split vtenc_init() into vtenc_init() (VTEncContext initialization) and
vtenc_configure_encoder() (creates the vt session).

This commit will allow to restart the vt session while encoding.

Signed-off-by: Aman Gupta <aman@tmm1.net>
6 months agoavcodec/videotoolboxenc: fix mutex/cond leak in error path
Thomas Guillem [Mon, 11 Jun 2018 14:21:17 +0000 (16:21 +0200)]
avcodec/videotoolboxenc: fix mutex/cond leak in error path

The leak could happen when the vtenc_create_encoder() function failed.

Signed-off-by: Aman Gupta <aman@tmm1.net>
6 months agoavcodec/vc1: remove unused ff_vc1_loop_filter_iblk
Jerome Borsboom [Wed, 6 Jun 2018 18:47:32 +0000 (20:47 +0200)]
avcodec/vc1: remove unused ff_vc1_loop_filter_iblk

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 months agoavcodec/vc1: rewrite vc1_decode_i_blocks to align with VC-1 spec
Jerome Borsboom [Tue, 12 Jun 2018 09:34:58 +0000 (11:34 +0200)]
avcodec/vc1: rewrite vc1_decode_i_blocks to align with VC-1 spec

Change vc1_decode_i_blocks to use vc1_put_blocks_clamped and
ff_vc1_i_loop_filter.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 months agoavcodec/vc1: add Simple and Main profile to vc1_put_signed_blocks_clamped
Jerome Borsboom [Fri, 8 Jun 2018 09:01:26 +0000 (11:01 +0200)]
avcodec/vc1: add Simple and Main profile to vc1_put_signed_blocks_clamped

Simple and Main Profile also need unsigned put_pixels_clamped. Add an argument
to choose between signed and unsigned put_pixels and change function name to
vc1_put_blocks_clamped.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 months agoRevert "avcodec/vc1: add Simple and Main profile to vc1_put_signed_blocks_clamped"
Carl Eugen Hoyos [Mon, 18 Jun 2018 09:53:56 +0000 (11:53 +0200)]
Revert "avcodec/vc1: add Simple and Main profile to vc1_put_signed_blocks_clamped"

This reverts commit 2065317db6dc3a219f8ed2de427fe7e19e02eb68.

I committed a wrong version of this patch.
Also reverts the follow-up commits 77a3dfb3 and 8331e591.

6 months agolibavfilter/opencl: Add macro for setting opencl kernel arguments
Danil Iashchenko [Fri, 15 Jun 2018 02:55:34 +0000 (05:55 +0300)]
libavfilter/opencl: Add macro for setting opencl kernel arguments

6 months agoavcodec/vc1: support multi-slice field interlaced pictures with hwaccel
Jerome Borsboom [Wed, 9 May 2018 05:50:28 +0000 (07:50 +0200)]
avcodec/vc1: support multi-slice field interlaced pictures with hwaccel

When using hardware accelerated decoding for multi-slice field interlaced pictures,
only the first slice was decoded. This patch adds the neccesary looping over the
remaining slices that may exist in field interlaced pictures. Additionally, we align
the calculation of mby_start for the second field with the method given in VC-1 spec.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 months agoavcodec/vaapi_vc1: slice_vertical_position starts from zero for the second field
Jerome Borsboom [Wed, 9 May 2018 05:50:23 +0000 (07:50 +0200)]
avcodec/vaapi_vc1: slice_vertical_position starts from zero for the second field

Contrary to VC-1 spec, VAAPI expects the row address of the first
macroblock row in the first slice to start from zero for the second
field in a field interlaced picture.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 months agofftools/cmdutils: Replace the number by macro for bprint init
Jun Zhao [Sun, 10 Jun 2018 07:53:24 +0000 (15:53 +0800)]
fftools/cmdutils: Replace the number by macro for bprint init

Replace the number by macro for bprint init.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
6 months agotests/bprint: Replace the number by macro for bprint init
Jun Zhao [Sun, 10 Jun 2018 08:04:52 +0000 (16:04 +0800)]
tests/bprint: Replace the number by macro for bprint init

Replace the number by macro for bprint init.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
6 months agoavutil/log: Replace the number by macro for bprint init
Jun Zhao [Sun, 10 Jun 2018 08:03:40 +0000 (16:03 +0800)]
avutil/log: Replace the number by macro for bprint init

Replace the number by macro for bprint init.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
6 months agolavf/tedcaptionsdec: Replace the number by macro for bprint init
Jun Zhao [Sun, 10 Jun 2018 08:02:57 +0000 (16:02 +0800)]
lavf/tedcaptionsdec: Replace the number by macro for bprint init

Replace the number by macro for bprint init.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
6 months agolavf/icecast: Replace the number by macro for bprint init
Jun Zhao [Sun, 10 Jun 2018 08:02:15 +0000 (16:02 +0800)]
lavf/icecast: Replace the number by macro for bprint init

Replace the number by macro for bprint init.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
6 months agolavfi/graphdump: Replace the number by macro for bprint init
Jun Zhao [Sun, 10 Jun 2018 08:01:35 +0000 (16:01 +0800)]
lavfi/graphdump: Replace the number by macro for bprint init

Replace the number by macro for bprint init.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
6 months agolavfi/af_amerge: Replace the number by macro for bprint init
Jun Zhao [Sun, 10 Jun 2018 08:00:49 +0000 (16:00 +0800)]
lavfi/af_amerge: Replace the number by macro for bprint init

Replace the number by macro for bprint init.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
6 months agolavc/pngdec: Replace the number by macro for bprint init
Jun Zhao [Sun, 10 Jun 2018 08:00:02 +0000 (16:00 +0800)]
lavc/pngdec: Replace the number by macro for bprint init

Replace the number by macro for bprint init.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
6 months agolavc/dvdsubenc: Replace the number by macro for bprint init
Jun Zhao [Sun, 10 Jun 2018 07:59:03 +0000 (15:59 +0800)]
lavc/dvdsubenc: Replace the number by macro for bprint init

Replace the number by macro for bprint init.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
6 months agofftools/ffmpeg_filter: Replace the number by macro for bprint init
Jun Zhao [Sun, 10 Jun 2018 07:57:26 +0000 (15:57 +0800)]
fftools/ffmpeg_filter: Replace the number by macro for bprint init

Replace the number by macro for bprint init.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
6 months agofftools/ffmpeg: Replace the number by macro for bprint init
Jun Zhao [Sun, 10 Jun 2018 07:56:04 +0000 (15:56 +0800)]
fftools/ffmpeg: Replace the number by macro for bprint init

Replace the number by macro for bprint init.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
6 months agoavcodec/vc1: remove unused ff_vc1_loop_filter_iblk
Jerome Borsboom [Wed, 6 Jun 2018 18:47:32 +0000 (20:47 +0200)]
avcodec/vc1: remove unused ff_vc1_loop_filter_iblk

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 months agoavcodec/vc1: rewrite vc1_decode_i_blocks to align with VC-1 spec
Jerome Borsboom [Tue, 12 Jun 2018 09:34:58 +0000 (11:34 +0200)]
avcodec/vc1: rewrite vc1_decode_i_blocks to align with VC-1 spec

Change vc1_decode_i_blocks to use vc1_put_blocks_clamped and
ff_vc1_i_loop_filter.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 months agoavcodec/vc1: add Simple and Main profile to vc1_put_signed_blocks_clamped
Jerome Borsboom [Wed, 6 Jun 2018 18:47:23 +0000 (20:47 +0200)]
avcodec/vc1: add Simple and Main profile to vc1_put_signed_blocks_clamped

Simple and Main profile also need unsigned put_pixels_clamped. Add an argument
to choose between signed and unsigned put_pixels and change function name to
vc1_put_blocks_clamped.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 months agoavcodec/vc1: fix overlap and loop filtering for Simple and Main profile
Jerome Borsboom [Fri, 8 Jun 2018 09:01:20 +0000 (11:01 +0200)]
avcodec/vc1: fix overlap and loop filtering for Simple and Main profile

Overlap filtering I and BI frames for Simple and Main profile is only
dependent on PQUANT. Restrict testing for CONDOVER and OVERFLAGS to
advanced profile. Change from mb_width to end_mb_x in ff_vc1_i_loop_filter
to avoid breaking the Microsoft Screen 2 decoder.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 months agoavcodec/vc1: fix overlap smoothing filter for P frames
Jerome Borsboom [Wed, 30 May 2018 11:53:48 +0000 (13:53 +0200)]
avcodec/vc1: fix overlap smoothing filter for P frames

The v_overlap_filter needs to run on the colocated block of the previous
macroblock. For the luma plane, the colocated block is located two blocks
on the left instead of one. In addition, the overlap filter needs to run
on the non-edge blocks of the first macroblock row and column.

Fixes ticket #7171.

Signed-off-by: Jerome Borsboom <jerome.borsboom@carpalis.nl>
6 months agolavc/dpx: Allow packed 12-bit little-endian images.
Carl Eugen Hoyos [Sat, 16 Jun 2018 14:18:06 +0000 (16:18 +0200)]
lavc/dpx: Allow packed 12-bit little-endian images.

Can be tested with GraphicsMagick.

6 months agofate: correct filename references of qt-faststart binary
Gyan Doshi [Fri, 15 Jun 2018 17:08:26 +0000 (22:38 +0530)]
fate: correct filename references of qt-faststart binary

qt-faststart build doesn't have PROGSSUF added.

6 months agolavf/aviobuf: Increase Statistics verbosity to AV_LOG_VERBOSE.
Carl Eugen Hoyos [Thu, 14 Jun 2018 09:21:31 +0000 (11:21 +0200)]
lavf/aviobuf: Increase Statistics verbosity to AV_LOG_VERBOSE.

6 months agoavcodec/aacdec_fixed: Fix undefined integer overflow in apply_independent_coupling_fi...
Michael Niedermayer [Thu, 14 Jun 2018 14:41:49 +0000 (16:41 +0200)]
avcodec/aacdec_fixed: Fix undefined integer overflow in apply_independent_coupling_fixed()

Fixes: signed integer overflow: 1195517 * 2048 cannot be represented in type 'int'
Fixes: 8636/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-4695836326887424

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/dirac_dwt_template: Fix undefined behavior in interleave()
Michael Niedermayer [Thu, 14 Jun 2018 14:37:32 +0000 (16:37 +0200)]
avcodec/dirac_dwt_template: Fix undefined behavior in interleave()

Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 8697/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5197148130902016

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavutil/common: Fix undefined behavior in av_clip_uintp2_c()
Michael Niedermayer [Thu, 14 Jun 2018 13:41:33 +0000 (15:41 +0200)]
avutil/common: Fix undefined behavior in av_clip_uintp2_c()

Fixes: negation of -2147483648 cannot be represented in type 'int'; cast to an unsigned type to negate this value to itself
Fixes: 8521/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5639024952737792

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/decode: Consider STRIDE_ALIGN in get_buffer_internal() when checking width
Michael Niedermayer [Thu, 14 Jun 2018 13:00:55 +0000 (15:00 +0200)]
avcodec/decode: Consider STRIDE_ALIGN in get_buffer_internal() when checking width

STRIDE_ALIGN is not known in libavutil so av_image_check_size* cannot consider it

Fixes: OOM
Fixes: 8291/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SNOW_fuzzer-5176528009691136

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoqt-faststart - print errors to stderr
erankor [Thu, 14 Jun 2018 11:06:14 +0000 (14:06 +0300)]
qt-faststart - print errors to stderr

instead of stdout

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoconfigure: simplify ffnvcodec version logic
Timo Rothenpieler [Fri, 15 Jun 2018 09:18:37 +0000 (11:18 +0200)]
configure: simplify ffnvcodec version logic

6 months agoavcodec/nvenc: enable nvenc encoder instance reuse
Pavel Koshevoy [Thu, 7 Jun 2018 15:08:15 +0000 (09:08 -0600)]
avcodec/nvenc: enable nvenc encoder instance reuse

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
6 months agolavfi/atempo: raise max tempo limit (v2)
Pavel Koshevoy [Fri, 15 Jun 2018 01:19:17 +0000 (19:19 -0600)]
lavfi/atempo: raise max tempo limit (v2)

6 months agolavc/dpx: Reset n_datum for every new line when decoding 12bit.
Carl Eugen Hoyos [Wed, 13 Jun 2018 12:19:45 +0000 (14:19 +0200)]
lavc/dpx: Reset n_datum for every new line when decoding 12bit.

Fixes odd unpacked 12bit decoding.
Reported-by: Piotr Bandurski
6 months agoffmpeg: assert that audio packet duration in process_input_packet() is non negative
Michael Niedermayer [Wed, 13 Jun 2018 14:50:39 +0000 (16:50 +0200)]
ffmpeg: assert that audio packet duration in process_input_packet() is non negative

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agofftools/ffmpeg: Fallback to duration if sample rate is unavailable
Michael Niedermayer [Tue, 1 May 2018 20:44:07 +0000 (22:44 +0200)]
fftools/ffmpeg: Fallback to duration if sample rate is unavailable

Regression since: af1761f7
Fixes: Division by 0
Fixes: ffmpeg_crash_1

Found-by: Thuan Pham, Marcel Böhme, Andrew Santosa and Alexandru Razvan Caciulescu with AFLSmart
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavformat/mov: Only set pkt->duration to non negative values
Michael Niedermayer [Wed, 16 May 2018 21:35:58 +0000 (23:35 +0200)]
avformat/mov: Only set pkt->duration to non negative values

Reviewed-by: Sasi Inguva <isasi@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agodoc/formats: get fflags values up-to-date
Gyan Doshi [Thu, 14 Jun 2018 11:58:45 +0000 (17:28 +0530)]
doc/formats: get fflags values up-to-date

6 months agoqt-faststart: add fate test for stco overflow
erankor [Mon, 11 Jun 2018 11:45:11 +0000 (14:45 +0300)]
qt-faststart: add fate test for stco overflow

verify that the stco atom is upgraded to co64 when the addition of moov
size to the offsets results in an overflow

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoqt-faststart - stco offset bug fix
erankor [Fri, 1 Jun 2018 06:55:45 +0000 (09:55 +0300)]
qt-faststart - stco offset bug fix

when the last offsets in the stco atom are close to 4GB, the addition of
the moov atom size can overflow, causing corruption near the end of the
mp4 file.
this patch upgrades all stco atoms to co64 when such an edge case is
detected. in order to accomplish this, the implementation was changed to
walk the atom tree, instead of searching for the strings 'stco'/'co64'.
this was required since when an stco atom is changed to co64, its size
changes, and the sizes of all containing atoms (moov, trak, etc.) have
to be updated as well.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoqt-faststart: add validation on ftyp atom size
erankor [Wed, 13 Jun 2018 08:48:20 +0000 (11:48 +0300)]
qt-faststart: add validation on ftyp atom size

avoid trying to allocate an unreasonably sized buffer on corrupt files

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/mpeg4videodec: Clear bits_per_raw_sample if it has originated from a previous...
Michael Niedermayer [Sat, 9 Jun 2018 20:25:38 +0000 (22:25 +0200)]
avcodec/mpeg4videodec: Clear bits_per_raw_sample if it has originated from a previous instance

Fixes: assertion failure
Fixes: ffmpeg_crash_5.avi

Found-by: Thuan Pham <thuanpv@comp.nus.edu.sg>, Marcel Böhme, Andrew Santosa and Alexandru Razvan Caciulescu with AFLSmart
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agodoc/devices: order alphabetically and add missing v4l2 outdev
Lou Logan [Wed, 13 Jun 2018 19:21:12 +0000 (11:21 -0800)]
doc/devices: order alphabetically and add missing v4l2 outdev

Signed-off-by: Lou Logan <lou@lrcd.com>
6 months agoavformat/movenc: fix recognization of cover image streams
Timo Teräs [Mon, 4 Jun 2018 14:36:19 +0000 (17:36 +0300)]
avformat/movenc: fix recognization of cover image streams

For chapter images, the mov demux produces streams with disposition set
to attached_pic+timed_thumbnails. This patch fixes to properly recognize
streams that should be encoded as cover image (ones with only and only
attached_pic disposition set).

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavformat/movenc: properly handle cover image codecs
Timo Teräs [Thu, 31 May 2018 23:24:39 +0000 (02:24 +0300)]
avformat/movenc: properly handle cover image codecs

Find codec tag for attached images using appropriate list of
supported image formats.

This fixes writing the cover image to m4v/m4a and other container
formats that do not allow these codecs as a track.

Signed-off-by: Timo Teräs <timo.teras@iki.fi>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavformat/mov: Add check for per-sample IV size.
Jacob Trimble [Tue, 12 Jun 2018 21:26:20 +0000 (14:26 -0700)]
avformat/mov: Add check for per-sample IV size.

Found by Chrome's ClusterFuzz: http://crbug.com/849062.

Signed-off-by: Jacob Trimble <modmaker@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoconfigure: The eac3_core bitstream filter needs the ac3 parser.
Carl Eugen Hoyos [Tue, 12 Jun 2018 08:02:44 +0000 (10:02 +0200)]
configure: The eac3_core bitstream filter needs the ac3 parser.

Fixes linking with "--disable-everything --enable-bsf=eac3_core".

6 months agoavformat: deprecate unused MP4A_LATM flag
Gyan Doshi [Sun, 10 Jun 2018 14:48:10 +0000 (20:18 +0530)]
avformat: deprecate unused MP4A_LATM flag

A generic lavf flag for AAC LATM packetization for the RTP muxer was
added in ef409645f0 and then made inert 20 days later in 0832122880
when a private muxer option was added and the generic flag no longer
read.

6 months agoavdevice/decklink_dec: capture timecode to metadata when requested
Jon Morley [Thu, 31 May 2018 09:45:07 +0000 (02:45 -0700)]
avdevice/decklink_dec: capture timecode to metadata when requested

If the user provides a valid timecode_format look for timecode of that
format in the capture and if found store it on the video avstream's
metadata.

Slightly modified by Marton Balint to capture per-frame timecode as well.

Signed-off-by: Marton Balint <cus@passwd.hu>
6 months agoavdevice/decklink_common: Move DECKLINK_* string functions into header
Jon Morley [Fri, 25 May 2018 18:41:06 +0000 (11:41 -0700)]
avdevice/decklink_common: Move DECKLINK_* string functions into header

This allows other decklink source access to these cross-platform
convenience functions.

Signed-off-by: Marton Balint <cus@passwd.hu>
6 months agoavdevice/decklink_dec: use std::atomic for decklink_input_callback refcounting
Marton Balint [Mon, 4 Jun 2018 08:27:42 +0000 (10:27 +0200)]
avdevice/decklink_dec: use std::atomic for decklink_input_callback refcounting

Also remove the callback from the context, and add proper error handling.

Signed-off-by: Marton Balint <cus@passwd.hu>
6 months agoavdevice/decklink_dec: use a custom memory allocator
Marton Balint [Mon, 4 Jun 2018 08:02:46 +0000 (10:02 +0200)]
avdevice/decklink_dec: use a custom memory allocator

The default memory allocator is limited in the max number of frames available,
and therefore caused frame drops if the frames were not freed fast enough.

Signed-off-by: Marton Balint <cus@passwd.hu>
6 months agolavc/qsv: suppress code scan complain
Zhong Li [Wed, 9 May 2018 06:07:40 +0000 (14:07 +0800)]
lavc/qsv: suppress code scan complain

Suppress the complain "variables 'type' is used but maybe uninitialized".

6 months agopixdesc: Only check against valid entries when iterating over lists of enums
Derek Buitenhuis [Fri, 8 Jun 2018 15:40:29 +0000 (16:40 +0100)]
pixdesc: Only check against valid entries when iterating over lists of enums

Some of these enums have gaps in between their values, since they correspond
to the values in various specs, instead of being an incrementing list.

Fixes segfaults when, for example, using the valid API call:

   av_color_primaries_from_name("jecdec-p22");

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
6 months agoavcodec/h264_slice: Fix overflow in recovery_frame computation
Michael Niedermayer [Fri, 8 Jun 2018 17:07:22 +0000 (19:07 +0200)]
avcodec/h264_slice: Fix overflow in recovery_frame computation

Fixes: signed integer overflow: 15 + 2147483646 cannot be represented in type 'int'
Fixes: 8381/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-6225533137321984

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/h264_ps: Move MAX_LOG2_MAX_FRAME_NUM to header so it can be used in h264_sei
Michael Niedermayer [Sun, 10 Jun 2018 15:02:47 +0000 (17:02 +0200)]
avcodec/h264_ps: Move MAX_LOG2_MAX_FRAME_NUM to header so it can be used in h264_sei

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/h264_mc_template: Only prefetch motion if the list is used.
Michael Niedermayer [Fri, 8 Jun 2018 16:25:14 +0000 (18:25 +0200)]
avcodec/h264_mc_template: Only prefetch motion if the list is used.

Fixes: index 59 out of bounds for type 'H264Ref [48]'
Fixes: 8232/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5703295145345024

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/xwddec: Use ff_set_dimensions()
Michael Niedermayer [Thu, 7 Jun 2018 22:42:31 +0000 (00:42 +0200)]
avcodec/xwddec: Use ff_set_dimensions()

Fixes: OOM
Fixes: 8178/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_XWD_fuzzer-4844793342459904

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/wavpack: Fix overflow in adding tail
Michael Niedermayer [Thu, 7 Jun 2018 22:07:04 +0000 (00:07 +0200)]
avcodec/wavpack: Fix overflow in adding tail

Fixes: signed integer overflow: 2146907204 + 26846088 cannot be represented in type 'int'
Fixes: 8105/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WAVPACK_fuzzer-6233036682166272

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/libzvbi-teletextdec: add support for selecting subtitle pages only
Marton Balint [Sat, 28 Apr 2018 19:42:34 +0000 (21:42 +0200)]
avcodec/libzvbi-teletextdec: add support for selecting subtitle pages only

Signed-off-by: Marton Balint <cus@passwd.hu>
6 months agolsws/rgb2rgb_template: Do not compile unneeded shuffle functions on big-endian.
Carl Eugen Hoyos [Sun, 10 Jun 2018 01:19:59 +0000 (03:19 +0200)]
lsws/rgb2rgb_template: Do not compile unneeded shuffle functions on big-endian.

Fixes the following warnings:
In file included from libswscale/rgb2rgb.c:128:0:
libswscale/rgb2rgb_template.c:346:13: warning: 'shuffle_bytes_3210_c' defined but not used
libswscale/rgb2rgb_template.c:346:13: warning: 'shuffle_bytes_3012_c' defined but not used
libswscale/rgb2rgb_template.c:346:13: warning: 'shuffle_bytes_1230_c' defined but not used

6 months agolavc/aacsbr: fix make checkheaders warning
Jun Zhao [Mon, 4 Jun 2018 13:42:18 +0000 (21:42 +0800)]
lavc/aacsbr: fix make checkheaders warning

move the the function aacsbr_tableinit definition from header file
to .c file to fix make checkheaders warning.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
6 months agolavc/dolby_e: fix make checkheaders warning
Jun Zhao [Mon, 4 Jun 2018 13:32:37 +0000 (21:32 +0800)]
lavc/dolby_e: fix make checkheaders warning

move the the function init_tables() definitions from header file
to .c file to fix make checkheaders warning.

Signed-off-by: Jun Zhao <mypopydev@gmail.com>
6 months agoffmpeg: Fail if the user requested impossible subtitle encoding.
Carl Eugen Hoyos [Wed, 6 Jun 2018 19:09:38 +0000 (21:09 +0200)]
ffmpeg: Fail if the user requested impossible subtitle encoding.

Fixes ticket #7239.

6 months agoavformat/mov: Fix reading saio/saiz for clear content.
Jacob Trimble [Thu, 7 Jun 2018 17:29:33 +0000 (10:29 -0700)]
avformat/mov: Fix reading saio/saiz for clear content.

This validates that the common encryption saio/saiz atoms only appear
when the data is actually encrypted.  This also ignores those atoms
in clear content.

Found by Chrome's ClusterFuzz: http://crbug.com/850389

Signed-off-by: Jacob Trimble <modmaker@google.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agodoc/filters: change subtitles example to hint at correct color syntax
Gyan Doshi [Sat, 9 Jun 2018 07:06:24 +0000 (12:36 +0530)]
doc/filters: change subtitles example to hint at correct color syntax

libass changed their color syntax in 2015 to TBGR

6 months agoavformat/mxfdec: add support for recognizing timed text streams
Marton Balint [Sat, 19 May 2018 10:29:51 +0000 (12:29 +0200)]
avformat/mxfdec: add support for recognizing timed text streams

Signed-off-by: Marton Balint <cus@passwd.hu>
6 months agoavcodec/avcodec.h: add AV_CODEC_ID_TTML
Marton Balint [Sat, 19 May 2018 09:06:23 +0000 (11:06 +0200)]
avcodec/avcodec.h: add AV_CODEC_ID_TTML

Signed-off-by: Marton Balint <cus@passwd.hu>
6 months agoavformat/mxfdec: remove check for NULL MXFTrack in mxf_set_pts
Marton Balint [Wed, 30 May 2018 23:32:29 +0000 (01:32 +0200)]
avformat/mxfdec: remove check for NULL MXFTrack in mxf_set_pts

It cannot happen for video streams.

Signed-off-by: Marton Balint <cus@passwd.hu>
6 months agoavformat/mxfdec: only disallow seek on metadata streams
Marton Balint [Wed, 30 May 2018 23:29:06 +0000 (01:29 +0200)]
avformat/mxfdec: only disallow seek on metadata streams

Signed-off-by: Marton Balint <cus@passwd.hu>
6 months agoavformat/mxfdec: recognize SMPTE 436 VBI data
Marton Balint [Sat, 19 May 2018 09:17:20 +0000 (11:17 +0200)]
avformat/mxfdec: recognize SMPTE 436 VBI data

Signed-off-by: Marton Balint <cus@passwd.hu>
6 months agoavformat/mxfdec: use MXFCodecUL struct to store essence description for data_essence_...
Marton Balint [Fri, 18 May 2018 19:06:17 +0000 (21:06 +0200)]
avformat/mxfdec: use MXFCodecUL struct to store essence description for data_essence_container_uls

Signed-off-by: Marton Balint <cus@passwd.hu>
6 months agoffmpeg: mark sseof as an input-only option
Gyan Doshi [Thu, 7 Jun 2018 17:45:35 +0000 (23:15 +0530)]
ffmpeg: mark sseof as an input-only option

6 months agolibavfilter/dnn_interface.c: fix av_freep dnn_module.
Sergey Lavrushkin [Thu, 7 Jun 2018 15:22:22 +0000 (18:22 +0300)]
libavfilter/dnn_interface.c: fix av_freep dnn_module.

Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
6 months agolibavfilter/vf_srcnn.c: adds DNN module backend AVOption, changes AV_LOG_INFO message...
Sergey Lavrushkin [Tue, 5 Jun 2018 22:44:40 +0000 (01:44 +0300)]
libavfilter/vf_srcnn.c: adds DNN module backend AVOption, changes AV_LOG_INFO message to AV_LOG_VERBOSE.

Signed-off-by: Pedro Arthur <bygrandao@gmail.com>
6 months agoMAINTAINERS: add myself to qsv section
Zhong Li [Mon, 4 Jun 2018 09:41:57 +0000 (17:41 +0800)]
MAINTAINERS: add myself to qsv section

Signed-off-by: Zhong Li <zhong.li@intel.com>
6 months agoavcodec/shorten: Fix multiple integer overflows
Michael Niedermayer [Tue, 5 Jun 2018 11:19:35 +0000 (13:19 +0200)]
avcodec/shorten: Fix multiple integer overflows

Fixes: signed integer overflow: 3 * 1006632960 cannot be represented in type 'int'
Fixes: 8278/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5692857166856192

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/shorten: Fix undefined shift in fix_bitshift()
Michael Niedermayer [Tue, 5 Jun 2018 11:15:34 +0000 (13:15 +0200)]
avcodec/shorten: Fix undefined shift in fix_bitshift()

Fixes: left shift of negative value -9
Fixes: 8571/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5715966875926528

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/shorten: Fix a negative left shift in shorten_decode_frame()
Michael Niedermayer [Tue, 5 Jun 2018 11:12:54 +0000 (13:12 +0200)]
avcodec/shorten: Fix a negative left shift in shorten_decode_frame()

Fixes: left shift of negative value -9057
Fixes: 8527/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5666853924896768

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
6 months agoavcodec/shorten: Sanity check nmeans
Michael Niedermayer [Tue, 5 Jun 2018 11:03:48 +0000 (13:03 +0200)]
avcodec/shorten: Sanity check nmeans

Fixes: OOM
Fixes: 8195/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SHORTEN_fuzzer-5179785826271232

The reference software appears to use longs for 32bits and it uses int for nmeans
hinting that the intended maximum size was not 32bit.

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>