]> git.sesse.net Git - ffmpeg/log
ffmpeg
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>
3 years agodoc/examples/transcode_aac: use av_packet_alloc() to allocate packets
James Almer [Sun, 31 Jan 2021 16:33:56 +0000 (13:33 -0300)]
doc/examples/transcode_aac: use av_packet_alloc() to allocate packets

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

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agotests/api/api-flac-test: use av_packet_alloc() to allocate packets
James Almer [Sun, 31 Jan 2021 16:28:43 +0000 (13:28 -0300)]
tests/api/api-flac-test: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agotools/target_bsf_fuzzer: use av_packet_alloc() to allocate packets
James Almer [Sun, 31 Jan 2021 16:22:43 +0000 (13:22 -0300)]
tools/target_bsf_fuzzer: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agotools/target_dem_fuzzer: use av_packet_alloc() to allocate packets
James Almer [Sun, 31 Jan 2021 16:20:20 +0000 (13:20 -0300)]
tools/target_dem_fuzzer: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agotools/target_dec_fuzzer: use av_packet_alloc() to allocate packets
James Almer [Sun, 31 Jan 2021 16:18:01 +0000 (13:18 -0300)]
tools/target_dec_fuzzer: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agotools/pktdumper: use av_packet_alloc() to allocate packets
James Almer [Sun, 31 Jan 2021 16:08:51 +0000 (13:08 -0300)]
tools/pktdumper: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavfilter/vf_uspp: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 16:54:05 +0000 (13:54 -0300)]
avfilter/vf_uspp: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavfilter/vf_mcdeint: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 16:32:19 +0000 (13:32 -0300)]
avfilter/vf_mcdeint: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavdevice/xcbgrab: stop using av_init_packet()
James Almer [Fri, 29 Jan 2021 16:28:42 +0000 (13:28 -0300)]
avdevice/xcbgrab: stop using av_init_packet()

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavdevice/decklink_dec: stop using av_init_packet()
James Almer [Fri, 29 Jan 2021 16:27:02 +0000 (13:27 -0300)]
avdevice/decklink_dec: stop using av_init_packet()

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/tests/movenc: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 15:31:41 +0000 (12:31 -0300)]
avformat/tests/movenc: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/tests/fifo_muxer: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 15:22:18 +0000 (12:22 -0300)]
avformat/tests/fifo_muxer: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/wc3movie: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 15:22:07 +0000 (12:22 -0300)]
avformat/wc3movie: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/subtitles: use av_packet_alloc() to allocate packets
James Almer [Wed, 3 Feb 2021 23:55:27 +0000 (20:55 -0300)]
avformat/subtitles: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/rtpenc_mpegts: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 15:07:57 +0000 (12:07 -0300)]
avformat/rtpenc_mpegts: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/rtpdec: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 14:55:40 +0000 (11:55 -0300)]
avformat/rtpdec: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/mpegtsenc: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 14:30:44 +0000 (11:30 -0300)]
avformat/mpegtsenc: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/mpegts: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 14:23:45 +0000 (11:23 -0300)]
avformat/mpegts: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/movenc: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 14:13:18 +0000 (11:13 -0300)]
avformat/movenc: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/matroskaenc: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 13:46:43 +0000 (10:46 -0300)]
avformat/matroskaenc: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/matroskadec: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 13:42:48 +0000 (10:42 -0300)]
avformat/matroskadec: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/hls: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 13:27:05 +0000 (10:27 -0300)]
avformat/hls: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/flacdec: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 13:20:21 +0000 (10:20 -0300)]
avformat/flacdec: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/id3v2: replace call to av_init_packet()
James Almer [Sun, 31 Jan 2021 19:59:31 +0000 (16:59 -0300)]
avformat/id3v2: replace call to av_init_packet()

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/flac_picture: replace call to av_init_packet()
James Almer [Sun, 31 Jan 2021 19:59:07 +0000 (16:59 -0300)]
avformat/flac_picture: replace call to av_init_packet()

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/avienc: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 03:02:12 +0000 (00:02 -0300)]
avformat/avienc: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/avidec: use av_packet_alloc() to allocate packets
James Almer [Sun, 31 Jan 2021 15:10:13 +0000 (12:10 -0300)]
avformat/avidec: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/asfdec_o: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 02:52:46 +0000 (23:52 -0300)]
avformat/asfdec_o: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/amvenc: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 02:27:10 +0000 (23:27 -0300)]
avformat/amvenc: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/utils: use av_packet_alloc() to allocate packets
James Almer [Sun, 31 Jan 2021 16:05:49 +0000 (13:05 -0300)]
avformat/utils: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/mux: use av_packet_alloc() to allocate packets
James Almer [Sat, 30 Jan 2021 18:04:24 +0000 (15:04 -0300)]
avformat/mux: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/tests/avpacket: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 02:21:05 +0000 (23:21 -0300)]
avcodec/tests/avpacket: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/webp: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 02:15:36 +0000 (23:15 -0300)]
avcodec/webp: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/tiff: use av_packet_alloc() to allocate AVPackets
James Almer [Fri, 29 Jan 2021 02:10:06 +0000 (23:10 -0300)]
avcodec/tiff: use av_packet_alloc() to allocate AVPackets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/tdsc: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 02:07:10 +0000 (23:07 -0300)]
avcodec/tdsc: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/pthread_frame: use av_packet_alloc() to allocate packets
James Almer [Wed, 3 Feb 2021 18:24:58 +0000 (15:24 -0300)]
avcodec/pthread_frame: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/mpegvideo_enc: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 02:02:50 +0000 (23:02 -0300)]
avcodec/mpegvideo_enc: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/libxvid: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 01:49:37 +0000 (22:49 -0300)]
avcodec/libxvid: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/encode: silence a deprecation warning about av_init_packet()
James Almer [Tue, 16 Mar 2021 15:01:32 +0000 (12:01 -0300)]
avcodec/encode: silence a deprecation warning about av_init_packet()

No need to adapt this code as it will be removed long before av_init_packet()

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/cri: use av_packet_alloc() to allocate packets
James Almer [Fri, 29 Jan 2021 01:45:29 +0000 (22:45 -0300)]
avcodec/cri: use av_packet_alloc() to allocate packets

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/packet_internal: make avpriv_packet_list_* functions use an internal struct
James Almer [Fri, 5 Mar 2021 14:26:24 +0000 (11:26 -0300)]
avcodec/packet_internal: make avpriv_packet_list_* functions use an internal struct

The next pointer is kept at the end for backwards compatability until the
major bump, when it should ideally be moved at the front.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/packet: deprecate av_init_packet()
James Almer [Wed, 27 Jan 2021 19:24:10 +0000 (16:24 -0300)]
avcodec/packet: deprecate av_init_packet()

Once removed, sizeof(AVPacket) will stop being a part of the public ABI.

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/vaapi_encode: use AVCodecContext.get_encode_buffer()
James Almer [Fri, 12 Mar 2021 23:50:42 +0000 (20:50 -0300)]
avcodec/vaapi_encode: use AVCodecContext.get_encode_buffer()

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/nvenc: use AVCodecContext.get_encode_buffer()
James Almer [Fri, 12 Mar 2021 23:50:01 +0000 (20:50 -0300)]
avcodec/nvenc: use AVCodecContext.get_encode_buffer()

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/mfenc: use AVCodecContext.get_encode_buffer()
James Almer [Sat, 13 Mar 2021 00:07:42 +0000 (21:07 -0300)]
avcodec/mfenc: use AVCodecContext.get_encode_buffer()

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/librav1e: use AVCodecContext.get_encode_buffer()
James Almer [Fri, 12 Mar 2021 23:50:22 +0000 (20:50 -0300)]
avcodec/librav1e: use AVCodecContext.get_encode_buffer()

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavcodec/amfenc: use AVCodecContext.get_encode_buffer()
James Almer [Fri, 12 Mar 2021 23:49:44 +0000 (20:49 -0300)]
avcodec/amfenc: use AVCodecContext.get_encode_buffer()

Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavformat/mov: Handle when we have an mfra box but have not read the full sidx for...
Derek Buitenhuis [Mon, 15 Mar 2021 14:20:17 +0000 (14:20 +0000)]
avformat/mov: Handle when we have an mfra box but have not read the full sidx for a fragment

Use the tfra timestamp if it is available and sidx timestamp is not.

Fixes reading the entire file after seeking in a live-style DASH FMP4
with an MFRA.

This specifically fixes when use_mfra_for is set.

Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
3 years agoavcodec/libdavs2: unbreak compilation failure
Gyan Doshi [Wed, 17 Mar 2021 05:21:30 +0000 (10:51 +0530)]
avcodec/libdavs2: unbreak compilation failure

FF_CODEC_CAP_AUTO_THREADS added in 8a129077cc requires internal.h

Signed-off-by: Timo Rothenpieler <timo@rothenpieler.org>
3 years agoavformat/aviobuf: don't reduce short seek threshold
Andriy Gelman [Sun, 14 Mar 2021 04:54:32 +0000 (23:54 -0500)]
avformat/aviobuf: don't reduce short seek threshold

Commit 8c8e5d5286bf598a89ef9993a2cf6ea409d03a32 added a way to reduce
seek time by waiting for the windowed tcp packets instead of creating a
new socket connection. It implemented this by overwriting
s->short_seek_threshold in avio_seek(). However,
s->short_seek_threshold could already be set and be higher than the
threshold set by the protocol (i.e. s->short_seek_threshold is set in
ff_configure_buffers_for_index()).

This new feature was only enabled for tls connections in
70d8077b795766e2486e6ec8110f22a97362d6d6. As in Ticket #9148 it reduced
performance because instead of waiting to refill the AVIOContext buffers
with an existing connections, a new HTTP request was often made instead.

Fixes Ticket #9148.

Reviewed-by: Martin Storsjö <martin@martin.st>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
3 years agolavc: drop unused argument from lock_avcodec()
Anton Khirnov [Wed, 10 Mar 2021 08:01:50 +0000 (09:01 +0100)]
lavc: drop unused argument from lock_avcodec()

3 years agolavc: drop ff_ prefix from ff_(un)lock_avcodec
Anton Khirnov [Wed, 10 Mar 2021 08:01:00 +0000 (09:01 +0100)]
lavc: drop ff_ prefix from ff_(un)lock_avcodec

It is unnecessary and misleading, as those are static functions.

3 years agolavc: move decoder bsf init into decoder-specific code
Anton Khirnov [Tue, 9 Mar 2021 11:00:09 +0000 (12:00 +0100)]
lavc: move decoder bsf init into decoder-specific code

3 years agolavc: factor decoder validation/setup from avcodec_open2()
Anton Khirnov [Tue, 9 Mar 2021 10:35:47 +0000 (11:35 +0100)]
lavc: factor decoder validation/setup from avcodec_open2()

3 years agolavc/encode: reindent after previous commit
Anton Khirnov [Tue, 9 Mar 2021 10:39:42 +0000 (11:39 +0100)]
lavc/encode: reindent after previous commit

3 years agolavc: factor out encoder init/validation from avcodec_open2()
Anton Khirnov [Tue, 9 Mar 2021 10:35:47 +0000 (11:35 +0100)]
lavc: factor out encoder init/validation from avcodec_open2()

avcodec_open2() is massive, splitting it makes it more readable.

Also, add a missing error code to ticks_per_frame sanity check.

3 years agocmdutils: replace strncpy() with direct assignment
Anton Khirnov [Wed, 24 Feb 2021 10:19:27 +0000 (11:19 +0100)]
cmdutils: replace strncpy() with direct assignment

Only one character is actually rewritten.

Fixes truncation warnings, such as
warning: ‘strncpy’ output truncated before terminating nul copying 3 bytes from a string of the same length [-Wstringop-truncation]
in gcc 10.2.0

3 years agolavc: rename AV_CODEC_CAP_AUTO_THREADS->AV_CODEC_CAP_OTHER_THREADS
Anton Khirnov [Tue, 9 Mar 2021 17:35:56 +0000 (18:35 +0100)]
lavc: rename AV_CODEC_CAP_AUTO_THREADS->AV_CODEC_CAP_OTHER_THREADS

This cap is currently used to mark multithreading-capable codecs that
wrap external libraries with their own multithreading code. The name is
highly confusing for our API users, since libavcodec ALWAYS handles
thread_count=0 (see commit message in previous commit). Therefore rename
the cap and update its documentation to make its meaning clear.

The old name is kept deprecated until next+1 major bump.

3 years agolavc: replace internal use of AV_CODEC_CAP_AUTO_THREADS with an internal cap
Anton Khirnov [Tue, 9 Mar 2021 17:00:44 +0000 (18:00 +0100)]
lavc: replace internal use of AV_CODEC_CAP_AUTO_THREADS with an internal cap

AV_CODEC_CAP_AUTO_THREADS was originally added in b4d44a45f9a to mark
codecs that spawn threads internally and are able to select an optimal
threads count by themselves (all such codecs are wrappers around
external libraries). It is used by lavc generic code to check whether it
should handle thread_count=0 itself or pass the zero directly to the
codec implementation. Within this meaning, it is clearly supposed to be
an internal cap rather than a public one, since from the viewpoint of a
libavcodec user, lavc ALWAYS handles thread_count=0. Whether it happens
in the generic code or within the codec internals is not a meaningful
difference for the caller.

External aspects of this flag will be dealt with in the following
commit.

3 years agodoc/encoders: Remove text about single bit-depth libx264 support
Tobias Rapp [Mon, 15 Mar 2021 13:07:27 +0000 (14:07 +0100)]
doc/encoders: Remove text about single bit-depth libx264 support

In the meanwhile libx264 allows to be configured for including both 8/10 bit
support within a single library. The new libx264 interface was enabled in
2f96190732d15510ba29471fa45d66841c0c3df1.

Signed-off-by: Tobias Rapp <t.rapp@noa-archive.com>
3 years agoavformat/matroskadec: Check for EOF in resync loop
Michael Niedermayer [Fri, 29 Jan 2021 20:18:36 +0000 (21:18 +0100)]
avformat/matroskadec: Check for EOF in resync loop

Fixes: Timeout (too long -> instantly)
Fixes: 29136/clusterfuzz-testcase-minimized-ffmpeg_dem_WEBM_DASH_MANIFEST_fuzzer-4586141227548672
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/utils: Use more bits for intermediate for AV_CODEC_ID_ADPCM_MS
Michael Niedermayer [Mon, 1 Feb 2021 18:55:03 +0000 (19:55 +0100)]
avcodec/utils: Use more bits for intermediate for AV_CODEC_ID_ADPCM_MS

Fixes: signed integer overflow: 1172577312 * 2 cannot be represented in type 'int'
Fixes: 29924/clusterfuzz-testcase-minimized-ffmpeg_dem_BOA_fuzzer-4882912874594304
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/ipmovie: Free packets allocated in header reading
Michael Niedermayer [Mon, 1 Feb 2021 18:47:16 +0000 (19:47 +0100)]
avformat/ipmovie: Free packets allocated in header reading

Fixes: memleaks
Fixes: 29905/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5679700745781248
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agolibavformat/hls: Reset options after open_url_keepalive() fails
Ed Martin [Wed, 10 Mar 2021 21:43:10 +0000 (21:43 +0000)]
libavformat/hls: Reset options after open_url_keepalive() fails

open_url_keepalive() unsets the options when it uses them, this
includes the offsets for the Range: header. When using the HLS
tag #EXT-X-BYTERANGE along with multiple files, the range options
must be preserved after open_url_keepalive() returns EOF so that
the new file can be opened. Failure to do this results in ignoring
the #EXT-X-BYTERANGE tag and reading the wrong bytes of the file.

To fix it, reset the options before calling io_open() following
open_url_keepalive() reaching EOF

Reviewed-by: Steven Liu <liuqi05@kuaishou.com>
3 years agoavcodec/decode: Remove outdated comment
Andreas Rheinhardt [Sat, 13 Mar 2021 00:24:08 +0000 (01:24 +0100)]
avcodec/decode: Remove outdated comment

Removing it was forgotten in 417d473bde220a1f267bc694835c129a5adc4309.

Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavutil/avstring: Check for memory allocation error in av_escape
Andreas Rheinhardt [Tue, 9 Mar 2021 20:25:06 +0000 (21:25 +0100)]
avutil/avstring: Check for memory allocation error in av_escape

av_bprint_finalize() can still fail even when it has been checked that
the AVBPrint is currently complete: Namely if the string was so short
that it fit into the AVBPrint's internal buffer.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavutil/avstring: Limit string length in av_escape to range of int
Andreas Rheinhardt [Tue, 9 Mar 2021 20:17:12 +0000 (21:17 +0100)]
avutil/avstring: Limit string length in av_escape to range of int

Otherwise the caller can't distinguish the return value from an error.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/h264_cavlc: Reindent after the previous commit
Andreas Rheinhardt [Tue, 9 Mar 2021 19:34:53 +0000 (20:34 +0100)]
avcodec/h264_cavlc: Reindent after the previous commit

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agoavcodec/h264_cavlc: Remove redundant check
Andreas Rheinhardt [Tue, 9 Mar 2021 19:25:06 +0000 (20:25 +0100)]
avcodec/h264_cavlc: Remove redundant check

The only caller to ff_h264_decode_init_vlc() already uses
ff_thread_once() for the call; ergo the check via a simple int with
static storage duration in ff_h264_decode_init_vlc() is redundant.
And if it were not redundant, it would be a potential for data races.
So remove it.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
3 years agodoc/APIchanges: Fill in some missing information
Michael Niedermayer [Wed, 10 Mar 2021 17:42:53 +0000 (18:42 +0100)]
doc/APIchanges: Fill in some missing information

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavcodec/jpegls: Check A[Q] for overflow in ff_jpegls_update_state_regular()
Michael Niedermayer [Tue, 2 Mar 2021 19:07:13 +0000 (20:07 +0100)]
avcodec/jpegls: Check A[Q] for overflow in ff_jpegls_update_state_regular()

Fixes: Timeout
Fixes: 30912/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_MJPEG_fuzzer-5556235476795392
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: prevent remaining size from becoming negative in ff_voc_get_packet()
Michael Niedermayer [Tue, 2 Mar 2021 19:47:06 +0000 (20:47 +0100)]
avformat/voc_packet: prevent remaining size from becoming negative in ff_voc_get_packet()

Fixes: memleak
Fixes: 30909/clusterfuzz-testcase-minimized-ffmpeg_dem_AVS_fuzzer-4886284057313280
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/timecode: Avoid fps overflow
Michael Niedermayer [Mon, 1 Mar 2021 12:44:12 +0000 (13:44 +0100)]
avutil/timecode: Avoid fps overflow

Fixes: Integer overflow and division by 0
Fixes: poc-202102-div.mov
Found-by: 1vanChen of NSFOCUS Security Team
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
3 years agoavformat/mvi: Check audio size for more overflows
Michael Niedermayer [Mon, 22 Feb 2021 19:20:48 +0000 (20:20 +0100)]
avformat/mvi: Check audio size for more overflows

Fixes: left shift of negative value -352256000
Fixes: 30837/clusterfuzz-testcase-minimized-ffmpeg_dem_MVI_fuzzer-5755626262888448
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/samidec: Deallocate hdr_buf
Michael Niedermayer [Mon, 22 Feb 2021 19:44:36 +0000 (20:44 +0100)]
avformat/samidec: Deallocate hdr_buf

Fixes: memleak
Fixes: 30841/clusterfuzz-testcase-minimized-ffmpeg_dem_SAMI_fuzzer-4521799196999680
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/cfhd: Fix negative shift in cfhd_decode()
Michael Niedermayer [Tue, 16 Feb 2021 23:02:04 +0000 (00:02 +0100)]
avcodec/cfhd: Fix negative shift in cfhd_decode()

Fixes: left shift of negative value -1
Fixes: 30714/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_CFHD_fuzzer-4867823371419648
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 agoavdevice/xcbgrab: Add option for grabbing a window
sgerwk [Wed, 10 Feb 2021 16:36:00 +0000 (17:36 +0100)]
avdevice/xcbgrab: Add option for grabbing a window

The option allows to select a specific window instead of the whole
screen.

Reviewed-by: Andriy Gelman <andriy.gelman@gmail.com>
Signed-off-by: Andriy Gelman <andriy.gelman@gmail.com>
3 years agoavcodec: add a mention about get_encode_buffer in the old encode API doxy
James Almer [Wed, 10 Mar 2021 01:24:16 +0000 (22:24 -0300)]
avcodec: add a mention about get_encode_buffer in the old encode API doxy

Direct users to the callback that should be used to keep supporting user
provided buffers with the new encode API.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: James Almer <jamrial@gmail.com>
3 years agoavfilter/vf_xfade: drop unused frames from inactive inputs
Paul B Mahol [Sun, 14 Mar 2021 12:06:50 +0000 (13:06 +0100)]
avfilter/vf_xfade: drop unused frames from inactive inputs

3 years agodoc/filters: note default for zoompan's duration
Gyan Doshi [Sun, 14 Mar 2021 08:37:24 +0000 (14:07 +0530)]
doc/filters: note default for zoompan's duration