gstreamer/gst-sdk/tutorials/android-tutorial-1/jni/tutorial-1.c

32 lines
934 B
C
Raw Normal View History

2012-10-04 10:15:02 +00:00
#include <string.h>
#include <jni.h>
#include <android/log.h>
2012-10-04 10:15:02 +00:00
#include <gst/gst.h>
/*
* Java Bindings
*/
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;
}
jclass klass = (*env)->FindClass (env, "com/gst_sdk_tutorials/tutorial_1/Tutorial1");
(*env)->RegisterNatives (env, klass, native_methods, G_N_ELEMENTS(native_methods));
return JNI_VERSION_1_4;
}