mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-24 02:31:03 +00:00
[824/906] android: Build fixes
https://bugzilla.gnome.org/show_bug.cgi?id=709786
This commit is contained in:
parent
ab5a3e310d
commit
266ffc48be
6 changed files with 39 additions and 26 deletions
|
@ -28,8 +28,7 @@
|
|||
#include "config.h"
|
||||
#endif
|
||||
|
||||
#include "../gstgl_fwd.h"
|
||||
#include <gst/gl/gstglcontext.h>
|
||||
#include <gst/gst.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
|
|
|
@ -41,8 +41,7 @@ typedef struct _GstGLWindowAndroidEGLClass GstGLWindowAndroidEGLClass;
|
|||
struct _GstGLWindowAndroidEGL {
|
||||
/*< private >*/
|
||||
GstGLWindow parent;
|
||||
|
||||
GstGLEGL *egl;
|
||||
|
||||
/* This is actually an ANativeWindow */
|
||||
EGLNativeWindowType native_window;
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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 <gmodule.h>
|
||||
|
||||
#include "gl.h"
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#ifndef __GST_GL_DISPLAY_H__
|
||||
#define __GST_GL_DISPLAY_H__
|
||||
|
||||
#include <gst/gst.h>
|
||||
|
||||
#include <gst/gl/gstgl_fwd.h>
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue