Commit Graph

106635 Commits

Author SHA1 Message Date
James Almer bc99e3a9d6 ffmpeg: replace custom channel_layout code with an SpecifierOpt based one
This is cleaner and allows fine tuning which stream the option is applied to.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-22 08:45:38 -03:00
James Almer e6e86a3907 avformat/test/seek: set ch_layout instead of channels
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-22 08:45:38 -03:00
James Almer edd26bca60 avformat/dfpwmdec: add support to set channel layout
Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-22 08:45:38 -03:00
James Almer e42e54fa4e avformat/pcmdec: add support to set channel layout in sln demuxer
Deprecate the channels option, and ensure ch_layout has priority if set over
channels, until the latter is gone.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-22 08:45:38 -03:00
James Almer 5cd6cb9f05 avformat/pcmdec: deprecate channels option
And ensure ch_layout has priority if set over channels, until the latter is
gone.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-22 08:45:34 -03:00
Paul B Mahol 902ee9cafc avcodec/binkaudio: add support for >2 channels dct codec
As presented in .binka files.
2022-03-22 11:03:03 +01:00
Andreas Rheinhardt fa989df1c6 avcodec/internal: Move FF_DEFAULT_QUANT_BIAS to mpegvideoenc.h
Only used there.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-21 23:25:36 +01:00
Andreas Rheinhardt 86c909558c avcodec/internal: Move FF_SIGNBIT and ff_log2_run to mathops.h
It is a more fitting place for them.
Also move the definition of ff_log2_run to mathtables.c.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-21 23:25:36 +01:00
Andreas Rheinhardt 495de744fa avcodec/bitstream: Move code for initializing VLCs to file of its own
bitstream.c is currently the disjoint union of three parts:
The first part is ff_log2_run, the second part are some auxiliary
functions for the PutBits-API; and the third part is the code
for creating VLCs. This commit moves the latter into a file of its own.
This has the advantage of making one of the hacks in tableprint_vlc.h
redundant as vlc.c does not include config.h (whereas the PutBits-API
part does).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-21 23:25:36 +01:00
Andreas Rheinhardt b303f1e083 avcodec/mathops: Move bitswap_32() to its only user
Effectively reverts eaff1aa09e
given that bitswap_32 is no longer used outside of bitstream.c
since 03008c2811.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-21 23:25:36 +01:00
Michael Niedermayer 7aebdb8bf1 avformat/mxfdec: Do not clear array in mxf_read_strong_ref_array() before writing
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-21 22:27:14 +01:00
Michael Niedermayer 8d6f49cfc3 avformat/mxfdec: Check for avio_read() failure in mxf_read_strong_ref_array()
Fixes: 42827/clusterfuzz-testcase-minimized-ffmpeg_dem_MXF_fuzzer-4900528511909888

Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-21 22:27:14 +01:00
Michael Niedermayer 3015c556f3 avformat/mxfdec: Check count in mxf_read_strong_ref_array()
Reviewed-by: Tomas Härdin <tjoppen@acc.umu.se>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-21 22:27:14 +01:00
Michael Niedermayer dd1ce72e68 avcodec/allcodecs: Dont play with NULLs
Fixes: member access within null pointer of type 'const FFCodec' (aka 'const struct FFCodec')
Fixes: 45726/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-6554445419249664

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-21 22:27:14 +01:00
Michael Niedermayer 4fdfe430c1 avcodec/av1dec: Check tile_cols
Fixes: division by zero
Fixes: 43769/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-5392562205097984
Fixes: 43950/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_AV1_fuzzer-5769210217758720

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-21 22:27:14 +01:00
James Almer 6bab6afecc avcodec/wmaprodec: ensure channel count in the private context and decoder context are consistent
avctx->ch_layout will be reinitialized using channel_mask later in the
function.

Fixes: 45736/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_WMAPRO_fuzzer-5769886813519872

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-21 16:12:04 -03:00
James Almer 37f4440682 avformat/demux: ensure ch_layout is not lost in the stream's internal avctx
This is a workaround until avcodec_close() stops freeing ch_layout through
av_opt_fre(), or the former is removed.

Fixes a regression since 327efa6633.

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-21 08:50:28 -03:00
Gyan Doshi 505a7d39cd doc/bitstream_filters: add missing options in h264_metadata 2022-03-21 16:00:02 +05:30
Michael Niedermayer a8fd3f7fab avformat/hls: Check target_duration
Fixes: signed integer overflow: 77777777777777 * 1000000 cannot be represented in type 'long long'
Fixes: 45545/clusterfuzz-testcase-minimized-ffmpeg_dem_HLS_fuzzer-6438101247983616

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-21 09:07:58 +01:00
Michael Niedermayer 23e27a360e avcodec/mlpdec: Use 64bit for channel layout
Fixes: shift exponent 33 is too large for 32-bit type 'int'
Fixes: 45645/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_TRUEHD_fuzzer-5651350182035456

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-21 09:07:58 +01:00
Michael Niedermayer 0c1f20c6c8 avcodec/pixlet: Avoid signed integer overflow in scaling in filterfn()
Fixes: signed integer overflow: 11494 * 1073741824000000 cannot be represented in type 'long'
Fixes: 26586/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_PIXLET_fuzzer-5752633970917376

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2022-03-21 09:07:58 +01:00
Andreas Rheinhardt 5aabb2596f avcodec/codec_internal: Rename AVCodecDefault->FFCodecDefault
This structure is no longer declared in a public header,
so using an FF-prefix is more appropriate.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-21 01:33:10 +01:00
Andreas Rheinhardt 20f9727018 avcodec/codec_internal: Add FFCodec, hide internal part of AVCodec
Up until now, codec.h contains both public and private parts
of AVCodec. This exposes the internals of AVCodec to users
and leads them into the temptation of actually using them
and forces us to forward-declare structures and types that
users can't use at all.

This commit changes this by adding a new structure FFCodec to
codec_internal.h that extends AVCodec, i.e. contains the public
AVCodec as first member; the private fields of AVCodec are moved
to this structure, leaving codec.h clean.

Reviewed-by: Anton Khirnov <anton@khirnov.net>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-21 01:33:09 +01:00
Andreas Rheinhardt a688f3c13c avcodec/internal: Move FF_CODEC_CAP_* to a new header codec_internal.h
Also move FF_CODEC_TAGS_END as well as struct AVCodecDefault.
This reduces the amount of files that have to include internal.h
(which comes with quite a lot of indirect inclusions), as e.g.
most encoders don't need it. It is furthemore in preparation
for moving the private part of AVCodec out of the public codec.h.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-21 01:33:09 +01:00
Marton Balint 5b3732227e avfilter/x86/vf_blend: use unaligned movs for output
Fixes crashes with:

ffmpeg -f lavfi -i allyuv=d=1 -vf tblend=difference128,pad=5000:ih:1 -f null x

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-03-21 00:50:44 +01:00
Zhao Zhili 117672c814 ffplay: don't shadow global variable
Signed-off-by: Marton Balint <cus@passwd.hu>
2022-03-21 00:48:30 +01:00
Zhao Zhili 269ed0a413 ffplay: check AVFMT_NO_BYTE_SEEK flag for seek_by_bytes
Signed-off-by: Marton Balint <cus@passwd.hu>
2022-03-21 00:48:30 +01:00
Zhao Zhili 92053aa260 avformat/hls: add AVFMT_NO_BYTE_SEEK flag
After d6ac6650b9, ffplay failed to seek HLS stream with AVSEEK_FLAG_BYTE
enabled by default.

Signed-off-by: Marton Balint <cus@passwd.hu>
2022-03-21 00:48:30 +01:00
James Almer efdde028bb avcodec/opus: always use ambisonic layout for mapping family 2
No need to use a Custom layout when the non diegetic channels can be
described as a standard mask.

This fixes:

45684/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_LIBOPUS_fuzzer-5039410989629440

Signed-off-by: James Almer <jamrial@gmail.com>
2022-03-20 19:23:12 -03:00
Anton Khirnov a24e6ca8bf lavc/bsf: improve doxy 2022-03-19 15:59:58 +01:00
Anton Khirnov 5e7643eff7 lavc/bsf: add general documentation
Also, place the BSF api docs in their own doxygen group.
2022-03-19 15:59:07 +01:00
Anton Khirnov 6ccc3989d1 doc/APIchanges: update for the new channel layout API 2022-03-19 15:55:51 +01:00
Pierre-Anthony Lemieux 2a1eae2179
avformat/concat: refactor to use ff_rescale_interval()
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-03-19 21:34:08 +10:00
Pierre-Anthony Lemieux f409c78517
avformat/imf: refactor to use ff_rescale_interval()
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-03-19 21:34:06 +10:00
Pierre-Anthony Lemieux 8744b103da
avformat/tests: add test for ff_rescale_interval()
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-03-19 21:34:04 +10:00
Pierre-Anthony Lemieux b172c0f8c5
avformat/seek: add ff_rescale_interval() function
Refactors a function used by avformat/concat and avformat/imf.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-03-19 21:34:00 +10:00
Pierre-Anthony Lemieux 22e1175e39
avformat/imf: clean-up and reduce logging
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-03-19 21:33:58 +10:00
Pierre-Anthony Lemieux 32b9f5ac2f
avformat/imf: add support for input seeking
The IMF demuxer did not implement AVInputFormat::read_seek2(), resulting in
inefficient input seeking.

Addresses https://trac.ffmpeg.org/ticket/9648

Byte- and frame-seeking are not supported.

Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-03-19 21:33:55 +10:00
Pierre-Anthony Lemieux 9ca4d80d6b
avformat/imf: relocate static function imf_time_to_ts()
Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
2022-03-19 21:33:48 +10:00
Paul B Mahol f8dc89b34d avfilter/af_afftdn: remove unused or set only variables 2022-03-19 10:55:35 +01:00
Paul B Mahol 7ae2ded0d1 avfilter/avf_ahistogram: fix off by one in slide mode 2022-03-19 10:53:38 +01:00
Andreas Rheinhardt df2edfe1b0 configure: Add missing cri->mjpegdec dependency
The CRI decoder is useless without the MJPEG-decoder
(its init-function always errors out).

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 06:54:48 +01:00
Andreas Rheinhardt 30c08b42f2 avcodec/flashsv2enc: Avoid opening and closing z_stream
Instead initialize a z_stream during init and reset it when needed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:36 +01:00
Andreas Rheinhardt c3c2b5423d avcodec/lclenc: Use ff_deflate_init/end() wrappers
They return nicer error messages on error; furthermore,
they also use our allocation functions. It also stops
calling deflateEnd() on a z_stream that might not have been
successfully initialized.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:36 +01:00
Andreas Rheinhardt 1692a97251 avcodec/pngenc: Use ff_deflate_init/end() wrappers
They return nicer error messages.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:36 +01:00
Andreas Rheinhardt e85095b524 avcodec/zmbvenc: Use ff_deflate_init/end() wrappers
They emit better error messages (it does not claim that inflateInit
failed upon an error from deflateInit!) and uses our allocation functions.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:36 +01:00
Andreas Rheinhardt 9cae7f9450 avcodec/zlib_wrapper: Add wrapper for deflateInit()
The rationale is the same as for the wrappers for inflateInit(),
although the case for it is admittedly not so strong because
there are less users of deflateInit().
Also remove an unnecessary inclusion of config.h in
libavformat/protocols.c in order to trigger a request for reconfigure
(which is needed for CONFIG_DEFLATE_WRAPPER to take effect).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:36 +01:00
Andreas Rheinhardt e9d12766b2 avcodec/pngenc: Don't use deflateInit2() with default parameters
Use deflateInit() instead.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:36 +01:00
Andreas Rheinhardt 74c930e1b8 avcodec/pngdec: Don't open and close z_streams unnecessarily
Instead reuse and reset a single z_stream.
Also use FFZStream in decode_zbuf(), because it has nicer error
messages.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:36 +01:00
Andreas Rheinhardt 7ca99e1f15 avcodec/lscrdec: Don't open and close z_streams unnecessarily
Instead reuse and reset a single z_stream.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2022-03-19 00:18:36 +01:00