mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
androidcamera: If callback is NULL then set it to NULL in jni
This commit is contained in:
parent
e3ba219494
commit
c85df6807d
1 changed files with 24 additions and 20 deletions
|
@ -247,7 +247,7 @@ _init_classes (void)
|
||||||
gchar *path = g_strdup_printf ("%s/GstAhcCallback.jar", g_getenv ("TMP"));
|
gchar *path = g_strdup_printf ("%s/GstAhcCallback.jar", g_getenv ("TMP"));
|
||||||
FILE *fd = fopen (path, "wb");
|
FILE *fd = fopen (path, "wb");
|
||||||
|
|
||||||
GST_WARNING ("Found embedded GstAhcCallback.jar, trying to load dynamically"
|
GST_DEBUG ("Found embedded GstAhcCallback.jar, trying to load dynamically"
|
||||||
"from %s", path);
|
"from %s", path);
|
||||||
if (fd) {
|
if (fd) {
|
||||||
if (fwrite (gst_ahc_callback_jar, gst_ahc_callback_jar_size, 1, fd) == 1) {
|
if (fwrite (gst_ahc_callback_jar, gst_ahc_callback_jar_size, 1, fd) == 1) {
|
||||||
|
@ -310,7 +310,7 @@ _init_classes (void)
|
||||||
(*env)->ExceptionClear (env);
|
(*env)->ExceptionClear (env);
|
||||||
if (temp) {
|
if (temp) {
|
||||||
|
|
||||||
GST_WARNING ("Successfully loaded embedded GstAhcCallback");
|
GST_DEBUG ("Successfully loaded embedded GstAhcCallback");
|
||||||
com_gstreamer_gstahccallback.klass = (*env)->NewGlobalRef (env,
|
com_gstreamer_gstahccallback.klass = (*env)->NewGlobalRef (env,
|
||||||
temp);
|
temp);
|
||||||
(*env)->DeleteLocalRef (env, temp);
|
(*env)->DeleteLocalRef (env, temp);
|
||||||
|
@ -562,9 +562,10 @@ gst_ah_camera_set_error_callback (GstAHCamera * self, GstAHCErrorCallback cb,
|
||||||
gpointer user_data)
|
gpointer user_data)
|
||||||
{
|
{
|
||||||
JNIEnv *env = gst_dvm_get_env ();
|
JNIEnv *env = gst_dvm_get_env ();
|
||||||
jobject object;
|
jobject object = NULL;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
|
||||||
|
if (cb) {
|
||||||
object = (*env)->NewObject (env,
|
object = (*env)->NewObject (env,
|
||||||
com_gstreamer_gstahccallback.klass,
|
com_gstreamer_gstahccallback.klass,
|
||||||
com_gstreamer_gstahccallback.constructor,
|
com_gstreamer_gstahccallback.constructor,
|
||||||
|
@ -574,6 +575,7 @@ gst_ah_camera_set_error_callback (GstAHCamera * self, GstAHCErrorCallback cb,
|
||||||
(*env)->ExceptionClear (env);
|
(*env)->ExceptionClear (env);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
AHC_CALL (goto done, Void, setErrorCallback, object);
|
AHC_CALL (goto done, Void, setErrorCallback, object);
|
||||||
|
|
||||||
|
@ -590,9 +592,10 @@ gst_ah_camera_set_preview_callback_with_buffer (GstAHCamera * self,
|
||||||
GstAHCPreviewCallback cb, gpointer user_data)
|
GstAHCPreviewCallback cb, gpointer user_data)
|
||||||
{
|
{
|
||||||
JNIEnv *env = gst_dvm_get_env ();
|
JNIEnv *env = gst_dvm_get_env ();
|
||||||
jobject object;
|
jobject object = NULL;
|
||||||
gboolean ret = FALSE;
|
gboolean ret = FALSE;
|
||||||
|
|
||||||
|
if (cb) {
|
||||||
object = (*env)->NewObject (env,
|
object = (*env)->NewObject (env,
|
||||||
com_gstreamer_gstahccallback.klass,
|
com_gstreamer_gstahccallback.klass,
|
||||||
com_gstreamer_gstahccallback.constructor,
|
com_gstreamer_gstahccallback.constructor,
|
||||||
|
@ -602,6 +605,7 @@ gst_ah_camera_set_preview_callback_with_buffer (GstAHCamera * self,
|
||||||
(*env)->ExceptionClear (env);
|
(*env)->ExceptionClear (env);
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
AHC_CALL (goto done, Void, setPreviewCallbackWithBuffer, object);
|
AHC_CALL (goto done, Void, setPreviewCallbackWithBuffer, object);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue