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,17 +562,19 @@ 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;
|
||||||
|
|
||||||
object = (*env)->NewObject (env,
|
if (cb) {
|
||||||
com_gstreamer_gstahccallback.klass,
|
object = (*env)->NewObject (env,
|
||||||
com_gstreamer_gstahccallback.constructor,
|
com_gstreamer_gstahccallback.klass,
|
||||||
*((jlong *) & cb), *((jlong *) & user_data));
|
com_gstreamer_gstahccallback.constructor,
|
||||||
if (!object) {
|
*((jlong *) & cb), *((jlong *) & user_data));
|
||||||
GST_ERROR ("Failed to create callback object");
|
if (!object) {
|
||||||
(*env)->ExceptionClear (env);
|
GST_ERROR ("Failed to create callback object");
|
||||||
goto done;
|
(*env)->ExceptionClear (env);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AHC_CALL (goto done, Void, setErrorCallback, object);
|
AHC_CALL (goto done, Void, setErrorCallback, object);
|
||||||
|
@ -590,17 +592,19 @@ 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;
|
||||||
|
|
||||||
object = (*env)->NewObject (env,
|
if (cb) {
|
||||||
com_gstreamer_gstahccallback.klass,
|
object = (*env)->NewObject (env,
|
||||||
com_gstreamer_gstahccallback.constructor,
|
com_gstreamer_gstahccallback.klass,
|
||||||
*((jlong *) & cb), *((jlong *) & user_data));
|
com_gstreamer_gstahccallback.constructor,
|
||||||
if (!object) {
|
*((jlong *) & cb), *((jlong *) & user_data));
|
||||||
GST_ERROR ("Failed to create callback object");
|
if (!object) {
|
||||||
(*env)->ExceptionClear (env);
|
GST_ERROR ("Failed to create callback object");
|
||||||
goto done;
|
(*env)->ExceptionClear (env);
|
||||||
|
goto done;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AHC_CALL (goto done, Void, setPreviewCallbackWithBuffer, object);
|
AHC_CALL (goto done, Void, setPreviewCallbackWithBuffer, object);
|
||||||
|
|
Loading…
Reference in a new issue