这个教程是gst-doc里面的example,可以快速熟悉android上gstreamer的使用,使用很简单,现在gst-doc,然后导入tutorials到android studio里面,修改下sdk和ndk的路径,配置好gstAndroidRoot环境变量,修改个别配置就可以跑起来了,下面是记录比较重要的几个点。
下载gst-docs代码
gst-docs: https://github.com/GStreamer/gst-docs.git
修改的点
修改examples/tutorials/android/local.properties
增加sdk、ndk目录
sdk.dir=/home/hui/Android/Sdk
ndk.dir=/home/hui/Android/Sdk/ndk/21.3.6528147
新建examples/tutorials/android/gradle.properties
增加gstAndroidRoot环境变量
gstAndroidRoot=/home/hui/disk4t/codes/gstreamer-gstplayer/gstreamer/gstreamer-1.0-android-universal-1.19.3
修改tutorial下的每一个build.gradle
android {
- compileSdkVersion 23
+ compileSdkVersion 30
buildToolsVersion '27.0.3'
defaultConfig {
applicationId "org.freedesktop.gstreamer.tutorials.tutorial_3"
minSdkVersion 15
- targetSdkVersion 15
+ targetSdkVersion 30
versionCode 1
versionName "1.0"
- throw new GradleException('GSTREAMER_ROOT_ANDROID must be set, or "gstAndroidRoot" must be defined in your gradle.properties in the top level directory of the unpacked universal GStreamer Android binaries')
+ throw GradleException('GSTREAMER_ROOT_ANDROID must be set, or "gstAndroidRoot" must be defined in your gradle.properties in the top level directory of the unpacked universal GStreamer Android binaries')
下载gstreamer-android libs
下载gstreamer-1.0-android-universal-1.19.3解压到/home/hui/disk4t/codes/gstreamer-gstplayer/gstreamer/gstreamer-1.0-android-universal-1.19.3,前面gstAndroidRoot用的地址就是这个目录
下载地址:
https://gstreamer.freedesktop.org/data/pkg/android/1.19.3/gstreamer-1.0-android-universal-1.19.3.tar.xz
import到android studio后编译OK。
使用官网cerbero提供的编译方式也可以生成gstreamer-1.0-android-universal-1.19.3.tar.xz