问题
A complete novice question here. I am pretty familiar with programming in C/C++ on Linux environments. However, I have no experience whatsoever with Android environment, let alone when it comes to making an application with C for Android platforms. I need to use opus codec in my application but it is not present in the default libraries of Android NDK. How can I add it?
Some sources on internet talk about Android.mk
files. I am using the most recent version of Android Studio and there is no .mk files, only Cmake files.
回答1:
According to this, it's as easy as
implementation "com.vcpkg.ndk.support:opus:1.3.1"
There are tons of tutorials and examples of how to integrate native code in an Android app. Generally this requires a Java (or Kotlin) wrapper and some JNI code on the C side. Consider also consuming the opus codec via ffmpeg (e.g. mobile-ffmpeg library).
来源:https://stackoverflow.com/questions/65634552/how-to-include-use-latest-version-of-opus-codec-in-android-ndk