diff --git a/gst-libs/gst/gl/android/gstglwindow_android_egl.c b/gst-libs/gst/gl/android/gstglwindow_android_egl.c index a918127b6e..5d5d0df22a 100644 --- a/gst-libs/gst/gl/android/gstglwindow_android_egl.c +++ b/gst-libs/gst/gl/android/gstglwindow_android_egl.c @@ -28,8 +28,7 @@ #include "config.h" #endif -#include "../gstgl_fwd.h" -#include +#include #include "gstglwindow_android_egl.h" @@ -39,6 +38,7 @@ G_DEFINE_TYPE (GstGLWindowAndroidEGL, gst_gl_window_android_egl, GST_GL_TYPE_WINDOW); +static guintptr gst_gl_window_android_egl_get_display (GstGLWindow * window); static guintptr gst_gl_window_android_egl_get_window_handle (GstGLWindow * window); static void gst_gl_window_android_egl_set_window_handle (GstGLWindow * window, @@ -46,8 +46,7 @@ static void gst_gl_window_android_egl_set_window_handle (GstGLWindow * window, static void gst_gl_window_android_egl_draw (GstGLWindow * window, guint width, guint height); static void gst_gl_window_android_egl_run (GstGLWindow * window); -static void gst_gl_window_android_egl_quit (GstGLWindow * window, - GstGLWindowCB callback, gpointer data); +static void gst_gl_window_android_egl_quit (GstGLWindow * window); static void gst_gl_window_android_egl_send_message_async (GstGLWindow * window, GstGLWindowCB callback, gpointer data, GDestroyNotify destroy); static gboolean gst_gl_window_android_egl_open (GstGLWindow * window, @@ -59,6 +58,8 @@ gst_gl_window_android_egl_class_init (GstGLWindowAndroidEGLClass * klass) { GstGLWindowClass *window_class = (GstGLWindowClass *) klass; + window_class->get_display = + GST_DEBUG_FUNCPTR (gst_gl_window_android_egl_get_display); window_class->get_window_handle = GST_DEBUG_FUNCPTR (gst_gl_window_android_egl_get_window_handle); window_class->set_window_handle = @@ -131,16 +132,12 @@ gst_gl_window_android_egl_run (GstGLWindow * window) } static void -gst_gl_window_android_egl_quit (GstGLWindow * window, GstGLWindowCB callback, - gpointer data) +gst_gl_window_android_egl_quit (GstGLWindow * window) { GstGLWindowAndroidEGL *window_egl; window_egl = GST_GL_WINDOW_ANDROID_EGL (window); - if (callback) - gst_gl_window_android_egl_send_message (window, callback, data); - GST_LOG ("sending quit"); g_main_loop_quit (window_egl->loop); @@ -216,13 +213,15 @@ draw_cb (gpointer data) struct draw *draw_data = data; GstGLWindowAndroidEGL *window_egl = draw_data->window; GstGLWindow *window = GST_GL_WINDOW (window_egl); - GstGLContext *context = window->context; - GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (window->context); + GstGLContext *context = gst_gl_window_get_context (window); + GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context); if (window->draw) window->draw (window->draw_data); context_class->swap_buffers (context); + + gst_object_unref (context); } static void @@ -236,3 +235,9 @@ gst_gl_window_android_egl_draw (GstGLWindow * window, guint width, guint height) gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, &draw_data); } + +static guintptr +gst_gl_window_android_egl_get_display (GstGLWindow * window) +{ + return 0; +} diff --git a/gst-libs/gst/gl/android/gstglwindow_android_egl.h b/gst-libs/gst/gl/android/gstglwindow_android_egl.h index e206685184..7ff2bd9b8a 100644 --- a/gst-libs/gst/gl/android/gstglwindow_android_egl.h +++ b/gst-libs/gst/gl/android/gstglwindow_android_egl.h @@ -41,8 +41,7 @@ typedef struct _GstGLWindowAndroidEGLClass GstGLWindowAndroidEGLClass; struct _GstGLWindowAndroidEGL { /*< private >*/ GstGLWindow parent; - - GstGLEGL *egl; + /* This is actually an ANativeWindow */ EGLNativeWindowType native_window; diff --git a/gst-libs/gst/gl/egl/gstglcontext_egl.c b/gst-libs/gst/gl/egl/gstglcontext_egl.c index 27d37535f9..9007a490b5 100644 --- a/gst-libs/gst/gl/egl/gstglcontext_egl.c +++ b/gst-libs/gst/gl/egl/gstglcontext_egl.c @@ -453,16 +453,19 @@ gst_gl_context_egl_get_gl_api (GstGLContext * context) static gpointer gst_gl_context_egl_get_proc_address (GstGLContext * context, const gchar * name) { - gpointer result; + gpointer result = NULL; /* FIXME: On Android this returns wrong addresses for non-EGL functions */ #ifdef GST_GL_HAVE_WINDOW_ANDROID - return NULL; -#endif - + if (!(result = gst_gl_context_default_get_proc_address (context, name))) { + if (g_str_has_prefix (name, "egl")) + result = eglGetProcAddress (name); + } +#else if (!(result = eglGetProcAddress (name))) { result = gst_gl_context_default_get_proc_address (context, name); } +#endif return result; } diff --git a/gst-libs/gst/gl/gstglcontext.c b/gst-libs/gst/gl/gstglcontext.c index 4b853270e3..0101a830f0 100644 --- a/gst-libs/gst/gl/gstglcontext.c +++ b/gst-libs/gst/gl/gstglcontext.c @@ -22,6 +22,13 @@ # include "config.h" #endif +#if defined(ANDROID) || defined(__ANDROID__) +/* Avoid a linker error with _isoc99_sscanf() when building a shared library + * for android + */ +#define _GNU_SOURCE +#endif + #include #include "gl.h" diff --git a/gst-libs/gst/gl/gstgldisplay.h b/gst-libs/gst/gl/gstgldisplay.h index 604141a025..46f2228105 100644 --- a/gst-libs/gst/gl/gstgldisplay.h +++ b/gst-libs/gst/gl/gstgldisplay.h @@ -24,6 +24,8 @@ #ifndef __GST_GL_DISPLAY_H__ #define __GST_GL_DISPLAY_H__ +#include + #include G_BEGIN_DECLS diff --git a/gst-libs/gst/gl/gstglshadervariables.c b/gst-libs/gst/gl/gstglshadervariables.c index a9e5c6a4a7..2e27328182 100644 --- a/gst-libs/gst/gl/gstglshadervariables.c +++ b/gst-libs/gst/gl/gstglshadervariables.c @@ -319,9 +319,6 @@ parse_error: trimleft (p0, " \t\n"); GST_ERROR ("\n%s", p0); e[1] = e1; - for (i = 0; i < t - p; ++i) - fprintf (stderr, " "); - fprintf (stderr, "^\n"); } GST_ERROR ("parse error on line %d, position %ld (%s)", line, (glong) (t - p), t); @@ -742,7 +739,7 @@ parsevalue (char *value, char *_saveptr, struct gst_gl_shadervariable_desc *ret) return _saveptr + j; } ret->value = (void *) g_malloc (sizeof (float)); - *((float *) ret->value) = (float) atof (value); + *((float *) ret->value) = (float) strtod (value, NULL); } else { ret->value = g_malloc (sizeof (float) * ret->count); @@ -763,7 +760,7 @@ parsevalue (char *value, char *_saveptr, struct gst_gl_shadervariable_desc *ret) return _saveptr + (saveptr - t) + j; } - ((float *) ret->value)[i] = (float) atof (t); + ((float *) ret->value)[i] = (float) strtod (t, NULL); t = strtok_r (0, ",", &saveptr); } } @@ -926,7 +923,7 @@ vec_parsevalue (int n, char *value, char *_saveptr, return _saveptr + (saveptr - t) + j; } - ((float *) ret->value)[i] = (float) atof (t); + ((float *) ret->value)[i] = (float) strtod (t, NULL); t = strtok_r (0, ",", &saveptr); } @@ -976,7 +973,7 @@ vec_parsevalue (int n, char *value, char *_saveptr, return _saveptr + (t - value) + j; } - ((float *) ret->value)[k * n + i] = (float) atof (t); + ((float *) ret->value)[k * n + i] = (float) strtod (t, NULL); t = strtok_r (0, ",", &saveptr); if (i < (n - 1) && !t) return _saveptr + (saveptr - value); @@ -1425,7 +1422,7 @@ mat_parsevalue (int n, int m, char *value, char *_saveptr, return _saveptr + (saveptr - t) + j; } - ((float *) ret->value)[i] = (float) atof (t); + ((float *) ret->value)[i] = (float) strtod (t, NULL); t = strtok_r (0, ",", &saveptr); } @@ -1475,7 +1472,7 @@ mat_parsevalue (int n, int m, char *value, char *_saveptr, return _saveptr + (t - value) + j; } - ((float *) ret->value)[k * n * m + i] = (float) atof (t); + ((float *) ret->value)[k * n * m + i] = (float) strtod (t, NULL); t = strtok_r (0, ",", &saveptr); if (i < (n * m - 1) && !t) return _saveptr + (saveptr - value);