You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-10 06:10:52 +02:00
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>
This commit is contained in:
@@ -718,6 +718,9 @@ int attribute_align_arg avcodec_receive_frame(AVCodecContext *avctx, AVFrame *fr
|
|||||||
{
|
{
|
||||||
av_frame_unref(frame);
|
av_frame_unref(frame);
|
||||||
|
|
||||||
|
if (!avcodec_is_open(avctx))
|
||||||
|
return AVERROR(EINVAL);
|
||||||
|
|
||||||
if (av_codec_is_decoder(avctx->codec))
|
if (av_codec_is_decoder(avctx->codec))
|
||||||
return ff_decode_receive_frame(avctx, frame);
|
return ff_decode_receive_frame(avctx, frame);
|
||||||
return ff_encode_receive_frame(avctx, frame);
|
return ff_encode_receive_frame(avctx, frame);
|
||||||
|
@@ -817,9 +817,6 @@ int ff_decode_receive_frame(AVCodecContext *avctx, AVFrame *frame)
|
|||||||
AVCodecInternal *avci = avctx->internal;
|
AVCodecInternal *avci = avctx->internal;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!avcodec_is_open(avctx) || !av_codec_is_decoder(avctx->codec))
|
|
||||||
return AVERROR(EINVAL);
|
|
||||||
|
|
||||||
if (avci->buffer_frame->buf[0]) {
|
if (avci->buffer_frame->buf[0]) {
|
||||||
av_frame_move_ref(frame, avci->buffer_frame);
|
av_frame_move_ref(frame, avci->buffer_frame);
|
||||||
} else {
|
} else {
|
||||||
|
Reference in New Issue
Block a user