- av_image_copy(picture->data, picture->linesize, (const uint8_t**)planes,
- linesizes, avctx->pix_fmt, img->d_w, img->d_h);
+
+ if (img->fb_priv && (!ctx->has_alpha_channel || img_alpha->fb_priv)) {
+ ret = ff_decode_frame_props(avctx, picture);
+ if (ret < 0)
+ return ret;
+ picture->buf[0] = av_buffer_ref(img->fb_priv);
+ if (!picture->buf[0])
+ return AVERROR(ENOMEM);
+ if (ctx->has_alpha_channel) {
+ picture->buf[1] = av_buffer_ref(img_alpha->fb_priv);
+ if (!picture->buf[1]) {
+ av_frame_unref(picture);
+ return AVERROR(ENOMEM);
+ }
+ }
+ for (int i = 0; i < 4; i++) {
+ picture->data[i] = planes[i];
+ picture->linesize[i] = linesizes[i];
+ }
+ } else {
+ if ((ret = ff_get_buffer(avctx, picture, 0)) < 0)
+ return ret;
+ av_image_copy(picture->data, picture->linesize, (const uint8_t**)planes,
+ linesizes, avctx->pix_fmt, img->d_w, img->d_h);
+ }