- ret = avcodec_decode_video2(ctx->jpeg_avctx, ctx->jpgframe,
- &got_frame, &jpkt);
- if (ret < 0 || !got_frame || ctx->jpgframe->format != AV_PIX_FMT_YUVJ420P) {
+ ret = avcodec_send_packet(ctx->jpeg_avctx, &jpkt);
+ if (ret < 0) {
+ av_log(avctx, AV_LOG_ERROR, "Error submitting a packet for decoding\n");
+ return ret;
+ }
+
+ ret = avcodec_receive_frame(ctx->jpeg_avctx, ctx->jpgframe);
+ if (ret < 0 || ctx->jpgframe->format != AV_PIX_FMT_YUVJ420P) {