在使用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)

查看:55
本文介绍了在使用CMake(CMakeLists.txt)而不是ndk-build(Android.mk)的android ndk项目中包括GStreamer的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个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

  1. CMake does its job and i never had problems with it

  2. as stated here cmake is the default for android ndk https://developer.android.com/studio/projects/add-native-code

  3. 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

  1. 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)
  2. 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

  1. 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})

  2. 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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆