首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从int到avcodecid的转换无效(ffmepg)

从int到avcodecid的转换无效(ffmepg)
EN

Stack Overflow用户
提问于 2015-03-18 07:01:53
回答 1查看 1.5K关注 0票数 0

今天,当我在CodeBlocks中运行ffmpeg示例c程序时,我得到了错误:

代码语言:javascript
复制
invalid conversion from int to avcodecid[-fpermissive]

我把代码的一部分放在这里:

代码语言:javascript
复制
static AVCodec **codec;
static AVCodecContext *c= NULL;
static int  ret,   got_output;
static FILE *f;
static AVFrame *frame;
static AVPacket pkt;
static uint8_t endcode[] = { 0, 0, 1, 0xb7 };
enum AVCodecID codec_id;

*codec = avcodec_find_encoder(codec_id);

无论我使用*codec还是codec,它都会产生同样的错误,我检查了我的opencv和ffmpeg版本,所有最新版本都是2.4.10 opencv和2.5.3ffmpeg。如果我单击错误,它会将我指向另一个文件avcode.h,给出错误

初始化“AVcodec*acvodec_find_encoder(AVCodeciD)”的第1标记-允许的

在文件的这一行

代码语言:javascript
复制
frame = avcodec_alloc_frame();
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-03-18 07:23:30

此错误消息

从int到avco发允许的无效转换

意味着不存在从intenum AVCodecID类型的隐式转换。因此,您需要显式地将整数强制转换为枚举的类型。

我想你包括了所有必需的标题,不是吗?

此错误消息

初始化“AVcodec*acvodec_find_encoder(AVCodeciD)”的第1标记-允许的

表示函数调用使用了错误的参数类型。您必须在调用函数声明之前检查它,并为其参数提供正确的参数。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29115929

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档