2012-10-04 10:15:02 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <jni.h>
|
2012-10-15 11:19:27 +00:00
|
|
|
#include <android/log.h>
|
2012-10-04 10:15:02 +00:00
|
|
|
#include <gst/gst.h>
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Java Bindings
|
|
|
|
*/
|
2016-06-03 13:17:41 +00:00
|
|
|
static jstring gst_native_get_gstreamer_info (JNIEnv* env, jobject thiz) {
|
2013-05-02 10:52:17 +00:00
|
|
|
char *version_utf8 = gst_version_string();
|
|
|
|
jstring *version_jstring = (*env)->NewStringUTF(env, version_utf8);
|
|
|
|
g_free (version_utf8);
|
|
|
|
return version_jstring;
|
2012-10-04 10:15:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
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) {
|
2012-10-15 11:21:47 +00:00
|
|
|
__android_log_print (ANDROID_LOG_ERROR, "tutorial-1", "Could not retrieve JNIEnv");
|
2012-10-04 10:15:02 +00:00
|
|
|
return 0;
|
|
|
|
}
|
2016-06-03 13:17:41 +00:00
|
|
|
jclass klass = (*env)->FindClass (env, "org/freedesktop/gstreamer/tutorials/tutorial_1/Tutorial1");
|
2012-10-04 10:15:02 +00:00
|
|
|
(*env)->RegisterNatives (env, klass, native_methods, G_N_ELEMENTS(native_methods));
|
|
|
|
|
|
|
|
return JNI_VERSION_1_4;
|
|
|
|
}
|