vs2013编译ffmpeg之二十 openal

openal

对应ffmpeg configure选项–enable-openal。

http://www.openal.org/上没有找到源代码(只有预先编译好的包),在www.openal-soft.org上下载到了源代码,版本openal-soft-1.15.1。这样有可能有问题,这个功能没有验证过。

编译错误一

在链接的时候出现了下面的错误:

libavdevice.a(openal-dec.o) : error LNK2019: unresolved external symbol impalcGetString referenced in function _al_get_error

libavdevice.a(openal-dec.o) : error LNK2019: unresolved external symbol impalcGetError referenced in function _al_get_error

libavdevice.a(openal-dec.o) : error LNK2019: unresolved external symbol impalcCaptureStart referenced in function _read_header

libavdevice.a(openal-dec.o) : error LNK2019: unresolved external symbol impalcCaptureCloseDevice referenced in function _read_header

libavdevice.a(openal-dec.o) : error LNK2019: unresolved external symbol impalcCaptureOpenDevice referenced in function _read_header

libavdevice.a(openal-dec.o) : error LNK2019: unresolved external symbol impalcCaptureSamples referenced in function _read_packet

libavdevice.a(openal-dec.o) : error LNK2019: unresolved external symbol impalcGetIntegerv referenced in function _read_packet

libavdevice.a(openal-dec.o) : error LNK2019: unresolved external symbol impalcCaptureStop referenced in function _read_close

从openal-dec.o的符号表里面发现有(用nm命令可以导出符号表):

U __imp__alcGetString

而从openal-dec.c里面看:

error_msg_ret = (const char) alcGetString(device, error);

调用的时候并没有imp前缀。在Openal源代码里面的al.h/alc.h里面有:

#ifndef ALC_API

 #if defined(AL_LIBTYPE_STATIC)

  #define ALC_API

 #elif defined(_WIN32)

  #define ALC_API __declspec(dllimport)

 #else

  #define ALC_API extern

 #endif

#endif

在openal-dec.c中al.h/alc.h前面,加上#define AL_LIBTYPE_STATIC就不会有问题了。其他的库用nm倒出来的符号表,对外的接口里面每个符号都有个对应的加了imp前缀的符号。

编译错误二

编译openal-soft-1.15.1的openal-info.exe的时候,会有下面的打印:

2>openal-info.obj : error LNK2001: unresolved external symbol impalcCloseDevice

2>openal-info.obj : error LNK2001: unresolved external symbol impalcDestroyContext

2>openal-info.obj : error LNK2001: unresolved external symbol impalcMakeContextCurrent

2>openal-info.obj : error LNK2001: unresolved external symbol impalcCreateContext

2>openal-info.obj : error LNK2001: unresolved external symbol impalcOpenDevice

2>openal-info.obj : error LNK2001: unresolved external symbol impalcGetString

2>openal-info.obj : error LNK2001: unresolved external symbol impalcIsExtensionPresent

2>openal-info.obj : error LNK2001: unresolved external symbol impalcGetIntegerv

2>openal-info.obj : error LNK2001: unresolved external symbol impalcGetError

2>openal-info.obj : error LNK2001: unresolved external symbol impalGetString

2>openal-info.obj : error LNK2001: unresolved external symbol impalGetError

2>openal-info.obj : error LNK2001: unresolved external symbol impalGetEnumValue

也是同样的解决办法,即在openal-info.c最前面加上#define AL_LIBTYPE_STATIC。

##编译错误三##

编译ffmpeg_g的时候,下面这个错误:

OpenAL32.lib(null.obj) : error LNK2001: unresolved external symbol imptimeGetTime@0

SDL.lib(SDL_systimer.obj) : error LNK2019: unresolved external symbol imptimeBeginPeriod@4 referenced in function _SDL_StartTicks

SDL.lib(SDL_systimer.obj) : error LNK2019: unresolved external symbol imptimeSetEvent@20 referenced in function _SDL_SYS_TimerInit

SDL.lib(SDL_systimer.obj) : error LNK2019: unresolved external symbol imptimeEndPeriod@4 referenced in function _SDL_SYS_TimerQuit

SDL.lib(SDL_systimer.obj) : error LNK2019: unresolved external symbol imptimeKillEvent@4 referenced in function _SDL_SYS_TimerQuit

SDL.lib(SDL_dx5video.obj) : error LNK2001: unresolved external symbol _GUID_POV

将WinMM.Lib Gdi32.lib dxguid.lib链进来就可以了。

enabled openal            && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do

                               check_lib 'AL/al.h' alGetError "${al_libs}"  && break; done } ||

改成:

enabled openal            && { { for al_libs in "${OPENAL_LIBS}" "-lopenal" "-lOpenAL32"; do

                               check_lib 'AL/al.h' alGetError "${al_libs}" -lWinMM -lUser32 -lole32 && break; done } ||

加了dxguid.lib后有了新问题,因为dxguid.lib是用/MT编译的,其他的库和ffmpeg都是用/MTd编译的,编译ffmpeg_g.exe的时候会报错:

LIBCMT.lib(invarg.obj) : error LNK2005: __initp_misc_invarg already defined in LIBCMTD.lib(invarg.obj)

因为没有dxguid.lib的源代码,所以只能加/NODEFAULTLIB:LIBCMTD.lib来解决。

编译错误四

vs2013+ffmpeg-3.3,前面的openal是用vs2010编译的,在vs2013下需要重新执行cmake,编译的时候出现出现下面的错误:

./CMakeFiles/CMakeError.log:26:LINK : fatal error LNK1146: 没有用选项“/L/usr/win32/lib:”指定的参数 [K:\MinGW\msys\1.0\home\AA\contribute\MSVC\openal-soft-1.15.1\CMakeFiles\CMakeTmp\cmTC_550b6.vcxproj]

这个额外的选项在Linker选项里面,直接删除就可以了:
这里写图片描述

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值