]> git.sesse.net Git - ffmpeg/log
ffmpeg
3 years agolsws/x86/yuv2rgb: Fix compilation with mmxext or ssse3 disabled.
Carl Eugen Hoyos [Sat, 14 Nov 2020 14:37:57 +0000 (15:37 +0100)]
lsws/x86/yuv2rgb: Fix compilation with mmxext or ssse3 disabled.

Fixes ticket #8986.

3 years agoavformat/rtsp: av_rescale -> av_rescale_q
Limin Wang [Fri, 30 Oct 2020 12:37:51 +0000 (20:37 +0800)]
avformat/rtsp: av_rescale -> av_rescale_q

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavcodec/cbs_av1: remove dead code
James Almer [Thu, 12 Nov 2020 18:20:38 +0000 (15:20 -0300)]
avcodec/cbs_av1: remove dead code

The other branch already covers cases where enable_order_hint is true
and frame is of type Inter.
Regression since ddb0e4fecdef24e8c7b90fa0a41d13e642ea732f

Fixes Coverity issues #1469194 and #1469195.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/vp3dsp: Use unsigned constant to avoid undefined integer overflow in ff_vp3ds...
Michael Niedermayer [Mon, 9 Nov 2020 23:04:51 +0000 (00:04 +0100)]
avcodec/vp3dsp: Use unsigned constant to avoid undefined integer overflow in ff_vp3dsp_set_bounding_values()

Fixes: signed integer overflow: 64 * 33686018 cannot be represented in type 'int'
Fixes: 26911/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_THEORA_fuzzer-4904975073017856
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/icodec: Check for zero streams and stream creation failure
Michael Niedermayer [Wed, 4 Nov 2020 00:06:46 +0000 (01:06 +0100)]
avformat/icodec: Check for zero streams and stream creation failure

Fixes: NULL pointer dereference
Fixes: 26814/clusterfuzz-testcase-minimized-ffmpeg_dem_ICO_fuzzer-5758487797432320
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/icodec: Factor failure code out in read_header()
Michael Niedermayer [Wed, 4 Nov 2020 00:06:45 +0000 (01:06 +0100)]
avformat/icodec: Factor failure code out in read_header()

Reviewed-by: Peter Ross <pross@xvid.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/nvdec_av1: fix setting film grain parameters for frames with update_grain...
James Almer [Thu, 12 Nov 2020 20:17:04 +0000 (17:17 -0300)]
avcodec/nvdec_av1: fix setting film grain parameters for frames with update_grain == 0

The spec in section 6.8.20 states the parameters should be loaded from a
reference frame indexed by film_grain_params_ref_idx.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/av1dec: remove order_hint from AV1Frame
James Almer [Thu, 12 Nov 2020 20:06:05 +0000 (17:06 -0300)]
avcodec/av1dec: remove order_hint from AV1Frame

We now have access to the raw frame header, so use that

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/av1dec: add a reference to the raw frame header to AV1Frames
James Almer [Thu, 12 Nov 2020 19:59:37 +0000 (16:59 -0300)]
avcodec/av1dec: add a reference to the raw frame header to AV1Frames

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/dxva2: add AV1 decode support
Hendrik Leppkes [Thu, 5 Nov 2020 13:13:14 +0000 (14:13 +0100)]
avcodec/dxva2: add AV1 decode support

Signed-off-by: Hendrik Leppkes <h.leppkes@gmail.com>
3 years agoaviobuf: Increase the default SHORT_SEEK_THRESHOLD to 32 KB
Martin Storsjö [Fri, 30 Oct 2020 10:59:03 +0000 (12:59 +0200)]
aviobuf: Increase the default SHORT_SEEK_THRESHOLD to 32 KB

The previous threshold, 4 KB, maybe was reasonable when it was set
(in 2010), but in today's settings and with typical network speeds
and data sizes, it's pretty small. 32 KB probably is a more reasonable
default now, regardless of input.

This changes the test references for two seek tests.

When using the normal seek function, which boils down to the lseek(2)
function, a seek to an out of bounds position doesn't return an error,
but that condition is only reported when doing the subsequent read
(which returns EOF). When doing more seeks by fast forwarding, the
fact that the seeked to destination is out of bounds is noticed and
reported sooner in these cases.

Signed-off-by: Martin Storsjö <martin@martin.st>
3 years agoavcodec/adpcmenc: Fix leak of trellis buffer with ADPCM_IMA_AMV
Andreas Rheinhardt [Thu, 12 Nov 2020 06:15:29 +0000 (07:15 +0100)]
avcodec/adpcmenc: Fix leak of trellis buffer with ADPCM_IMA_AMV

Fixes Coverity ID 1469181.

Reviewed-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/nvdec: add av1 hwaccel
Timo Rothenpieler [Sat, 17 Oct 2020 16:16:54 +0000 (18:16 +0200)]
avcodec/nvdec: add av1 hwaccel

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
Co-authored-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/nvdec: add support for separate reference frame
Timo Rothenpieler [Sat, 17 Oct 2020 16:16:36 +0000 (18:16 +0200)]
avcodec/nvdec: add support for separate reference frame

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
3 years agoavcodec/av1dec: expose coded_lossless
Timo Rothenpieler [Tue, 3 Nov 2020 14:54:44 +0000 (15:54 +0100)]
avcodec/av1dec: expose coded_lossless

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
Co-authored-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/av1dec: expose skip mode frame index
Timo Rothenpieler [Tue, 3 Nov 2020 14:34:28 +0000 (15:34 +0100)]
avcodec/av1dec: expose skip mode frame index

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
Co-authored-by: James Almer <jamrial@gmail.com>
3 years agoavformat/bintext: Check width
Michael Niedermayer [Sat, 31 Oct 2020 12:51:47 +0000 (13:51 +0100)]
avformat/bintext: Check width

Fixes: division by 0
Fixes: 26780/clusterfuzz-testcase-minimized-ffmpeg_dem_ADF_fuzzer-5117945027756032
Fixes: 26998/clusterfuzz-testcase-minimized-ffmpeg_dem_ADF_fuzzer-5119352359354368
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/sbgdec: Check that end is not before start
Michael Niedermayer [Mon, 9 Nov 2020 23:04:50 +0000 (00:04 +0100)]
avformat/sbgdec: Check that end is not before start

Fixes: signed integer overflow: -9223372036854775808 + -5279949906739200 cannot be represented in type 'long'
Fixes: 26908/clusterfuzz-testcase-minimized-ffmpeg_dem_SBG_fuzzer-6329610851319808
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/cbs_av1: add a range check to tg_end
James Almer [Tue, 27 Oct 2020 21:25:06 +0000 (18:25 -0300)]
avcodec/cbs_av1: add a range check to tg_end

Section 6.10.1 of the AV1 spec states:

It is a requirement of bitstream conformance that the value of tg_start is
equal to the value of TileNum at the point that tile_group_obu is invoked.
It is a requirement of bitstream conformance that the value of tg_end is
greater than or equal to tg_start.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/cbs_av1: infer ref_order_hint when not coded in the bitstream
James Almer [Thu, 29 Oct 2020 12:54:59 +0000 (09:54 -0300)]
avcodec/cbs_av1: infer ref_order_hint when not coded in the bitstream

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/rtspdec: return proper error code
Limin Wang [Wed, 4 Nov 2020 13:06:00 +0000 (21:06 +0800)]
avformat/rtspdec: return proper error code

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavformat/rtsp: check return value of ffurl_read_complete
Limin Wang [Wed, 4 Nov 2020 12:44:43 +0000 (20:44 +0800)]
avformat/rtsp: check return value of ffurl_read_complete

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavformat/rtsp: prefer to use variable instead of type
Limin Wang [Wed, 4 Nov 2020 12:09:02 +0000 (20:09 +0800)]
avformat/rtsp: prefer to use variable instead of type

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavformat/rtspdec: use SDP_MAX_SIZE for sdp array
Limin Wang [Wed, 4 Nov 2020 11:55:48 +0000 (19:55 +0800)]
avformat/rtspdec: use SDP_MAX_SIZE for sdp array

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavformat/rtsp: move SDP_MAX_SIZE macro definition to header file
Limin Wang [Wed, 11 Nov 2020 10:26:26 +0000 (18:26 +0800)]
avformat/rtsp: move SDP_MAX_SIZE macro definition to header file

move comments for the size of SDP_MAX_SIZE here:
Some SDP lines, particularly for Realmedia or ASF RTSP streams,
contain long SDP lines containing complete ASF Headers (several
kB) or arrays of MDPR (RM stream descriptor) headers plus
"rulebooks" describing their properties. Therefore, the SDP line
buffer is large.
The Vorbis FMTP line can be up to 16KB - see xiph_parse_sdp_line
in rtpdec_xiph.c.

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavformat/rtsp: 16384 -> SDP_MAX_SIZE
Limin Wang [Wed, 4 Nov 2020 12:51:06 +0000 (20:51 +0800)]
avformat/rtsp: 16384 -> SDP_MAX_SIZE

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavformat/lvfdec: Check stream_index before use
Michael Niedermayer [Sat, 7 Nov 2020 23:17:09 +0000 (00:17 +0100)]
avformat/lvfdec: Check stream_index before use

Fixes: assertion failure
Fixes: 26905/clusterfuzz-testcase-minimized-ffmpeg_dem_LVF_fuzzer-5724267599364096.fuzz
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>
3 years agoavformat/au: cleanup on EOF return in au_read_annotation()
Michael Niedermayer [Thu, 5 Nov 2020 19:23:54 +0000 (20:23 +0100)]
avformat/au: cleanup on EOF return in au_read_annotation()

Fixes: memleak
Fixes: 26841/clusterfuzz-testcase-minimized-ffmpeg_dem_AU_fuzzer-5174166309044224
Regression since: e680d50eb4feddafb2d8575b21fc5fc8764f4801
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolibavformat/avidec: Extract more metadata from the header
Thierry Foucu [Fri, 6 Nov 2020 23:10:17 +0000 (15:10 -0800)]
libavformat/avidec: Extract more metadata from the header

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavfilter/af_asoftclip: add oversampling support
Paul B Mahol [Thu, 5 Nov 2020 12:33:32 +0000 (13:33 +0100)]
avfilter/af_asoftclip: add oversampling support

3 years agoavcodec/gdv: Remove dead check
Andreas Rheinhardt [Thu, 5 Nov 2020 20:35:56 +0000 (21:35 +0100)]
avcodec/gdv: Remove dead check

At the end of its decode function, the decoder sets *got_frame to 1 and
then checks whether ret is < 0; if so, it is returned, otherwise
avpkt->size is. But it is impossible for ret to be < 0 here and if it
were, it would be nonsense to set *got_frame to 1 before this. Therefore
just return avpkt->size unconditionally.

Fixes Coverity issue #1439730.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/utils: clear the packet props queue on flushing
James Almer [Mon, 9 Nov 2020 13:12:59 +0000 (10:12 -0300)]
avcodec/utils: clear the packet props queue on flushing

This ensures no queued timestamps or side data are kept and used after
seeking, preventing potential desyncs.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoChangelog: add amv muxer & encoder
Zane van Iperen [Mon, 9 Nov 2020 05:15:27 +0000 (15:15 +1000)]
Changelog: add amv muxer & encoder

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavformat: add amv muxer
Zane van Iperen [Mon, 2 Nov 2020 05:47:32 +0000 (15:47 +1000)]
avformat: add amv muxer

AMV is a hard-coded (and broken) subset of AVI. It's not worth sullying
the existing AVI muxer with its filth.

Fixes ticket #747.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavcodec: add adpcm_ima_amv encoder
Zane van Iperen [Mon, 2 Nov 2020 05:47:29 +0000 (15:47 +1000)]
avcodec: add adpcm_ima_amv encoder

Fixes ticket #747.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavcodec/adpcm_ima_amv: document header format
Zane van Iperen [Mon, 2 Nov 2020 05:47:26 +0000 (15:47 +1000)]
avcodec/adpcm_ima_amv: document header format

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavcodec/adpcm_ima_amv: use coded sample count
Zane van Iperen [Mon, 2 Nov 2020 05:47:24 +0000 (15:47 +1000)]
avcodec/adpcm_ima_amv: use coded sample count

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavcodec/adpcm_ima_amv: restrict to 1 channel
Zane van Iperen [Mon, 2 Nov 2020 05:47:21 +0000 (15:47 +1000)]
avcodec/adpcm_ima_amv: restrict to 1 channel

The format doesn't allow for anything else.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agolavc/amfenc: Add hardware config metadata
OvchinnikovDmitrii [Thu, 15 Oct 2020 00:16:21 +0000 (03:16 +0300)]
lavc/amfenc: Add hardware config metadata

Without this metadata section the ffmpeg utility thinks that the AMF encoder
does not support input from D3D11 and DXVA2 hardware surfaces, causing
hardware pipelines to fail.

Fixes #8953.

3 years agolavc: Mark hw_config pointer arrays as const
Mark Thompson [Sun, 8 Nov 2020 18:51:15 +0000 (18:51 +0000)]
lavc: Mark hw_config pointer arrays as const

They are read-only just like the HWConfig structures they point to.

3 years agotools/target_dem_fuzzer: Consider it an EIO when reading position wraps around 64bit
Michael Niedermayer [Fri, 23 Oct 2020 08:48:36 +0000 (10:48 +0200)]
tools/target_dem_fuzzer: Consider it an EIO when reading position wraps around 64bit

Fixes: signed integer overflow: 9223372036854775807 + 564 cannot be represented in type 'long'
Fixes: 26494/clusterfuzz-testcase-minimized-ffmpeg_dem_VOC_fuzzer-576754158849228
Fixes: 26549/clusterfuzz-testcase-minimized-ffmpeg_dem_AVS_fuzzer-4844306424397824
FIxes: 26875/clusterfuzz-testcase-minimized-ffmpeg_dem_C93_fuzzer-5996226782429184

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/mpegts: Limit copied data to space
Michael Niedermayer [Wed, 4 Nov 2020 00:06:47 +0000 (01:06 +0100)]
avformat/mpegts: Limit copied data to space

Fixes: out of array access
Fixes: 26816/clusterfuzz-testcase-minimized-ffmpeg_dem_MPEGTSRAW_fuzzer-6282861159907328.fuzz
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/adpcm_ima_swf: fix frame size to 4096
Zane van Iperen [Fri, 6 Nov 2020 12:03:37 +0000 (22:03 +1000)]
avcodec/adpcm_ima_swf: fix frame size to 4096

SWF File Format Specification, Version 19 says this is 1 raw
sample + 4095 nibbles.

https://www.adobe.com/content/dam/acom/en/devnet/pdf/swf-file-format-spec.pdf

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoRevert "avcodec/adpcm_swf: support decoding multiple fixed-sized blocks at once"
Zane van Iperen [Fri, 6 Nov 2020 13:55:29 +0000 (23:55 +1000)]
Revert "avcodec/adpcm_swf: support decoding multiple fixed-sized blocks at once"

Is incorrect behaviour. Was covering for an encoder bug where it produced frames
of the wrong size.

This reverts commit e9dd73d30d09043446ac6dd7b8ad31e557873852.

Fixes: out of array write
Fixes: 26821/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ADPCM_SWF_fuzzer-5764465137811456
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavdevice/xcbgrab: Add select_region option
Omar Emara [Sat, 11 Jul 2020 09:29:09 +0000 (11:29 +0200)]
avdevice/xcbgrab: Add select_region option

This patch adds a select_region option to the xcbgrab input device.
If set to 1, the user will be prompted to select the grabbing area
graphically by clicking and dragging. A rectangle will be drawn to
mark the grabbing area. A single click with no dragging will select
the whole screen. The option overwrites the video_size, grab_x, and
grab_y options if set by the user.

For testing, just set the select_region option as follows:

ffmpeg -f x11grab -select_region 1 -i :0.0 output.mp4

The drawing happens directly on the root window using standard rubber
banding techniques, so it is very efficient and doesn't depend on any
X extensions or compositors.

Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com>
Signed-off-by: Omar Emara <mail@OmarEmara.dev>
3 years agoavformat/rtsp: support infinite initial_timeout for rtsp option
Limin Wang [Tue, 3 Nov 2020 10:15:21 +0000 (18:15 +0800)]
avformat/rtsp: support infinite initial_timeout for rtsp option

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agofate/filter-video: add 10bit test for unsharp filter
Limin Wang [Sun, 1 Nov 2020 23:30:21 +0000 (07:30 +0800)]
fate/filter-video: add 10bit test for unsharp filter

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavfilter/vf_unsharp: add more pixel format support
Limin Wang [Mon, 14 Oct 2019 10:27:06 +0000 (18:27 +0800)]
avfilter/vf_unsharp: add more pixel format support

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavfilter/vf_unsharp: add 10bit support
Limin Wang [Mon, 14 Oct 2019 10:27:05 +0000 (18:27 +0800)]
avfilter/vf_unsharp: add 10bit support

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavcodec/truemotion2: Allocate buffers together
Andreas Rheinhardt [Sun, 27 Sep 2020 13:55:27 +0000 (15:55 +0200)]
avcodec/truemotion2: Allocate buffers together

Reduces the number of allocations and frees.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/truemotion2: Cleanup generically on init failure
Andreas Rheinhardt [Sun, 27 Sep 2020 12:33:40 +0000 (14:33 +0200)]
avcodec/truemotion2: Cleanup generically on init failure

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/truemotion2: Remove redundant initializations
Andreas Rheinhardt [Sun, 27 Sep 2020 12:31:46 +0000 (14:31 +0200)]
avcodec/truemotion2: Remove redundant initializations

The codec's private context has already been zeroed generically.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/truemotion2: Replace av_free() by av_freep() in AVCodec.close
Andreas Rheinhardt [Sun, 27 Sep 2020 12:30:18 +0000 (14:30 +0200)]
avcodec/truemotion2: Replace av_free() by av_freep() in AVCodec.close

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/sonic: Don't allocate a temporary buffer for every frame
Andreas Rheinhardt [Sun, 27 Sep 2020 09:34:34 +0000 (11:34 +0200)]
avcodec/sonic: Don't allocate a temporary buffer for every frame

Instead allocate it together with the buffer that it mirrors.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mss4: Fix memleaks upon allocation error
Andreas Rheinhardt [Tue, 3 Nov 2020 22:43:01 +0000 (23:43 +0100)]
avcodec/mss4: Fix memleaks upon allocation error

During init the mts2 decoder allocates several VLCs and then several
buffers in a loop; if one of the latter allocations fails, only the VLCs
are freed, not any buffers that might already have been successfully
allocated. This commit fixes this by setting the
FF_CODEC_CAP_INIT_CLEANUP flag.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter: add adenorm filter
Paul B Mahol [Mon, 2 Nov 2020 16:16:05 +0000 (17:16 +0100)]
avfilter: add adenorm filter

3 years agoAdd support for playing Audible AAXC (.aaxc) files [PATCH v4]
Vesselin Bontchev [Sat, 1 Jan 2000 09:00:00 +0000 (09:00 +0000)]
Add support for playing Audible AAXC (.aaxc) files [PATCH v4]

The AAXC container format is the same as the (already supported) Audible
AAX format but it uses a different encryption scheme.

Note: audible_key and audible_iv values are variable (per file) and are
externally fed.

It is possible to extend https://github.com/mkb79/Audible to derive the
audible_key and audible_key values.

Relevant code:

def decrypt_voucher(deviceSerialNumber, customerId, deviceType, asin, voucher):
    buf = (deviceType + deviceSerialNumber + customerId + asin).encode("ascii")
    digest = hashlib.sha256(buf).digest()
    key = digest[0:16]
    iv = digest[16:]

    # decrypt "voucher" using AES in CBC mode with no padding
    cipher = AES.new(key, AES.MODE_CBC, iv)
    plaintext = cipher.decrypt(voucher).rstrip(b"\x00")  # improve this!
    return json.loads(plaintext)

The decrypted "voucher" has the required audible_key and audible_iv
values.

Update (Nov-2020): This patch has now been tested by multiple folks -
details at the following URL:

https://github.com/mkb79/Audible/issues/3

Signed-off-by: Vesselin Bontchev <vesselin.bontchev@yandex.com>
3 years agotls: Hook up the url_get_short_seek function in the TLS backends
Martin Storsjö [Thu, 29 Oct 2020 19:56:17 +0000 (21:56 +0200)]
tls: Hook up the url_get_short_seek function in the TLS backends

This makes sure that small seeks forward on https don't end up
doing new requests.

Signed-off-by: Martin Storsjö <martin@martin.st>
3 years agoavfilter/scale_cuda: fix pitch calculation for >8 bit formats
Timo Rothenpieler [Wed, 4 Nov 2020 23:46:54 +0000 (00:46 +0100)]
avfilter/scale_cuda: fix pitch calculation for >8 bit formats

3 years agoavformat/bintext: Check width in idf_read_header()
Michael Niedermayer [Sat, 31 Oct 2020 12:51:47 +0000 (13:51 +0100)]
avformat/bintext: Check width in idf_read_header()

Fixes: division by 0
Fixes: 26802/clusterfuzz-testcase-minimized-ffmpeg_dem_IDF_fuzzer-5180591554953216.fuzz
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/iff: check size against INT64_MAX
Michael Niedermayer [Tue, 27 Oct 2020 20:51:08 +0000 (21:51 +0100)]
avformat/iff: check size against INT64_MAX

Bigger sizes are misinterpreted as negative numbers by the API
Fixes: infinite loop
Fixes: 26611/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-4890614975692800
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/vividas: improve extradata packing checks in track_header()
Michael Niedermayer [Wed, 28 Oct 2020 19:11:54 +0000 (20:11 +0100)]
avformat/vividas: improve extradata packing checks in track_header()

Fixes: out of array accesses
Fixes: 26622/clusterfuzz-testcase-minimized-ffmpeg_dem_VIVIDAS_fuzzer-6581200338288640
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/paf: Check for EOF in read_table()
Michael Niedermayer [Sat, 24 Oct 2020 18:30:48 +0000 (20:30 +0200)]
avformat/paf: Check for EOF in read_table()

Fixes: OOM
Fixes: 26528/clusterfuzz-testcase-minimized-ffmpeg_dem_PAF_fuzzer-5081929248145408
Fixes: 26584/clusterfuzz-testcase-minimized-ffmpeg_dem_PAF_fuzzer-5172661183053824
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/gxf: Check pkt_len
Michael Niedermayer [Mon, 26 Oct 2020 20:08:55 +0000 (21:08 +0100)]
avformat/gxf: Check pkt_len

Fixes: Infinite loop
Fixes: 26576/clusterfuzz-testcase-minimized-ffmpeg_dem_GXF_fuzzer-4823080360476672
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/aiffdec: Check packet size
Michael Niedermayer [Mon, 26 Oct 2020 19:55:31 +0000 (20:55 +0100)]
avformat/aiffdec: Check packet size

Fixes: Fixes infinite loop
Fixes: 26575/clusterfuzz-testcase-minimized-ffmpeg_dem_AIFF_fuzzer-5727522236661760
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolibavformat/aviobuf: Forward error from avio_read in ffio_read_size()
Michael Niedermayer [Sat, 31 Oct 2020 09:29:56 +0000 (10:29 +0100)]
libavformat/aviobuf: Forward error from avio_read in ffio_read_size()

Suggested-by: Andreas Rheinhardt
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/rmdec: remove unneeded memset() on packet allocation
Michael Niedermayer [Mon, 2 Nov 2020 00:21:27 +0000 (01:21 +0100)]
avformat/rmdec: remove unneeded memset() on packet allocation

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/argo_brp: remove block_align check for audio
Zane van Iperen [Tue, 3 Nov 2020 13:41:53 +0000 (23:41 +1000)]
avformat/argo_brp: remove block_align check for audio

Causes a divide-by-zero in the rare case where:
- the file has an audio stream,
- the first audio frame isn't within the first BRP_BASF_LOOKAHEAD frames,
- an audio frame is encountered later, and
- its chunk header (except num_blocks) contains all zeros
   (matching the uninitialised structure in the context)

The decoder will discard any garbage data, so the check isn't really needed.

Fixes: division by 0
Fixes: 26667/clusterfuzz-testcase-minimized-ffmpeg_dem_ARGO_BRP_fuzzer-5645146928185344.fuzz
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavcodec/sonic: Don't hardcode sizeof(int) == 4
Andreas Rheinhardt [Sun, 1 Nov 2020 13:52:49 +0000 (14:52 +0100)]
avcodec/sonic: Don't hardcode sizeof(int) == 4

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/sonic: Allocate several buffers together
Andreas Rheinhardt [Sun, 27 Sep 2020 09:33:41 +0000 (11:33 +0200)]
avcodec/sonic: Allocate several buffers together

It simplifies freeing them and reduces the amount of allocations.

Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/scale_cuda: simplify linesize calculation
Timo Rothenpieler [Wed, 4 Nov 2020 19:00:35 +0000 (20:00 +0100)]
avfilter/scale_cuda: simplify linesize calculation

3 years agoavfilter/scale_cuda: add support for RGB formats
Timo Rothenpieler [Wed, 4 Nov 2020 18:53:41 +0000 (19:53 +0100)]
avfilter/scale_cuda: add support for RGB formats

3 years agoavfilter/scale_cuda: expose optional algorithm parameter
Timo Rothenpieler [Wed, 4 Nov 2020 17:10:19 +0000 (18:10 +0100)]
avfilter/scale_cuda: expose optional algorithm parameter

3 years agoavfilter/scale_cuda: add lanczos algorithm
Timo Rothenpieler [Wed, 4 Nov 2020 00:43:00 +0000 (01:43 +0100)]
avfilter/scale_cuda: add lanczos algorithm

3 years agoavutil/hwcontext_cuda: fix edge case with non-even frame heights
Timo Rothenpieler [Wed, 4 Nov 2020 00:36:48 +0000 (01:36 +0100)]
avutil/hwcontext_cuda: fix edge case with non-even frame heights

3 years agoavutil/hwcontext_cuda: query correct alignment from device
Timo Rothenpieler [Tue, 3 Nov 2020 23:19:55 +0000 (00:19 +0100)]
avutil/hwcontext_cuda: query correct alignment from device

3 years agovaapi_encode_mpeg2: Fix setting colour properties
Mark Thompson [Mon, 2 Nov 2020 22:46:49 +0000 (22:46 +0000)]
vaapi_encode_mpeg2: Fix setting colour properties

Follow the same pattern as the previous commits for H.264 and H.265.

Reviewed-By: Jan Ekström <jeebjp@gmail.com>
Tested-By: Xu, Yefeng <yefengx.xu@intel.com>
3 years agovaapi_encode_h265: Fix setting colour properties
Mark Thompson [Mon, 2 Nov 2020 22:46:48 +0000 (22:46 +0000)]
vaapi_encode_h265: Fix setting colour properties

Matching the previous commit for H.264.

Reviewed-By: Jan Ekström <jeebjp@gmail.com>
Tested-By: Xu, Yefeng <yefengx.xu@intel.com>
3 years agovaapi_encode_h264: Fix setting colour properties
Mark Thompson [Mon, 2 Nov 2020 22:46:47 +0000 (22:46 +0000)]
vaapi_encode_h264: Fix setting colour properties

The properties should always be set; only the presence flags want to be
conditional.

Fixes #8959.

Reviewed-By: Jan Ekström <jeebjp@gmail.com>
Tested-By: Xu, Yefeng <yefengx.xu@intel.com>
3 years agoavfilter/scale_cuda: add nearest neighbour algorithm
Timo Rothenpieler [Tue, 3 Nov 2020 18:28:06 +0000 (19:28 +0100)]
avfilter/scale_cuda: add nearest neighbour algorithm

3 years agoavfilter/scale_cuda: code cleanup
Timo Rothenpieler [Tue, 3 Nov 2020 17:33:55 +0000 (18:33 +0100)]
avfilter/scale_cuda: code cleanup

3 years agoavfilter/scale_cuda: add bicubic interpolation
Timo Rothenpieler [Sat, 31 Oct 2020 19:22:33 +0000 (20:22 +0100)]
avfilter/scale_cuda: add bicubic interpolation

3 years agoavutil/hwcontext_cuda: increase CUDA frame alignment to 512
Timo Rothenpieler [Mon, 2 Nov 2020 20:31:35 +0000 (21:31 +0100)]
avutil/hwcontext_cuda: increase CUDA frame alignment to 512

At least on Turing, a frame without 512 byte alignment cannot be passed
to cuTexObjectCreate.

3 years agoavcodec/mpc8: Unobfuscate sign-extension
Andreas Rheinhardt [Thu, 29 Oct 2020 22:58:51 +0000 (23:58 +0100)]
avcodec/mpc8: Unobfuscate sign-extension

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mimic: Inline constants
Andreas Rheinhardt [Wed, 28 Oct 2020 13:06:23 +0000 (14:06 +0100)]
avcodec/mimic: Inline constants

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/tscc2: Don't check for errors for complete VLCs
Andreas Rheinhardt [Thu, 29 Oct 2020 14:26:06 +0000 (15:26 +0100)]
avcodec/tscc2: Don't check for errors for complete VLCs

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/apngdec: Remove goto fail that does nothing
Andreas Rheinhardt [Wed, 11 Dec 2019 11:15:05 +0000 (12:15 +0100)]
avformat/apngdec: Remove goto fail that does nothing

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/apngdec: Check fcTL chunk length when reading header
Andreas Rheinhardt [Sat, 31 Oct 2020 13:07:27 +0000 (14:07 +0100)]
avformat/apngdec: Check fcTL chunk length when reading header

Reading the header terminates when an fcTL chunk is encountered in which
case read_header returned success without checking the length of said
chunk. Yet when read_packet processes this chunk, it checks for the
length to be 26 and errors out otherwise. So do so when reading the header,
too.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/apngdec: Fix size/overflow checks
Andreas Rheinhardt [Sun, 12 Jan 2020 16:36:05 +0000 (17:36 +0100)]
avformat/apngdec: Fix size/overflow checks

apng data consists of parts containing a small header (including a
four-byte size field) and a data part; the size field does not account
for everything and is actually twelve bytes short of the actual size. In
order to make sure that the size fits into an int, the size field is
checked for being > INT_MAX; yet this does not account for the + 12 and
upon conversion to int (which happens when calling append_extradata()),
the size parameter can still wrap around. In this case the currently
used check would lead to undefined signed integer overflow.

Furthermore, append_extradata() appends the new data to the already
existing extradata and therefore needs to make sure that the combined
size of new and old data as well as padding fits into an int. The check
used for this is "if (old_size > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE -
new_size)". If new_size is > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE
the right side becomes negative if the types are signed (as they are
now); yet changing this to "if (new_size > INT_MAX -
AV_INPUT_BUFFER_PADDING_SIZE - old_size)" is better as this also works
for unsigned types (where it is of course presumed that INT_MAX is
replaced by the corresponding maximum for the new type).

Both of these issues have been fixed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/apngdec: Return error for incomplete header
Andreas Rheinhardt [Tue, 10 Dec 2019 10:47:57 +0000 (11:47 +0100)]
avformat/apngdec: Return error for incomplete header

If avio_read() could read anything, it returns the number of bytes read,
even if it could not read as much as the caller desired.
apng_read_header() only checked the return value of its avio_read() calls
for being negative and this meant that it was possible for an incomplete
header to not be detected. The return value of the last successfull call
has been returned instead. This commit changes this.

Fixes: OOM
Fixes: 26608/clusterfuzz-testcase-minimized-ffmpeg_dem_APNG_fuzzer-4839491644424192
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/af_asoftclip: add asserts in default switch cases
Paul B Mahol [Tue, 3 Nov 2020 11:28:02 +0000 (12:28 +0100)]
avfilter/af_asoftclip: add asserts in default switch cases

3 years agoavfitler/af_asoftclip: add hard type
Paul B Mahol [Tue, 3 Nov 2020 11:21:48 +0000 (12:21 +0100)]
avfitler/af_asoftclip: add hard type

3 years agoavfilter/af_asoftclip: add erf soft clip type
Paul B Mahol [Tue, 3 Nov 2020 11:05:24 +0000 (12:05 +0100)]
avfilter/af_asoftclip: add erf soft clip type

3 years agodoc: mark "ADPCM IMA High Voltage Software ALP" as encodable
Zane van Iperen [Thu, 29 Oct 2020 10:57:18 +0000 (20:57 +1000)]
doc: mark "ADPCM IMA High Voltage Software ALP" as encodable

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavcodec/utils: add adpcm_ima_alp to av_get_exact_bits_per_sample()
Zane van Iperen [Thu, 29 Oct 2020 10:55:41 +0000 (20:55 +1000)]
avcodec/utils: add adpcm_ima_alp to av_get_exact_bits_per_sample()

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavformat/argo_brp: bail if no video frames
Zane van Iperen [Mon, 2 Nov 2020 11:57:19 +0000 (21:57 +1000)]
avformat/argo_brp: bail if no video frames

Fixes: Assertion failure
Fixes: 26572/clusterfuzz-testcase-minimized-ffmpeg_dem_ARGO_BRP_fuzzer-5166735591997440
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavcodec/magicyuv: Free previous VLC table
Michael Niedermayer [Mon, 2 Nov 2020 00:21:25 +0000 (01:21 +0100)]
avcodec/magicyuv: Free previous VLC table

Fixes: memleak
Fixes: 26788/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MAGICYUV_fuzzer-5184116808744960
Regression since: 1bf30a1beb7527887c9b466d07765d20fa3b5412

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/concatdec: use av_strstart()
Michael Niedermayer [Sat, 31 Oct 2020 22:46:33 +0000 (23:46 +0100)]
avformat/concatdec: use av_strstart()

Fixes: out array read
Fixes: 26610/clusterfuzz-testcase-minimized-ffmpeg_dem_CONCAT_fuzzer-5631838049271808
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec: add av1 VAAPI decoder
Fei Wang [Thu, 29 Oct 2020 06:54:25 +0000 (14:54 +0800)]
avcodec: add av1 VAAPI decoder

Example cmdline:
ffmpeg -hwaccel vaapi -hwaccel_device /dev/dri/renderD128 -v verbose \
-c:v av1 -i input.ivf -pix_fmt yuv420p -vsync passthrough -f md5     \
-y out.md5

Signed-off-by: Fei Wang <fei.w.wang@intel.com>
3 years agodoc/APIchanges: add missing marker for release 4.3
James Almer [Mon, 2 Nov 2020 21:54:30 +0000 (18:54 -0300)]
doc/APIchanges: add missing marker for release 4.3

Signed-off-by: James Almer <jamrial@gmail.com>