mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-25 03:01:03 +00:00
Do not use GST_ERROR before GStreamer has been initialized (tutorial 5)
This commit is contained in:
parent
0ccc6fe8c8
commit
1c3c4ee7b7
2 changed files with 5 additions and 4 deletions
|
@ -5,7 +5,7 @@ include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE := tutorial-5
|
LOCAL_MODULE := tutorial-5
|
||||||
LOCAL_SRC_FILES := tutorial-5.c
|
LOCAL_SRC_FILES := tutorial-5.c
|
||||||
LOCAL_SHARED_LIBRARIES := gstreamer_android
|
LOCAL_SHARED_LIBRARIES := gstreamer_android
|
||||||
LOCAL_LDLIBS := -landroid
|
LOCAL_LDLIBS := -llog -landroid
|
||||||
include $(BUILD_SHARED_LIBRARY)
|
include $(BUILD_SHARED_LIBRARY)
|
||||||
|
|
||||||
ifndef GSTREAMER_SDK_ROOT
|
ifndef GSTREAMER_SDK_ROOT
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <jni.h>
|
#include <jni.h>
|
||||||
|
#include <android/log.h>
|
||||||
#include <android/native_window.h>
|
#include <android/native_window.h>
|
||||||
#include <android/native_window_jni.h>
|
#include <android/native_window_jni.h>
|
||||||
#include <gst/gst.h>
|
#include <gst/gst.h>
|
||||||
|
@ -324,6 +325,8 @@ void gst_native_init (JNIEnv* env, jobject thiz) {
|
||||||
data->desired_position = GST_CLOCK_TIME_NONE;
|
data->desired_position = GST_CLOCK_TIME_NONE;
|
||||||
data->last_seek_time = GST_CLOCK_TIME_NONE;
|
data->last_seek_time = GST_CLOCK_TIME_NONE;
|
||||||
SET_CUSTOM_DATA (env, thiz, custom_data_field_id, data);
|
SET_CUSTOM_DATA (env, thiz, custom_data_field_id, data);
|
||||||
|
GST_DEBUG_CATEGORY_INIT (debug_category, "tutorial-5", 0, "Android tutorial 5");
|
||||||
|
gst_debug_set_threshold_for_name("tutorial-5", GST_LEVEL_DEBUG);
|
||||||
GST_DEBUG ("Created CustomData at %p", data);
|
GST_DEBUG ("Created CustomData at %p", data);
|
||||||
data->app = (*env)->NewGlobalRef (env, thiz);
|
data->app = (*env)->NewGlobalRef (env, thiz);
|
||||||
GST_DEBUG ("Created GlobalRef for app object at %p", data->app);
|
GST_DEBUG ("Created GlobalRef for app object at %p", data->app);
|
||||||
|
@ -459,12 +462,10 @@ static JNINativeMethod native_methods[] = {
|
||||||
jint JNI_OnLoad(JavaVM *vm, void *reserved) {
|
jint JNI_OnLoad(JavaVM *vm, void *reserved) {
|
||||||
JNIEnv *env = NULL;
|
JNIEnv *env = NULL;
|
||||||
|
|
||||||
GST_DEBUG_CATEGORY_INIT (debug_category, "tutorial-5", 0, "Android tutorial 5");
|
|
||||||
|
|
||||||
java_vm = vm;
|
java_vm = vm;
|
||||||
|
|
||||||
if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_4) != JNI_OK) {
|
if ((*vm)->GetEnv(vm, (void**) &env, JNI_VERSION_1_4) != JNI_OK) {
|
||||||
GST_ERROR ("Could not retrieve JNIEnv");
|
__android_log_print (ANDROID_LOG_ERROR, "tutorial-5", "Could not retrieve JNIEnv");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
jclass klass = (*env)->FindClass (env, "com/gst_sdk_tutorials/tutorial_5/Tutorial5");
|
jclass klass = (*env)->FindClass (env, "com/gst_sdk_tutorials/tutorial_5/Tutorial5");
|
||||||
|
|
Loading…
Reference in a new issue