diff options
author | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2025-03-10 16:14:26 +0100 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@outlook.com> | 2025-03-13 02:16:27 +0100 |
commit | 3e19e5062c42c6edc901b36fb68ef89c0cb93d9d (patch) | |
tree | aa22667397791b5ceb3134f973ced5144471e482 /libavcodec/avcodec.c | |
parent | fed6612415c98fc1b0193bb5a92442fab550fd49 (diff) | |
download | ffmpeg-3e19e5062c42c6edc901b36fb68ef89c0cb93d9d.tar.gz |
avcodec/decode: Move is_open check to avcodec_receive_frame()
It also applies to scenarios where ff_encode_receive_frame()
is used. Also remove the redundant av_codec_is_decoder().
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
Diffstat (limited to 'libavcodec/avcodec.c')
-rw-r--r-- | libavcodec/avcodec.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/avcodec.c b/libavcodec/avcodec.c index e7e2c09222..64c1788c57 100644 --- a/libavcodec/avcodec.c +++ b/libavcodec/avcodec.c @@ -718,6 +718,9 @@ int attribute_align_arg avcodec_receive_frame(AVCodecContext *avctx, AVFrame *fr { av_frame_unref(frame); + if (!avcodec_is_open(avctx)) + return AVERROR(EINVAL); + if (av_codec_is_decoder(avctx->codec)) return ff_decode_receive_frame(avctx, frame); return ff_encode_receive_frame(avctx, frame); |