]> git.sesse.net Git - ffmpeg/log
ffmpeg
3 years agoavutil/buffer: change public function and struct size parameter types to size_t
James Almer [Sat, 6 Mar 2021 15:26:16 +0000 (12:26 -0300)]
avutil/buffer: change public function and struct size parameter types to size_t

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavfilter/af_dynaudnorm: make better check for available samples
Paul B Mahol [Wed, 10 Mar 2021 22:48:44 +0000 (23:48 +0100)]
avfilter/af_dynaudnorm: make better check for available samples

Also report more correct EOF timestamp.

3 years agoavfilter/vf_nnedi: Fix use of uninitialized value
Andreas Rheinhardt [Tue, 9 Mar 2021 21:43:13 +0000 (22:43 +0100)]
avfilter/vf_nnedi: Fix use of uninitialized value

Fixes Coverity issue #1473546.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agofftools/ffplay: do not write out of rdft visualization texture
Marton Balint [Wed, 3 Mar 2021 22:23:10 +0000 (23:23 +0100)]
fftools/ffplay: do not write out of rdft visualization texture

If the window is resized it was possible that xpos pointed outside the
visualization texture. By rearranging the overflow check we make sure this (and
a crash) does not happen.

We also don't have to use xleft for start position, as that is 0 anyways, and
if we ever want to take into account xleft then the texture should be
positioned accordingly when rendering.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavcodec/mediacodec_wrapper: use MediaCodecInfo.isSoftwareOnly() when available
sfan5 [Wed, 17 Feb 2021 15:51:09 +0000 (16:51 +0100)]
avcodec/mediacodec_wrapper: use MediaCodecInfo.isSoftwareOnly() when available

Added in Android 10 it provides a reliable way of filtering out
software decoders, unlike existing string-based checks.

3 years agoavcodec/mediacodec_wrapper: check if codec is software earlier
sfan5 [Wed, 17 Feb 2021 15:50:00 +0000 (16:50 +0100)]
avcodec/mediacodec_wrapper: check if codec is software earlier

3 years agoavformat/mvdec: Allocate extradata only once
Michael Niedermayer [Fri, 1 Jan 2021 23:36:39 +0000 (00:36 +0100)]
avformat/mvdec: Allocate extradata only once

Fixes: memleak
Fixes: 28686/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5822961932173312
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 agolibavcodec/amfenc_hevc: Recommend values for min and max video quantizer scale.
Ovchinnikov Dmitrii [Tue, 9 Mar 2021 19:05:07 +0000 (22:05 +0300)]
libavcodec/amfenc_hevc: Recommend values for min and max video quantizer scale.

Current settings makes bitrate larger than expected, more information:
https://github.com/HandBrake/HandBrake/issues/3447#issue-820490736

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/decode: Reindent after previous commits
Andreas Rheinhardt [Thu, 4 Mar 2021 13:04:08 +0000 (14:04 +0100)]
avcodec/decode: Reindent after previous commits

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/decode: Don't needlessly copy side-data for subtitles
Andreas Rheinhardt [Thu, 4 Mar 2021 12:49:20 +0000 (13:49 +0100)]
avcodec/decode: Don't needlessly copy side-data for subtitles

AVCodecInternal.last_pkt_props is not used when decoding subtitles;
ergo it makes no sense to set it at all.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/decode: Avoid stack packets when decoding subtitles
Andreas Rheinhardt [Thu, 4 Mar 2021 09:53:26 +0000 (10:53 +0100)]
avcodec/decode: Avoid stack packets when decoding subtitles

Use AVCodecInternal.buffer_pkt (previously only used in
avcodec_send_packet) instead of stack packets when decoding subtitles.
Also stop sharing side-data between packets and use the user-supplied
packet directly for decoding when possible (no subtitle decoder ever
modifies the packet it is given).
Reusing AVCodecInternal.buffer_pkt is based upon an idea from James
Almer.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/qsvdec: Make functions used only here static, remove header
Andreas Rheinhardt [Thu, 4 Mar 2021 15:08:41 +0000 (16:08 +0100)]
avcodec/qsvdec: Make functions used only here static, remove header

Forgotten after d78ecf10bd745cb69a71b32419e0661bfdcfb1fd.

(Also mark some AVPackets as const.)

Reviewed-by: Mark Thompson <sw@jkqxz.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec: Constify some AVPackets
Andreas Rheinhardt [Thu, 4 Mar 2021 12:13:20 +0000 (13:13 +0100)]
avcodec: Constify some AVPackets

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agomailmap: add entry for myself
Linjie Fu [Mon, 8 Mar 2021 15:06:10 +0000 (15:06 +0000)]
mailmap: add entry for myself

Signed-off-by: Linjie Fu <linjie.justin.fu@gmail.com>
3 years agoavcodec/dcadsp: Fix integer overflow in dmix_add_c()
Michael Niedermayer [Sat, 30 Jan 2021 18:09:36 +0000 (19:09 +0100)]
avcodec/dcadsp: Fix integer overflow in dmix_add_c()

Fixes: signed integer overflow: 1515225320 + 759416059 cannot be represented in type 'int'
Fixes: 29256/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DCA_fuzzer-5719088561258496
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/flvdec: Check double before cast in parse_keyframes_index()
Michael Niedermayer [Tue, 26 Jan 2021 15:50:10 +0000 (16:50 +0100)]
avformat/flvdec: Check double before cast in parse_keyframes_index()

Fixes: -2.21166e+304 is outside the range of representable values of type 'long'
Fixes: 29169/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5725452796821504
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 before allocation in read_header()
Michael Niedermayer [Tue, 19 Jan 2021 23:11:34 +0000 (00:11 +0100)]
avformat/paf: Check for EOF before allocation in read_header()

Fixes: OOM
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 agotools/target_dec_fuzzer: Adjust flv1 threshold
Michael Niedermayer [Wed, 20 Jan 2021 23:44:48 +0000 (00:44 +0100)]
tools/target_dec_fuzzer: Adjust flv1 threshold

Fixes: Timeout (long -> 95ms)
Fixes: 29068/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FLV_fuzzer-6509662832820224
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/aacdec_template: Avoid undefined negation in imdct_and_windowing_eld()
Michael Niedermayer [Wed, 20 Jan 2021 22:56:43 +0000 (23:56 +0100)]
avcodec/aacdec_template: Avoid undefined negation in imdct_and_windowing_eld()

Fixes: negation of -2147483648 cannot be represented in type 'INTFLOAT' (aka 'int'); cast to an unsigned type to negate this value to itself
Fixes: 29057/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AAC_FIXED_fuzzer-5642758933053440
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/swfdec: Check outlen before allocation
Michael Niedermayer [Thu, 21 Jan 2021 23:39:19 +0000 (00:39 +0100)]
avformat/swfdec: Check outlen before allocation

Fixes: Timeout (too long -> 241ms)
Fixes: 29083/clusterfuzz-testcase-minimized-ffmpeg_dem_SWF_fuzzer-6273684478230528
The source of the magic number is
A very quick simulation of the best case compression for "compress"
below is not nice written code as i did not expect I or anyone else
would ever see it again

I would have preferred some nicer expression or course, but thats
what it seems to be asymptotically. For smaller amounts of data a
tighter bound is possible but i saw no nice way to consider that
and it seems also overkill to try to do it more fine grained for
just this

main(){
    int64_t bits = 0;
    int bank = 256;
    int bitbank = 8;
    for(unsigned i = 0; i<1024*1024*1024*4U-100000;) {
        int word_size = bank-255;
        i += word_size;
        bits += bitbank;

        if (!(bank & (bank-1)))
            bitbank ++;
        bank++;
        if (bitbank > 16) {
            printf("BEST %f \n", 8.0 * i / bits );
            bank = 256;
            bitbank = 8;
        }
    }
}

above assumes i remembered correctly how the algorithm works but the
value was close to what actual compession of zeros gave

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/mpeg4videodec: add forgotten flags to mpeg4_options
Paul B Mahol [Tue, 2 Mar 2021 18:52:18 +0000 (19:52 +0100)]
avcodec/mpeg4videodec: add forgotten flags to mpeg4_options

3 years agomobiclip: fix copyright headers
Florian Nouwt [Mon, 8 Mar 2021 10:54:04 +0000 (11:54 +0100)]
mobiclip: fix copyright headers

The Mobiclip related code was based on Mobius (https://github.com/adibsurani/Mobius),
which was based on my original reverse engineering efforts (https://github.com/Gericom/MobiclipDecoder).
This commit adds the appropriate copyright headers on the related files.

Signed-off-by: Florian Nouwt <fnouwt2@gmail.com>
3 years agoavcodec/ylc: Reindent after previous commit
Andreas Rheinhardt [Mon, 8 Mar 2021 15:08:52 +0000 (16:08 +0100)]
avcodec/ylc: Reindent after previous commit

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/ylc: Avoid code duplication when creating and freeing VLCs
Andreas Rheinhardt [Mon, 8 Mar 2021 15:05:26 +0000 (16:05 +0100)]
avcodec/ylc: Avoid code duplication when creating and freeing VLCs

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/ylc: Use only one temporary buffer
Andreas Rheinhardt [Mon, 8 Mar 2021 13:12:06 +0000 (14:12 +0100)]
avcodec/ylc: Use only one temporary buffer

The effective lifetime of the buffer used to build the VLCs and
the buffer containing the bitstream is disjoint, so that one can use
a common buffer for both.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/ylc: Remove write-only variable
Andreas Rheinhardt [Mon, 8 Mar 2021 12:59:54 +0000 (13:59 +0100)]
avcodec/ylc: Remove write-only variable

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/h261dec: Remove parse_context cruft
Andreas Rheinhardt [Tue, 22 Dec 2020 17:54:12 +0000 (18:54 +0100)]
avcodec/h261dec: Remove parse_context cruft

The H.261 decoder doesn't use the ParseContext of its
MpegEncContext since e7316976650b429345da619c3acff38004aaf6b8.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agolavc: clarify thread_safe_callbacks doxy
Anton Khirnov [Tue, 2 Mar 2021 09:08:08 +0000 (10:08 +0100)]
lavc: clarify thread_safe_callbacks doxy

State explicitly when this field will be removed and how to access it in
a forward compatible way.

3 years agolscrdec: add copyright header
Anton Khirnov [Thu, 4 Mar 2021 09:02:49 +0000 (10:02 +0100)]
lscrdec: add copyright header

As requested by the author.

3 years agolavc: remove tests/options
Anton Khirnov [Mon, 14 Dec 2020 14:32:41 +0000 (15:32 +0100)]
lavc: remove tests/options

It tests deprecated avcodec_copy_context().

3 years agotests/api-flac-test: reindent
Anton Khirnov [Wed, 27 Jan 2021 12:38:00 +0000 (13:38 +0100)]
tests/api-flac-test: reindent

3 years agotests/api-flac-test: convert to new encoding/decoding API
Anton Khirnov [Wed, 27 Jan 2021 12:38:00 +0000 (13:38 +0100)]
tests/api-flac-test: convert to new encoding/decoding API

3 years agotests/api-flac-test: ensure the frame is writable before writing to it
Anton Khirnov [Wed, 27 Jan 2021 10:43:03 +0000 (11:43 +0100)]
tests/api-flac-test: ensure the frame is writable before writing to it

The encoder may keep a reference to frames that were sent to it, so the
caller cannot modify them without checking first.

3 years agomjpegdec: handle lowres with AVID cropping
Anton Khirnov [Mon, 1 Mar 2021 09:10:54 +0000 (10:10 +0100)]
mjpegdec: handle lowres with AVID cropping

3 years agoavcodec/jpeglsenc: Allocate buffers together
Andreas Rheinhardt [Thu, 3 Sep 2020 17:50:03 +0000 (19:50 +0200)]
avcodec/jpeglsenc: Allocate buffers together

Having only one allocation that is not automatically freed in particular
means that one does not need to free the already allocated buffers
when allocating another one fails.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/jpeglsenc: Avoid allocation of JLSState
Andreas Rheinhardt [Thu, 3 Sep 2020 17:48:10 +0000 (19:48 +0200)]
avcodec/jpeglsenc: Avoid allocation of JLSState

This state is currently allocated and freed for every packet; but it can
just be moved to the stack instead.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/jpeglsenc: Only use one line at a time as spare buffer
Andreas Rheinhardt [Thu, 3 Sep 2020 17:02:59 +0000 (19:02 +0200)]
avcodec/jpeglsenc: Only use one line at a time as spare buffer

ls_encode_line() encodes one line of input from left to right and
to do so it uses the values of the left, upper left, upper and upper
right pixels for prediction (i.e. the values that a decoder gets when it
decodes the already encoded part of the picture). So a simple algorithm
would use a buffer that can hold two lines, namely the current line as
well as the last line and swap the pointers to the two lines after
decoding each line. Yet if one is currently encoding the pixel with
index k of a line, one doesn't need any pixel with index < k - 1 of the
last line at all and similarly, no pixels with index >= k have been
written yet. So the overlap in the effective lifetime is pretty limited
and since the last patch (which stopped reading the upper left pixel and
instead reused the value of the upper pixel from the last iteration of
the loop) it is inexistent. Ergo one only needs one line and doesn't
need to swap the lines out.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/jpeglsenc: Move check out of loop
Andreas Rheinhardt [Thu, 3 Sep 2020 16:39:43 +0000 (18:39 +0200)]
avcodec/jpeglsenc: Move check out of loop

ls_encode_line() encodes a line of input, going from left to right. In
order to calculate a predicted value it uses the left and upper-left
value of the output picture (that is, it uses how a decoder would see
the already encoded part of the picture), unless this is the very first
pixel of this line in which case one uses the first pixel of the last
(upper) line and the line before the last line. Therefore the loop
contained a check for whether this is the beginning of a new line. This
commit moves said check out of the loop by initializing these values
before the loop and by updating these values at the end of the loop
body; already read/calculated values are reused for this (the prediction
also needs the value of the upper pixel and this can be reused for the
upper left value of the next iteration of the loop).

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/jpeglsenc: Don't modify frame we don't own
Andreas Rheinhardt [Thu, 3 Sep 2020 14:25:24 +0000 (16:25 +0200)]
avcodec/jpeglsenc: Don't modify frame we don't own

The jpegls encoder uses three buffers (as well as its state) to perform
its function: A copy of the last encoded line as a decoder would decode it,
the part of the current line that has been encoded (again, as a decoder
would decode it) and the part of the current line that is not yet encoded.

The encoder solves this by modifying the input frame as it encodes the
output (it also zero-allocates a line to serve as last line for the
first line where no preceding line exists); yet this is wrong as said
frame is not owned by the encoder, so it must not be modified (and it is
given to the encoder as const AVFrame *) without making it writable.

This patch solves this bug by allocating two lines, one for the last and
one for the currently encoded line of output (as a decoder would decode it).

Notice that the frame is only modified if the encoder is in the
non-default non-lossless mode.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/jpeglsenc: Don't use put bits API for byte-aligned writes
Andreas Rheinhardt [Thu, 3 Sep 2020 10:42:09 +0000 (12:42 +0200)]
avcodec/jpeglsenc: Don't use put bits API for byte-aligned writes

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/codec: Update init_static_data doxygen
Andreas Rheinhardt [Sat, 6 Mar 2021 13:31:05 +0000 (14:31 +0100)]
avcodec/codec: Update init_static_data doxygen

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/avcodec: Don't suggest calling deprecated avcodec_register_all()
Andreas Rheinhardt [Fri, 26 Feb 2021 03:59:59 +0000 (04:59 +0100)]
avcodec/avcodec: Don't suggest calling deprecated avcodec_register_all()

Despite avcodec_register and avcodec_register_all being deprecated,
their documentation still said that one of them has to be called
before doing anything else. Clarify this confusing situation.

Furthermore, don't use avcodec_register_all in sample code for
a non-deprecated function.

Reviewed-by: mypopy@gmail.com <mypopy@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/dashdec: Don't needlessly strdup metadata
Andreas Rheinhardt [Tue, 2 Mar 2021 14:44:07 +0000 (15:44 +0100)]
avformat/dashdec: Don't needlessly strdup metadata

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/dashdec: Remove limit on length of id
Andreas Rheinhardt [Tue, 2 Mar 2021 14:32:30 +0000 (15:32 +0100)]
avformat/dashdec: Remove limit on length of id

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/codec: add doxy to AVCodec.decode()
James Almer [Fri, 5 Mar 2021 04:05:05 +0000 (01:05 -0300)]
avcodec/codec: add doxy to AVCodec.decode()

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/codec: use the correct name for all AVCodec.decode() parameters
James Almer [Fri, 5 Mar 2021 04:01:08 +0000 (01:01 -0300)]
avcodec/codec: use the correct name for all AVCodec.decode() parameters

This field hasn't been used to return the output frame size since
avcodec_decode_audio4() was introduced.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/codec: remove outdated comment about AVCodec.encode2()
James Almer [Fri, 5 Mar 2021 03:55:21 +0000 (00:55 -0300)]
avcodec/codec: remove outdated comment about AVCodec.encode2()

The packet passed as argument to this function hasn't contained
a user-provided buffer since 93016f5d1d.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavfilter/buffersink: Postpone removal of av_[a]buffersink_params_alloc
Andreas Rheinhardt [Sat, 6 Mar 2021 17:23:43 +0000 (18:23 +0100)]
avfilter/buffersink: Postpone removal of av_[a]buffersink_params_alloc

They have been deprecated in 61097535cdaa91fea0d62c567b3af02a940f6c2d,
yet this was less than two years ago. Removing them will therefore have
to wait.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter/avfilter: Remove avfilter_link_set_closed() on bump
Andreas Rheinhardt [Sat, 6 Mar 2021 17:02:47 +0000 (18:02 +0100)]
avfilter/avfilter: Remove avfilter_link_set_closed() on bump

Deprecated in 39a09e995d32d16e4f8c87a6ff5273cb9d98146e.

Reviewed-by: Nicolas George <george@nsup.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agodoc/muxers.texi: Readd documentation removed accidentally
Andreas Rheinhardt [Sat, 6 Mar 2021 16:11:38 +0000 (17:11 +0100)]
doc/muxers.texi: Readd documentation removed accidentally

Happened in e7c04eaf50b4b50f2528ab2c69b76777a1862535.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/http: Fix leak when using deprecated option
Andreas Rheinhardt [Sat, 6 Mar 2021 12:55:04 +0000 (13:55 +0100)]
avformat/http: Fix leak when using deprecated option

When the deprecated option "user-agent" was set to something different
than its default value, said option would always precede and overwrite
the ordinary user_agent option (regardless of whether it was explicitly
set) which leads to a leak of the user_agent option (which has a default
value, so the leak happens always).
Fix this by setting the same destination for both options; the last
option applied wins then.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/libxvid: Remove unnecessary header
Andreas Rheinhardt [Sat, 6 Mar 2021 12:05:42 +0000 (13:05 +0100)]
avcodec/libxvid: Remove unnecessary header

Forgotten in a1c6fc773f941fd6a6ef3f12f102a7902ae69453.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavfilter: add msad video filter
Paul B Mahol [Wed, 3 Mar 2021 18:31:38 +0000 (19:31 +0100)]
avfilter: add msad video filter

3 years agoavfilter: add identity video filter
Paul B Mahol [Wed, 3 Mar 2021 14:21:04 +0000 (15:21 +0100)]
avfilter: add identity video filter

3 years agoavcodec/parser: Schedule av_parser_change for removal
Andreas Rheinhardt [Fri, 26 Feb 2021 09:32:51 +0000 (10:32 +0100)]
avcodec/parser: Schedule av_parser_change for removal

Originally deprecated in 748c2fca7e4d99357c234936aa71212a6282be36,
publically deprecated in 9a07c1332cfe092b57b5758f22b686ca58806c60
(merged into FFmpeg in 1885ffb03d0af28e6bac2bcc8725fa15b93f6ac9).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat: add TTML muxer
Jan Ekström [Thu, 4 Mar 2021 17:09:50 +0000 (19:09 +0200)]
avformat: add TTML muxer

Enables writing TTML documents or encoded TTML paragraphs as such
documents.

Additionally, a test for the combined TTML encoder and muxer has
been added to validate that the components still work.

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
3 years agoavcodec: add TTML encoder
Jan Ekström [Thu, 19 Jan 2017 13:02:27 +0000 (13:02 +0000)]
avcodec: add TTML encoder

Enables encoding of other subtitle formats into TTML paragraphs.

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
3 years agoavcodec: enable usage of err_recognition for encoders
Jan Ekström [Mon, 22 Feb 2021 12:21:09 +0000 (14:21 +0200)]
avcodec: enable usage of err_recognition for encoders

Enables the usage of such values as AV_EF_EXPLODE in encoders, which
can be useful in cases such as subtitle encoders where they have the
responsibility to validate the correctness of an incoming ASS dialog line.

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
3 years agoffprobe: switch to av_bprint_escape for XML escaping
Jan Ekström [Mon, 16 Nov 2020 07:46:42 +0000 (09:46 +0200)]
ffprobe: switch to av_bprint_escape for XML escaping

Additionally update the result of the ffprobe XML writing test.

Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
3 years agoavutil/{avstring,bprint}: add XML escaping from ffprobe to avutil
Stefano Sabatini [Mon, 16 Nov 2020 07:38:39 +0000 (09:38 +0200)]
avutil/{avstring,bprint}: add XML escaping from ffprobe to avutil

Base escaping only escapes values required for base character data
according to part 2.4 of XML, and if additional flags are added
single and double quotes can additionally be escaped in order
to handle single and double quoted attributes.

Co-authored-by: Jan Ekström <jan.ekstrom@24i.com>
Signed-off-by: Jan Ekström <jan.ekstrom@24i.com>
3 years agoavcodec/decode: Check size before opening iconv
Andreas Rheinhardt [Thu, 4 Mar 2021 08:36:15 +0000 (09:36 +0100)]
avcodec/decode: Check size before opening iconv

Avoids closing iconv when the size check fails.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/decode: Return early upon failure
Andreas Rheinhardt [Thu, 4 Mar 2021 08:32:21 +0000 (09:32 +0100)]
avcodec/decode: Return early upon failure

Allows to remove one level of indentation.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agotests/fate: Don't keep unnecessary temp files
Andreas Rheinhardt [Sun, 28 Feb 2021 17:43:18 +0000 (18:43 +0100)]
tests/fate: Don't keep unnecessary temp files

Some FATE tests use files created by other FATE tests as input files;
this mostly affects the seek tests which use files from vsynth_lena as
well as acodec-pcm as input files. In order to make this possible the
temporary files of all the vsynth* and all acodec-pcm tests are kept.
Yet only a fraction of these files are actually used. This commit
changes this to only keep the files that are actually needed for other
tests. This reduces the size of the tests/data/fate folder after a full
FATE run from 2024727441B to 138739312B.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/aadec: Replace strncpy by av_strlcpy
Andreas Rheinhardt [Tue, 2 Mar 2021 09:00:18 +0000 (10:00 +0100)]
avformat/aadec: Replace strncpy by av_strlcpy

While this usage of strncpy is correct, said function nevertheless has
the disadvantage of not automatically ensuring that the destination
string is zero-terminated. So av_strlcpy should be preferred.
This also removes a -Wstringop-truncation warning from GCC (it doesn't
matter whether the buffer is truncated, as long as it can fit all
the names of the supported codecs).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/aadec: Use smaller scope for variables, remove initializations
Andreas Rheinhardt [Tue, 2 Mar 2021 08:48:14 +0000 (09:48 +0100)]
avformat/aadec: Use smaller scope for variables, remove initializations

avio_get_str always zero terminates the strings it reads.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agolavf/sga: Silence several warnings because of wrong format specifiers.
Carl Eugen Hoyos [Thu, 4 Mar 2021 19:34:36 +0000 (20:34 +0100)]
lavf/sga: Silence several warnings because of wrong format specifiers.

Fixes warnings like:
warning: format ‘%lX’ expects argument of type ‘long unsigned int’, but argument n has type ‘uint64_t’

3 years agoavformat/mxfdec: add support for getting product version number metadata
Marton Balint [Fri, 19 Feb 2021 23:06:47 +0000 (00:06 +0100)]
avformat/mxfdec: add support for getting product version number metadata

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/mxfdec: change toolkit_version metadata field to toolkit_version_num
Marton Balint [Fri, 19 Feb 2021 23:00:59 +0000 (00:00 +0100)]
avformat/mxfdec: change toolkit_version metadata field to toolkit_version_num

It only got added recently, and the new name makes it consistent with
product_version_num in the next patch.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavcodec/speedhq: fix decoding non 444 subsampling when width is not multiple of 16
Paul B Mahol [Mon, 1 Mar 2021 13:58:52 +0000 (14:58 +0100)]
avcodec/speedhq: fix decoding non 444 subsampling when width is not multiple of 16

3 years agoavcodec/decode: constify the source packet parameter in extract_packet_props()
James Almer [Wed, 3 Mar 2021 22:25:43 +0000 (19:25 -0300)]
avcodec/decode: constify the source packet parameter in extract_packet_props()

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/utils: free last_pkt_props on avcodec_open2() failure
James Almer [Wed, 3 Mar 2021 21:05:15 +0000 (18:05 -0300)]
avcodec/utils: free last_pkt_props on avcodec_open2() failure

Regression since b34d1de8dc

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/decode: port last_pkt_props to AVFifoBuffer
James Almer [Mon, 1 Mar 2021 17:10:36 +0000 (14:10 -0300)]
avcodec/decode: port last_pkt_props to AVFifoBuffer

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/lxfdec: Fix multiple integer overflows related to track_size
Michael Niedermayer [Thu, 14 Jan 2021 21:08:25 +0000 (22:08 +0100)]
avformat/lxfdec: Fix multiple integer overflows related to track_size

Fixes: signed integer overflow: 538976288 * 8 cannot be represented in type 'int'
Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_LXF_fuzzer-6634030636335104
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/mccdec: Use av_sat_add64() for fs
Michael Niedermayer [Thu, 14 Jan 2021 21:15:18 +0000 (22:15 +0100)]
avformat/mccdec: Use av_sat_add64() for fs

Fixes: signed integer overflow: -9223372036854775808 + -242 cannot be represented in type 'long'
Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_MCC_fuzzer-6723018395090944
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 agoavutil/parseutils: Check sign in av_parse_time()
Michael Niedermayer [Thu, 14 Jan 2021 20:11:05 +0000 (21:11 +0100)]
avutil/parseutils: Check sign in av_parse_time()

Fixes: signed integer overflow: -9223372053736 * 1000000 cannot be represented in type 'long'
Fixes: 26910/clusterfuzz-testcase-minimized-ffmpeg_dem_CONCAT_fuzzer-6607924558430208
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/mspdec: Check packet_size more completely
Michael Niedermayer [Wed, 3 Mar 2021 10:00:23 +0000 (11:00 +0100)]
avformat/mspdec: Check packet_size more completely

Fixes: OOM
Fixes: 28348/clusterfuzz-testcase-minimized-ffmpeg_dem_MSP_fuzzer-4612055872831488
Fixes: 28360/clusterfuzz-testcase-minimized-ffmpeg_dem_MSP_fuzzer-6245230626078720
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/aiffdec: Check that SSND is at least 8 bytes
Michael Niedermayer [Wed, 3 Mar 2021 09:49:04 +0000 (10:49 +0100)]
avformat/aiffdec: Check that SSND is at least 8 bytes

Fixes: Infinite loop
Fixes: 30874/clusterfuzz-testcase-minimized-ffmpeg_dem_AIFF_fuzzer-5933710488764416
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/dcstr: Check sample rate
Michael Niedermayer [Wed, 3 Mar 2021 09:49:03 +0000 (10:49 +0100)]
avformat/dcstr: Check sample rate

Fixes: signed integer overflow: -1300248894420254720 * 16 cannot be represented in type 'long'
Fixes: 30879/clusterfuzz-testcase-minimized-ffmpeg_dem_DCSTR_fuzzer-5094464215449600
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/frmdec: Simplify finding pixel format
Andreas Rheinhardt [Mon, 1 Mar 2021 16:22:31 +0000 (17:22 +0100)]
avformat/frmdec: Simplify finding pixel format

The fourccs used by the Megalux Frame format to determine the pixel
format are actually no fourccs at all as they are a single byte.
Furthermore, their range is continuous (1-5), so they are actually
ordinary indices. So treat them as such and don't use PixelFormatTags
for them.

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat: Deprecate AVFMT_FLAG_PRIV_OPT, remove av_demuxer_open on bump
Andreas Rheinhardt [Fri, 26 Feb 2021 16:25:54 +0000 (17:25 +0100)]
avformat: Deprecate AVFMT_FLAG_PRIV_OPT, remove av_demuxer_open on bump

This flag was added in 492026209b9b58eaf6d2ea56423f6b1e1a8a76a5
in conjunction with av_demuxer_open() to allow to pass private
options to demuxers. It worked as follows: av_open_input_stream()
(the predecessor of avformat_open_input()) would not call the
read_header function if this flag is set. Instead the user could set
private options of the demuxer via the format's private class after
avformat_open_input() and then call av_demuxer_open() which called
the format's read_header function.

This approach was abandoned in e37f161e66e042d6c2c7470c4d9881df9427fc4a
and av_demuxer_open() deprecated; instead the AVDictionary based way of
passing private options to the demuxer was choosen. Yet
AVFMT_FLAG_PRIV_OPT has never been deprecated and av_demuxer_open()
never removed. This commit implements the deprecation of the flag and
schedules av_demuxer_open for removal on the next major bump.
Given that av_demuxer_open() has been deprecated in 2012 and that this
flag is useless without it, the flag will be ignored after the next
major version bump.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoivfenc: write duration for frame_cnt=1.
Ronald S. Bultje [Tue, 2 Mar 2021 18:52:44 +0000 (13:52 -0500)]
ivfenc: write duration for frame_cnt=1.

3 years agoavcodec/float2half: fix minor style issue
Paul B Mahol [Wed, 3 Mar 2021 11:47:56 +0000 (12:47 +0100)]
avcodec/float2half: fix minor style issue

3 years agoavcodec/half2float: fix integer overflows in convertmantissa()
Paul B Mahol [Wed, 3 Mar 2021 11:37:02 +0000 (12:37 +0100)]
avcodec/half2float: fix integer overflows in convertmantissa()

3 years agoavcodec/mobiclip: Avoid undefined integer overflow in MV computation
Michael Niedermayer [Mon, 1 Mar 2021 23:19:21 +0000 (00:19 +0100)]
avcodec/mobiclip: Avoid undefined integer overflow in MV computation

Fixes: signed integer overflow: 1 + 2147483647 cannot be represented in type 'int'
Fixes: 30877/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MOBICLIP_fuzzer-4775601145774080
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/alsdec: Check bitstream input in read_block()
Michael Niedermayer [Mon, 1 Mar 2021 22:24:37 +0000 (23:24 +0100)]
avcodec/alsdec: Check bitstream input in read_block()

Fixes: Timeout
Fixes: 28110/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_ALS_fuzzer-5036338973507584
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: add lut oriented half to float conversion code
Paul B Mahol [Sun, 28 Feb 2021 11:44:25 +0000 (12:44 +0100)]
avcodec/exr: add lut oriented half to float conversion code

3 years agoavcodec/exrenc: move float2half code to own header
Paul B Mahol [Sun, 28 Feb 2021 10:57:04 +0000 (11:57 +0100)]
avcodec/exrenc: move float2half code to own header

3 years agoavcodec/exr: add DWA decompression support
Paul B Mahol [Fri, 26 Feb 2021 14:47:15 +0000 (15:47 +0100)]
avcodec/exr: add DWA decompression support

3 years agoavcodec/svq1dec: use av_fast_padded_malloc() for allocation pmv only when necessary
Paul B Mahol [Tue, 2 Mar 2021 14:03:33 +0000 (15:03 +0100)]
avcodec/svq1dec: use av_fast_padded_malloc() for allocation pmv only when necessary

3 years agoavformat/dashdec: Increase size of id buffer
Andreas Rheinhardt [Tue, 2 Mar 2021 10:34:07 +0000 (11:34 +0100)]
avformat/dashdec: Increase size of id buffer

The current size is not enough, see e.g.
http://ftp.itec.aau.at/datasets/DASHDataset2014/TearsOfSteel/1sec/TearsOfSteel_1s_simple_2014_05_09.mpd

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/dashdec: Ensure strings are zero-terminated
Andreas Rheinhardt [Tue, 2 Mar 2021 10:20:29 +0000 (11:20 +0100)]
avformat/dashdec: Ensure strings are zero-terminated

strncpy only ensures that one does not write beyond the end of the
destination buffer; in case of truncation it does not zero-terminate
the destination buffer. This makes using it the way it is now in the
DASH demuxer dangerous. So use av_strlcpy instead.

Also don't write anything if there is no id: The buffer has already been
zeroed initially.

The DASH testset from the Universität Klagenfurt contains samples with
ids that are too long. E.g.
http://ftp.itec.aau.at/datasets/DASHDataset2014/TearsOfSteel/1sec/TearsOfSteel_1s_simple_2014_05_09.mpd

Reviewed-by: Steven Liu <lq@chinaffmpeg.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agofftools: Switch to const AVCodec * where possible
Andreas Rheinhardt [Thu, 25 Feb 2021 04:02:39 +0000 (05:02 +0100)]
fftools: Switch to const AVCodec * where possible

The obstacle to do so was in filter_codec_opts: It uses searches
the AVCodec for options via the AV_OPT_SEARCH_FAKE_OBJ method, which
requires using a void * that points to a pointer to a const AVClass.
When using const AVCodec *, one can not simply use a pointer that points
to the AVCodec's pointer to its AVClass, as said pointer is const, too.
This is fixed by using a temporary pointer to the AVClass.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/mpegvideo: Schedule unused, deprecated rc_strategy for removal
Andreas Rheinhardt [Fri, 26 Feb 2021 08:48:27 +0000 (09:48 +0100)]
avcodec/mpegvideo: Schedule unused, deprecated rc_strategy for removal

Deprecated in d05c3b9ceeb9d00d4500c376448230e45f6ab108.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agofate/matroska: Test remuxing tracks for hearing/visually impaired
Andreas Rheinhardt [Wed, 17 Feb 2021 04:28:31 +0000 (05:28 +0100)]
fate/matroska: Test remuxing tracks for hearing/visually impaired

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/matroskaenc: Add support for FlagOriginal
Andreas Rheinhardt [Tue, 16 Feb 2021 17:53:55 +0000 (18:53 +0100)]
avformat/matroskaenc: Add support for FlagOriginal

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/matroskadec: Add support for FlagOriginal
Andreas Rheinhardt [Tue, 16 Feb 2021 17:41:30 +0000 (18:41 +0100)]
avformat/matroskadec: Add support for FlagOriginal

Needs a CountedElement in order to distinguish the case of the element
not being present and the element being present with a value of zero.

(It has been argued by Ridley Combs that one should only ever use the
AV_DISPOSITION_DUB field for audio tracks. Yet given that there is no
definition for the disposition flags, one can also interpret it to mean
that e.g. a subtitle track is meant to be used with the dubbed audio
track or the original audio track. This commit interprets this flag in
this sense, which also allows to maintain it on remuxing.)

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Reviewed-by: Ridley Combs <rcombs@rcombs.me>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/mov: Extend data_size check in mov_read_udta_string()
Michael Niedermayer [Sat, 12 Dec 2020 23:08:46 +0000 (00:08 +0100)]
avformat/mov: Extend data_size check in mov_read_udta_string()

Fixes: signed integer overflow: -2147483634 - 16 cannot be represented in type 'int'
Fixes: 28322/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5711888402612224
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/aadec: Check for EOF while reading chapters
Michael Niedermayer [Sat, 12 Dec 2020 21:19:22 +0000 (22:19 +0100)]
avformat/aadec: Check for EOF while reading chapters

Fixes: timeout
Fixes: 28199/clusterfuzz-testcase-minimized-ffmpeg_dem_AA_fuzzer-4896162657861632
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/h2645_parse: Reduce the initial skipped_bytes_pos size with small inputs
Michael Niedermayer [Sat, 12 Dec 2020 15:36:04 +0000 (16:36 +0100)]
avcodec/h2645_parse: Reduce the initial skipped_bytes_pos size with small inputs

Fixes: OOM
Fixes: 23817/clusterfuzz-testcase-minimized-ffmpeg_BSF_H264_METADATA_fuzzer-6300869057576960
Fixes: 28055/clusterfuzz-testcase-minimized-ffmpeg_BSF_TRACE_HEADERS_fuzzer-5706035297517568
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/voc_packet: Add a basic check on max_size
Michael Niedermayer [Sat, 12 Dec 2020 00:24:42 +0000 (01:24 +0100)]
avformat/voc_packet: Add a basic check on max_size

Fixes: signed integer overflow: -2147483648 - 4 cannot be represented in type 'int'
Fixes: 28127/clusterfuzz-testcase-minimized-ffmpeg_dem_VOC_fuzzer-4880586455646208
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>