summaryrefslogtreecommitdiff
path: root/libavcodec/utils.c
Commit message (Collapse)AuthorAge
* avcodec/utils: free last_pkt_props on avcodec_open2() failureJames Almer2021-03-03
| | | | | | Regression since b34d1de8dc Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/decode: port last_pkt_props to AVFifoBufferJames Almer2021-03-03
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: add SGA PCM decoderPaul B Mahol2021-03-01
|
* avcodec/utils: unbreak BINKAUDIO_DCT duration calculationPaul B Mahol2021-02-04
|
* lavc: shedule old encoding/decoding API for removalAnton Khirnov2021-01-26
| | | | | | | | It has been deprecated for 4 years and certain new codecs do not work with it. Also include AVCodecContext.refcounted_frames, as it has no effect with the new API.
* avcodec/utils: Check for integer overflow in get_audio_frame_duration() for ↵Michael Niedermayer2021-01-23
| | | | | | | | | | ADPCM_DTK Fixes: signed integer overflow: 131203586 * 28 cannot be represented in type 'int' Fixes: 26817/clusterfuzz-testcase-minimized-ffmpeg_dem_MSF_fuzzer-6296902548848640 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/utils: Check bitrate for overflow in get_bit_rate()Michael Niedermayer2020-12-19
| | | | | | | | Fixes: signed integer overflow: 617890810133996544 * 16 cannot be represented in type 'long' Fixes: 26565/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-5092054700654592 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/utils: Remove ff_codec_open2_recursive()Andreas Rheinhardt2020-12-04
| | | | | | | | | | | | | | | This function existed to enable codecs with non-threadsafe init functions to initialize other codecs despite the fact that normally no two codecs with non-threadsafe init functions can be initialized at the same time (there is a mutex guarding this). Yet there are no users of this function any more as all users have been made thread-safe (switching away from ff_codec_open2_recursive() was required for this as said function requires the caller to hold the lock to the mutex guarding the initializations and this is only true for codecs with the FF_CODEC_CAP_INIT_THREADSAFE flag unset); so remove it. Reviewed-by: Anton Khirnov <anton@khirnov.net> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/utils: Require a non zero channels unless AV_CODEC_CAP_CHANNEL_CONF ↵Michael Niedermayer2020-11-28
| | | | | | | | | | | | | | | | is set This avoids per codec checks for channels not being 0 Fixes: division by 0 Fixes: 25419/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FASTAUDIO_fuzzer-5632544761184256 Fixes: 25433/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FASTAUDIO_fuzzer-6215671900536832 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Suggested-by: Paul B Mahol <onemda@gmail.com> See: [FFmpeg-devel] [PATCH 1/3] avcodec/fastaudio: Check channel Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec: deprecate thread_safe_callbacksAnton Khirnov2020-11-27
| | | | | | | | | They add considerable complexity to frame-threading implementation, which includes an unavoidably leaking error path, while the advantages of this option to the users are highly dubious. It should be always possible and desirable for the callers to make their get_buffer2() implementation thread-safe, so deprecate this option.
* avcodec/utils: clear the packet props queue on flushingJames Almer2020-11-09
| | | | | | | This ensures no queued timestamps or side data are kept and used after seeking, preventing potential desyncs. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: add adpcm_ima_amv encoderZane van Iperen2020-11-09
| | | | | | Fixes ticket #747. Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/adpcm_ima_amv: restrict to 1 channelZane van Iperen2020-11-09
| | | | | | The format doesn't allow for anything else. Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/utils: add adpcm_ima_alp to av_get_exact_bits_per_sample()Zane van Iperen2020-11-03
| | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/utils: Check sample rate before use for AV_CODEC_ID_BINKAUDIO_DCT in ↵Michael Niedermayer2020-10-29
| | | | | | | | | | get_audio_frame_duration() Fixes: shift exponent 95 is too large for 32-bit type 'int' Fixes: 26590/clusterfuzz-testcase-minimized-ffmpeg_dem_SMACKER_fuzzer-5120609937522688 Reviewed-by: Peter Ross <pross@xvid.org> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* lavc: un-avpriv avpriv_bprint_to_extradata()Anton Khirnov2020-10-28
| | | | | | It has not been used outside of lavc since 6f69f7a8bf6. Also, move it to the only place where it is used.
* avcodec/utils: Check for overflow with ATRAC* in get_audio_frame_duration()Michael Niedermayer2020-10-17
| | | | | | | | Fixes: signed integer overflow: 1024 * 13129048 cannot be represented in type 'int' Fixes: 26378/clusterfuzz-testcase-minimized-ffmpeg_dem_CODEC2RAW_fuzzer-5634018353348608 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/utils: add missing FF_API_TAG_STRING checkJames Almer2020-10-01
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/utils: ReindentationAndreas Rheinhardt2020-10-01
| | | | Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/utils: Also free encoder extradata on avcodec_open2() errorAndreas Rheinhardt2020-10-01
| | | | | | It is owned by libavcodec for encoders. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/utils: Don't forget cleaning up when allocating priv_data failsAndreas Rheinhardt2020-10-01
| | | | | | | | | Allocating an AVCodecContext's priv_data used to be the first object allocated in avcodec_open2(), so it was unnecessary to goto free_and_end (which does the cleanup) upon error here. But this is no longer so since f3a29b750a5979ae6847879fba758faf1fae88d0. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/utils: Improve check for freeing codec private optionsAndreas Rheinhardt2020-10-01
| | | | | | | | | | Don't check for AVCodec.priv_data_size (which is always true if AVCodec.priv_class is set). Instead check for AVCodecContext.priv_data to actually exist. (Note: av_opt_free(NULL) is a no-op.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/utils: Remove always-true checkAndreas Rheinhardt2020-10-01
| | | | | | | | | | | | The first thing avcodec_open2() allocates is the AVCodecInternal. If allocating it fails, a jump to end occurs; but if an error happens after its allocation, a jump to free_and_end happens which frees all allocations performed so far and then jumps to end. Yet free_and_end contained a check for AVCodecInternal (after having already dereferenced it to check whether ff_thread_free() needs to be called) which is of course always true. So remove it. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/utils: Only call codec->close if init has been calledAndreas Rheinhardt2020-09-29
| | | | | | | | | | | | | | | | | | | | avcodec_open2() also called the AVCodec's close function if an error happened before init had ever been called if the AVCodec has the FF_CODEC_CAP_INIT_CLEANUP flag set. This is against the documentation of said flag: "The codec allows calling the close function for deallocation even if the init function returned a failure." E.g. the SVQ3 decoder is not ready to be closed if init has never been called. Fixes: NULL dereference Fixes: 25762/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_SVQ3_fuzzer-5716279070294016 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Paul B Mahol <onemda@gmail.com> Reviewed-by: Michael Niedermayer <michael@niedermayer.cc> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec/decode: use a packet list to store packet propertiesJames Almer2020-09-15
| | | | | | | | | Keeping only the latest packet fed to the decoder works only for decoders that return a frame immediately after every consumed packet. Decoders that consume several packets before they return a frame will fill said frame with properties taken from the last consumed packet instead of the earliest. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/utils: make the src paramater for ff_thread_ref_frame constJames Almer2020-09-11
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* fftools, libavcodec, libavfilter: Add const to some AVCodec *Andreas Rheinhardt2020-09-11
| | | | | | | | The user has no business modifying the underlying AVCodec. Reviewed-by: Paul B Mahol <onemda@gmail.com> Reviewed-by: Nicolas George <george@nsup.org> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
* avcodec: add FastAudio decoderPaul B Mahol2020-09-03
|
* avcodec: add ADPCM IMA MOFLEX decoderPaul B Mahol2020-09-03
|
* avcodec/utils: calculate frame number of HEVC if the framerate > 30FPSLimin Wang2020-08-16
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec: move ff_alloc_a53_sei() to atsc_53James Almer2020-08-15
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: add adpcm_argo encoderZane van Iperen2020-08-07
| | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec: add adpcm_ima_apm encoderZane van Iperen2020-07-21
| | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com>
* avcodec/utils: add ff_alloc_timecode_sei() for hevc timecode seiLimin Wang2020-06-28
| | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* avcodec/encode: restructure the old encode APIJames Almer2020-06-18
| | | | | | | Following the same logic as 061a0c14bb, this commit turns the old encode API into a wrapper for the new one. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/encode: restructure the core encoding codeJames Almer2020-06-18
| | | | | | | | | | | | | | | | This commit follows the same logic as 061a0c14bb, but for the encode API: The new public encoding API will no longer be a wrapper around the old deprecated one, and the internal API used by the encoders now consists of a single receive_packet() callback that pulls frames as required. amf encoders adapted by James Almer librav1e encoder adapted by James Almer nvidia encoders adapted by James Almer MediaFoundation encoders adapted by James Almer vaapi encoders adapted by Linjie Fu v4l2_m2m encoders adapted by Andriy Gelman Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: add adpcm_ima_ssi encoderZane van Iperen2020-05-27
| | | | | Signed-off-by: Zane van Iperen <zane@zanevaniperen.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec: move avcodec_flush_buffers from decode.c to utils.cJames Almer2020-05-24
| | | | | | It's not a decoding exclusive function anymore. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/decode: remove ff_decode_bsfs_uninit()James Almer2020-05-21
| | | | | | It's been a wrapper for a simple av_bsf_free() call since c96904f525. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/utils: simplify, remove duplicate codeLimin Wang2020-05-05
| | | | | Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Limin Wang <lance.lmwang@gmail.com>
* lavc: Rename hwaccel.h to hwconfig.hMark Thompson2020-04-26
| | | | | This already applied to decoders as well as hwaccels, and adding encoder support was going to make the name even more inaccurate.
* lavc: do not implicitly share the frame pool between threadsAnton Khirnov2020-04-10
| | | | | | | | | | | | | Currently the frame pool used by the default get_buffer2() implementation is a single struct, allocated when opening the decoder. A pointer to it is simply copied to each frame thread and we assume that no thread attempts to modify it at an unexpected time. This is rather fragile and potentially dangerous. With this commit, the frame pool is made refcounted, with the reference being propagated across threads along with other context variables. The frame pool is now also immutable - when the stream parameters change we drop the old reference and create a new one.
* avcodec/utils: Fix ff_add_cpb_side_data() add twiceNicolas Gaullier2020-03-20
| | | | | | Makes it behave similarly to av_stream_add_side_data(). Signed-off-by: Anton Khirnov <anton@khirnov.net>
* avcodec: add derf dpcm decoderPaul B Mahol2020-03-17
|
* avcodec: add an AVCodecContext field to signal types of packet, frame, and ↵James Almer2020-02-22
| | | | | | | | coded stream side data to export Add an initial mvs flag to is, analog to the export_mvs flags2 one. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec: fix pcm zork decoderPaul B Mahol2020-02-16
| | | | Fixes #1939
* avcodec/utils: remove extra bracketsleozhang2020-02-01
| | | | | Signed-off-by: leozhang <leozhang@qiyi.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/utils: replace avctx->internal with avci for better readabilityLimin Wang2020-01-10
| | | | | Signed-off-by: Limin Wang <lance.lmwang@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Silence "string-plus-int" warning shown by clang.Carl Eugen Hoyos2020-01-06
| | | | libswscale/utils.c:89:42: warning: adding 'unsigned long' to a string does not append to the string [-Wstring-plus-int]
* avcodec/utils: remove access of AV_SAMPLE_FMT_NBZhao Zhili2019-12-31
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>