问题描述
我正在尝试编译我的native-lib.cpp,但我一直收到此错误。这里的问题是参数
pkt.pts = av_rescale_q_rnd(pkt.pts,in_stream->time_base,out_stream->time_base,(AVRounding)(AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX));
pkt.dts = av_rescale_q_rnd(pkt.dts,(AVRounding)(AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX));
pkt.duration = av_rescale_q(pkt.duration,out_stream->time_base);
我得到的错误
> Task :app:externalNativebuildrelease
Build native-lib_armeabi-v7a
ninja: Entering directory `\app\.cxx\cmake\release\armeabi-v7a'
[1/2] Building CXX object CMakeFiles/native-lib.dir/native-lib.cpp.o
[2/2] Linking CXX shared library \app\build\intermediates\cmake\release\obj\armeabi-v7a\libnative-lib.so
Build native-lib_arm64-v8a
ninja: Entering directory `\app\.cxx\cmake\release\arm64-v8a'
[1/2] Building CXX object CMakeFiles/native-lib.dir/native-lib.cpp.o
Failed: CMakeFiles/native-lib.dir/native-lib.cpp.o
\AppData\Local\Android\Sdk\ndk\21.0.6113669\toolchains\llvm\prebuilt\windows-x86_64\bin\clang++.exe --target=aarch64-none-linux-android23 --gcc-toolchain=/Local/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64 --sysroot=/Local/Android/Sdk/ndk/21.0.6113669/toolchains/llvm/prebuilt/windows-x86_64/sysroot -Dnative_lib_EXPORTS -I/app/src/main/libs/arm64-v8a/include -g -DANDROID -fdata-sections -ffunction-sections -funwind-tables -fstack-protector-strong -no-canonical-prefixes -D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security -frtti -fexceptions -O2 -DNDEBUG -fPIC -MD -MT CMakeFiles/native-lib.dir/native-lib.cpp.o -MF CMakeFiles\native-lib.dir\native-lib.cpp.o.d -o CMakeFiles/native-lib.dir/native-lib.cpp.o -c /app/src/main/cpp/native-lib.cpp
/app/src/main/cpp/native-lib.cpp:716:19: error: no matching function for call to 'av_rescale_q_rnd'
pkt.pts = av_rescale_q_rnd(pkt.pts,(enum AVRounding)(AV_ROUND_NEAR_INF|AV_ROUND_PASS_MINMAX));
^~~~~~~~~~~~~~~~
/app/src/main/libs/arm64-v8a/include\libavutil/mathematics.h:160:9: note: candidate function not viable: no kNown conversion from 'AVRational *' to 'AVRational' for 2nd argument; dereference the argument with *
int64_t av_rescale_q_rnd(int64_t a,AVRational bq,AVRational cq,^
/app/src/main/cpp/native-lib.cpp:717:19: error: no matching function for call to 'av_rescale_q_rnd'
pkt.dts = av_rescale_q_rnd(pkt.dts,^
/app/src/main/cpp/native-lib.cpp:718:24: error: no matching function for call to 'av_rescale_q'
pkt.duration = av_rescale_q(pkt.duration,out_stream->time_base);
^~~~~~~~~~~~
/app/src/main/libs/arm64-v8a/include\libavutil/mathematics.h:151:9: note: candidate function not viable: no kNown conversion from 'AVRational *' to 'AVRational' for 2nd argument; dereference the argument with *
int64_t av_rescale_q(int64_t a,AVRational cq) av_const;
^
3 errors generated.
ninja: build stopped: subcommand Failed.
> Task :app:externalNativebuildrelease Failed
从上面的错误中我认为它似乎仅针对arm64-v8抛出
app\src\main\libs\arm64-v8a\include\libavutil\mathematics.h:151:9: note: candidate function not viable: no kNown conversion from 'AVRational *' to 'AVRational' for 2nd argument; dereference the argument with *
因为这是一个ffmpeg示例代码块,所以我没有做任何更改。仅当我尝试生成签名的apk时,Android Studio才会引发错误,并且我可以在我的Android 6设备中正常运行此错误。
我尝试将in_stream->time_base,out_stream->time_base
替换为*in_stream->time_base,*out_stream->time_base
,这会引发其他类型的错误
app\src\main\cpp\native-lib.cpp:716:45: error: indirection requires pointer operand ('AVRational' invalid)
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)