From: Matthew Waters Date: Wed, 9 Jan 2013 14:13:23 +0000 (+1100) Subject: [642/906] add gstglconfig.h for apps to find out what our capabilites are X-Git-Tag: 1.19.3~511^2~1989^2~1877 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e983f02e87013d94cbba2db3080235832e85e388;p=platform%2Fupstream%2Fgstreamer.git [642/906] add gstglconfig.h for apps to find out what our capabilites are ie libgstgl can be compiled with any combination of opengl/gles2 --- diff --git a/gst-libs/gst/gl/gstglapi.c b/gst-libs/gst/gl/gstglapi.c index 86ff505..d771d13 100644 --- a/gst-libs/gst/gl/gstglapi.c +++ b/gst-libs/gst/gl/gstglapi.c @@ -25,7 +25,7 @@ NULL, #define GST_GL_EXT_END() -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL static GstGLFuncs gst_gl = { #include "glprototypes/opengl.h" {NULL,}, @@ -44,7 +44,7 @@ gst_gl_get_opengl_vtable (void) } #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 static GstGLES2Funcs gst_gles2 = { #include "glprototypes/gles1gles2.h" {NULL,}, diff --git a/gst-libs/gst/gl/gstglapi.h b/gst-libs/gst/gl/gstglapi.h index 30efa44..cdf1c46 100644 --- a/gst-libs/gst/gl/gstglapi.h +++ b/gst-libs/gst/gl/gstglapi.h @@ -21,17 +21,19 @@ #ifndef __GST_GL_API_H__ #define __GST_GL_API_H__ +#include "gstglconfig.h" + /* OpenGL 2.0 for Embedded Systems */ -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 # include # include -# if !HAVE_OPENGL +# if !GST_GL_HAVE_OPENGL # include "gstgles2.h" # endif #endif /* OpenGL for desktop systems */ -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL # if __APPLE__ # include # include @@ -73,7 +75,7 @@ typedef enum ret (*name) args; #define GST_GL_EXT_END() -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL typedef struct _GstGLFuncs { #include "glprototypes/opengl.h" @@ -89,7 +91,7 @@ typedef struct _GstGLFuncs const GstGLFuncs *gst_gl_get_opengl_vtable (void); #endif -#if GST_GL_GLES2 +#if GST_GL_HAVE_GLES2 typedef struct _GstGLES2Funcs { #include "glprototypes/gles1gles2.h" diff --git a/gst-libs/gst/gl/gstgldisplay.c b/gst-libs/gst/gl/gstgldisplay.c index 0e2f91d..a6b8955 100644 --- a/gst-libs/gst/gl/gstgldisplay.c +++ b/gst-libs/gst/gl/gstgldisplay.c @@ -67,7 +67,7 @@ static void gst_gl_display_finalize (GObject * object); gpointer gst_gl_display_thread_create_context (GstGLDisplay * display); void gst_gl_display_thread_destroy_context (GstGLDisplay * display); void gst_gl_display_thread_run_generic (GstGLDisplay * display); -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 void gst_gl_display_thread_init_redisplay (GstGLDisplay * display); #endif void gst_gl_display_thread_gen_fbo (GstGLDisplay * display); @@ -88,7 +88,7 @@ void gst_gl_display_del_texture_thread (GstGLDisplay * display, void gst_gl_display_gen_texture_window_cb (GstGLDisplay * display); -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL void _gen_fbo_opengl (GstGLDisplay * display); void _use_fbo_opengl (GstGLDisplay * display); void _use_fbo_v2_opengl (GstGLDisplay * display); @@ -96,7 +96,7 @@ void _del_fbo_opengl (GstGLDisplay * display); void _gen_shader_opengl (GstGLDisplay * display); void _del_shader_opengl (GstGLDisplay * display); #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 void _gen_fbo_gles2 (GstGLDisplay * display); void _use_fbo_gles2 (GstGLDisplay * display); void _use_fbo_v2_gles2 (GstGLDisplay * display); @@ -154,7 +154,7 @@ gst_gl_display_init (GstGLDisplay * display) display->redisplay_texture_width = 0; display->redisplay_texture_height = 0; display->keep_aspect_ratio = FALSE; -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 display->redisplay_shader = NULL; display->redisplay_attr_position_loc = 0; display->redisplay_attr_texture_loc = 0; @@ -213,7 +213,7 @@ gst_gl_display_init (GstGLDisplay * display) display->uploads = NULL; display->downloads = NULL; -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 /* *INDENT-OFF* */ display->redisplay_vertex_shader_str_gles2 = "attribute vec4 a_position; \n" @@ -336,7 +336,7 @@ gst_gl_display_set_error (GstGLDisplay * display, const char *format, ...) display->isAlive = FALSE; } -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 static gboolean _create_context_gles2 (GstGLDisplay * display, gint * gl_major, gint * gl_minor) { @@ -375,7 +375,7 @@ _create_context_gles2 (GstGLDisplay * display, gint * gl_major, gint * gl_minor) } #endif -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL gboolean _create_context_opengl (GstGLDisplay * display, gint * gl_major, gint * gl_minor) { @@ -439,10 +439,10 @@ _compiled_api (void) { GstGLAPI ret = GST_GL_API_NONE; -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL ret |= GST_GL_API_OPENGL; #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 ret |= GST_GL_API_GLES2; #endif @@ -493,11 +493,11 @@ gst_gl_display_thread_create_context (GstGLDisplay * display) g_free (compiled_api_s); /* gl api specific code */ -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL if (!ret && USING_OPENGL(display)) ret = _create_context_opengl (display, &gl_major, NULL); #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 if (!ret && USING_GLES2(display)) ret = _create_context_gles2 (display, &gl_major, NULL); #endif @@ -555,7 +555,7 @@ failure: void gst_gl_display_thread_destroy_context (GstGLDisplay * display) { -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 if (display->redisplay_shader) { g_object_unref (G_OBJECT (display->redisplay_shader)); display->redisplay_shader = NULL; @@ -575,7 +575,7 @@ gst_gl_display_thread_run_generic (GstGLDisplay * display) display->generic_callback (display, display->data); } -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 /* Called in the gl thread */ void gst_gl_display_thread_init_redisplay (GstGLDisplay * display) @@ -605,7 +605,7 @@ gst_gl_display_thread_init_redisplay (GstGLDisplay * display) } #endif -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL void _gen_fbo_opengl (GstGLDisplay * display) { @@ -671,7 +671,7 @@ _gen_fbo_opengl (GstGLDisplay * display) } #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 void _gen_fbo_gles2 (GstGLDisplay * display) { @@ -732,7 +732,7 @@ _gen_fbo_gles2 (GstGLDisplay * display) #endif /* Called in the gl thread */ -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL void _use_fbo_opengl (GstGLDisplay * display) { @@ -801,7 +801,7 @@ _use_fbo_opengl (GstGLDisplay * display) } #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 void _use_fbo_gles2 (GstGLDisplay * display) { @@ -842,7 +842,7 @@ _use_fbo_gles2 (GstGLDisplay * display) /* Called in a gl thread * Need full shader support */ -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL void _use_fbo_v2_opengl (GstGLDisplay * display) { @@ -882,7 +882,7 @@ _use_fbo_v2_opengl (GstGLDisplay * display) } #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 void _use_fbo_v2_gles2 (GstGLDisplay * display) { @@ -919,7 +919,7 @@ _use_fbo_v2_gles2 (GstGLDisplay * display) #endif /* Called in the gl thread */ -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL void _del_fbo_opengl (GstGLDisplay * display) { @@ -936,7 +936,7 @@ _del_fbo_opengl (GstGLDisplay * display) } #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 void _del_fbo_gles2 (GstGLDisplay * display) { @@ -991,7 +991,7 @@ _gen_shader_opengl (GstGLDisplay * display) } } -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 void _gen_shader_gles2 (GstGLDisplay * display) { @@ -1031,7 +1031,7 @@ _gen_shader_gles2 (GstGLDisplay * display) #endif /* Called in the gl thread */ -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL void _del_shader_opengl (GstGLDisplay * display) { @@ -1044,7 +1044,7 @@ _del_shader_opengl (GstGLDisplay * display) } #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 void _del_shader_gles2 (GstGLDisplay * display) { @@ -1096,7 +1096,7 @@ gst_gl_display_on_resize (GstGLDisplay * display, gint width, gint height) } else { glViewport (0, 0, width, height); } -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL if (USING_OPENGL(display)) { glMatrixMode (GL_PROJECTION); glLoadIdentity (); @@ -1122,7 +1122,7 @@ gst_gl_display_on_draw (GstGLDisplay * display) if (display->colorspace_conversion == GST_GL_DISPLAY_CONVERSION_GLSL) glUseProgramObjectARB (0); -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL if (USING_OPENGL(display)) glDisable (GL_TEXTURE_RECTANGLE_ARB); #endif @@ -1142,7 +1142,7 @@ gst_gl_display_on_draw (GstGLDisplay * display) } /* default opengl scene */ else { -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL if (USING_OPENGL(display)) { glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); @@ -1177,7 +1177,7 @@ gst_gl_display_on_draw (GstGLDisplay * display) glDisable (GL_TEXTURE_RECTANGLE_ARB); } #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 if (USING_GLES2(display)) { const GLfloat vVertices[] = { 1.0f, 1.0f, 0.0f, 1.0f, 0.0f, @@ -1355,7 +1355,7 @@ gst_gl_display_check_framebuffer_status (void) case GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT: GST_ERROR ("GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS"); break; -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL case GL_FRAMEBUFFER_UNDEFINED: GST_ERROR ("GL_FRAMEBUFFER_UNDEFINED"); break; @@ -1413,7 +1413,7 @@ gst_gl_display_redisplay (GstGLDisplay * display, GLuint texture, gst_gl_display_lock (display); if (display->isAlive) { -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 if (USING_GLES2(display)) { if (!display->redisplay_shader) { gst_gl_window_send_message (display->gl_window, diff --git a/gst-libs/gst/gl/gstgldisplay.h b/gst-libs/gst/gl/gstgldisplay.h index 313880f..e0d51c2 100644 --- a/gst-libs/gst/gl/gstgldisplay.h +++ b/gst-libs/gst/gl/gstgldisplay.h @@ -23,6 +23,8 @@ #ifndef __GST_GL_H__ #define __GST_GL_H__ +#include "gstglconfig.h" + #include typedef struct _GstGLUpload GstGLUpload; @@ -159,7 +161,7 @@ struct _GstGLDisplay GLuint redisplay_texture_width; GLuint redisplay_texture_height; gboolean keep_aspect_ratio; -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 GstGLShader *redisplay_shader; gchar *redisplay_vertex_shader_str_gles2; gchar *redisplay_fragment_shader_str_gles2; diff --git a/gst-libs/gst/gl/gstgldownload.c b/gst-libs/gst/gl/gstgldownload.c index 87dbb39..3d7946c8 100644 --- a/gst-libs/gst/gl/gstgldownload.c +++ b/gst-libs/gst/gl/gstgldownload.c @@ -58,13 +58,13 @@ static gboolean gst_gl_download_perform_with_data_unlocked (GstGLDownload * static gboolean gst_gl_download_perform_with_data_unlocked_thread (GstGLDownload * download, GLuint texture_id, gpointer data[GST_VIDEO_MAX_PLANES]); -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL static void _do_download_draw_rgb_opengl (GstGLDisplay * display, GstGLDownload * download); static void _do_download_draw_yuv_opengl (GstGLDisplay * display, GstGLDownload * download); #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 static void _do_download_draw_rgb_gles2 (GstGLDisplay * display, GstGLDownload * download); static void _do_download_draw_yuv_gles2 (GstGLDisplay * display, @@ -75,7 +75,7 @@ static void _do_download_draw_yuv_gles2 (GstGLDisplay * display, /* YUY2:y2,u,y1,v UYVY:v,y1,u,y2 */ -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL static gchar *text_shader_YUY2_UYVY_opengl = "#extension GL_ARB_texture_rectangle : enable\n" "uniform sampler2DRect tex;\n" @@ -144,9 +144,9 @@ static gchar *text_shader_AYUV_opengl = "}\n"; #define text_vertex_shader_opengl NULL -#endif /* HAVE_OPENGL */ +#endif /* GST_GL_HAVE_OPENGL */ -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 static gchar *text_shader_YUY2_UYVY_gles2 = "precision mediump float;\n" "varying vec2 v_texCoord;\n" @@ -214,7 +214,7 @@ static gchar *text_shader_RGB_gles2 = "{ \n" " gl_FragColor = texture2D( s_texture, v_texCoord );\n" "} \n"; -#endif /* HAVE_GLES2 */ +#endif /* GST_GL_HAVE_GLES2 */ /* *INDENT-ON* */ @@ -288,7 +288,7 @@ gst_gl_download_new (GstGLDisplay * display) download->display = g_object_ref (display); priv = download->priv; -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL if (USING_OPENGL (display)) { priv->YUY2_UYVY = text_shader_YUY2_UYVY_opengl; priv->I420_YV12 = text_shader_I420_YV12_opengl; @@ -298,7 +298,7 @@ gst_gl_download_new (GstGLDisplay * display) priv->do_yuv = _do_download_draw_yuv_opengl; } #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 if (USING_GLES2 (display)) { priv->YUY2_UYVY = text_shader_YUY2_UYVY_gles2; priv->I420_YV12 = text_shader_I420_YV12_gles2; @@ -781,7 +781,7 @@ _init_download (GstGLDisplay * display, GstGLDownload * download) /* setup the render buffer for depth */ glGenRenderbuffersEXT (1, &download->depth_buffer); glBindRenderbufferEXT (GL_RENDERBUFFER_EXT, download->depth_buffer); -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL if (USING_OPENGL (display)) { glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, out_width, out_height); @@ -789,7 +789,7 @@ _init_download (GstGLDisplay * display, GstGLDownload * download) out_width, out_height); } #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 if (USING_GLES2 (display)) { glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16, out_width, out_height); @@ -859,7 +859,7 @@ _init_download (GstGLDisplay * display, GstGLDownload * download) glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, download->depth_buffer); -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 if (USING_GLES2 (display)) { glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, @@ -936,7 +936,7 @@ _init_download_shader (GstGLDisplay * display, GstGLDownload * download) case GST_VIDEO_FORMAT_RGB: case GST_VIDEO_FORMAT_BGR: /* color space conversion is not needed */ -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 { if (USING_GLES2 (display)) { /* glGetTexImage2D not available in OpenGL ES 2.0 */ @@ -1093,7 +1093,7 @@ _do_download (GstGLDisplay * display, GstGLDownload * download) } } -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL static void _do_download_draw_rgb_opengl (GstGLDisplay * display, GstGLDownload * download) { @@ -1159,7 +1159,7 @@ _do_download_draw_rgb_opengl (GstGLDisplay * display, GstGLDownload * download) #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 static void _do_download_draw_rgb_gles2 (GstGLDisplay * display, GstGLDownload * download) { @@ -1243,7 +1243,7 @@ _do_download_draw_rgb_gles2 (GstGLDisplay * display, GstGLDownload * download) } #endif -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL static void _do_download_draw_yuv_opengl (GstGLDisplay * display, GstGLDownload * download) { @@ -1428,7 +1428,7 @@ _do_download_draw_yuv_opengl (GstGLDisplay * display, GstGLDownload * download) } #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 static void _do_download_draw_yuv_gles2 (GstGLDisplay * display, GstGLDownload * download) { diff --git a/gst-libs/gst/gl/gstgldownload.h b/gst-libs/gst/gl/gstgldownload.h index a066773..f933b09 100644 --- a/gst-libs/gst/gl/gstgldownload.h +++ b/gst-libs/gst/gl/gstgldownload.h @@ -98,12 +98,12 @@ struct _GstGLDownloadClass * * The currently supported formats that can be downloaded */ -#if !HAVE_GLES2 +#if !GST_GL_HAVE_GLES2 # define GST_GL_DOWNLOAD_FORMATS "{ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, " \ "xBGR, ARGB, ABGR, I420, YV12, YUY2, UYVY, AYUV }" -#else /* HAVE_GLES2 */ +#else /* GST_GL_HAVE_GLES2 */ # define GST_GL_DOWNLOAD_FORMATS "{ RGB, RGBx, RGBA, I420, YV12, YUY2, UYVY, AYUV }" -#endif /* !HAVE_GLES2 */ +#endif /* !GST_GL_HAVE_GLES2 */ /** * GST_GL_DOWNLOAD_VIDEO_CAPS: diff --git a/gst-libs/gst/gl/gstglfeature.c b/gst-libs/gst/gl/gstglfeature.c index 2c924e2..0dc2ca2 100644 --- a/gst-libs/gst/gl/gstglfeature.c +++ b/gst-libs/gst/gl/gstglfeature.c @@ -54,7 +54,7 @@ gst_gl_check_extension (const char *name, const gchar * ext) /* Define a set of arrays containing the functions required from GL for each feature */ -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL #define GST_GL_EXT_BEGIN(name, \ min_gl_major, min_gl_minor, \ gles_availability, \ @@ -83,13 +83,13 @@ gst_gl_check_extension (const char *name, const gchar * ext) static const GstGLFeatureData gst_gl_feature_ext_functions_data_opengl[] = { #include "glprototypes/opengl_functions.h" }; -#endif /* HAVE_OPENGL */ +#endif /* GST_GL_HAVE_OPENGL */ #undef GST_GL_EXT_BEGIN #undef GST_GL_EXT_FUNCTION #undef GST_GL_EXT_END -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 #define GST_GL_EXT_BEGIN(name, \ min_gl_major, min_gl_minor, \ gles_availability, \ @@ -118,7 +118,7 @@ static const GstGLFeatureData gst_gl_feature_ext_functions_data_opengl[] = { static const GstGLFeatureData gst_gl_feature_ext_functions_data_gles2[] = { #include "glprototypes/gles2_functions.h" }; -#endif /* HAVE_GLES2 */ +#endif /* GST_GL_HAVE_GLES2 */ #undef GST_GL_EXT_BEGIN #undef GST_GL_EXT_FUNCTION @@ -132,18 +132,18 @@ _gst_gl_feature_check (GstGLDisplay * display, { const char *suffix = NULL; int func_num; -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL static const GstGLFuncs *gst_gl = NULL; #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 static const GstGLES2Funcs *gst_gles2 = NULL; #endif -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL if (!gst_gl) gst_gl = gst_gl_get_opengl_vtable (); #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 if (!gst_gles2) gst_gles2 = gst_gl_get_gles2_vtable (); #endif @@ -219,13 +219,13 @@ _gst_gl_feature_check (GstGLDisplay * display, goto error; /* Set the function pointer in the context */ -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL if (display->gl_api & GST_GL_API_OPENGL) { *(void **) ((guint8 *) gst_gl + data->functions[func_num].pointer_offset) = func; } #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 if (display->gl_api & GST_GL_API_GLES2) { *(void **) ((guint8 *) gst_gles2 + data->functions[func_num].pointer_offset) = func; @@ -240,13 +240,13 @@ _gst_gl_feature_check (GstGLDisplay * display, * do feature testing by just looking at the function pointers */ error: for (func_num = 0; data->functions[func_num].name; func_num++) { -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL if (display->gl_api & GST_GL_API_OPENGL) { *(void **) ((guint8 *) gst_gl + data->functions[func_num].pointer_offset) = NULL; } #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 if (display->gl_api & GST_GL_API_GLES2) { *(void **) ((guint8 *) gst_gles2 + data->functions[func_num].pointer_offset) = NULL; @@ -263,7 +263,7 @@ _gst_gl_feature_check_ext_functions (GstGLDisplay * display, { int i; -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL if (display->gl_api & GST_GL_API_OPENGL) { for (i = 0; i < G_N_ELEMENTS (gst_gl_feature_ext_functions_data_opengl); i++) @@ -272,7 +272,7 @@ _gst_gl_feature_check_ext_functions (GstGLDisplay * display, gl_extensions); } #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 if (display->gl_api & GST_GL_API_GLES2) { for (i = 0; i < G_N_ELEMENTS (gst_gl_feature_ext_functions_data_gles2); i++) _gst_gl_feature_check (display, "GL", diff --git a/gst-libs/gst/gl/gstglfilter.c b/gst-libs/gst/gl/gstglfilter.c index 9a91a99..3fd3466 100644 --- a/gst-libs/gst/gl/gstglfilter.c +++ b/gst-libs/gst/gl/gstglfilter.c @@ -1075,7 +1075,7 @@ gst_gl_filter_render_to_target (GstGLFilter * filter, gboolean resize, in_width, 0, in_height, GST_GL_DISPLAY_PROJECTION_ORTHO2D, data); } -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL static void _draw_with_shader_cb (gint width, gint height, guint texture, gpointer stuff) { @@ -1156,4 +1156,4 @@ gst_gl_filter_draw_texture (GstGLFilter * filter, GLuint texture, glEnd (); } -#endif /* HAVE_OPENGL */ +#endif /* GST_GL_HAVE_OPENGL */ diff --git a/gst-libs/gst/gl/gstglfilter.h b/gst-libs/gst/gl/gstglfilter.h index 4059603..dda8ddd 100644 --- a/gst-libs/gst/gl/gstglfilter.h +++ b/gst-libs/gst/gl/gstglfilter.h @@ -124,12 +124,12 @@ gboolean gst_gl_filter_filter_texture (GstGLFilter * filter, GstBuffer * inbuf, void gst_gl_filter_render_to_target (GstGLFilter *filter, gboolean resize, GLuint input, GLuint target, GLCB func, gpointer data); -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL void gst_gl_filter_render_to_target_with_shader (GstGLFilter * filter, gboolean resize, GLuint input, GLuint target, GstGLShader *shader); void gst_gl_filter_draw_texture (GstGLFilter *filter, GLuint texture, guint width, guint height); -#endif /* HAVE_OPENGL */ +#endif /* GST_GL_HAVE_OPENGL */ G_END_DECLS diff --git a/gst-libs/gst/gl/gstglmemory.c b/gst-libs/gst/gl/gstglmemory.c index 25db723..1c4d89d 100644 --- a/gst-libs/gst/gl/gstglmemory.c +++ b/gst-libs/gst/gl/gstglmemory.c @@ -226,7 +226,7 @@ _gl_mem_copy_thread (GstGLDisplay * display, gpointer data) glGenRenderbuffersEXT (1, &rboId); glBindRenderbufferEXT (GL_RENDERBUFFER_EXT, rboId); -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL if (USING_OPENGL (display)) { glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, width, height); @@ -234,7 +234,7 @@ _gl_mem_copy_thread (GstGLDisplay * display, gpointer data) width, height); } #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 if (USING_GLES2 (display)) { glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16, width, height); @@ -244,7 +244,7 @@ _gl_mem_copy_thread (GstGLDisplay * display, gpointer data) glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, rboId); -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL if (USING_OPENGL (display)) { glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, rboId); @@ -277,7 +277,7 @@ _gl_mem_copy_thread (GstGLDisplay * display, gpointer data) GST_CAT_ERROR (GST_CAT_GL_MEMORY, "GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS"); break; -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL case GL_FRAMEBUFFER_UNDEFINED: GST_CAT_ERROR (GST_CAT_GL_MEMORY, "GL_FRAMEBUFFER_UNDEFINED"); break; diff --git a/gst-libs/gst/gl/gstglshader.c b/gst-libs/gst/gl/gstglshader.c index de45884..1aaa38b 100644 --- a/gst-libs/gst/gl/gstglshader.c +++ b/gst-libs/gst/gl/gstglshader.c @@ -303,12 +303,12 @@ gst_gl_shader_compile (GstGLShader * shader, GError ** error) glGetObjectParameterivARB (priv->vertex_handle, GL_OBJECT_COMPILE_STATUS_ARB, &status); -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL if (USING_OPENGL (shader->display)) glGetInfoLogARB (priv->vertex_handle, sizeof (info_buffer) - 1, &len, info_buffer); #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 if (USING_GLES2 (shader->display)) glGetShaderInfoLog (priv->vertex_handle, sizeof (info_buffer) - 1, &len, info_buffer); @@ -342,12 +342,12 @@ gst_gl_shader_compile (GstGLShader * shader, GError ** error) glGetObjectParameterivARB (priv->fragment_handle, GL_OBJECT_COMPILE_STATUS_ARB, &status); -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL if (USING_OPENGL (shader->display)) glGetInfoLogARB (priv->fragment_handle, sizeof (info_buffer) - 1, &len, info_buffer); #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 if (USING_GLES2 (shader->display)) glGetShaderInfoLog (priv->fragment_handle, sizeof (info_buffer) - 1, &len, info_buffer); @@ -372,11 +372,11 @@ gst_gl_shader_compile (GstGLShader * shader, GError ** error) /* if nothing failed link shaders */ glLinkProgramARB (priv->program_handle); -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL if (USING_OPENGL (shader->display)) glGetObjectParameterivARB (priv->program_handle, GL_LINK_STATUS, &status); #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 if (USING_GLES2 (shader->display)) glGetProgramiv (priv->program_handle, GL_LINK_STATUS, &status); #endif @@ -419,11 +419,11 @@ gst_gl_shader_release (GstGLShader * shader) if (priv->vertex_handle) { /* not needed but nvidia doesn't care to respect the spec */ GST_TRACE ("finalizing vertex shader %u", priv->vertex_handle); -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL if (USING_OPENGL (shader->display)) glDeleteObjectARB (priv->vertex_handle); #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 if (USING_GLES2 (shader->display)) glDeleteShader (priv->vertex_handle); #endif @@ -438,11 +438,11 @@ gst_gl_shader_release (GstGLShader * shader) GST_TRACE ("finalizing fragment shader %u", priv->fragment_handle); -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL if (USING_OPENGL (shader->display)) glDeleteObjectARB (priv->fragment_handle); #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 if (USING_GLES2 (shader->display)) glDeleteShader (priv->fragment_handle); #endif @@ -820,7 +820,7 @@ gst_gl_shader_set_uniform_matrix_4fv (GstGLShader * shader, const gchar * name, glUniformMatrix4fvARB (location, count, transpose, value); } -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL void gst_gl_shader_set_uniform_matrix_2x3fv (GstGLShader * shader, const gchar * name, gint count, gboolean transpose, const gfloat * value) @@ -916,7 +916,7 @@ gst_gl_shader_set_uniform_matrix_4x3fv (GstGLShader * shader, glUniformMatrix4x3fv (location, count, transpose, value); } -#endif /* HAVE_OPENGL */ +#endif /* GST_GL_HAVE_OPENGL */ GLint gst_gl_shader_get_attribute_location (GstGLShader * shader, const gchar * name) diff --git a/gst-libs/gst/gl/gstglshader.h b/gst-libs/gst/gl/gstglshader.h index d92135b..589594f 100644 --- a/gst-libs/gst/gl/gstglshader.h +++ b/gst-libs/gst/gl/gstglshader.h @@ -105,7 +105,7 @@ void gst_gl_shader_set_uniform_4fv (GstGLShader *shader, const gchar *n void gst_gl_shader_set_uniform_matrix_2fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value); void gst_gl_shader_set_uniform_matrix_3fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value); void gst_gl_shader_set_uniform_matrix_4fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value); -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL void gst_gl_shader_set_uniform_matrix_2x3fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value); void gst_gl_shader_set_uniform_matrix_2x4fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value); void gst_gl_shader_set_uniform_matrix_3x2fv (GstGLShader *shader, const gchar *name, gint count, gboolean transpose, const gfloat* value); diff --git a/gst-libs/gst/gl/gstglshadervariables.c b/gst-libs/gst/gl/gstglshadervariables.c index 1125105..a9e5c6a 100644 --- a/gst-libs/gst/gl/gstglshadervariables.c +++ b/gst-libs/gst/gl/gstglshadervariables.c @@ -566,7 +566,7 @@ gst_gl_shadervariable_set (GstGLShader * shader, (float *) ret->value); break; -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL case _mat2x3: gst_gl_shader_set_uniform_matrix_2x3fv (shader, ret->name, ret->count, 0, (float *) ret->value); diff --git a/gst-libs/gst/gl/gstglupload.c b/gst-libs/gst/gl/gstglupload.c index d1ed939..76a0bf1 100644 --- a/gst-libs/gst/gl/gstglupload.c +++ b/gst-libs/gst/gl/gstglupload.c @@ -59,18 +59,18 @@ static gboolean gst_gl_upload_perform_with_data_unlocked (GstGLUpload * upload, static gboolean gst_gl_upload_perform_with_data_unlocked_thread (GstGLUpload * upload, GLuint texture_id, gpointer data[GST_VIDEO_MAX_PLANES]); -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL static void _do_upload_draw_opengl (GstGLDisplay * display, GstGLUpload * upload); #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 static void _do_upload_draw_gles2 (GstGLDisplay * display, GstGLUpload * upload); #endif /* *INDENT-OFF* */ -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL /* YUY2:r,g,a UYVY:a,b,r */ static gchar *text_shader_YUY2_UYVY_opengl = @@ -133,7 +133,7 @@ static gchar *text_shader_AYUV_opengl = #define text_vertex_shader_opengl NULL #endif -#ifdef HAVE_GLES2 +#if GST_GL_HAVE_GLES2 /* YUY2:r,g,a UYVY:a,b,r */ static gchar *text_shader_YUY2_UYVY_gles2 = @@ -276,7 +276,7 @@ gst_gl_upload_new (GstGLDisplay * display) g_mutex_init (&upload->lock); -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL if (USING_OPENGL (display)) { priv->YUY2_UYVY = text_shader_YUY2_UYVY_opengl; priv->I420_YV12 = text_shader_I420_YV12_opengl; @@ -285,7 +285,7 @@ gst_gl_upload_new (GstGLDisplay * display) priv->draw = _do_upload_draw_opengl; } #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 if (USING_GLES2 (display)) { priv->YUY2_UYVY = text_shader_YUY2_UYVY_gles2; priv->I420_YV12 = text_shader_I420_YV12_gles2; @@ -795,13 +795,13 @@ _init_upload (GstGLDisplay * display, GstGLUpload * upload) case GST_VIDEO_FORMAT_UYVY: { gchar text_shader_UYVY[2048]; -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL if (USING_GLES2 (display)) { sprintf (text_shader_UYVY, upload->priv->YUY2_UYVY, 'a', 'b', 'r'); } #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 if (USING_GLES2 (display)) { sprintf (text_shader_UYVY, upload->priv->YUY2_UYVY, 'a', 'r', 'b'); @@ -825,7 +825,7 @@ _init_upload (GstGLDisplay * display, GstGLUpload * upload) case GST_VIDEO_FORMAT_YV12: { gchar text_shader_I420_YV12[2048]; -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL if (USING_OPENGL (display)) { if ((g_ascii_strncasecmp ("ATI", (gchar *) glGetString (GL_VENDOR), 3) == 0) @@ -840,7 +840,7 @@ _init_upload (GstGLDisplay * display, GstGLUpload * upload) "*0.5"); } #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 if (USING_GLES2 (display)) g_strlcpy (text_shader_I420_YV12, upload->priv->I420_YV12, 2048); #endif @@ -959,7 +959,7 @@ _init_upload_fbo (GstGLDisplay * display, GstGLUpload * upload) /* setup the render buffer for depth */ glGenRenderbuffersEXT (1, &upload->depth_buffer); glBindRenderbufferEXT (GL_RENDERBUFFER_EXT, upload->depth_buffer); -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL if (USING_OPENGL (display)) { glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT, out_width, out_height); @@ -967,7 +967,7 @@ _init_upload_fbo (GstGLDisplay * display, GstGLUpload * upload) out_width, out_height); } #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 if (USING_GLES2 (display)) { glRenderbufferStorageEXT (GL_RENDERBUFFER_EXT, GL_DEPTH_COMPONENT16, out_width, out_height); @@ -994,7 +994,7 @@ _init_upload_fbo (GstGLDisplay * display, GstGLUpload * upload) glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, upload->depth_buffer); -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL if (USING_OPENGL (display)) { glFramebufferRenderbufferEXT (GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, GL_RENDERBUFFER_EXT, upload->depth_buffer); @@ -1379,7 +1379,7 @@ _do_upload_fill (GstGLDisplay * display, GstGLUpload * upload) glBindTexture (GL_TEXTURE_RECTANGLE_ARB, 0); } -#if HAVE_OPENGL +#if GST_GL_HAVE_OPENGL /* called by _do_upload (in the gl thread) */ static void _do_upload_draw_opengl (GstGLDisplay * display, GstGLUpload * upload) @@ -1625,7 +1625,7 @@ _do_upload_draw_opengl (GstGLDisplay * display, GstGLUpload * upload) } #endif -#if HAVE_GLES2 +#if GST_GL_HAVE_GLES2 static void _do_upload_draw_gles2 (GstGLDisplay * display, GstGLUpload * upload) { diff --git a/gst-libs/gst/gl/gstglupload.h b/gst-libs/gst/gl/gstglupload.h index cc3d10c..3cd622c 100644 --- a/gst-libs/gst/gl/gstglupload.h +++ b/gst-libs/gst/gl/gstglupload.h @@ -101,12 +101,12 @@ struct _GstGLUploadClass * * The currently supported formats that can be uploaded */ -#if !HAVE_GLES2 +#if !GST_GL_HAVE_GLES2 #define GST_GL_UPLOAD_FORMATS "{ RGB, RGBx, RGBA, BGR, BGRx, BGRA, xRGB, " \ "xBGR, ARGB, ABGR, I420, YV12, YUY2, UYVY, AYUV }" -#else /* HAVE_GLES2 */ +#else /* GST_GL_HAVE_GLES2 */ # define GST_GL_UPLOAD_FORMATS "{ RGB, RGBx, RGBA, I420, YV12, YUY2, UYVY, AYUV }" -#endif /* !HAVE_GLES2 */ +#endif /* !GST_GL_HAVE_GLES2 */ /** * GST_GL_UPLOAD_VIDEO_CAPS: diff --git a/gst-libs/gst/gl/gstglwindow.c b/gst-libs/gst/gl/gstglwindow.c index c51e333..3ace45c 100644 --- a/gst-libs/gst/gl/gstglwindow.c +++ b/gst-libs/gst/gl/gstglwindow.c @@ -26,16 +26,16 @@ #include "gstglwindow.h" -#ifdef HAVE_WINDOW_X11 +#if GST_GL_HAVE_WINDOW_X11 #include "x11/gstglwindow_x11.h" #endif -#ifdef HAVE_WINDOW_WIN32 +#if GST_GL_HAVE_WINDOW_WIN32 #include "win32/gstglwindow_win32.h" #endif -#ifdef HAVE_WINDOW_COCOA +#if GST_GL_HAVE_WINDOW_COCOA #include "cocoa/gstglwindow_cocoa.h" #endif -#ifdef HAVE_WINDOW_WAYLAND +#if GST_GL_HAVE_WINDOW_WAYLAND #include "wayland/gstglwindow_wayland_egl.h" #endif @@ -83,24 +83,24 @@ gst_gl_window_new (GstGLAPI api, guintptr external_gl_context, GError ** error) user_choice = g_getenv ("GST_GL_WINDOW"); GST_INFO ("creating a window, user choice:%s", user_choice); -#ifdef HAVE_WINDOW_X11 +#if GST_GL_HAVE_WINDOW_X11 if (!window && (!user_choice || g_strstr_len (user_choice, 3, "x11"))) window = GST_GL_WINDOW (gst_gl_window_x11_new (api, external_gl_context, error)); #endif -#ifdef HAVE_WINDOW_WIN32 +#if GST_GL_HAVE_WINDOW_WIN32 if (!window && (!user_choice || g_strstr_len (user_choice, 5, "win32"))) window = GST_GL_WINDOW (gst_gl_window_win32_new (api, external_gl_context, error)); #endif -#ifdef HAVE_WINDOW_COCOA +#if GST_GL_HAVE_WINDOW_COCOA if (!window && (!user_choice || g_strstr_len (user_choice, 5, "cocoa"))) window = GST_GL_WINDOW (gst_gl_window_cocoa_new (api, external_gl_context, error)); #endif -#ifdef HAVE_WINDOW_WAYLAND +#if GST_GL_HAVE_WINDOW_WAYLAND if (!window && (!user_choice || g_strstr_len (user_choice, 7, "wayland"))) window = GST_GL_WINDOW (gst_gl_window_wayland_egl_new (api, diff --git a/gst-libs/gst/gl/win32/gstglwindow_win32.c b/gst-libs/gst/gl/win32/gstglwindow_win32.c index d4ed0dd..0ecb1d7 100644 --- a/gst-libs/gst/gl/win32/gstglwindow_win32.c +++ b/gst-libs/gst/gl/win32/gstglwindow_win32.c @@ -25,10 +25,10 @@ #include "gstglwindow_win32.h" -#if HAVE_WGL +#if GST_GL_HAVE_PLATFORM_WGL #include "gstglwindow_win32_wgl.h" #endif -#if HAVE_EGL +#if GST_GL_HAVE_PLATFORM_EGL #include "gstglwindow_win32_egl.h" #endif diff --git a/gst-libs/gst/gl/x11/gstglwindow_x11.c b/gst-libs/gst/gl/x11/gstglwindow_x11.c index 022fd9b..5c968d8 100644 --- a/gst-libs/gst/gl/x11/gstglwindow_x11.c +++ b/gst-libs/gst/gl/x11/gstglwindow_x11.c @@ -30,10 +30,10 @@ #include "gstglwindow_x11.h" -#ifdef HAVE_GLX +#if GST_GL_HAVE_PLATFORM_GLX # include "gstglwindow_x11_glx.h" #endif -#ifdef HAVE_EGL +#if GST_GL_HAVE_PLATFORM_EGL # include "gstglwindow_x11_egl.h" #endif @@ -217,8 +217,8 @@ gst_gl_window_x11_new (GstGLAPI gl_api, guintptr external_gl_context, user_choice = g_getenv ("GST_GL_PLATFORM"); -#ifdef HAVE_GLX -#ifdef HAVE_EGL +#if GST_GL_HAVE_PLATFORM_GLX +#if GST_GL_HAVE_PLATFORM_EGL /* try GLX first for Desktop OpenGL */ if (gl_api & GST_GL_API_OPENGL || gl_api & GST_GL_API_OPENGL3) { if (!window && (!user_choice @@ -243,18 +243,18 @@ gst_gl_window_x11_new (GstGLAPI gl_api, guintptr external_gl_context, GST_GL_WINDOW_X11 (gst_gl_window_x11_glx_new (gl_api, external_gl_context, error)); } -#endif /* HAVE_EGL */ +#endif /* GST_GL_HAVE_PLATFORM_EGL */ if (!window && (!user_choice || g_strstr_len (user_choice, 3, "glx") != NULL)) window = GST_GL_WINDOW_X11 (gst_gl_window_x11_glx_new (gl_api, external_gl_context, error)); -#endif /* HAVE_GLX */ -#ifdef HAVE_EGL +#endif /* GST_GL_HAVE_PLATFORM_GLX */ +#ifdef GST_GL_HAVE_PLATFORM_EGL if (!window && (!user_choice || g_strstr_len (user_choice, 3, "egl") != NULL)) window = GST_GL_WINDOW_X11 (gst_gl_window_x11_egl_new (gl_api, external_gl_context, error)); -#endif /* HAVE_EGL */ +#endif /* GST_GL_HAVE_PLATFORM_EGL */ if (!window) { GST_WARNING ("Failed to create x11 window, user_choice:%s", user_choice ? user_choice : "NULL");