mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-05 23:18:52 +00:00
[824/906] android: Build fixes
https://bugzilla.gnome.org/show_bug.cgi?id=709786
This commit is contained in:
parent
9515519826
commit
775ea000dc
6 changed files with 39 additions and 26 deletions
|
@ -28,8 +28,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "../gstgl_fwd.h"
|
#include <gst/gst.h>
|
||||||
#include <gst/gl/gstglcontext.h>
|
|
||||||
|
|
||||||
#include "gstglwindow_android_egl.h"
|
#include "gstglwindow_android_egl.h"
|
||||||
|
|
||||||
|
@ -39,6 +38,7 @@
|
||||||
G_DEFINE_TYPE (GstGLWindowAndroidEGL, gst_gl_window_android_egl,
|
G_DEFINE_TYPE (GstGLWindowAndroidEGL, gst_gl_window_android_egl,
|
||||||
GST_GL_TYPE_WINDOW);
|
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 *
|
static guintptr gst_gl_window_android_egl_get_window_handle (GstGLWindow *
|
||||||
window);
|
window);
|
||||||
static void gst_gl_window_android_egl_set_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,
|
static void gst_gl_window_android_egl_draw (GstGLWindow * window, guint width,
|
||||||
guint height);
|
guint height);
|
||||||
static void gst_gl_window_android_egl_run (GstGLWindow * window);
|
static void gst_gl_window_android_egl_run (GstGLWindow * window);
|
||||||
static void gst_gl_window_android_egl_quit (GstGLWindow * window,
|
static void gst_gl_window_android_egl_quit (GstGLWindow * window);
|
||||||
GstGLWindowCB callback, gpointer data);
|
|
||||||
static void gst_gl_window_android_egl_send_message_async (GstGLWindow * window,
|
static void gst_gl_window_android_egl_send_message_async (GstGLWindow * window,
|
||||||
GstGLWindowCB callback, gpointer data, GDestroyNotify destroy);
|
GstGLWindowCB callback, gpointer data, GDestroyNotify destroy);
|
||||||
static gboolean gst_gl_window_android_egl_open (GstGLWindow * window,
|
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;
|
GstGLWindowClass *window_class = (GstGLWindowClass *) klass;
|
||||||
|
|
||||||
|
window_class->get_display =
|
||||||
|
GST_DEBUG_FUNCPTR (gst_gl_window_android_egl_get_display);
|
||||||
window_class->get_window_handle =
|
window_class->get_window_handle =
|
||||||
GST_DEBUG_FUNCPTR (gst_gl_window_android_egl_get_window_handle);
|
GST_DEBUG_FUNCPTR (gst_gl_window_android_egl_get_window_handle);
|
||||||
window_class->set_window_handle =
|
window_class->set_window_handle =
|
||||||
|
@ -131,16 +132,12 @@ gst_gl_window_android_egl_run (GstGLWindow * window)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_gl_window_android_egl_quit (GstGLWindow * window, GstGLWindowCB callback,
|
gst_gl_window_android_egl_quit (GstGLWindow * window)
|
||||||
gpointer data)
|
|
||||||
{
|
{
|
||||||
GstGLWindowAndroidEGL *window_egl;
|
GstGLWindowAndroidEGL *window_egl;
|
||||||
|
|
||||||
window_egl = GST_GL_WINDOW_ANDROID_EGL (window);
|
window_egl = GST_GL_WINDOW_ANDROID_EGL (window);
|
||||||
|
|
||||||
if (callback)
|
|
||||||
gst_gl_window_android_egl_send_message (window, callback, data);
|
|
||||||
|
|
||||||
GST_LOG ("sending quit");
|
GST_LOG ("sending quit");
|
||||||
|
|
||||||
g_main_loop_quit (window_egl->loop);
|
g_main_loop_quit (window_egl->loop);
|
||||||
|
@ -216,13 +213,15 @@ draw_cb (gpointer data)
|
||||||
struct draw *draw_data = data;
|
struct draw *draw_data = data;
|
||||||
GstGLWindowAndroidEGL *window_egl = draw_data->window;
|
GstGLWindowAndroidEGL *window_egl = draw_data->window;
|
||||||
GstGLWindow *window = GST_GL_WINDOW (window_egl);
|
GstGLWindow *window = GST_GL_WINDOW (window_egl);
|
||||||
GstGLContext *context = window->context;
|
GstGLContext *context = gst_gl_window_get_context (window);
|
||||||
GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (window->context);
|
GstGLContextClass *context_class = GST_GL_CONTEXT_GET_CLASS (context);
|
||||||
|
|
||||||
if (window->draw)
|
if (window->draw)
|
||||||
window->draw (window->draw_data);
|
window->draw (window->draw_data);
|
||||||
|
|
||||||
context_class->swap_buffers (context);
|
context_class->swap_buffers (context);
|
||||||
|
|
||||||
|
gst_object_unref (context);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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);
|
gst_gl_window_send_message (window, (GstGLWindowCB) draw_cb, &draw_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static guintptr
|
||||||
|
gst_gl_window_android_egl_get_display (GstGLWindow * window)
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
|
@ -42,7 +42,6 @@ struct _GstGLWindowAndroidEGL {
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
GstGLWindow parent;
|
GstGLWindow parent;
|
||||||
|
|
||||||
GstGLEGL *egl;
|
|
||||||
/* This is actually an ANativeWindow */
|
/* This is actually an ANativeWindow */
|
||||||
EGLNativeWindowType native_window;
|
EGLNativeWindowType native_window;
|
||||||
|
|
||||||
|
|
|
@ -453,16 +453,19 @@ gst_gl_context_egl_get_gl_api (GstGLContext * context)
|
||||||
static gpointer
|
static gpointer
|
||||||
gst_gl_context_egl_get_proc_address (GstGLContext * context, const gchar * name)
|
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 */
|
/* FIXME: On Android this returns wrong addresses for non-EGL functions */
|
||||||
#ifdef GST_GL_HAVE_WINDOW_ANDROID
|
#ifdef GST_GL_HAVE_WINDOW_ANDROID
|
||||||
return NULL;
|
if (!(result = gst_gl_context_default_get_proc_address (context, name))) {
|
||||||
#endif
|
if (g_str_has_prefix (name, "egl"))
|
||||||
|
result = eglGetProcAddress (name);
|
||||||
|
}
|
||||||
|
#else
|
||||||
if (!(result = eglGetProcAddress (name))) {
|
if (!(result = eglGetProcAddress (name))) {
|
||||||
result = gst_gl_context_default_get_proc_address (context, name);
|
result = gst_gl_context_default_get_proc_address (context, name);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,13 @@
|
||||||
# include "config.h"
|
# include "config.h"
|
||||||
#endif
|
#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 <gmodule.h>
|
#include <gmodule.h>
|
||||||
|
|
||||||
#include "gl.h"
|
#include "gl.h"
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
#ifndef __GST_GL_DISPLAY_H__
|
#ifndef __GST_GL_DISPLAY_H__
|
||||||
#define __GST_GL_DISPLAY_H__
|
#define __GST_GL_DISPLAY_H__
|
||||||
|
|
||||||
|
#include <gst/gst.h>
|
||||||
|
|
||||||
#include <gst/gl/gstgl_fwd.h>
|
#include <gst/gl/gstgl_fwd.h>
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
|
@ -319,9 +319,6 @@ parse_error:
|
||||||
trimleft (p0, " \t\n");
|
trimleft (p0, " \t\n");
|
||||||
GST_ERROR ("\n%s", p0);
|
GST_ERROR ("\n%s", p0);
|
||||||
e[1] = e1;
|
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),
|
GST_ERROR ("parse error on line %d, position %ld (%s)", line, (glong) (t - p),
|
||||||
t);
|
t);
|
||||||
|
@ -742,7 +739,7 @@ parsevalue (char *value, char *_saveptr, struct gst_gl_shadervariable_desc *ret)
|
||||||
return _saveptr + j;
|
return _saveptr + j;
|
||||||
}
|
}
|
||||||
ret->value = (void *) g_malloc (sizeof (float));
|
ret->value = (void *) g_malloc (sizeof (float));
|
||||||
*((float *) ret->value) = (float) atof (value);
|
*((float *) ret->value) = (float) strtod (value, NULL);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ret->value = g_malloc (sizeof (float) * ret->count);
|
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;
|
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);
|
t = strtok_r (0, ",", &saveptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -926,7 +923,7 @@ vec_parsevalue (int n, char *value, char *_saveptr,
|
||||||
return _saveptr + (saveptr - t) + j;
|
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);
|
t = strtok_r (0, ",", &saveptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -976,7 +973,7 @@ vec_parsevalue (int n, char *value, char *_saveptr,
|
||||||
return _saveptr + (t - value) + j;
|
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);
|
t = strtok_r (0, ",", &saveptr);
|
||||||
if (i < (n - 1) && !t)
|
if (i < (n - 1) && !t)
|
||||||
return _saveptr + (saveptr - value);
|
return _saveptr + (saveptr - value);
|
||||||
|
@ -1425,7 +1422,7 @@ mat_parsevalue (int n, int m, char *value, char *_saveptr,
|
||||||
return _saveptr + (saveptr - t) + j;
|
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);
|
t = strtok_r (0, ",", &saveptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1475,7 +1472,7 @@ mat_parsevalue (int n, int m, char *value, char *_saveptr,
|
||||||
return _saveptr + (t - value) + j;
|
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);
|
t = strtok_r (0, ",", &saveptr);
|
||||||
if (i < (n * m - 1) && !t)
|
if (i < (n * m - 1) && !t)
|
||||||
return _saveptr + (saveptr - value);
|
return _saveptr + (saveptr - value);
|
||||||
|
|
Loading…
Reference in a new issue