eglglessink: Fix render_and_display logic

Switch procedure according to enabled rendering path
This commit is contained in:
Reynaldo H. Verdejo Pinochet 2012-09-11 10:20:16 -03:00 committed by Sebastian Dröge
parent ada5a83eb4
commit 3fce24549f

View file

@ -1187,6 +1187,12 @@ gst_eglglessink_render_and_display (GstEglGlesSink * eglglessink,
GstBuffer * buf)
{
gint w, h;
#ifdef EGL_FAST_RENDERING_POSSIBLE
EGLImageKHR img = EGL_NO_IMAGE_KHR;
EGLint attrs[] = { EGL_IMAGE_PRESERVED_KHR,
EGL_FALSE, EGL_NONE, EGL_NONE
};
#endif
if (!buf) {
GST_ERROR_OBJECT (eglglessink, "Null buffer, no past queue implemented");
@ -1207,6 +1213,24 @@ gst_eglglessink_render_and_display (GstEglGlesSink * eglglessink,
goto HANDLE_ERROR;
}
switch (eglglessink->rendering_path) {
#ifdef EGL_FAST_RENDERING_POSSIBLE
case GST_EGLGLESSINK_RENDER_FAST:
/* XXX: Not Fully implemented */
img = my_eglCreateImageKHR (eglglessink->display, EGL_NO_CONTEXT,
EGL_NATIVE_PIXMAP_KHR, (EGLClientBuffer) GST_BUFFER_DATA (buf),
attrs);
if (img == EGL_NO_IMAGE_KHR) {
GST_ERROR_OBJECT (eglglessink, "my_eglCreateImageKHR failed");
goto HANDLE_EGL_ERROR;
}
my_glEGLImageTargetTexture2DOES (GL_TEXTURE_2D, img);
break;
#endif
default: /* case GST_EGLGLESSINK_RENDER_SLOW */
/* XXX: This should actually happen each time
* frame/window dimension changes.
* Also might want to find a way to pass buffer's
@ -1230,7 +1254,6 @@ gst_eglglessink_render_and_display (GstEglGlesSink * eglglessink,
g_mutex_lock (eglglessink->flow_lock);
if (!eglglessink->have_vbo) {
GST_DEBUG_OBJECT (eglglessink, "Doing initial VBO setup");
eglglessink->coordarray[0].x = -1;
eglglessink->coordarray[0].y = 1;
eglglessink->coordarray[0].z = 0;
@ -1293,33 +1316,13 @@ gst_eglglessink_render_and_display (GstEglGlesSink * eglglessink,
goto HANDLE_ERROR;
eglSwapBuffers (eglglessink->display, eglglessink->surface);
}
GST_DEBUG_OBJECT (eglglessink, "Succesfully rendered 1 frame");
return;
/*
EGLImageKHR img = EGL_NO_IMAGE_KHR;
EGLint attrs[] = { EGL_IMAGE_PRESERVED_KHR,
EGL_FALSE, EGL_NONE, EGL_NONE
};
if (!buf) {
GST_ERROR_OBJECT (eglglessink, "Null buffer, no past queue implemented");
goto HANDLE_ERROR;
}
img = my_eglCreateImageKHR (eglglessink->display, EGL_NO_CONTEXT,
EGL_NATIVE_PIXMAP_KHR, (EGLClientBuffer) GST_BUFFER_DATA (buf), attrs);
if (img == EGL_NO_IMAGE_KHR) {
GST_ERROR_OBJECT (eglglessink, "my_eglCreateImageKHR failed");
goto HANDLE_EGL_ERROR;
}
my_glEGLImageTargetTexture2DOES (GL_TEXTURE_2D, img);
HANDLE_EGL_ERROR:
GST_ERROR_OBJECT (eglglessink, "EGL call returned error %x", eglGetError ());
*/
HANDLE_ERROR_LOCKED:
g_mutex_unlock (eglglessink->flow_lock);
HANDLE_ERROR: