]> git.sesse.net Git - ffmpeg/log
ffmpeg
3 years agoavcodec/hqx: Inline constants
Andreas Rheinhardt [Sat, 7 Nov 2020 09:31:59 +0000 (10:31 +0100)]
avcodec/hqx: Inline constants

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/intrax8: Make ff_intrax8_common_init() thread-safe
Andreas Rheinhardt [Mon, 16 Nov 2020 21:00:34 +0000 (22:00 +0100)]
avcodec/intrax8: Make ff_intrax8_common_init() thread-safe

In particular, don't reinitialize VLCs every time an IntraX8Context is
initialized.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/intrax8: Replace always-false check by assert
Andreas Rheinhardt [Fri, 6 Nov 2020 12:15:24 +0000 (13:15 +0100)]
avcodec/intrax8: Replace always-false check by assert

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/atrac9tab: Add missing static to internal table
Andreas Rheinhardt [Mon, 9 Nov 2020 13:59:13 +0000 (14:59 +0100)]
avcodec/atrac9tab: Add missing static to internal table

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/atrac9dec: Replace av_free() by av_freep() in close function
Andreas Rheinhardt [Thu, 5 Nov 2020 02:51:50 +0000 (03:51 +0100)]
avcodec/atrac9dec: Replace av_free() by av_freep() in close function

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/atrac9dec: Don't use unnecessarily large VLC tables
Andreas Rheinhardt [Wed, 4 Nov 2020 04:38:31 +0000 (05:38 +0100)]
avcodec/atrac9dec: Don't use unnecessarily large VLC tables

Using more bits for a VLC than the longest code has has no advantage.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/atrac9dec: Use least max_depth in calls to get_vlc2()
Andreas Rheinhardt [Wed, 4 Nov 2020 04:33:33 +0000 (05:33 +0100)]
avcodec/atrac9dec: Use least max_depth in calls to get_vlc2()

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/atrac9dec: Don't confuse max_depth of VLC with max codelength
Andreas Rheinhardt [Wed, 4 Nov 2020 04:20:10 +0000 (05:20 +0100)]
avcodec/atrac9dec: Don't confuse max_depth of VLC with max codelength

The whole point of VLCs with their tables is to read more than one bit
at a time; therefore max_depth, the number of times one has to
(maximally) read further bits is given by ceil(max_code_length / table_bits)
which in the case of ATRAC9's coefficient VLCs gives an upper bound of
two. Instead the maximum length of a code of the given VLC has been used
(which is not even a compile-time constant). Use two instead.

Furthermore, given that this was the only usage of the field containing
the maximum of all the code lengths of a given VLC the field has been
removed from its containing struct.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/truemotion2: Mark decoder as init-threadsafe
Andreas Rheinhardt [Tue, 17 Nov 2020 10:22:09 +0000 (11:22 +0100)]
avcodec/truemotion2: Mark decoder as init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/g2meet: Use least max_depth in get_vlc2()
Andreas Rheinhardt [Sun, 1 Nov 2020 01:17:43 +0000 (02:17 +0100)]
avcodec/g2meet: Use least max_depth in get_vlc2()

The longest AC codes of the standard JPEG tables are 16 bits long; for
the DC tables, the maximum is 11, so using max_depth of two is
sufficient.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/sheervideo: Add av_cold to build_vlc()
Andreas Rheinhardt [Sun, 1 Nov 2020 00:14:36 +0000 (01:14 +0100)]
avcodec/sheervideo: Add av_cold to build_vlc()

It is an init function even when called from decode_frame().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mss4: Mark decoder as init-threadsafe
Andreas Rheinhardt [Fri, 20 Nov 2020 02:53:42 +0000 (03:53 +0100)]
avcodec/mss4: Mark decoder as init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/rv40vlc2: Make VLC smaller
Andreas Rheinhardt [Sat, 31 Oct 2020 19:32:25 +0000 (20:32 +0100)]
avcodec/rv40vlc2: Make VLC smaller

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/qdm2: Remove outdated comment
Andreas Rheinhardt [Tue, 17 Nov 2020 12:31:44 +0000 (13:31 +0100)]
avcodec/qdm2: Remove outdated comment

Forgotten in f054e309c58894450a5d18cce9799ef58aab9f14.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mpegaudiodsp: Make initializing synth windows thread-safe
Andreas Rheinhardt [Sun, 15 Nov 2020 19:56:22 +0000 (20:56 +0100)]
avcodec/mpegaudiodsp: Make initializing synth windows thread-safe

These arrays are used by the Musepack decoders, the MPEG audio decoders
as well as qdm2 and up until now, these arrays might be initialized more
than once, leading to potential data races as well as unnecessary
initializations. Therefore this commit ensures that each array will only
be initialized once.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mpegaudiodsp: Make ff_mpadsp_init() thread-safe
Andreas Rheinhardt [Sun, 15 Nov 2020 15:01:49 +0000 (16:01 +0100)]
avcodec/mpegaudiodsp: Make ff_mpadsp_init() thread-safe

The only thing missing for this is to make ff_mpadsp_init_x86()
thread-safe; it currently isn't because a static table is initialized
every time ff_mpadsp_init() is called (when ARCH_X86 is true). Solve
this by initializing this table only once, namely together with the
ordinary not-arch specific tables. This also allows to reuse their AVOnce.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/fft_template, fft_init_table: Make ff_fft_init() thread-safe
Andreas Rheinhardt [Wed, 18 Nov 2020 20:38:45 +0000 (21:38 +0100)]
avcodec/fft_template, fft_init_table: Make ff_fft_init() thread-safe

Commit 1af615683e4a1a858407afbaa2fd686842da7e49 put initializing
the ff_fft_offsets_lut (which is typically used if FFT_FIXED_32)
behind an ff_thread_once() to make ff_fft_init() thread-safe; yet
there is a second place where said table may be initialized which
is not guarded by this AVOnce: ff_fft_init_mips(). MIPS uses this LUT
even for ordinary floating point FFTs, so that ff_fft_init() is not
thread-safe (on MIPS) for both 32bit fixed-point as well as
floating-point FFTs; e.g. ff_mdct_init() inherits this flaw and
therefore initializing e.g. the AAC decoders is not thread-safe (on
MIPS) despite them having FF_CODEC_CAP_INIT_CLEANUP set.

This commit fixes this by moving the AVOnce to fft_init_table.c and
using it to guard all initializations of ff_fft_offsets_lut.

(It is not that bad in practice, because every entry of
ff_fft_offsets_lut is never read during initialization and is only once
ever written to (namely to its final value); but even these are
conflicting actions which are (by definition) data races and lead to
undefined behaviour.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mpegaudiodsp: Combine initializing float and int tables
Andreas Rheinhardt [Sun, 15 Nov 2020 14:53:34 +0000 (15:53 +0100)]
avcodec/mpegaudiodsp: Combine initializing float and int tables

This avoids code duplication in the functions used to initialize them
and allows to remove an AVOnce.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/motionpixels: Make decoder init-threadsafe
Andreas Rheinhardt [Tue, 17 Nov 2020 09:50:01 +0000 (10:50 +0100)]
avcodec/motionpixels: Make decoder init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/motionpixels: Use symbols table
Andreas Rheinhardt [Thu, 29 Oct 2020 09:56:32 +0000 (10:56 +0100)]
avcodec/motionpixels: Use symbols table

If allows us to directly store the deltas in the VLC table and therefore
avoids a level of indirection.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/motionpixels: Don't check for errors for complete VLC
Andreas Rheinhardt [Thu, 29 Oct 2020 09:25:09 +0000 (10:25 +0100)]
avcodec/motionpixels: Don't check for errors for complete VLC

The algorithm used here always creates a complete VLC, so it is
unnecessary to check this again.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/motionpixels: Be more strict when parsing Huffman trees
Andreas Rheinhardt [Thu, 29 Oct 2020 09:41:01 +0000 (10:41 +0100)]
avcodec/motionpixels: Be more strict when parsing Huffman trees

This ensures that the number of leafs in the Huffman tree equals the
number it is supposed to be and therefore ensures that the VLC tree is
complete, allowing us to remove checks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/motionpixels: Only create VLC iff it is going to be used
Andreas Rheinhardt [Thu, 29 Oct 2020 08:46:34 +0000 (09:46 +0100)]
avcodec/motionpixels: Only create VLC iff it is going to be used

If the Huffman tree consists of only one entry (which has length zero),
no tree is used at all for parsing as the VLC API currently can't handle
this. So it makes no sense to create a VLC in this case.

Commit 41b7389cade702383e59343561776f83bb26e17f added a check for
whether creating the VLC should be skipped, but it also skipped decoding
the packet and it used the wrong check: It checked max_codes_bits,
the maximum length of a code; but this value is only updated iff there is
more than one Huffman entry. So if there is only one Huffman entry, and
there was a previous frame with more than one entry, then a VLC was
created unnecessarily; yet if there was no previous frame with more than
one entry, then this frame will be skipped which is probably
spec-incompliant. I have no sample for the latter.

This commit improves the check to create a VLC iff it is going to be
used.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mimic: Mark decoder as init-threadsafe
Andreas Rheinhardt [Sun, 15 Nov 2020 12:41:41 +0000 (13:41 +0100)]
avcodec/mimic: Mark decoder as init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mimic: Cleanup generically upon init failure
Andreas Rheinhardt [Sun, 15 Nov 2020 12:34:57 +0000 (13:34 +0100)]
avcodec/mimic: Cleanup generically upon init failure

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/rv10: Make initializing static RV10 VLCs thread-safe
Andreas Rheinhardt [Tue, 17 Nov 2020 09:09:34 +0000 (10:09 +0100)]
avcodec/rv10: Make initializing static RV10 VLCs thread-safe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/smacker: Mark decoders as init-threadsafe
Andreas Rheinhardt [Sun, 15 Nov 2020 09:27:04 +0000 (10:27 +0100)]
avcodec/smacker: Mark decoders as init-threadsafe

Both Smacker audio and video decoders don't use/modify any global state.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/tscc2: Mark tscc2 decoder as init-threadsafe
Andreas Rheinhardt [Sun, 15 Nov 2020 08:53:00 +0000 (09:53 +0100)]
avcodec/tscc2: Mark tscc2 decoder as init-threadsafe

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/af_adenorm: add timeline and slice threading support
Paul B Mahol [Tue, 24 Nov 2020 10:27:14 +0000 (11:27 +0100)]
avfilter/af_adenorm: add timeline and slice threading support

3 years agoavfilter/af_asubboost: add timeline and slice threading support
Paul B Mahol [Tue, 24 Nov 2020 09:00:34 +0000 (10:00 +0100)]
avfilter/af_asubboost: add timeline and slice threading support

3 years agoavcodec: add SpeedHQ encoder
Jean-Baptiste Kempf [Mon, 9 Nov 2020 11:25:02 +0000 (12:25 +0100)]
avcodec: add SpeedHQ encoder

3 years agoavformat/av1: add support for passing through MP4/Matroska av1c
Jan Ekström [Mon, 23 Nov 2020 16:00:44 +0000 (18:00 +0200)]
avformat/av1: add support for passing through MP4/Matroska av1c

3 years agoavcodec/av1{dec,parser}: move to ff_cbs_read_extradata_from_codec
Jan Ekström [Mon, 23 Nov 2020 15:36:20 +0000 (17:36 +0200)]
avcodec/av1{dec,parser}: move to ff_cbs_read_extradata_from_codec

This lets us re-utilize the extradata-related checks in the CBS
to add support for passing the AV1CodecConfigurationRecord
as extradata as-is without further filtering.

3 years agoavcodec/cbs_av1: add support for standard MP4/Matroska extradata
Jan Ekström [Mon, 23 Nov 2020 17:37:38 +0000 (19:37 +0200)]
avcodec/cbs_av1: add support for standard MP4/Matroska extradata

This way API clients can just pass the AV1CodecConfigurationRecord
as extradata as-is without further filtering.

3 years agocbs: Add function to read extradata from an AVCodecContext
Mark Thompson [Mon, 23 Nov 2020 17:53:57 +0000 (17:53 +0000)]
cbs: Add function to read extradata from an AVCodecContext

This is useful in decoders and parsers, matching the way that bitstream
filters read extradata from AVCodecParameters.

3 years agoavdevice/decklink_dec: fix warning for unused variable
Limin Wang [Thu, 19 Nov 2020 14:35:02 +0000 (22:35 +0800)]
avdevice/decklink_dec: fix warning for unused variable

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavdevice/decklink: add AV_OPT_FLAG_DEPRECATED flag for list_devices
Limin Wang [Sun, 22 Nov 2020 13:34:16 +0000 (21:34 +0800)]
avdevice/decklink: add AV_OPT_FLAG_DEPRECATED flag for list_devices

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavdevice/decklink: use boolean for list_devices option
Limin Wang [Thu, 19 Nov 2020 13:57:52 +0000 (21:57 +0800)]
avdevice/decklink: use boolean for list_devices option

For the document(indevs.texi and outdevs.texi) used it as boolean.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavfilter/af_aiir: add support for arbitrary order lattice-ladder filter format
Paul B Mahol [Sun, 22 Nov 2020 20:57:39 +0000 (21:57 +0100)]
avfilter/af_aiir: add support for arbitrary order lattice-ladder filter format

3 years agoavcodec/exr: skip bottom clearing loop when its outside the image
Michael Niedermayer [Sat, 24 Oct 2020 22:23:12 +0000 (00:23 +0200)]
avcodec/exr: skip bottom clearing loop when its outside the image

Fixes: signed integer overflow: 1633771809 * 32960 cannot be represented in type 'int'
Fixes: 26532/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5613925708857344
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 agoavcodec/exr: Check ymin vs. h
Michael Niedermayer [Sat, 24 Oct 2020 20:21:48 +0000 (22:21 +0200)]
avcodec/exr: Check ymin vs. h

Fixes: out of array access
Fixes: 26532/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5613925708857344
Fixes: 27443/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_EXR_fuzzer-5631239813595136
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/avs: Use 64bit for the avio_tell() output
Michael Niedermayer [Sat, 24 Oct 2020 22:23:10 +0000 (00:23 +0200)]
avformat/avs: Use 64bit for the avio_tell() output

Fixes: signed integer overflow: 9223372036854775807 - -1 cannot be represented in type 'long'
Fixes: 26549/clusterfuzz-testcase-minimized-ffmpeg_dem_AVS_fuzzer-4844306424397824
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/moflex: Check pkt_size
Michael Niedermayer [Sat, 24 Oct 2020 22:23:07 +0000 (00:23 +0200)]
avformat/moflex: Check pkt_size

Fixes: Timeout (>20sec -> 1ms)
Fixes: 26527/clusterfuzz-testcase-minimized-ffmpeg_dem_MOFLEX_fuzzer-6308307310215168
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 agoavfilter/af_biquads: remove not needed code
Paul B Mahol [Sun, 22 Nov 2020 13:16:52 +0000 (14:16 +0100)]
avfilter/af_biquads: remove not needed code

3 years agoavformat/movenc: allow Apple Lossless inside mp4
Leo Izen [Fri, 20 Nov 2020 16:38:31 +0000 (11:38 -0500)]
avformat/movenc: allow Apple Lossless inside mp4

The 'alac' identifier has been registered to ISO and thus towards
ISOBMFF at the MP4 registration authority. The existing non-MOV
mux mode matches the official ALAC-in-MP4 specification.

3 years agoavfilter/af_afreqshift: add timeline and slice threading support
Paul B Mahol [Sun, 22 Nov 2020 09:44:49 +0000 (10:44 +0100)]
avfilter/af_afreqshift: add timeline and slice threading support

3 years agoavcodec/atrac3: increase max block align size
Paul B Mahol [Sat, 21 Nov 2020 21:09:17 +0000 (22:09 +0100)]
avcodec/atrac3: increase max block align size

Fixes decoding of lossy part of advanced lossless atrac3.
Regression since f09151fff9c754fbc1d2560adf18b14957f8b181

3 years agoavcodec/mobiclip: Check mv against INT_MAX
Michael Niedermayer [Sat, 14 Nov 2020 21:27:00 +0000 (22:27 +0100)]
avcodec/mobiclip: Check mv against INT_MAX

Fixes: signed integer overflow: 2147483647 + 1 cannot be represented in type 'int'
Fixes: 27369/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-5083469356728320
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/wavdec: More complete size check in find_guid()
Michael Niedermayer [Sat, 14 Nov 2020 21:13:52 +0000 (22:13 +0100)]
avformat/wavdec: More complete size check in find_guid()

Fixes: signed integer overflow: 9223372036854775807 + 8 cannot be represented in type 'long'
Fixes: 27341/clusterfuzz-testcase-minimized-ffmpeg_dem_W64_fuzzer-5442833206738944
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 agoavcodec/mv30: Use unsigned in idct_1d()
Michael Niedermayer [Sat, 14 Nov 2020 20:10:18 +0000 (21:10 +0100)]
avcodec/mv30: Use unsigned in idct_1d()

Fixes: signed integer overflow: 2110302399 + 39074947 cannot be represented in type 'int'
Fixes: 27330/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MV30_fuzzer-5664923153334272
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 before skip
Michael Niedermayer [Sat, 14 Nov 2020 19:59:01 +0000 (20:59 +0100)]
avformat/iff: Check size before skip

Fixes: Infinite loop
Fixes: 27292/clusterfuzz-testcase-minimized-ffmpeg_dem_IFF_fuzzer-5731168991051776
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/rmdec: Check for EOF in index packet reading
Michael Niedermayer [Fri, 13 Nov 2020 22:30:47 +0000 (23:30 +0100)]
avformat/rmdec: Check for EOF in index packet reading

Fixes: Timeout(>10sec -> 1ms)
Fixes: 27284/clusterfuzz-testcase-minimized-ffmpeg_dem_RM_fuzzer-6304211110985728
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 agoavcodec/cuviddec: fix missing context push/pop
leozhang [Fri, 20 Nov 2020 03:23:43 +0000 (11:23 +0800)]
avcodec/cuviddec: fix missing context push/pop

Test command like below:
cuda-memcheck ./ffmpeg -hwaccel cuvid -c:v h264_cuvid -i input_file -c:v h264_nvenc -f null -

Signed-off-by: leozhang <nowerzt@gmail.com>
Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
3 years agoavformat/rtsp: don't forget to call ff_network_close() on error
Andriy Gelman [Mon, 12 Oct 2020 20:36:09 +0000 (16:36 -0400)]
avformat/rtsp: don't forget to call ff_network_close() on error

In sdp_read_header() some ff_network_close() calls were missed.

Also in rtp_read_header() update comment to explain why a single
call to ff_network_close() is enough to cover all cases even if
sdp_read_header() returns an error.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
3 years agoavformat/rtsp: set return variable in error path
Andriy Gelman [Mon, 12 Oct 2020 20:36:08 +0000 (16:36 -0400)]
avformat/rtsp: set return variable in error path

In this error path ret still stores the number of bytes read in
ffurl_read().

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
3 years agoavformat/rtspdec: cosmetics
Andriy Gelman [Mon, 12 Oct 2020 20:36:07 +0000 (16:36 -0400)]
avformat/rtspdec: cosmetics

Make error check style consistent with rest of function.

Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
3 years agoavformat/rtspdec: fix mem leaks in connect mode if init fails
Andriy Gelman [Mon, 12 Oct 2020 20:36:06 +0000 (16:36 -0400)]
avformat/rtspdec: fix mem leaks in connect mode if init fails

Fixes #6334

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
3 years agoavformat/rtspdec: fix mem leaks in listen mode if init fails
Andriy Gelman [Mon, 12 Oct 2020 20:36:05 +0000 (16:36 -0400)]
avformat/rtspdec: fix mem leaks in listen mode if init fails

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
3 years agoavformat/rtspdec: add network init to listen mode
Andriy Gelman [Mon, 12 Oct 2020 20:36:04 +0000 (16:36 -0400)]
avformat/rtspdec: add network init to listen mode

As per the docs network initialization is required before ff_url_join().
Furthermore, because the ff_network_init() was skipped, this makes
one additional call to ff_network_close() if the stream exits without
errors.

The was forgotten in the origin commit of the listen mode:
a8ad6ffafe89e3a83f343f69249338e8245816f7

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
3 years agoavdevice/decklink_dec: map the raw_format instead of hardcode
Limin Wang [Thu, 19 Nov 2020 04:16:47 +0000 (12:16 +0800)]
avdevice/decklink_dec: map the raw_format instead of hardcode

The patch will change the numerical values for the string constants so bump
micro version.

Reviewed-by: Marton Balint <cus@passwd.hu>
Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agotools/target_bsf_fuzzer: set bitstream filter options
James Almer [Sun, 15 Nov 2020 01:14:24 +0000 (22:14 -0300)]
tools/target_bsf_fuzzer: set bitstream filter options

Should increase coverage with some bitstream filters

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agotools/target_bsf_fuzzer: Call av_bsf_flush() in a fuzzer choosen pattern
James Almer [Sun, 15 Nov 2020 01:11:17 +0000 (22:11 -0300)]
tools/target_bsf_fuzzer: Call av_bsf_flush() in a fuzzer choosen pattern

This should increase coverage.

Based on a commit by Michael Niedermayer

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agotools/target_dec_fuzzer: Call avcodec_flush_buffers() in a fuzzer choosen pattern
Michael Niedermayer [Sun, 15 Nov 2020 00:41:19 +0000 (21:41 -0300)]
tools/target_dec_fuzzer: Call avcodec_flush_buffers() in a fuzzer choosen pattern

This should increase coverage

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agotools/target_dem_fuzzer: use avio_context_free() to free the fuzzer's AVIOContext
James Almer [Sat, 14 Nov 2020 20:19:04 +0000 (17:19 -0300)]
tools/target_dem_fuzzer: use avio_context_free() to free the fuzzer's AVIOContext

The doxy for avio_alloc_context() states it must be used for this.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agolavfi/src_movie: switch to new decoding API
Anton Khirnov [Mon, 2 Nov 2020 11:26:18 +0000 (12:26 +0100)]
lavfi/src_movie: switch to new decoding API

3 years agodoc/examples/transcoding: switch to the new encoding API
Anton Khirnov [Thu, 29 Oct 2020 15:00:23 +0000 (16:00 +0100)]
doc/examples/transcoding: switch to the new encoding API

3 years agodoc/examples/transcoding: stop constantly allocating AVFrames
Anton Khirnov [Thu, 29 Oct 2020 15:00:23 +0000 (16:00 +0100)]
doc/examples/transcoding: stop constantly allocating AVFrames

Allocate just one and reuse it.

3 years agolavu: add missing stddef.h includes for size_t.
Anton Khirnov [Mon, 24 Feb 2020 12:18:57 +0000 (13:18 +0100)]
lavu: add missing stddef.h includes for size_t.

3 years agolavfi/lavfutils: switch to the new decoding API
Anton Khirnov [Sat, 18 Apr 2020 13:53:18 +0000 (15:53 +0200)]
lavfi/lavfutils: switch to the new decoding API

3 years agotools/enum_options: fix build and add to Makefile
Anton Khirnov [Sun, 12 Apr 2020 07:01:55 +0000 (09:01 +0200)]
tools/enum_options: fix build and add to Makefile

3 years agoavformat/matroskadec: only use the track duration if it exists
Steve Lhomme [Sun, 15 Nov 2020 09:00:35 +0000 (10:00 +0100)]
avformat/matroskadec: only use the track duration if it exists

No need to multiplying/dividing when we know it's zero.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
3 years agoavformat/matroskadec: adjust the cluster time to the track timebase
Steve Lhomme [Sun, 15 Nov 2020 08:59:48 +0000 (09:59 +0100)]
avformat/matroskadec: adjust the cluster time to the track timebase

The Block timestamp read in matroska_parse_block() is in track timebase and is
passed on as such to the AVPacket which uses this timebase.

In the normal case the Cluster and Track timebases are the same because the
track->time_scale is 1.0. But when it is not the case, the values in Cluster
timebase need to be transformed in Track timebase so they can be added
together.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
3 years agoavformat/matroskadec: add a warning when the track TimestampScale won't be used
Steve Lhomme [Sun, 15 Nov 2020 08:59:47 +0000 (09:59 +0100)]
avformat/matroskadec: add a warning when the track TimestampScale won't be used

Signed-off-by: Anton Khirnov <anton@khirnov.net>
3 years agoavfilter/vf_lut3d: fix sanitizef INF handling
Mark Reid [Mon, 9 Nov 2020 01:12:29 +0000 (17:12 -0800)]
avfilter/vf_lut3d: fix sanitizef INF handling

Signed-off-by: Anton Khirnov <anton@khirnov.net>
3 years agoavcodec/exr: use lookuptable for alpha if there is no trc_func
Mark Reid [Mon, 9 Nov 2020 03:37:23 +0000 (19:37 -0800)]
avcodec/exr: use lookuptable for alpha if there is no trc_func

Signed-off-by: Anton Khirnov <anton@khirnov.net>
3 years agohttp: Check for AVERROR_EOF in the check for premature end
Martin Storsjö [Thu, 12 Nov 2020 22:06:30 +0000 (00:06 +0200)]
http: Check for AVERROR_EOF in the check for premature end

When the check was added (in 3668701f9600, in 2015), some IO
functions returned 0 on EOF (in particular, the TCP protocol
did, but the TLS protocol returned AVERROR_EOF). Since
0e1f771d2200d in 2017, the TCP protocol also returns AVERROR_EOF
instead of 0, making the check for premature end never have the
intended effect.

Signed-off-by: Martin Storsjö <martin@martin.st>
3 years agoavformat/mpegts: make sure mpegts_read_header always stops at the first pmt
Marton Balint [Sat, 14 Nov 2020 23:31:11 +0000 (00:31 +0100)]
avformat/mpegts: make sure mpegts_read_header always stops at the first pmt

mpegts_read_header stops parsing the file at the first PMT. However the check
that ensured this was wrong because streams can also be added before the first
PMT is received (e.g. EIT).

So let's make sure we are in the header reading phase by checking if ts->pkt is
unset instead of checking if the number of streams found so far is 0.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/dvenc: check the format before vst and ast[i] are initialized
Limin Wang [Thu, 27 Aug 2020 15:40:02 +0000 (23:40 +0800)]
avformat/dvenc: check the format before vst and ast[i] are initialized

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavformat/dvenc: s->streams[i] -> st
Limin Wang [Thu, 27 Aug 2020 15:32:48 +0000 (23:32 +0800)]
avformat/dvenc: s->streams[i] -> st

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavfilter/vf_fade: config_props -> config_input
Limin Wang [Fri, 30 Oct 2020 13:45:28 +0000 (21:45 +0800)]
avfilter/vf_fade: config_props -> config_input

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavfilter/vf_fade: simplify code to use pts timebase for time check
Limin Wang [Fri, 30 Oct 2020 13:37:51 +0000 (21:37 +0800)]
avfilter/vf_fade: simplify code to use pts timebase for time check

Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
3 years agoavfilter/vf_xfade: add squeeze transitions
Paul B Mahol [Thu, 19 Nov 2020 13:50:02 +0000 (14:50 +0100)]
avfilter/vf_xfade: add squeeze transitions

3 years agoavutil/frame: fix potential leaks in av_frame_ref()
Gil Pedersen [Wed, 18 Nov 2020 13:05:18 +0000 (13:05 +0000)]
avutil/frame: fix potential leaks in av_frame_ref()

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavutil/frame: use av_buffer_replace() to simplify code
Gil Pedersen [Wed, 18 Nov 2020 13:05:17 +0000 (13:05 +0000)]
avutil/frame: use av_buffer_replace() to simplify code

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Gil Pedersen <git@gpost.dk>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/wavpack: use av_buffer_replace() to simplify code
Gil Pedersen [Wed, 18 Nov 2020 13:05:16 +0000 (13:05 +0000)]
avcodec/wavpack: use av_buffer_replace() to simplify code

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Gil Pedersen <git@gpost.dk>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavfilter/vf_frei0r: add support for commands
Paul B Mahol [Thu, 19 Nov 2020 10:53:10 +0000 (11:53 +0100)]
avfilter/vf_frei0r: add support for commands

3 years agoavfilter/vf_despill: add support for commands
Paul B Mahol [Wed, 18 Nov 2020 16:34:52 +0000 (17:34 +0100)]
avfilter/vf_despill: add support for commands

3 years agoavfilter/af_afade: add sinc curve types
Paul B Mahol [Wed, 18 Nov 2020 10:10:39 +0000 (11:10 +0100)]
avfilter/af_afade: add sinc curve types

3 years agofate: Convert the musepack8 test to an oneoff test
Martin Storsjö [Wed, 11 Nov 2020 10:18:42 +0000 (12:18 +0200)]
fate: Convert the musepack8 test to an oneoff test

This fixes tests if built for x86 with x87 FPU.

Signed-off-by: Martin Storsjö <martin@martin.st>
3 years agoavfilter/af_anlmdn: support all options as commands
Paul B Mahol [Tue, 17 Nov 2020 12:43:55 +0000 (13:43 +0100)]
avfilter/af_anlmdn: support all options as commands

3 years agoavfilter/af_anlmdn: allow to change smooth/m at runtime
Paul B Mahol [Tue, 17 Nov 2020 11:45:36 +0000 (12:45 +0100)]
avfilter/af_anlmdn: allow to change smooth/m at runtime

3 years agolavfi/frei0r: Remove duplicated pix_fmt entry
Andrew Rodland [Sat, 14 Nov 2020 18:10:39 +0000 (13:10 -0500)]
lavfi/frei0r: Remove duplicated pix_fmt entry

Fixes e.g. 'ffmpeg -i input.mp4 -vf frei0r=pixeliz0r output.mp4':

    [Parsed_frei0r_0 @ 0x5585b8093280] Duplicated pixel format
    Error reinitializing filters!
    Failed to inject frame into filter network: Invalid argument
    Error while processing the decoded data for stream #0:0
    Conversion failed!

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
3 years agoavcodec/mobiclip: Use get_ue_golomb_31() where possible
Andreas Rheinhardt [Thu, 5 Nov 2020 21:03:57 +0000 (22:03 +0100)]
avcodec/mobiclip: Use get_ue_golomb_31() where possible

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/asfdec_o: Remove code duplication
Andreas Rheinhardt [Tue, 17 Sep 2019 17:54:37 +0000 (19:54 +0200)]
avformat/asfdec_o: Remove code duplication

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/asfdec_o: Don't reset twice
Andreas Rheinhardt [Tue, 17 Sep 2019 17:49:51 +0000 (19:49 +0200)]
avformat/asfdec_o: Don't reset twice

A variable has been assigned a value twice consecutively; essentially
the same happens when one performs av_init_packet on an AVPacket after
a call to av_packet_unref.

Found via PVS-Studio (see ticket #8156).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/asfdec_o: Export metadata that applies to the whole file
Andreas Rheinhardt [Thu, 12 Nov 2020 16:57:37 +0000 (17:57 +0100)]
avformat/asfdec_o: Export metadata that applies to the whole file

The ASF specification of Metadata Objects' stream number is as follows:

"Specifies whether the entry applies to a specific digital media stream
or whether it applies to the whole file. A value of 0 in this field
indicates that it applies to the whole file; otherwise, the entry
applies only to the indicated stream number and must be between 1 and
127."

Yet the asf_o demuxer (the one originating from Libav) has always
treated such metadata as if it applied to a stream even though no stream
with a stream number may exist in a valid ASF file. This is fixed in
this commit; it affected e.g. the file
wma_with_metadata_library_object_tag_trimmed.wma from the FATE suite.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/asfdec_o: Don't segfault with lots of attached pics
Andreas Rheinhardt [Thu, 12 Nov 2020 15:13:48 +0000 (16:13 +0100)]
avformat/asfdec_o: Don't segfault with lots of attached pics

The ASF file format has a limit of 127 streams and the "asf_o" demuxer
(the ASF demuxer from Libav) has an array of pointers for a structure
called ASFStream that is allocated on demand for every stream. Attached
pictures are not streams in the sense of the ASF specification, yet the
demuxer created an ASFStream for them; and in one codepath it also
forgot to check whether the array of ASFStreams is already full. The
result is a write beyond the end of the array and a segfault lateron.

Fixing this is easy: Don't create ASFStreams for attached picture
streams.

(Other results of the current state of affairs are unnecessary allocations
(of ASFStreams structures), the misparsing of valid files (there might not
be enough ASFStreams left for the valid streams if attached pictures take
up too many); furthermore, the ASFStreams created for attached pictures all
have the stream number 0, an invalid stream number (the valid range is
1-127). This means that invalid data (packets for a stream with stream
number 0) won't get rejected lateron.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter: add speechnorm filter
Paul B Mahol [Sat, 2 May 2020 18:27:37 +0000 (20:27 +0200)]
avfilter: add speechnorm filter

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>