Message ID | 20201102131717.4959-2-anton@khirnov.net |
---|---|
State | Accepted |
Commit | e1c4a3ea7d2830a2e6c1e5212066c7995fffbdf2 |
Headers | show |
Series | [FFmpeg-devel,1/6] tools/enum_options: fix build and add to Makefile | expand |
Context | Check | Description |
---|---|---|
andriy/x86_make | success | Make finished |
andriy/x86_make_fate | success | Make fate finished |
On 11/2/2020 10:17 AM, Anton Khirnov wrote: > --- > libavfilter/lavfutils.c | 14 +++++++++----- > 1 file changed, 9 insertions(+), 5 deletions(-) > > diff --git a/libavfilter/lavfutils.c b/libavfilter/lavfutils.c > index a2085ed5ef..f8f8415c80 100644 > --- a/libavfilter/lavfutils.c > +++ b/libavfilter/lavfutils.c > @@ -31,7 +31,7 @@ int ff_load_image(uint8_t *data[4], int linesize[4], > AVCodecContext *codec_ctx = NULL; > AVCodecParameters *par; > AVFrame *frame = NULL; > - int frame_decoded, ret = 0; > + int ret = 0; > AVPacket pkt; > AVDictionary *opt=NULL; > > @@ -86,12 +86,16 @@ int ff_load_image(uint8_t *data[4], int linesize[4], > goto end; > } > > - ret = avcodec_decode_video2(codec_ctx, frame, &frame_decoded, &pkt); > + ret = avcodec_send_packet(codec_ctx, &pkt); > av_packet_unref(&pkt); > - if (ret < 0 || !frame_decoded) { > + if (ret < 0) { > + av_log(log_ctx, AV_LOG_ERROR, "Error submitting a packet to decoder\n"); > + goto end; > + } > + > + ret = avcodec_receive_frame(codec_ctx, frame); > + if (ret < 0) { > av_log(log_ctx, AV_LOG_ERROR, "Failed to decode image from file\n"); > - if (ret >= 0) > - ret = -1; > goto end; > } LGTM.
diff --git a/libavfilter/lavfutils.c b/libavfilter/lavfutils.c index a2085ed5ef..f8f8415c80 100644 --- a/libavfilter/lavfutils.c +++ b/libavfilter/lavfutils.c @@ -31,7 +31,7 @@ int ff_load_image(uint8_t *data[4], int linesize[4], AVCodecContext *codec_ctx = NULL; AVCodecParameters *par; AVFrame *frame = NULL; - int frame_decoded, ret = 0; + int ret = 0; AVPacket pkt; AVDictionary *opt=NULL; @@ -86,12 +86,16 @@ int ff_load_image(uint8_t *data[4], int linesize[4], goto end; } - ret = avcodec_decode_video2(codec_ctx, frame, &frame_decoded, &pkt); + ret = avcodec_send_packet(codec_ctx, &pkt); av_packet_unref(&pkt); - if (ret < 0 || !frame_decoded) { + if (ret < 0) { + av_log(log_ctx, AV_LOG_ERROR, "Error submitting a packet to decoder\n"); + goto end; + } + + ret = avcodec_receive_frame(codec_ctx, frame); + if (ret < 0) { av_log(log_ctx, AV_LOG_ERROR, "Failed to decode image from file\n"); - if (ret >= 0) - ret = -1; goto end; }