在使用CMake(CMakeLists.txt)而不是ndk-build(Android.mk)的android ndk项目中包括GStreamer [英] Include GStreamer in android ndk project that uses CMake (CMakeLists.txt) and not ndk-build (Android.mk)
问题描述
我有一个android项目,当前使用 Cmake 包含所有.cpp/.c代码.现在,我想添加 GStreamer本机库,以便可以在本机代码中使用它们.但是gstreamer文档
完成上述更改后,我可以使用CMake在GStreamer上成功使用APK进行构建
I have an android project that currently uses Cmake for including all .cpp /.c code. Now I want to add the GStreamer native libraries such that I can use them in my native code. But the gstreamer docs https://gstreamer.freedesktop.org/documentation/installing/for-android-development.html only document using ndk-build to use gstreamer on android.
Now I don't want to totally refactor my project to use ndk-build and Android.mk because
CMake does its job and i never had problems with it
as stated here cmake is the default for android ndk https://developer.android.com/studio/projects/add-native-code
I also need to include the googlevr ndk library that uses cmake.
So I need to figure out a workaround and therefore need your help. Here are some ideas I came up with
- Each module can have ether cmake or ndk-build support. Therefore, I probably could add a new module using ndk-build and include gstreamer there (but then gstreamer is only available in this module)
- Compile gstreamer for android using cmake inside android studio - but I don't see evidence that has been done before or is possible for someone without strong cmake knowledge.
Any other ideas/ improvements ? thanks
Even though you have already moved away from GStreamer but in case someone else is facing this issue please have a look at following github repository
https://github.com/henkeldi/gstreamer-android
For myself, I had to make two modifications
I modified the definition of GSTREAMER_ROOT to include ANDROID_ABI so it looks like following
#GStreamer set(GSTREAMER_ROOT $ENV{GSTREAMER_ROOT_ANDROID}/${ANDROID_ABI})
I had to rename the folders in GStreamer pre-built binaries to be according to ANDROID_ABI. So, my Gstreamer pre-built binaries folder look like following
After the above changes, I am able to successfully build with APK with GStreamer using CMake
这篇关于在使用CMake(CMakeLists.txt)而不是ndk-build(Android.mk)的android ndk项目中包括GStreamer的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!