Update
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
.externalNativeBuild/
|
||||
assets/
|
||||
gst-build-*/
|
||||
src/org/freedesktop/gstreamer/GStreamer.java
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="org.freedesktop.gstreamer.tutorials.tutorial_1"
|
||||
android:versionCode="1"
|
||||
android:versionName="1.0">
|
||||
|
||||
<application android:label="@string/app_name"
|
||||
android:icon="@drawable/gstreamer_logo_1">
|
||||
<activity android:name=".Tutorial1"
|
||||
android:label="@string/app_name"
|
||||
android:exported="true">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="android.intent.category.LAUNCHER" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,72 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
android {
|
||||
compileSdkVersion 32
|
||||
|
||||
defaultConfig {
|
||||
applicationId "org.freedesktop.gstreamer.tutorials.tutorial_1"
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 32
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
def gstRoot
|
||||
|
||||
if (project.hasProperty('gstAndroidRoot'))
|
||||
gstRoot = project.gstAndroidRoot
|
||||
else
|
||||
gstRoot = System.env.GSTREAMER_ROOT_ANDROID
|
||||
|
||||
if (gstRoot == null)
|
||||
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')
|
||||
|
||||
arguments "NDK_APPLICATION_MK=jni/Application.mk", "GSTREAMER_JAVA_SRC_DIR=src", "GSTREAMER_ROOT_ANDROID=$gstRoot", "GSTREAMER_ASSETS_DIR=src/assets"
|
||||
|
||||
targets "tutorial-1"
|
||||
|
||||
// All archs except MIPS and MIPS64 are supported
|
||||
abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
|
||||
sourceSets {
|
||||
main {
|
||||
manifest.srcFile 'AndroidManifest.xml'
|
||||
java.srcDirs = ['src']
|
||||
resources.srcDirs = ['src']
|
||||
aidl.srcDirs = ['src']
|
||||
renderscript.srcDirs = ['src']
|
||||
res.srcDirs = ['res']
|
||||
assets.srcDirs = ['assets']
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
externalNativeBuild {
|
||||
ndkBuild {
|
||||
path 'jni/Android.mk'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
if (project.hasProperty('compileDebugJavaWithJavac'))
|
||||
project.compileDebugJavaWithJavac.dependsOn 'externalNativeBuildDebug'
|
||||
if (project.hasProperty('compileReleaseJavaWithJavac'))
|
||||
project.compileReleaseJavaWithJavac.dependsOn 'externalNativeBuildRelease'
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
testImplementation 'junit:junit:4.12'
|
||||
implementation 'com.android.support:appcompat-v7:23.1.1'
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := tutorial-1
|
||||
LOCAL_SRC_FILES := tutorial-1.c dummy.cpp
|
||||
LOCAL_SHARED_LIBRARIES := gstreamer_android
|
||||
LOCAL_LDLIBS := -llog
|
||||
include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
ifndef GSTREAMER_ROOT_ANDROID
|
||||
$(error GSTREAMER_ROOT_ANDROID is not defined!)
|
||||
endif
|
||||
|
||||
ifeq ($(TARGET_ARCH_ABI),armeabi)
|
||||
GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)/arm
|
||||
else ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
|
||||
GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)/armv7
|
||||
else ifeq ($(TARGET_ARCH_ABI),arm64-v8a)
|
||||
GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)/arm64
|
||||
else ifeq ($(TARGET_ARCH_ABI),x86)
|
||||
GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)/x86
|
||||
else ifeq ($(TARGET_ARCH_ABI),x86_64)
|
||||
GSTREAMER_ROOT := $(GSTREAMER_ROOT_ANDROID)/x86_64
|
||||
else
|
||||
$(error Target arch ABI not supported: $(TARGET_ARCH_ABI))
|
||||
endif
|
||||
|
||||
GSTREAMER_NDK_BUILD_PATH := $(GSTREAMER_ROOT)/share/gst-android/ndk-build/
|
||||
GSTREAMER_PLUGINS := coreelements
|
||||
GSTREAMER_EXTRA_LIBS := -liconv
|
||||
include $(GSTREAMER_NDK_BUILD_PATH)/gstreamer-1.0.mk
|
||||
@@ -0,0 +1,2 @@
|
||||
APP_ABI = armeabi armeabi-v7a arm64-v8a x86 x86_64
|
||||
APP_STL = c++_shared
|
||||
@@ -0,0 +1,39 @@
|
||||
#include <string.h>
|
||||
#include <jni.h>
|
||||
#include <android/log.h>
|
||||
#include <gst/gst.h>
|
||||
|
||||
/*
|
||||
* Java Bindings
|
||||
*/
|
||||
static jstring
|
||||
gst_native_get_gstreamer_info (JNIEnv * env, jobject thiz)
|
||||
{
|
||||
char *version_utf8 = gst_version_string ();
|
||||
jstring *version_jstring = (*env)->NewStringUTF (env, version_utf8);
|
||||
g_free (version_utf8);
|
||||
return version_jstring;
|
||||
}
|
||||
|
||||
static JNINativeMethod native_methods[] = {
|
||||
{"nativeGetGStreamerInfo", "()Ljava/lang/String;",
|
||||
(void *) gst_native_get_gstreamer_info}
|
||||
};
|
||||
|
||||
jint
|
||||
JNI_OnLoad (JavaVM * vm, void *reserved)
|
||||
{
|
||||
JNIEnv *env = NULL;
|
||||
|
||||
if ((*vm)->GetEnv (vm, (void **) &env, JNI_VERSION_1_4) != JNI_OK) {
|
||||
__android_log_print (ANDROID_LOG_ERROR, "tutorial-1",
|
||||
"Could not retrieve JNIEnv");
|
||||
return 0;
|
||||
}
|
||||
jclass klass = (*env)->FindClass (env,
|
||||
"org/freedesktop/gstreamer/tutorials/tutorial_1/Tutorial1");
|
||||
(*env)->RegisterNatives (env, klass, native_methods,
|
||||
G_N_ELEMENTS (native_methods));
|
||||
|
||||
return JNI_VERSION_1_4;
|
||||
}
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 1.9 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 1.3 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 3.8 KiB |
BIN
Binary file not shown.
|
After Width: | Height: | Size: 5.0 KiB |
+14
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical" >
|
||||
|
||||
<TextView
|
||||
android:id="@+id/textview_info"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
</LinearLayout>
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string name="app_name">GStreamer tutorial 1</string>
|
||||
</resources>
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
package org.freedesktop.gstreamer.tutorials.tutorial_1;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.freedesktop.gstreamer.GStreamer;
|
||||
|
||||
public class Tutorial1 extends Activity {
|
||||
private native String nativeGetGStreamerInfo();
|
||||
|
||||
// Called when the activity is first created.
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
try {
|
||||
GStreamer.init(this);
|
||||
} catch (Exception e) {
|
||||
Toast.makeText(this, e.getMessage(), Toast.LENGTH_LONG).show();
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
setContentView(R.layout.main);
|
||||
|
||||
TextView tv = (TextView)findViewById(R.id.textview_info);
|
||||
tv.setText("Welcome to " + nativeGetGStreamerInfo() + " !");
|
||||
}
|
||||
|
||||
static {
|
||||
System.loadLibrary("gstreamer_android");
|
||||
System.loadLibrary("tutorial-1");
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user