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

29 lines
826 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) {
return (*env)->NewStringUTF(env, gst_version_string());
}
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;
}