[FFmpeg]什么是 avpicture_alloc、avpicture::data 的替代品,已弃用

[FFmpeg]what is replacements of avpicture_alloc,avpicture::data which were deprecated

我正在修改来自 FFmpeg 站点的示例源代码 (muxing.c)。 我将旧功能更改为新功能并尝试构建代码。 然后,有几个错误说 AVPicture 被宣布弃用。

我在互联网上做了一些研究,但找不到解决方法的答案。

/* Allocate the encoded raw picture. */
ret = avpicture_alloc(&dst_picture, c->pix_fmt, c->width, c->height);
if (ret < 0)
{
    //fprintf(stderr, "Could not allocate picture: %s\n", av_err2str(ret));
    char buf[256];
    av_strerror(ret, buf, sizeof(buf));
    printf("Could not allocate picture: %s,ret:%d\n", buf, ret);
    exit(1);
}

我只是改变了编译器的行为

有了这个

+#pragma 警告(禁用:4996)

这可能只是一个临时解决方案

我认为是av_image_alloc()

我也找不到替换的是什么,我在 AVPicture 的源代码中发现 avpicture_alloc 只是调用了那个函数。