libavcodec.a 从 QtApp 链接到 FFmpeg 时出现链接器错误

libavcodec.a linker error when linking to FFmpeg from QtApp

我正在尝试 link 我的 Qt 应用程序FFmpeg。我 使用来自 here. And, x264 from here.

的脚本从源代码构建 FFmpeg 作为静态库

构建没问题。以下是我用于 FFmpeg 的配置标志:

CONFIGURE_FLAGS="--enable-cross-compile --enable-debug --disable-programs --enable-postproc \
              --enable-swscale --enable-avfilter --enable-avresample \
              --disable-doc --enable-pic --enable-static --disable-opencl --disable-shared --disable-securetransport \
              --enable-videotoolbox --enable-audiotoolbox --enable-gpl"

为 x264 配置标志:

CONFIGURE_FLAGS="--enable-static --enable-pic --disable-cli --disable-asm"

以下是我 link 我 QtApp 尝试为 MacOSX 构建它的库的方式:

LIBS+= -LPath/to/ffmpeg/build/lib -lavformat -lavcodec -lswscale -lavutil -lavfilter -lswresample \ 
-lavdevice -lpostproc -lx264 -lz -llzma -lbz2 -framework CoreVideo -framework CoreFoundation -framework CoreMedia \ 
-framework VideoToolbox -framework AudioToolbox -framework OpenAL -framework CoreServices -framework AVFoundation \ 
-framework QuartzCore -framework CoreGraphics

我也按照推荐包括 FFmpeg headers:

#ifdef __cplusplus
extern "C"
{
  #include <libavcodec/avcodec.h>
  #include <libavformat/avformat.h>
  #include <libswscale/swscale.h>
  #include <libavutil/frame.h>
}
#endif

#if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55,28,1)
#define av_frame_alloc  avcodec_alloc_frame
#endif

问题:
但是当我调用av_register_all的时候。我收到以下 linker 错误。

Undefined symbols for architecture x86_64:
"_VDADecoderCreate", referenced from:
  _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
  _ff_vda_default_init in libavcodec.a(vda_h264.o)
"_VDADecoderDecode", referenced from:
  _vda_old_h264_end_frame in libavcodec.a(vda_h264.o)
  _vda_h264_end_frame in libavcodec.a(vda_h264.o)
"_VDADecoderDestroy", referenced from:
  _ff_vda_destroy_decoder in libavcodec.a(vda_h264.o)
"_VDADecoderFlush", referenced from:
  _vda_old_h264_end_frame in libavcodec.a(vda_h264.o)
  _vda_h264_end_frame in libavcodec.a(vda_h264.o)
"_kVDADecoderConfiguration_Height", referenced from:
  _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
  _ff_vda_default_init in libavcodec.a(vda_h264.o)
"_kVDADecoderConfiguration_SourceFormat", referenced from:
  _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
  _ff_vda_default_init in libavcodec.a(vda_h264.o)
"_kVDADecoderConfiguration_Width", referenced from:
  _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
  _ff_vda_default_init in libavcodec.a(vda_h264.o)
"_kVDADecoderConfiguration_avcCData", referenced from:
  _ff_vda_create_decoder in libavcodec.a(vda_h264.o)
  _ff_vda_default_init in libavcodec.a(vda_h264.o)
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

问题:
我在这里错过了什么?

已修复。链接器列表中缺少以下内容

LIBS += -framework VideoDecodeAcceleration

这修复了与 libavcodec.a(vda_h264.o)
相关的所有链接器问题 是的。