summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorReynaldo H. Verdejo Pinochet <reynaldo@collabora.com>2012-09-06 22:02:12 -0300
committerReynaldo H. Verdejo Pinochet <reynaldo@collabora.com>2012-09-06 22:02:12 -0300
commiteca5bebb27e547400569348b98f4e23b6917378c (patch)
tree8764f328f5a8c839e3586165b9fcc2a21b674f42
parent08cbca59aacb79a7b85f088f398c60773d950406 (diff)
Move eglUnlockSurfaceKHR init to platform wrapper
-rw-r--r--sys/android/gstvidroidsink.c22
-rw-r--r--sys/android/video_platform_wrapper.c16
-rw-r--r--sys/android/video_platform_wrapper.h2
3 files changed, 21 insertions, 19 deletions
diff --git a/sys/android/gstvidroidsink.c b/sys/android/gstvidroidsink.c
index c1ad8d39e..7da42e2cf 100644
--- a/sys/android/gstvidroidsink.c
+++ b/sys/android/gstvidroidsink.c
@@ -102,9 +102,6 @@ GST_DEBUG_CATEGORY_STATIC (gst_vidroidsink_debug);
static PFNEGLCREATEIMAGEKHRPROC my_eglCreateImageKHR;
static PFNEGLDESTROYIMAGEKHRPROC my_eglDestroyImageKHR;
static PFNGLEGLIMAGETARGETTEXTURE2DOESPROC my_glEGLImageTargetTexture2DOES;
-#ifdef __BIONIC__
-static PFNEGLUNLOCKSURFACEKHRPROC my_eglUnlockSurfaceKHR;
-#endif
static const char *vert_prog = {
"attribute vec3 position;"
@@ -667,11 +664,16 @@ gst_vidroidsink_start (GstBaseSink * sink)
ret = gst_vidroidsink_init_egl_display (vidroidsink);
if (!ret) {
- GST_ERROR_OBJECT (vidroidsink, "Couldn't init EGL display. Bailing out");
+ GST_ERROR_OBJECT (vidroidsink, "Couldn't init EGL display");
goto HANDLE_ERROR;
}
- platform_wrapper_init ();
+ ret = platform_wrapper_init ();
+
+ if (!ret) {
+ GST_ERROR_OBJECT (vidroidsink, "Couldn't init EGL platform wrapper");
+ goto HANDLE_ERROR;
+ }
/* Init supported caps list (Right now we just harcode the only one we support)
* XXX: Not sure this is the right place to do it.
@@ -694,16 +696,6 @@ gst_vidroidsink_start (GstBaseSink * sink)
GST_ERROR_OBJECT (vidroidsink, "Extension EGL_KHR_IMAGE not available");
goto HANDLE_ERROR;
}
-#ifdef __BIONIC__
- my_eglUnlockSurfaceKHR =
- (PFNEGLUNLOCKSURFACEKHRPROC) eglGetProcAddress ("eglUnlockSurfaceKHR");
-
- if (!my_eglUnlockSurfaceKHR) {
- GST_ERROR_OBJECT (vidroidsink,
- "Extension eglUnlockSurfaceKHR not available");
- goto HANDLE_ERROR;
- }
-#endif
my_glEGLImageTargetTexture2DOES =
(PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) eglGetProcAddress
diff --git a/sys/android/video_platform_wrapper.c b/sys/android/video_platform_wrapper.c
index 02c8c39b7..266f65d16 100644
--- a/sys/android/video_platform_wrapper.c
+++ b/sys/android/video_platform_wrapper.c
@@ -64,6 +64,7 @@ GST_DEBUG_CATEGORY_STATIC (vidroid_platform_wrapper);
#ifdef __BIONIC__
static PFNEGLLOCKSURFACEKHRPROC my_eglLockSurfaceKHR;
+static PFNEGLUNLOCKSURFACEKHRPROC my_eglUnlockSurfaceKHR;
static EGLint lock_attribs[] = {
EGL_MAP_PRESERVE_PIXELS_KHR, EGL_TRUE,
@@ -72,7 +73,7 @@ static EGLint lock_attribs[] = {
};
#endif
-void
+gboolean
platform_wrapper_init (void)
{
GST_DEBUG_CATEGORY_INIT (vidroid_platform_wrapper,
@@ -82,12 +83,21 @@ platform_wrapper_init (void)
#ifdef __BIONIC__
my_eglLockSurfaceKHR =
(PFNEGLLOCKSURFACEKHRPROC) eglGetProcAddress ("eglLockSurfaceKHR");
+ my_eglUnlockSurfaceKHR =
+ (PFNEGLUNLOCKSURFACEKHRPROC) eglGetProcAddress ("eglUnlockSurfaceKHR");
- if (!my_eglLockSurfaceKHR)
+ if (!my_eglLockSurfaceKHR) {
GST_CAT_ERROR (GST_CAT_DEFAULT, "Extension missing: eglLockSurfaceKHR");
+ return FALSE;
+ }
+
+ if (!my_eglUnlockSurfaceKHR) {
+ GST_CAT_ERROR (GST_CAT_DEFAULT, "Extension missing: eglUnlockSurfaceKHR");
+ return FALSE;
+ }
#endif
- return;
+ return TRUE;
}
#ifndef __BIONIC__
diff --git a/sys/android/video_platform_wrapper.h b/sys/android/video_platform_wrapper.h
index 3f85faae4..db27c572c 100644
--- a/sys/android/video_platform_wrapper.h
+++ b/sys/android/video_platform_wrapper.h
@@ -53,7 +53,7 @@
#include <gst/gst.h>
#include <EGL/egl.h>
-void platform_wrapper_init (void);
+gboolean platform_wrapper_init (void);
EGLNativeWindowType platform_create_native_window (gint width, gint height);
gboolean platform_destroy_native_window (EGLNativeDisplayType display,
EGLNativeWindowType w);