]> git.sesse.net Git - ffmpeg/log
ffmpeg
3 years agoavcodec/adpcm_argo: reset state on flush
Zane van Iperen [Tue, 23 Mar 2021 10:58:33 +0000 (20:58 +1000)]
avcodec/adpcm_argo: reset state on flush

Commit 003b5c800fef909fa84dd2fae43d66bd434d3f7e introduced seeking in argo_asf,
but this was missed, leading to non-deterministic output.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavcodec/adpcm_aica: reset state in flush callback
Zane van Iperen [Tue, 23 Mar 2021 10:55:17 +0000 (20:55 +1000)]
avcodec/adpcm_aica: reset state in flush callback

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavcodec/adpcm_zork: reset state in flush callback
Zane van Iperen [Tue, 23 Mar 2021 10:52:16 +0000 (20:52 +1000)]
avcodec/adpcm_zork: reset state in flush callback

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavcodec/adpcm: add comment to has_status field
Zane van Iperen [Tue, 23 Mar 2021 11:01:16 +0000 (21:01 +1000)]
avcodec/adpcm: add comment to has_status field

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavcodec/kmvc: Avoid branch when swapping pointers
Andreas Rheinhardt [Mon, 22 Mar 2021 01:40:20 +0000 (02:40 +0100)]
avcodec/kmvc: Avoid branch when swapping pointers

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/kmvc: Move commonly used variables to the front of the context
Andreas Rheinhardt [Mon, 22 Mar 2021 01:28:11 +0000 (02:28 +0100)]
avcodec/kmvc: Move commonly used variables to the front of the context

Reduces codesize because the offset in pointer+offset addressing
requires less bytes to encode. Reduces the size of .text from 8871B
to 8146B (GCC 10, -O3, x64).

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/kmvc: Prefer in-band palette
Andreas Rheinhardt [Mon, 22 Mar 2021 01:14:35 +0000 (02:14 +0100)]
avcodec/kmvc: Prefer in-band palette

Fixes decoding of https://samples.ffmpeg.org/V-codecs/KMVC/LOGO2.AVI

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/vc1dec: Postpone allocating sprite frame to avoid segfault
Andreas Rheinhardt [Tue, 22 Dec 2020 16:21:48 +0000 (17:21 +0100)]
avcodec/vc1dec: Postpone allocating sprite frame to avoid segfault

Up until now, the VC-1 decoders allocated an AVFrame for usage with
sprites during vc1_decode_init(); yet said AVFrame can be freed if
(re)initializing the context (which happens ordinarily during decoding)
fails. The AVFrame does not get allocated again lateron in this case,
leading to segfaults.

Fix this by moving the allocation of said frame immediately before it is
used (this also means that said frame won't be allocated at all any more
in case of a regular (i.e. non-image) stream).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agodoc/filters: fix option name for mix filter
Gyan Doshi [Wed, 24 Mar 2021 11:22:02 +0000 (16:52 +0530)]
doc/filters: fix option name for mix filter

Corrected from nb_inputs to inputs

3 years agoavutil/frame: Deprecate av_get_colorspace_name()
Andreas Rheinhardt [Sun, 21 Mar 2021 09:15:44 +0000 (10:15 +0100)]
avutil/frame: Deprecate av_get_colorspace_name()

Contrary to av_color_space_name() it doesn't even support newer
colorspaces.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/avcodec: Use AVBPrint in avcodec_string()
Andreas Rheinhardt [Sun, 21 Mar 2021 07:05:14 +0000 (08:05 +0100)]
avcodec/avcodec: Use AVBPrint in avcodec_string()

It automatically records the current length of the string,
whereas the current code contains lots of instances of
snprintf(buf + strlen(buf), buf_size - strlen(buf), ...).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/avcodec: Update check for identical colorspace/primaries/trc names
Andreas Rheinhardt [Sun, 21 Mar 2021 06:26:17 +0000 (07:26 +0100)]
avcodec/avcodec: Update check for identical colorspace/primaries/trc names

If the numerical constants for colorspace, transfer characteristics
and color primaries coincide, the current code presumes the
corresponding names to be identical and prints only one of them obtained
via av_get_colorspace_name(). There are two issues with this: The first
is that the underlying assumption is wrong: The names only coincide in
the 0-7 range, they differ for more recent additions. The second is that
av_get_colorspace_name() is outdated itself; it has not been updated
with the names of the newly defined colorspaces.

Fix both of this by using the names from
av_color_(space|primaries|transfer)_name() and comparing them via
strcmp; don't use av_get_colorspace_name() at all.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/avcodec: Don't use NULL for %s printf specifier
Andreas Rheinhardt [Sun, 21 Mar 2021 05:29:13 +0000 (06:29 +0100)]
avcodec/avcodec: Don't use NULL for %s printf specifier

Our "get name" functions can return NULL for invalid/unknown
arguments. So check for this.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/avcodec: Use dedicated pointer to access AVCodecInternal
Andreas Rheinhardt [Sun, 21 Mar 2021 05:06:12 +0000 (06:06 +0100)]
avcodec/avcodec: Use dedicated pointer to access AVCodecInternal

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agotests/dnn/dnn-layer-mathunary-test: add unit test for exp
Wenlong Ding [Mon, 22 Mar 2021 08:20:12 +0000 (16:20 +0800)]
tests/dnn/dnn-layer-mathunary-test: add unit test for exp

Signed-off-by: Wenlong Ding <wenlong.ding@intel.com>
3 years agolavfi/dnn/dnn_backend_native_layer_mathunary: add exp support
Wenlong Ding [Mon, 22 Mar 2021 08:20:11 +0000 (16:20 +0800)]
lavfi/dnn/dnn_backend_native_layer_mathunary: add exp support

Signed-off-by: Wenlong Ding <wenlong.ding@intel.com>
3 years agoavformat/amvenc: Remove unnecessary av_packet_free()
Andreas Rheinhardt [Thu, 18 Mar 2021 05:29:35 +0000 (06:29 +0100)]
avformat/amvenc: Remove unnecessary av_packet_free()

The muxer's deinit function takes care of cleaning up when init fails.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/webpenc: Fix memleak when trailer is never written
Andreas Rheinhardt [Thu, 18 Mar 2021 22:27:57 +0000 (23:27 +0100)]
avformat/webpenc: Fix memleak when trailer is never written

When the trailer is never written (or when a stream switches from
non-animation mode to animation mode mid-stream), a cached packet
(if existing) would leak. Fix this by adding a deinit function.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/webpenc: Reindentation
Andreas Rheinhardt [Thu, 18 Mar 2021 22:16:30 +0000 (23:16 +0100)]
avformat/webpenc: Reindentation

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/webpenc: Fix memleak when using invalid packets
Andreas Rheinhardt [Thu, 18 Mar 2021 22:04:37 +0000 (23:04 +0100)]
avformat/webpenc: Fix memleak when using invalid packets

The WebP muxer sometimes caches a packet it receives to write it later;
yet if a cached packet is too small (so small as to be invalid),
it is cached, but not written and not unreferenced. Such a packet leaks,
either by being overwritten by the next packet or because it is never
unreferenced at all.

Fix this by not caching unusable packets at all; and error out on
invalid packets.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/webpenc: Use init instead of write_header function
Andreas Rheinhardt [Thu, 18 Mar 2021 21:15:36 +0000 (22:15 +0100)]
avformat/webpenc: Use init instead of write_header function

webp_write_header() didn't write anything.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/ipmovie: Avoid stack packet
Andreas Rheinhardt [Thu, 18 Mar 2021 20:35:58 +0000 (21:35 +0100)]
avformat/ipmovie: Avoid stack packet

Replace it in ipmovie_read_header() by AVFormatInternal.parse_pkt
which is unused when reading the header.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/ipmovie: Remove redundant initializations
Andreas Rheinhardt [Thu, 18 Mar 2021 20:42:26 +0000 (21:42 +0100)]
avformat/ipmovie: Remove redundant initializations

The demuxer's context has already been zeroed generically.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/ipmovie: Fix indentation
Andreas Rheinhardt [Thu, 18 Mar 2021 20:11:43 +0000 (21:11 +0100)]
avformat/ipmovie: Fix indentation

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/ipmovie: Deduplicate parsing video data opcodes
Andreas Rheinhardt [Thu, 18 Mar 2021 20:03:15 +0000 (21:03 +0100)]
avformat/ipmovie: Deduplicate parsing video data opcodes

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/ipmovie: Avoid reading packets during read_header
Andreas Rheinhardt [Thu, 18 Mar 2021 19:29:42 +0000 (20:29 +0100)]
avformat/ipmovie: Avoid reading packets during read_header

They will be discarded anyway because this can only happen
for invalid data. This already implies that the pkt won't be used
at all when parsing the very first chunk when reading the header,
so one can use NULL as argument and remove the av_packet_unref()
on error.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/ipmovie: Remove redundant av_packet_unref()
Andreas Rheinhardt [Thu, 18 Mar 2021 18:55:55 +0000 (19:55 +0100)]
avformat/ipmovie: Remove redundant av_packet_unref()

When one of these errors happens during ipmovie_read_packet(),
an error is returned and the packet is cleaned up generically.
And since 712d3ac539f30239b764d8621829dc9dc913da61 the same happens
in ipmovie_read_header().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/asfdec_f: Avoid stack packet
Andreas Rheinhardt [Thu, 18 Mar 2021 18:11:40 +0000 (19:11 +0100)]
avformat/asfdec_f: Avoid stack packet

Replace it by using AVFormatInternal.parse_pkt which is otherwise unused
when reading a header.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/moflex: Simplify freeing packets
Andreas Rheinhardt [Thu, 18 Mar 2021 14:43:54 +0000 (15:43 +0100)]
avformat/moflex: Simplify freeing packets

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/matroskadec: Reuse AVFormatInternal.parse_pkt
Andreas Rheinhardt [Thu, 18 Mar 2021 05:04:17 +0000 (06:04 +0100)]
avformat/matroskadec: Reuse AVFormatInternal.parse_pkt

Before 8d78e90a6ba96646f7f25aff6ca3e12e71cec164 the Matroska demuxer
used stack packets to hold temporary packets; now it uses a temporary
packet allocated by the Matroska demuxer. Yet because it used stack
packets the code has always properly reset the packet on error, while
on success these temporary packets were put into a packet list via
avpriv_packet_list_put(), which already resets the source packet.
This means that this code is compatible with just reusing
AVFormatInternal.parse_pkt (which is unused while one is in the
demuxer's read_packet() function). Compared to before 8d78e90a6
this no longer wastes one initialization per AVPacket read
(the resetting of the stack packet performed by av_packet_move_ref()
in avpriv_packet_list_put() was for naught).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/rtpdec: attach producer reference time if available
Alok Priyadarshi [Tue, 23 Mar 2021 21:29:48 +0000 (14:29 -0700)]
avformat/rtpdec: attach producer reference time if available

This produces true wallclock time at rtp source instead of the
local wallclock time at rtp client.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agolavc/mjpegdec: Decode format 211121 as YUV 4:4:4
Carl Eugen Hoyos [Sun, 21 Mar 2021 00:36:32 +0000 (01:36 +0100)]
lavc/mjpegdec: Decode format 211121 as YUV 4:4:4

Fixes ticket #8930.

3 years agoavformat/utils: Don't allocate separate packet for extract_extradata
Andreas Rheinhardt [Thu, 18 Mar 2021 04:23:54 +0000 (05:23 +0100)]
avformat/utils: Don't allocate separate packet for extract_extradata

One can simply reuse AVFormatInternal.parse_pkt instead.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agolibavformat/utils: Fix indentation
Andreas Rheinhardt [Fri, 19 Mar 2021 03:32:41 +0000 (04:32 +0100)]
libavformat/utils: Fix indentation

Originally added in 12f996edfab67b65af0ff1ee829f9eeabb025b0f
behind #if 0; aebb56e1844d61965c97e95534c3ae0da69df028 then
removed the #if and replaced it by using av_dlog. Then commit
1a3eb042c704dea190c644def5b32c9cee8832b8 replaced this with av_log
at trace level. Yet the code block always stayed within { }
at an increased level of indentation.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/svq3: Don't copy watermarked frame data twice
Andreas Rheinhardt [Sat, 20 Mar 2021 17:58:23 +0000 (18:58 +0100)]
avcodec/svq3: Don't copy watermarked frame data twice

The SVQ3 decoder modifies the input bitstream at two places.
One of them is only reached when the file is watermarked.
Therefore commit 2264c1108135380c49fdf0aef97520bf77a6ed37
made a copy of all the frame data in this case.

But there is a second possibility for modifying the frame and
therefore Libav commit 1098f5c0495c61a98d4ff6b8e24c17974d4bace5
made the decoder always copy the data. This of course makes
the additional copy for watermarked frames redundant, but it hasn't
been removed. This commit does so.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/svq3: Use av_fast_padded_malloc() instead of av_fast_malloc()
Andreas Rheinhardt [Sat, 20 Mar 2021 17:39:38 +0000 (18:39 +0100)]
avcodec/svq3: Use av_fast_padded_malloc() instead of av_fast_malloc()

It takes care of zeroing padding (which has been forgotten here).
Also rename the size variable to indicate that this is not the size
of the current slice.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/s337m: Use av_get_packet() to read packet
Andreas Rheinhardt [Sat, 20 Mar 2021 03:39:27 +0000 (04:39 +0100)]
avformat/s337m: Use av_get_packet() to read packet

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/s337m: Use and test Dolby-E-parser
Andreas Rheinhardt [Fri, 19 Mar 2021 16:04:23 +0000 (17:04 +0100)]
avformat/s337m: Use and test Dolby-E-parser

This makes av_read_frame() return packets with proper timestamps.
As a result, seeking now works in combination with streamcopy.
A FATE-test for this has been added.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/utils: Fix confusing return value for ff_read_packet()
Andreas Rheinhardt [Fri, 12 Mar 2021 10:00:32 +0000 (11:00 +0100)]
avformat/utils: Fix confusing return value for ff_read_packet()

Currently, ff_read_packet() sometimes forwards the return value of
AVInputFormat.read_packet() (which should be zero on success, but isn't
for all demuxers) and sometimes it overwrites this with zero.
Furthermore, it uses two variables, one for the read_packet return value
and one for other errors, which is a bit confusing; it is also
unnecessary given that the documentation explicitly states that
ff_read_packet() never returns positive values. Returning a positive
value would lead to leaks with some callers (namely asfrtp_parse_packet
and estimate_timings_from_pts). So always return zero in case of
success.

(This behaviour stems from a time before av_read_packet sanitized
the return value of read_packet at all: It was added in commit
626004690c23c981f67228ea325dde3f35193988 and was unnecessary since
88b00723906f68b7563214c30333e48888dddf78.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec: Factor updating palette out
Andreas Rheinhardt [Wed, 17 Mar 2021 21:43:32 +0000 (22:43 +0100)]
avcodec: Factor updating palette out

Because the properties of frames returned from ff_get/reget_buffer
are not reset at all, lots of returned frames had palette_has_changed
wrongly set to 1. This has been changed, too.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/apetag: Avoid stack packet when reading attached picture
Andreas Rheinhardt [Thu, 18 Mar 2021 16:02:39 +0000 (17:02 +0100)]
avformat/apetag: Avoid stack packet when reading attached picture

Read it directly into AVStream.attached_pic.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat: remove FF_API_INIT_PACKET from AVStream.attached_pic
James Almer [Sun, 21 Mar 2021 21:47:27 +0000 (18:47 -0300)]
avformat: remove FF_API_INIT_PACKET from AVStream.attached_pic

This field needs to be replaced altogether, not just its type changed.
This will be done in a separate change.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoFATE: Add test for probing MOV/MP4 files with extended box sizes
Derek Buitenhuis [Thu, 18 Mar 2021 16:12:08 +0000 (16:12 +0000)]
FATE: Add test for probing MOV/MP4 files with extended box sizes

The test sample has to have no file extension, otherwise probing
happens to work, based off file extension alone, and we want to
test the actual probing function.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
3 years agoavformat/mov: Fix extended atom size buffer length check
Derek Buitenhuis [Thu, 18 Mar 2021 15:26:54 +0000 (15:26 +0000)]
avformat/mov: Fix extended atom size buffer length check

When extended atom size support was added to probing in
fec4a2d232d7ebf6d1084fb568d4d84844f25abc, the buffer
size check was backwards, but probing continued to work
because there was no minimum size check yet, so despite
size being 1 on these atoms, and failing to read the 64-bit
size, the tag was still correctly read.

When 0b78016b2d7c36b32d07669c0c86bc4b4225ec98 introduced a
minimum size check, this exposed the bug, and broke probing
any files with extended atom sizes, such as entirely valid
large files that start whith mdat atoms.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
3 years agoavformat/rtp_mpegts: typedef MuxChain struct
Gyan Doshi [Thu, 18 Mar 2021 12:33:28 +0000 (18:03 +0530)]
avformat/rtp_mpegts: typedef MuxChain struct

3 years agoconfigure: select child muxers for rtp_mpegts
Gyan Doshi [Thu, 18 Mar 2021 12:02:46 +0000 (17:32 +0530)]
configure: select child muxers for rtp_mpegts

3 years agolavc/aomenc: Force default qmax of 0 if crf was set to 0.
Carl Eugen Hoyos [Sat, 20 Mar 2021 18:27:48 +0000 (19:27 +0100)]
lavc/aomenc: Force default qmax of 0 if crf was set to 0.

Fixes lossless encoding without setting qmax to 0.

3 years agolavf/swfdec: Allow decoding Nellymoser in swf.
Carl Eugen Hoyos [Tue, 16 Mar 2021 20:11:45 +0000 (21:11 +0100)]
lavf/swfdec: Allow decoding Nellymoser in swf.

Such files exist in the wild, see ticket #9153.

3 years agoavformat/pp_bnk: Fix memleaks when reading non-stereo tracks
Andreas Rheinhardt [Sat, 20 Mar 2021 06:43:09 +0000 (07:43 +0100)]
avformat/pp_bnk: Fix memleaks when reading non-stereo tracks

Commit 6973df112275c8ea4af0bf3cb1338baecc1d06b3 added support
for music tracks by outputting its two containing tracks
together in one packet. But the actual data is not contiguous
in the file and therefore one can't simply use av_get_packet()
(which has been used before) for it. Therefore the packet was
now allocated via av_new_packet() and read via avio_read();
and this is also for non-music files.

This causes problems because one can now longer rely on things
done automatically by av_get_packet(): It automatically freed
the packet in case of errors; this lead to memleaks in several
FATE-tests covering this demuxer. Furthermore, in case the data
read is less than the data desired, the returned packet was not
zero-allocated (the packet's padding was uninitialized);
for music files the actual data could even be uninitialized.

The former problems are fixed by using av_get_packet() for
non-music files; the latter problem is handled by erroring out
unless both tracks could be fully read.

Reviewed-by: Zane van Iperen <zane@zanevaniperen.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/utils: Always leave parse_pkt in blank state, avoid resetting
Andreas Rheinhardt [Thu, 18 Mar 2021 03:59:54 +0000 (04:59 +0100)]
avformat/utils: Always leave parse_pkt in blank state, avoid resetting

Always leaving said packet in a blank state after having used it
allows to avoid having to reset it before one uses it; and it also
allows to use it in more places than just in parse_packet() here.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/parser: Don't return pointer to stack buffer
Andreas Rheinhardt [Fri, 19 Mar 2021 15:02:15 +0000 (16:02 +0100)]
avcodec/parser: Don't return pointer to stack buffer

When flushing, the parser receives a dummy buffer with padding
that lives on the stack of av_parser_parse2(). Certain parsers
(e.g. Dolby E) only analyze the input, but don't repack it. When
flushing, such parsers return a pointer to the stack buffer and
a size of 0. And this is also what av_parser_parse2() returns.

Fix this by always resetting poutbuf in case poutbuf_size is zero.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/options: Reindent after previous commit
Andreas Rheinhardt [Tue, 16 Mar 2021 19:48:20 +0000 (20:48 +0100)]
avcodec/options: Reindent after previous commit

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/options: Remove always-true check
Andreas Rheinhardt [Tue, 16 Mar 2021 19:41:42 +0000 (20:41 +0100)]
avcodec/options: Remove always-true check

Added in dc51a72ba45fbefb9f1c6c3ca5a5b2388d69b2da, yet even back then
the check was always true as the AVCodecContext has already been memset
to zero before that.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/avcodec: Move decoder channel count check to ff_decode_preinit
Andreas Rheinhardt [Tue, 16 Mar 2021 19:07:20 +0000 (20:07 +0100)]
avcodec/avcodec: Move decoder channel count check to ff_decode_preinit

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/avcodec: Sanitize options before using them
Andreas Rheinhardt [Tue, 16 Mar 2021 19:01:52 +0000 (20:01 +0100)]
avcodec/avcodec: Sanitize options before using them

This is how it is supposed to happen, yet when using frame threading,
the codec's init function has been called before preinit. This can lead
to crashes when e.g. using unsupported lowres values for decoders
together with frame threading.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/avcodec: Perform sub_charenc/iconv checks before AVCodec.init()
Andreas Rheinhardt [Tue, 16 Mar 2021 18:27:42 +0000 (19:27 +0100)]
avcodec/avcodec: Perform sub_charenc/iconv checks before AVCodec.init()

Also move them to ff_decode_preinit().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/avcodec: Check earlier for codec id/type mismatch
Andreas Rheinhardt [Tue, 16 Mar 2021 18:16:36 +0000 (19:16 +0100)]
avcodec/avcodec: Check earlier for codec id/type mismatch

These fields can't be set via AVOptions, ergo one can check them before
having allocated anything.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoBump minor versions after release branch
Michael Niedermayer [Fri, 19 Mar 2021 23:48:35 +0000 (00:48 +0100)]
Bump minor versions after release branch

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoBump Versions before release/4.4 branch
Michael Niedermayer [Fri, 19 Mar 2021 23:41:48 +0000 (00:41 +0100)]
Bump Versions before release/4.4 branch

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agodoc/APIchanges: fill in missing fields
Michael Niedermayer [Fri, 19 Mar 2021 23:39:48 +0000 (00:39 +0100)]
doc/APIchanges: fill in missing fields

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/mpeg4videoenc: Check extradata malloc()
Michael Niedermayer [Fri, 19 Mar 2021 15:30:08 +0000 (16:30 +0100)]
avcodec/mpeg4videoenc: Check extradata malloc()

Fixes: Null pointer dereference
Fixes: any mpeg4 testcase which fails the malloc at that exact spot
Found-by: Rafael Dutra <rafael.dutra@cispa.de>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/mov: Check offset addition for overflow
Michael Niedermayer [Wed, 17 Mar 2021 12:31:28 +0000 (13:31 +0100)]
avformat/mov: Check offset addition for overflow

Fixes: signed integer overflow: 9223372036854775807 + 536870912 cannot be represented in type 'long'
Fixes: 31678/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5614204619980800
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/speedhq: Width < 8 is not supported
Michael Niedermayer [Wed, 17 Mar 2021 12:14:39 +0000 (13:14 +0100)]
avcodec/speedhq: Width < 8 is not supported

Fixes: out of array access
Fixes: 31733/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SPEEDHQ_fuzzer-4704307963363328
Fixes: 31736/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SPEEDHQ_fuzzer-6190960292790272
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/rtsp: support buffer_size and pkt_size options for RTP
Jiangjie Gao [Tue, 9 Mar 2021 06:21:19 +0000 (14:21 +0800)]
avformat/rtsp: support buffer_size and pkt_size options for RTP

And forward it to the underlying UDP protocol.

Fixes ticket #7517.

Signed-off-by: Jiangjie Gao <gaojiangjie@live.com>
Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavfilter/vf_ocr: add white space to whitelist
Dominic Mayers [Thu, 18 Mar 2021 19:52:53 +0000 (15:52 -0400)]
avfilter/vf_ocr: add white space to whitelist

Fixes #9151. The current version of libavfilter/vf_ocr.c does not have white
space in the default whitelist. But it is recommanded to include white
space. See https://github.com/tesseract-ocr/tesseract/issues/2923

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/libsrt: fix help message
Zhao Zhili [Mon, 15 Mar 2021 09:05:19 +0000 (17:05 +0800)]
avformat/libsrt: fix help message

SRTO_TLPKTDROP works for receiver and sender both.

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/libsrt: fix setsockopt() typo
Zhao Zhili [Mon, 15 Mar 2021 09:05:18 +0000 (17:05 +0800)]
avformat/libsrt: fix setsockopt() typo

Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agoavformat/http,tls: honor http_proxy command line variable for HTTPS
Moritz Barsnick [Sun, 23 Aug 2020 11:53:39 +0000 (13:53 +0200)]
avformat/http,tls: honor http_proxy command line variable for HTTPS

Add the "http_proxy" option and its handling to the "tls" protocol,
pass the option from the "https" protocol.

The "https" protocol already defines the "http_proxy" command line
option, like the "http" protocol does. The "http" protocol properly
honors that command line option in addition to the environment
variable. The "https" protocol doesn't, because the proxy is
evaluated in the underlying "tls" protocol, which doesn't have this
option, and thus only handles the environment variable, which it
has access to.

Fixes #7223.

Signed-off-by: Moritz Barsnick <barsnick@gmx.net>
Signed-off-by: Marton Balint <cus@passwd.hu>
3 years agolavc/videotoolboxenc: Add support for HEVC with Alpha.
Hironori Bono [Tue, 23 Feb 2021 05:02:27 +0000 (14:02 +0900)]
lavc/videotoolboxenc: Add support for HEVC with Alpha.

This change supports the "HEVC Video with Alpha" profile introduced in WWDC 2019
<https://developer.apple.com/videos/play/wwdc2019/506/>. (This change is a
partial fix for Ticket #7965.)

For example, the following command converts an animation PNG file to an HEVC
with Alpha video:
./ffmpeg -i fate-suite/apng/clock.png -c:v hevc_videotoolbox -allow_sw 1 -alpha_quality 0.75 -vtag hvc1 clock.mov

(This change uses the "HEVC Video with Alpha" profile only when the
'-alpha_quality' value is not 0 for backward compatibility.)

Signed-off-by: Hironori Bono <bouno@rouge.plala.or.jp>
3 years agovideotoolboxenc: enable constant quality with -q:v on Apple Silicon Macs and use...
Simone Karin Lehmann [Fri, 22 Jan 2021 20:21:33 +0000 (21:21 +0100)]
videotoolboxenc: enable constant quality with -q:v on Apple Silicon Macs and use b-frames für HEVC and H264 and b-pyramid for HEVC.

Signed-off-by: Simone Karin Lehmann <simone@lisanet.de>
Signed-off-by: Rick Kern <kernrj@gmail.com>
3 years agoavcodec: move core AVCodecContext functions from util.c to a new file
James Almer [Wed, 17 Mar 2021 13:21:33 +0000 (10:21 -0300)]
avcodec: move core AVCodecContext functions from util.c to a new file

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec: move AVCodecParameters related functions from util.c to a new file
James Almer [Wed, 17 Mar 2021 04:25:22 +0000 (01:25 -0300)]
avcodec: move AVCodecParameters related functions from util.c to a new file

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agofate: add adpcm_ima_cunning stereo test case
Zane van Iperen [Mon, 15 Mar 2021 15:49:24 +0000 (01:49 +1000)]
fate: add adpcm_ima_cunning stereo test case

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavformat/pp_bnk: treat music files as stereo
Zane van Iperen [Fri, 13 Nov 2020 01:30:51 +0000 (11:30 +1000)]
avformat/pp_bnk: treat music files as stereo

These files are technically a series of planar mono tracks.
If the "music" flag is set, merge the packets from the two
mono tracks, essentially replicating:

  [0:a:0][0:a:1]join=inputs=2:channel_layout=stereo[a]

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavcodec/adpcm_ima_cunning: reindent
Zane van Iperen [Tue, 16 Mar 2021 00:58:05 +0000 (10:58 +1000)]
avcodec/adpcm_ima_cunning: reindent

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agoavcodec/adpcm_ima_cunning: support stereo
Zane van Iperen [Thu, 12 Nov 2020 14:09:02 +0000 (00:09 +1000)]
avcodec/adpcm_ima_cunning: support stereo

Changes the sample format to S16P, but was only ever mono so it
affects nothing.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
3 years agodoc/filters: remove option band in delogo
Gyan Doshi [Fri, 19 Mar 2021 11:51:03 +0000 (17:21 +0530)]
doc/filters: remove option band in delogo

Deprecated option removed in 74fe697f9650 but I forgot to remove
the docs entry.

3 years agodoc/ffmpeg: document parameters set by -target
Gyan Doshi [Fri, 12 Mar 2021 13:46:28 +0000 (19:16 +0530)]
doc/ffmpeg: document parameters set by -target

3 years agoavutil/adler32: Switch av_adler32_update() to size_t on bump
Andreas Rheinhardt [Thu, 18 Mar 2021 03:33:28 +0000 (04:33 +0100)]
avutil/adler32: Switch av_adler32_update() to size_t on bump

av_adler32_update() is used by av_hash_update() which will be switched
to size_t at the next bump. So it also has to be made to use size_t.
This is also necessary for framecrcenc.c, because the size of side data
will become a size_t, too.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/packet: Also change av_packet_pack/unpack_dictionary to size_t
Andreas Rheinhardt [Wed, 17 Mar 2021 18:31:45 +0000 (19:31 +0100)]
avcodec/packet: Also change av_packet_pack/unpack_dictionary to size_t

These are auxiliary side-data functions, so they should have been
switched to size_t in d79e0fe65c51491f9bf8a470bbe36fb09f3e1280,
but this has been forgotten.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/avpacket: Improve overflow checks when packing dictionary
Andreas Rheinhardt [Wed, 17 Mar 2021 17:32:36 +0000 (18:32 +0100)]
avcodec/avpacket: Improve overflow checks when packing dictionary

Also avoid reallocations.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat: Make AVChapter.id an int64_t on next major bump
Andreas Rheinhardt [Tue, 16 Mar 2021 07:29:59 +0000 (08:29 +0100)]
avformat: Make AVChapter.id an int64_t on next major bump

64 bits are needed in order to retain the uid values of Matroska
chapters; the type is kept signed because the semantics of NUT chapters
depend upon whether the id is > 0 or < 0.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/matroskaenc: Check chapter ids for duplicates
Andreas Rheinhardt [Mon, 15 Mar 2021 20:17:25 +0000 (21:17 +0100)]
avformat/matroskaenc: Check chapter ids for duplicates

Up until now, there has been no check that each chapter has a unique id;
there was only a check for whether a chapter id is zero (this happens
often when the chapters originated from a format that lacks the concept
of chapter id and simply counts from zero) which is invalid in Matroska.
In this case the chapter ids are offset by 1 to make them nonnegative.
Yet offsetting won't fix duplicate ids, therefore this is changed to
simply create new chapter uids when the input chapter uids don't conform
to the requirements of Matroska (in which case it can be presumed that
they did not originate from Matroska, so that we don't need to bother
to preserve them).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/libxvid: Remove set-but-unused variable
Andreas Rheinhardt [Fri, 19 Mar 2021 00:49:04 +0000 (01:49 +0100)]
avcodec/libxvid: Remove set-but-unused variable

Set-but-unused since 2101b99777860c853ca2321031eb3f4047dc5894.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/libxvid: Fix leak of AVPacket on error
Andreas Rheinhardt [Fri, 19 Mar 2021 00:38:59 +0000 (01:38 +0100)]
avcodec/libxvid: Fix leak of AVPacket on error

Regression since 2101b99777860c853ca2321031eb3f4047dc5894.
Fixes Coverity issue #1473721.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/tests/fifo_muxer: Fix memleak on error, fix API violation
Andreas Rheinhardt [Fri, 19 Mar 2021 00:31:31 +0000 (01:31 +0100)]
avformat/tests/fifo_muxer: Fix memleak on error, fix API violation

The test program for the FIFO muxer allocates a buffer without padding
and wraps it into a packet via av_packet_from_data(). This is an API
violation. Furthermore, said buffer leaks in case av_packet_from_data()
fails. Fix both of these issues by using av_new_packet() instead.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/tests/fifo_muxer: Fix leak of AVPacket on error
Andreas Rheinhardt [Fri, 19 Mar 2021 00:24:28 +0000 (01:24 +0100)]
avformat/tests/fifo_muxer: Fix leak of AVPacket on error

Also factor allocating and freeing the packet out.
Fixes Coverity issues #1473722 and #1473723; it is a regression
since 4b386b2059806ca7ee7f991d2c8b735410693e8c.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/mxfdec: Fix leak on error
Andreas Rheinhardt [Fri, 12 Mar 2021 12:16:38 +0000 (13:16 +0100)]
avformat/mxfdec: Fix leak on error

It was introduced in d3d9b1fc8e2dfc8b4d66c9916ab7221062ff4660;
Fixes Coverity issue #733800.

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavformat/mxfdec: Don't use wrong type of pointer
Andreas Rheinhardt [Fri, 12 Mar 2021 11:59:47 +0000 (12:59 +0100)]
avformat/mxfdec: Don't use wrong type of pointer

If one of the two results of a ternary conditional is a pointer to void,
the type of the whole conditional operator is a pointer to void, even
when the other possible result is not a pointer to void. This loophole
in the type system has allowed mxf_read_local_tags to have a pointer of
type pointer to MXFMetadataSet that actually points to an MXFContext.

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/pngdec: Fix memleak by postponing allocation
Andreas Rheinhardt [Wed, 10 Mar 2021 19:16:32 +0000 (20:16 +0100)]
avcodec/pngdec: Fix memleak by postponing allocation

Fixes Coverity ticket #1322342.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agolavfi/dnn_backend_openvino.c: fix mem leak for TaskItem upon error
Guo, Yejun [Sat, 13 Mar 2021 06:14:51 +0000 (14:14 +0800)]
lavfi/dnn_backend_openvino.c: fix mem leak for TaskItem upon error

3 years agolavfi/dnn_backend_openvino.c: fix mem leak for RequestItem upon error
Guo, Yejun [Sat, 13 Mar 2021 06:09:33 +0000 (14:09 +0800)]
lavfi/dnn_backend_openvino.c: fix mem leak for RequestItem upon error

3 years agolavfi/dnn_backend_openvino.c: fix typo upon error
Guo, Yejun [Sat, 13 Mar 2021 05:56:40 +0000 (13:56 +0800)]
lavfi/dnn_backend_openvino.c: fix typo upon error

3 years agolavfi/dnn_backend_openvino.c: fix mem leak for input_blob and output_blob upon error
Guo, Yejun [Sat, 13 Mar 2021 05:52:21 +0000 (13:52 +0800)]
lavfi/dnn_backend_openvino.c: fix mem leak for input_blob and output_blob upon error

3 years agolavfi/dnn_backend_openvino.c: fix mem leak for AVFrame upon error
Guo, Yejun [Sat, 13 Mar 2021 05:35:29 +0000 (13:35 +0800)]
lavfi/dnn_backend_openvino.c: fix mem leak for AVFrame upon error

3 years agofftools/ffmpeg: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 22:09:18 +0000 (19:09 -0300)]
fftools/ffmpeg: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agofftools/ffprobe: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 16:58:55 +0000 (13:58 -0300)]
fftools/ffprobe: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agodoc/examples/vaapi_transcode: use av_packet_alloc() to allocate packets
James Almer [Sun, 31 Jan 2021 17:52:34 +0000 (14:52 -0300)]
doc/examples/vaapi_transcode: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agodoc/examples/vaapi_encode: use av_packet_alloc() to allocate packets
James Almer [Sun, 31 Jan 2021 17:42:47 +0000 (14:42 -0300)]
doc/examples/vaapi_encode: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agodoc/examples/transcoding: use av_packet_alloc() to allocate packets
James Almer [Sun, 31 Jan 2021 17:28:13 +0000 (14:28 -0300)]
doc/examples/transcoding: use av_packet_alloc() to allocate packets

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