就我而言,我正在尝试使用 QtMultimedia 和 libffmpeg 作为解码器。
将 ffmpeg 导入为 extern "C",但 ffmpeg 的 AVPixelFormat 与 QVideoFrame 的 PixelFormat 冲突。
确切的错误:
'AVPixelFormat' : is not a member of 'QVideoFrame'
有谁知道可能的解决方案?
编辑:代码部分。
第 1 部分:Qt VideoWidget Sample
第 2 部分:libffmpeg 的使用,基于 dranger tutorial
extern "C"
{
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
}
最佳答案
这是由 FFmpeg 的 pixfmt.h
中的以下行引起的。 :#define PixelFormat AVPixelFormat
您可以尝试以下技巧:
extern "C"
{
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
}
#undef PixelFormat
#include <qt headers>
关于c++ - 如果 extern "C"包含与 Qt 库冲突怎么办?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21854469/