From 4d70b9f87c9f0f7a9a91018ea844b5bfd1e9b03b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Sat, 10 Dec 2022 13:11:08 +0000 Subject: [PATCH] vaapi: prefix USE_FOO defines to fix build with mesa 22.3.0 Apparently mesa 22.3.0 has updated the egl headers, and eglplatform.h now contains commit https://github.com/KhronosGroup/EGL-Registry/pull/130/commits/3670d645f4a26a0a9e87e7f3a8608e7cc1d53b5b after which xlib headers don't get included by default anymore but are dependent upon whether USE_X11 was defined. This breaks headless builds of gstreamer-vaapi because we always define an internal define USE_X11 as either 1 or 0. Change these defines to GST_VAAPI_USE_XYZ instead to avoid this. Fixes #1634 Part-of: --- .../gst-libs/gst/vaapi/gstvaapicontext.c | 2 +- .../gst-libs/gst/vaapi/gstvaapidisplay.c | 14 ++--- .../gst-libs/gst/vaapi/gstvaapidisplay_egl.c | 8 +-- .../gst-libs/gst/vaapi/gstvaapisurface_egl.c | 2 +- .../gst-libs/gst/vaapi/video-format.c | 8 +-- .../gstreamer-vaapi/gst/vaapi/gstvaapi.c | 10 ++-- .../gst/vaapi/gstvaapidecode.c | 16 +++--- .../gst/vaapi/gstvaapidecodebin.c | 2 +- .../gst/vaapi/gstvaapipluginbase.c | 12 ++--- .../gst/vaapi/gstvaapipluginutil.c | 52 +++++++++---------- .../gst/vaapi/gstvaapipostproc.c | 2 +- .../gstreamer-vaapi/gst/vaapi/gstvaapisink.c | 14 ++--- .../gst/vaapi/gstvaapivideobufferpool.c | 4 +- .../gst/vaapi/gstvaapivideocontext.c | 12 ++--- .../gst/vaapi/gstvaapivideometa_texture.c | 4 +- subprojects/gstreamer-vaapi/meson.build | 16 +++--- .../gstreamer-vaapi/tests/internal/output.c | 22 ++++---- .../tests/internal/test-display.c | 20 +++---- .../tests/internal/test-windows.c | 14 ++--- 19 files changed, 117 insertions(+), 117 deletions(-) diff --git a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapicontext.c b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapicontext.c index 0b97875b0a..97b81dcb17 100644 --- a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapicontext.c +++ b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapicontext.c @@ -338,7 +338,7 @@ config_create (GstVaapiContext * context) g_assert (attrib_index < G_N_ELEMENTS (attribs)); switch (cip->usage) { -#if USE_ENCODERS +#if GST_VAAPI_USE_ENCODERS case GST_VAAPI_CONTEXT_USAGE_ENCODE: { const GstVaapiConfigInfoEncoder *const config = &cip->config.encoder; diff --git a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidisplay.c b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidisplay.c index 5bf4b13786..acbc6af006 100644 --- a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidisplay.c +++ b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidisplay.c @@ -115,23 +115,23 @@ gst_vaapi_display_type_get_type (void) static const GEnumValue display_types[] = { {GST_VAAPI_DISPLAY_TYPE_ANY, "Auto detection", "any"}, -#if USE_X11 +#if GST_VAAPI_USE_X11 {GST_VAAPI_DISPLAY_TYPE_X11, "VA/X11 display", "x11"}, #endif -#if USE_GLX +#if GST_VAAPI_USE_GLX {GST_VAAPI_DISPLAY_TYPE_GLX, "VA/GLX display", "glx"}, #endif -#if USE_EGL +#if GST_VAAPI_USE_EGL {GST_VAAPI_DISPLAY_TYPE_EGL, "VA/EGL display", "egl"}, #endif -#if USE_WAYLAND +#if GST_VAAPI_USE_WAYLAND {GST_VAAPI_DISPLAY_TYPE_WAYLAND, "VA/Wayland display", "wayland"}, #endif -#if USE_DRM +#if GST_VAAPI_USE_DRM {GST_VAAPI_DISPLAY_TYPE_DRM, "VA/DRM display", "drm"}, #endif @@ -1896,13 +1896,13 @@ static gboolean get_render_mode_default (GstVaapiDisplay * display, GstVaapiRenderMode * pmode) { switch (GST_VAAPI_DISPLAY_VADISPLAY_TYPE (display)) { -#if USE_WAYLAND +#if GST_VAAPI_USE_WAYLAND case GST_VAAPI_DISPLAY_TYPE_WAYLAND: /* wl_buffer mapped from VA surface through vaGetSurfaceBufferWl() */ *pmode = GST_VAAPI_RENDER_MODE_OVERLAY; break; #endif -#if USE_DRM +#if GST_VAAPI_USE_DRM case GST_VAAPI_DISPLAY_TYPE_DRM: /* vaGetSurfaceBufferDRM() returns the underlying DRM buffer handle */ *pmode = GST_VAAPI_RENDER_MODE_OVERLAY; diff --git a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidisplay_egl.c b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidisplay_egl.c index fcffecdbcb..8213908e09 100644 --- a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidisplay_egl.c +++ b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapidisplay_egl.c @@ -28,10 +28,10 @@ #include "gstvaapiwindow_priv.h" #include "gstvaapitexture_egl.h" -#if USE_X11 +#if GST_VAAPI_USE_X11 #include "gstvaapidisplay_x11.h" #endif -#if USE_WAYLAND +#if GST_VAAPI_USE_WAYLAND #include "gstvaapidisplay_wayland.h" #endif @@ -110,13 +110,13 @@ gst_vaapi_display_egl_bind_display (GstVaapiDisplay * base_display, native_egl_display = params->gl_display; if (!native_vaapi_display) { -#if USE_X11 +#if GST_VAAPI_USE_X11 if (params->display_type == GST_VAAPI_DISPLAY_TYPE_ANY || params->display_type == GST_VAAPI_DISPLAY_TYPE_X11 || params->display_type == GST_VAAPI_DISPLAY_TYPE_EGL) native_vaapi_display = gst_vaapi_display_x11_new (NULL); #endif -#if USE_WAYLAND +#if GST_VAAPI_USE_WAYLAND if (!native_vaapi_display) native_vaapi_display = gst_vaapi_display_wayland_new (NULL); #endif diff --git a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapisurface_egl.c b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapisurface_egl.c index 362ac168c0..07ba0a55c9 100644 --- a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapisurface_egl.c +++ b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/gstvaapisurface_egl.c @@ -32,7 +32,7 @@ #include "gstvaapisurface_drm.h" #include "gstvaapisurface_priv.h" -#if USE_DRM +#if GST_VAAPI_USE_DRM #include #else #define DRM_FORMAT_MOD_LINEAR 0ULL diff --git a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/video-format.c b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/video-format.c index 5fd35e3d6e..916f66a67a 100644 --- a/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/video-format.c +++ b/subprojects/gstreamer-vaapi/gst-libs/gst/vaapi/video-format.c @@ -35,7 +35,7 @@ #define DEBUG 1 #include "gst/vaapi/gstvaapidebug.h" -#if USE_DRM +#if GST_VAAPI_USE_DRM #include #endif @@ -49,7 +49,7 @@ typedef struct _GstVideoFormatMapMap #define VA_BYTE_ORDER_NOT_CARE 0 -#if USE_DRM +#if GST_VAAPI_USE_DRM #define MAKE_DRM_FORMAT(DRM_FORMAT) G_PASTE(DRM_FORMAT_,DRM_FORMAT) #else #define MAKE_DRM_FORMAT(DRM_FORMAT) 0 @@ -643,7 +643,7 @@ gst_vaapi_video_format_create_map (VAImageFormat * formats, guint n) guint gst_vaapi_drm_format_from_va_fourcc (guint32 fourcc) { -#if USE_DRM +#if GST_VAAPI_USE_DRM const GArray *map = gst_vaapi_video_formats_map; const GstVideoFormatMap *m; guint i; @@ -679,7 +679,7 @@ gst_vaapi_drm_format_from_va_fourcc (guint32 fourcc) GstVideoFormat gst_vaapi_video_format_from_drm_format (guint drm_format) { -#if USE_DRM +#if GST_VAAPI_USE_DRM const GArray *map = gst_vaapi_video_formats_map; const GstVideoFormatMap *m; guint i; diff --git a/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapi.c b/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapi.c index c45fd0afa9..3fc761ea2e 100644 --- a/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapi.c +++ b/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapi.c @@ -29,14 +29,14 @@ #include "gstvaapisink.h" #include "gstvaapidecodebin.h" -#if USE_ENCODERS +#if GST_VAAPI_USE_ENCODERS #include "gstvaapiencode_h264.h" #include "gstvaapiencode_mpeg2.h" #include "gstvaapiencode_jpeg.h" #include "gstvaapiencode_vp8.h" #include "gstvaapiencode_h265.h" -#if USE_VP9_ENCODER +#if GST_VAAPI_USE_VP9_ENCODER #include "gstvaapiencode_vp9.h" #endif #endif @@ -109,7 +109,7 @@ display_get_decoder_codecs (GstVaapiDisplay * display) return codecs; } -#if USE_ENCODERS +#if GST_VAAPI_USE_ENCODERS static GArray * display_get_encoder_codecs (GstVaapiDisplay * display) { @@ -144,7 +144,7 @@ static const GstVaapiEncoderMap vaapi_encode_map[] = { DEF_ENC (MPEG2, mpeg2), DEF_ENC (JPEG, jpeg), DEF_ENC (VP8, vp8), -#if USE_VP9_ENCODER +#if GST_VAAPI_USE_VP9_ENCODER DEF_ENC (VP9, vp9), #endif DEF_ENC (H265, h265), @@ -217,7 +217,7 @@ plugin_init (GstPlugin * plugin) rank = GST_RANK_MARGINAL; gst_element_register (plugin, "vaapisink", rank, GST_TYPE_VAAPISINK); -#if USE_ENCODERS +#if GST_VAAPI_USE_ENCODERS gst_vaapiencode_register (plugin, display); #endif diff --git a/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapidecode.c b/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapidecode.c index 578e68bdf1..9f6eaba64f 100644 --- a/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapidecode.c +++ b/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapidecode.c @@ -30,7 +30,7 @@ #include "gstvaapidecode_props.h" #include "gstvaapipluginutil.h" #include "gstvaapivideobuffer.h" -#if (USE_GLX || USE_EGL) +#if (GST_VAAPI_USE_GLX || GST_VAAPI_USE_EGL) #include "gstvaapivideometa_texture.h" #endif #include "gstvaapivideobufferpool.h" @@ -44,7 +44,7 @@ #include #include #include -#if USE_AV1_DECODER +#if GST_VAAPI_USE_AV1_DECODER #include #endif @@ -72,7 +72,7 @@ char *gst_vaapidecode_sink_caps_str = NULL; static const char gst_vaapidecode_src_caps_str[] = GST_VAAPI_MAKE_SURFACE_CAPS "; " GST_VIDEO_CAPS_MAKE_WITH_FEATURES(GST_CAPS_FEATURE_MEMORY_DMABUF, GST_VAAPI_FORMATS_ALL) " ;" -#if (USE_GLX || USE_EGL) +#if (GST_VAAPI_USE_GLX || GST_VAAPI_USE_EGL) GST_VAAPI_MAKE_GLTEXUPLOAD_CAPS "; " #endif GST_VIDEO_CAPS_MAKE(GST_VAAPI_FORMATS_ALL); @@ -269,7 +269,7 @@ gst_vaapidecode_ensure_allowed_srcpad_caps (GstVaapiDecode * decode) gst_caps_set_features_simple (dma_caps, gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_DMABUF)); } -#if (USE_GLX || USE_EGL) +#if (GST_VAAPI_USE_GLX || GST_VAAPI_USE_EGL) if (!GST_VAAPI_PLUGIN_BASE_SRC_PAD_CAN_DMABUF (decode) && gst_vaapi_display_has_opengl (GST_VAAPI_PLUGIN_BASE_DISPLAY (decode))) { gltexup_caps = gst_caps_from_string (GST_VAAPI_MAKE_GLTEXUPLOAD_CAPS); @@ -341,7 +341,7 @@ gst_vaapidecode_update_src_caps (GstVaapiDecode * decode) if (feature == GST_VAAPI_CAPS_FEATURE_NOT_NEGOTIATED) return FALSE; -#if (!USE_GLX && !USE_EGL) +#if (!GST_VAAPI_USE_GLX && !GST_VAAPI_USE_EGL) /* This is a very pathological situation. Should not happen. */ if (feature == GST_VAAPI_CAPS_FEATURE_GL_TEXTURE_UPLOAD_META) return FALSE; @@ -632,7 +632,7 @@ gst_vaapidecode_push_decoded_frame (GstVideoDecoder * vdec, GST_BUFFER_FLAG_SET (out_frame->output_buffer, GST_VIDEO_BUFFER_FLAG_FIRST_IN_BUNDLE); } -#if (USE_GLX || USE_EGL) +#if (GST_VAAPI_USE_GLX || GST_VAAPI_USE_EGL) if (decode->has_texture_upload_meta) gst_buffer_ensure_texture_upload_meta (out_frame->output_buffer); #endif @@ -860,7 +860,7 @@ gst_vaapidecode_decide_allocation (GstVideoDecoder * vdec, GstQuery * query) decode->has_texture_upload_meta = FALSE; -#if (USE_GLX || USE_EGL) +#if (GST_VAAPI_USE_GLX || GST_VAAPI_USE_EGL) decode->has_texture_upload_meta = gst_query_find_allocation_meta (query, GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE, NULL) && @@ -972,7 +972,7 @@ gst_vaapidecode_create (GstVaapiDecode * decode, GstCaps * caps) case GST_VAAPI_CODEC_VP9: decode->decoder = gst_vaapi_decoder_vp9_new (dpy, caps); break; -#if USE_AV1_DECODER +#if GST_VAAPI_USE_AV1_DECODER case GST_VAAPI_CODEC_AV1: decode->decoder = gst_vaapi_decoder_av1_new (dpy, caps); break; diff --git a/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapidecodebin.c b/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapidecodebin.c index 67bd4e0e9b..da4b0d927a 100644 --- a/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapidecodebin.c +++ b/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapidecodebin.c @@ -96,7 +96,7 @@ static const char gst_vaapi_decode_bin_sink_caps_str[] = static const char gst_vaapi_decode_bin_src_caps_str[] = GST_VAAPI_MAKE_SURFACE_CAPS ", " GST_CAPS_INTERLACED_FALSE "; " -#if (USE_GLX || USE_EGL) +#if (GST_VAAPI_USE_GLX || GST_VAAPI_USE_EGL) GST_VAAPI_MAKE_GLTEXUPLOAD_CAPS ", " GST_CAPS_INTERLACED_FALSE "; " #endif diff --git a/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapipluginbase.c b/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapipluginbase.c index a670e976e5..9b713b5017 100644 --- a/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapipluginbase.c +++ b/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapipluginbase.c @@ -698,7 +698,7 @@ gst_vaapi_plugin_base_create_pool (GstVaapiPluginBase * plugin, GstCaps * caps, gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_ALIGNMENT); } -#if (USE_GLX || USE_EGL) +#if (GST_VAAPI_USE_GLX || GST_VAAPI_USE_EGL) if (options & GST_VAAPI_VIDEO_BUFFER_POOL_OPTION_GL_TEXTURE_UPLOAD) { gst_buffer_pool_config_add_option (config, GST_BUFFER_POOL_OPTION_VIDEO_GL_TEXTURE_UPLOAD_META); @@ -987,7 +987,7 @@ gst_vaapi_plugin_base_decide_allocation (GstVaapiPluginBase * plugin, guint i, size, min, max, pool_options, num_allocators; gint index_allocator; gboolean update_pool = FALSE; -#if (USE_GLX || USE_EGL) +#if (GST_VAAPI_USE_GLX || GST_VAAPI_USE_EGL) guint idx; #endif @@ -999,7 +999,7 @@ gst_vaapi_plugin_base_decide_allocation (GstVaapiPluginBase * plugin, if (gst_query_find_allocation_meta (query, GST_VIDEO_META_API_TYPE, NULL)) pool_options |= GST_VAAPI_VIDEO_BUFFER_POOL_OPTION_VIDEO_META; -#if (USE_GLX || USE_EGL) +#if (GST_VAAPI_USE_GLX || GST_VAAPI_USE_EGL) if (gst_query_find_allocation_meta (query, GST_VIDEO_GL_TEXTURE_UPLOAD_META_API_TYPE, &idx) && gst_vaapi_caps_feature_contains (caps, @@ -1328,13 +1328,13 @@ gst_vaapi_plugin_base_set_gl_context (GstVaapiPluginBase * plugin, gst_object_replace (&plugin->gl_context, object); switch (gst_gl_context_get_gl_platform (gl_context)) { -#if USE_GLX +#if GST_VAAPI_USE_GLX case GST_GL_PLATFORM_GLX: display_type = GST_VAAPI_DISPLAY_TYPE_GLX; break; #endif case GST_GL_PLATFORM_EGL: -#if USE_EGL +#if GST_VAAPI_USE_EGL display_type = GST_VAAPI_DISPLAY_TYPE_EGL; break; #endif @@ -1531,7 +1531,7 @@ void gst_vaapi_plugin_base_set_srcpad_can_dmabuf (GstVaapiPluginBase * plugin, GstObject * object) { -#if USE_EGL && USE_GST_GL_HELPERS +#if GST_VAAPI_USE_EGL && USE_GST_GL_HELPERS GstVaapiPadPrivate *srcpriv = GST_VAAPI_PAD_PRIVATE (plugin->srcpad); GstGLContext *const gl_context = GST_GL_CONTEXT (object); diff --git a/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapipluginutil.c b/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapipluginutil.c index fd8f164d32..6fa18f6fab 100644 --- a/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapipluginutil.c +++ b/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapipluginutil.c @@ -26,24 +26,24 @@ #include "gstvaapivideocontext.h" #include #include -#if USE_DRM +#if GST_VAAPI_USE_DRM # include #endif -#if USE_X11 +#if GST_VAAPI_USE_X11 # include #endif -#if USE_GLX +#if GST_VAAPI_USE_GLX # include #endif -#if USE_EGL +#if GST_VAAPI_USE_EGL # include #endif -#if USE_WAYLAND +#if GST_VAAPI_USE_WAYLAND # include #endif #if USE_GST_GL_HELPERS # include -#if USE_EGL && GST_GL_HAVE_PLATFORM_EGL +#if GST_VAAPI_USE_EGL && GST_GL_HAVE_PLATFORM_EGL # include #endif #endif @@ -66,28 +66,28 @@ typedef struct /* *INDENT-OFF* */ static const DisplayMap g_display_map[] = { -#if USE_WAYLAND +#if GST_VAAPI_USE_WAYLAND {"wayland", GST_VAAPI_DISPLAY_TYPE_WAYLAND, gst_vaapi_display_wayland_new, (GstVaapiDisplayCreateFromHandleFunc) gst_vaapi_display_wayland_new_with_display}, #endif -#if USE_GLX +#if GST_VAAPI_USE_GLX {"glx", GST_VAAPI_DISPLAY_TYPE_GLX, gst_vaapi_display_glx_new, (GstVaapiDisplayCreateFromHandleFunc) gst_vaapi_display_glx_new_with_display}, #endif -#if USE_X11 +#if GST_VAAPI_USE_X11 {"x11", GST_VAAPI_DISPLAY_TYPE_X11, gst_vaapi_display_x11_new, (GstVaapiDisplayCreateFromHandleFunc) gst_vaapi_display_x11_new_with_display}, #endif -#if USE_DRM +#if GST_VAAPI_USE_DRM {"drm", GST_VAAPI_DISPLAY_TYPE_DRM, gst_vaapi_display_drm_new}, @@ -140,26 +140,26 @@ gst_vaapi_get_display_type_from_gl (GstGLDisplayType gl_display_type, GstGLPlatform gl_platform) { switch (gl_display_type) { -#if USE_X11 +#if GST_VAAPI_USE_X11 case GST_GL_DISPLAY_TYPE_X11:{ -#if USE_GLX +#if GST_VAAPI_USE_GLX if (gl_platform == GST_GL_PLATFORM_GLX) return GST_VAAPI_DISPLAY_TYPE_GLX; #endif return GST_VAAPI_DISPLAY_TYPE_X11; } #endif -#if USE_WAYLAND +#if GST_VAAPI_USE_WAYLAND case GST_GL_DISPLAY_TYPE_WAYLAND:{ return GST_VAAPI_DISPLAY_TYPE_WAYLAND; } #endif -#if USE_EGL +#if GST_VAAPI_USE_EGL case GST_GL_DISPLAY_TYPE_EGL:{ return GST_VAAPI_DISPLAY_TYPE_EGL; } #endif -#if USE_DRM +#if GST_VAAPI_USE_DRM case GST_GL_DISPLAY_TYPE_GBM:{ return GST_VAAPI_DISPLAY_TYPE_DRM; } @@ -178,23 +178,23 @@ gst_vaapi_get_display_type_from_gl_env (void) const gchar *const gl_window_type = g_getenv ("GST_GL_WINDOW"); if (!gl_window_type) { -#if USE_X11 && GST_GL_HAVE_WINDOW_X11 +#if GST_VAAPI_USE_X11 && GST_GL_HAVE_WINDOW_X11 return GST_VAAPI_DISPLAY_TYPE_X11; -#elif USE_WAYLAND && GST_GL_HAVE_WINDOW_WAYLAND +#elif GST_VAAPI_USE_WAYLAND && GST_GL_HAVE_WINDOW_WAYLAND return GST_VAAPI_DISPLAY_TYPE_WAYLAND; -#elif USE_EGL && GST_GL_HAVE_PLATFORM_EGL +#elif GST_VAAPI_USE_EGL && GST_GL_HAVE_PLATFORM_EGL return GST_VAAPI_DISPLAY_TYPE_EGL; #endif } -#if USE_X11 +#if GST_VAAPI_USE_X11 if (g_strcmp0 (gl_window_type, "x11") == 0) return GST_VAAPI_DISPLAY_TYPE_X11; #endif -#if USE_WAYLAND +#if GST_VAAPI_USE_WAYLAND if (g_strcmp0 (gl_window_type, "wayland") == 0) return GST_VAAPI_DISPLAY_TYPE_WAYLAND; #endif -#if USE_EGL +#if GST_VAAPI_USE_EGL { const gchar *const gl_platform_type = g_getenv ("GST_GL_PLATFORM"); if (g_strcmp0 (gl_platform_type, "egl") == 0) @@ -205,7 +205,7 @@ gst_vaapi_get_display_type_from_gl_env (void) return GST_VAAPI_DISPLAY_TYPE_ANY; } -#if USE_EGL +#if GST_VAAPI_USE_EGL static gint gst_vaapi_get_gles_version_from_gl_api (GstGLAPI gl_api) { @@ -236,7 +236,7 @@ gst_vaapi_get_egl_handle_from_gl_display (GstGLDisplay * gl_display) } return egl_handle; } -#endif /* USE_EGL */ +#endif /* GST_VAAPI_USE_EGL */ static GstVaapiDisplay * gst_vaapi_create_display_from_egl (GstGLDisplay * gl_display, @@ -244,7 +244,7 @@ gst_vaapi_create_display_from_egl (GstGLDisplay * gl_display, gpointer native_display) { GstVaapiDisplay *display = NULL; -#if USE_EGL +#if GST_VAAPI_USE_EGL GstGLAPI gl_api; gint gles_version; guintptr egl_handler; @@ -917,10 +917,10 @@ gst_vaapi_create_test_display (void) guint i; GstVaapiDisplay *display = NULL; const GstVaapiDisplayType test_display_map[] = { -#if USE_DRM +#if GST_VAAPI_USE_DRM GST_VAAPI_DISPLAY_TYPE_DRM, #endif -#if USE_X11 +#if GST_VAAPI_USE_X11 GST_VAAPI_DISPLAY_TYPE_X11, #endif }; diff --git a/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapipostproc.c b/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapipostproc.c index 91b6c5e4d3..436dbaeb7f 100644 --- a/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapipostproc.c +++ b/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapipostproc.c @@ -72,7 +72,7 @@ static const char gst_vaapipostproc_sink_caps_str[] = static const char gst_vaapipostproc_src_caps_str[] = GST_VAAPI_MAKE_SURFACE_CAPS ", " GST_CAPS_INTERLACED_FALSE "; " -#if (USE_GLX || USE_EGL) +#if (GST_VAAPI_USE_GLX || GST_VAAPI_USE_EGL) GST_VAAPI_MAKE_GLTEXUPLOAD_CAPS "; " #endif GST_VIDEO_CAPS_MAKE (GST_VAAPI_FORMATS_ALL) ", " diff --git a/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapisink.c b/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapisink.c index f87b49f4d4..b318f70539 100644 --- a/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapisink.c +++ b/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapisink.c @@ -177,7 +177,7 @@ gst_vaapisink_render_surface (GstVaapiSink * sink, GstVaapiSurface * surface, /* --- DRM Backend --- */ /* ------------------------------------------------------------------------ */ -#if USE_DRM +#if GST_VAAPI_USE_DRM #include static gboolean @@ -212,7 +212,7 @@ gst_vaapisink_backend_drm (void) /* --- X11 Backend --- */ /* ------------------------------------------------------------------------ */ -#if USE_X11 +#if GST_VAAPI_USE_X11 #include #include @@ -528,7 +528,7 @@ gst_vaapisink_backend_x11 (void) /* --- Wayland Backend --- */ /* ------------------------------------------------------------------------ */ -#if USE_WAYLAND +#if GST_VAAPI_USE_WAYLAND #include #include @@ -1021,22 +1021,22 @@ static void gst_vaapisink_ensure_backend (GstVaapiSink * sink) { switch (GST_VAAPI_PLUGIN_BASE_DISPLAY_TYPE (sink)) { -#if USE_DRM +#if GST_VAAPI_USE_DRM case GST_VAAPI_DISPLAY_TYPE_DRM: sink->backend = gst_vaapisink_backend_drm (); break; #endif -#if USE_X11 +#if GST_VAAPI_USE_X11 case GST_VAAPI_DISPLAY_TYPE_X11: sink->backend = gst_vaapisink_backend_x11 (); break; #endif -#if USE_GLX +#if GST_VAAPI_USE_GLX case GST_VAAPI_DISPLAY_TYPE_GLX: sink->backend = gst_vaapisink_backend_x11 (); break; #endif -#if USE_WAYLAND +#if GST_VAAPI_USE_WAYLAND case GST_VAAPI_DISPLAY_TYPE_WAYLAND: sink->backend = gst_vaapisink_backend_wayland (); break; diff --git a/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapivideobufferpool.c b/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapivideobufferpool.c index d6c3ccd906..9e2166911f 100644 --- a/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapivideobufferpool.c +++ b/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapivideobufferpool.c @@ -25,7 +25,7 @@ #include "gstvaapivideobuffer.h" #include "gstvaapivideomemory.h" #include "gstvaapipluginutil.h" -#if (USE_GLX || USE_EGL) +#if (GST_VAAPI_USE_GLX || GST_VAAPI_USE_EGL) #include "gstvaapivideometa_texture.h" #endif @@ -431,7 +431,7 @@ gst_vaapi_video_buffer_pool_alloc_buffer (GstBufferPool * pool, GST_META_FLAG_SET (vmeta, GST_META_FLAG_POOLED); } -#if (USE_GLX || USE_EGL) +#if (GST_VAAPI_USE_GLX || GST_VAAPI_USE_EGL) if (priv->options & GST_VAAPI_VIDEO_BUFFER_POOL_OPTION_GL_TEXTURE_UPLOAD) { GstMeta *tex_meta = gst_buffer_add_texture_upload_meta (buffer); if (tex_meta) diff --git a/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapivideocontext.c b/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapivideocontext.c index cc2967b833..e2bbfb6cac 100644 --- a/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapivideocontext.c +++ b/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapivideocontext.c @@ -28,13 +28,13 @@ #if USE_GST_GL_HELPERS # include #endif -#if USE_X11 +#if GST_VAAPI_USE_X11 #include #endif -#if USE_WAYLAND +#if GST_VAAPI_USE_WAYLAND #include #endif -#if USE_DRM +#if GST_VAAPI_USE_DRM #include #endif @@ -104,7 +104,7 @@ gst_vaapi_video_context_get_display (GstContext * context, gboolean app_context, if (gst_structure_get (structure, "va-display", G_TYPE_POINTER, &va_display, NULL)) { -#if USE_X11 +#if GST_VAAPI_USE_X11 Display *x11_display = NULL; if (gst_structure_get (structure, "x11-display", G_TYPE_POINTER, &x11_display, NULL)) { @@ -112,7 +112,7 @@ gst_vaapi_video_context_get_display (GstContext * context, gboolean app_context, gst_vaapi_display_x11_new_with_va_display (va_display, x11_display); } #endif -#if USE_WAYLAND +#if GST_VAAPI_USE_WAYLAND if (!display) { struct wl_display *wl_display = NULL; if (gst_structure_get (structure, "wl-display", G_TYPE_POINTER, @@ -123,7 +123,7 @@ gst_vaapi_video_context_get_display (GstContext * context, gboolean app_context, } } #endif -#if USE_DRM +#if GST_VAAPI_USE_DRM if (!display) { gint fd = -1; if (gst_structure_get (structure, "drm-device-fd", G_TYPE_INT, &fd, diff --git a/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapivideometa_texture.c b/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapivideometa_texture.c index b4cf65bf7a..79863cb9e2 100644 --- a/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapivideometa_texture.c +++ b/subprojects/gstreamer-vaapi/gst/vaapi/gstvaapivideometa_texture.c @@ -30,13 +30,13 @@ #include "gstvaapivideometa_texture.h" #include "gstvaapipluginutil.h" -#if USE_GLX +#if GST_VAAPI_USE_GLX #include #endif #define DEFAULT_FORMAT GST_VIDEO_FORMAT_RGBA -#if (USE_GLX || USE_EGL) +#if (GST_VAAPI_USE_GLX || GST_VAAPI_USE_EGL) struct _GstVaapiVideoMetaTexture { GstVaapiTexture *texture; diff --git a/subprojects/gstreamer-vaapi/meson.build b/subprojects/gstreamer-vaapi/meson.build index efadd3ff15..f890ad0d3b 100644 --- a/subprojects/gstreamer-vaapi/meson.build +++ b/subprojects/gstreamer-vaapi/meson.build @@ -188,14 +188,14 @@ cdata.set_quoted('PACKAGE_NAME', 'GStreamer VA-API Plug-ins') cdata.set_quoted('PACKAGE_STRING', 'GStreamer VA-API Plug-ins @0@'.format(gst_version)) cdata.set_quoted('PACKAGE_BUGREPORT', get_option('package-origin')) cdata.set_quoted('VA_DRIVERS_PATH', '@0@'.format(driverdir)) -cdata.set10('USE_DRM', USE_DRM) -cdata.set10('USE_EGL', USE_EGL) -cdata.set10('USE_ENCODERS', USE_ENCODERS) -cdata.set10('USE_GLX', USE_GLX) -cdata.set10('USE_VP9_ENCODER', USE_VP9_ENCODER) -cdata.set10('USE_AV1_DECODER', USE_AV1_DECODER) -cdata.set10('USE_WAYLAND', USE_WAYLAND) -cdata.set10('USE_X11', USE_X11) +cdata.set10('GST_VAAPI_USE_DRM', USE_DRM) +cdata.set10('GST_VAAPI_USE_EGL', USE_EGL) +cdata.set10('GST_VAAPI_USE_ENCODERS', USE_ENCODERS) +cdata.set10('GST_VAAPI_USE_GLX', USE_GLX) +cdata.set10('GST_VAAPI_USE_VP9_ENCODER', USE_VP9_ENCODER) +cdata.set10('GST_VAAPI_USE_AV1_DECODER', USE_AV1_DECODER) +cdata.set10('GST_VAAPI_USE_WAYLAND', USE_WAYLAND) +cdata.set10('GST_VAAPI_USE_X11', USE_X11) cdata.set10('HAVE_XKBLIB', cc.has_header('X11/XKBlib.h', dependencies: x11_dep)) cdata.set10('HAVE_XRANDR', xrandr_dep.found()) cdata.set10('USE_GST_GL_HELPERS', gstgl_dep.found()) diff --git a/subprojects/gstreamer-vaapi/tests/internal/output.c b/subprojects/gstreamer-vaapi/tests/internal/output.c index 2182d5ab0d..074afa2aee 100644 --- a/subprojects/gstreamer-vaapi/tests/internal/output.c +++ b/subprojects/gstreamer-vaapi/tests/internal/output.c @@ -22,23 +22,23 @@ #include "gst/vaapi/sysdeps.h" #include -#if USE_DRM +#if GST_VAAPI_USE_DRM # include # include #endif -#if USE_X11 +#if GST_VAAPI_USE_X11 # include # include #endif -#if USE_GLX +#if GST_VAAPI_USE_GLX # include # include #endif -#if USE_EGL +#if GST_VAAPI_USE_EGL # include # include #endif -#if USE_WAYLAND +#if GST_VAAPI_USE_WAYLAND # include # include #endif @@ -47,22 +47,22 @@ static const VideoOutputInfo *g_video_output; static const VideoOutputInfo g_video_outputs[] = { /* Video outputs are sorted in test order for automatic characterisation */ -#if USE_WAYLAND +#if GST_VAAPI_USE_WAYLAND {"wayland", gst_vaapi_display_wayland_new, gst_vaapi_window_wayland_new}, #endif -#if USE_X11 +#if GST_VAAPI_USE_X11 {"x11", gst_vaapi_display_x11_new, gst_vaapi_window_x11_new}, #endif -#if USE_GLX +#if GST_VAAPI_USE_GLX {"glx", gst_vaapi_display_glx_new, gst_vaapi_window_glx_new}, #endif -#if USE_DRM +#if GST_VAAPI_USE_DRM {"drm", gst_vaapi_display_drm_new, gst_vaapi_window_drm_new}, @@ -188,7 +188,7 @@ video_output_create_display (const gchar * display_name) display = o->create_display (display_name); if (g_egl_mode) { -#if USE_EGL +#if GST_VAAPI_USE_EGL egl_display = gst_vaapi_display_egl_new (display, g_gles_version); #else egl_display = NULL; @@ -211,7 +211,7 @@ video_output_create_window (GstVaapiDisplay * display, guint width, if (!g_video_output) return NULL; -#if USE_EGL +#if GST_VAAPI_USE_EGL if (g_egl_mode) window = gst_vaapi_window_egl_new (display, width, height); else diff --git a/subprojects/gstreamer-vaapi/tests/internal/test-display.c b/subprojects/gstreamer-vaapi/tests/internal/test-display.c index e9ec12604a..aa3d8679d8 100644 --- a/subprojects/gstreamer-vaapi/tests/internal/test-display.c +++ b/subprojects/gstreamer-vaapi/tests/internal/test-display.c @@ -25,7 +25,7 @@ #define _GNU_SOURCE #include "gst/vaapi/sysdeps.h" #include -#if USE_DRM +#if GST_VAAPI_USE_DRM # include # include # include @@ -34,16 +34,16 @@ # define DRM_DEVICE_PATH "/dev/dri/card0" # endif #endif -#if USE_X11 +#if GST_VAAPI_USE_X11 # include #endif -#if USE_GLX +#if GST_VAAPI_USE_GLX # include #endif -#if USE_WAYLAND +#if GST_VAAPI_USE_WAYLAND # include #endif -#if USE_EGL +#if GST_VAAPI_USE_EGL # include #endif @@ -205,14 +205,14 @@ int main (int argc, char *argv[]) { GstVaapiDisplay *display; -#if USE_GLX || USE_WAYLAND +#if GST_VAAPI_USE_GLX || GST_VAAPI_USE_WAYLAND guint width, height; guint par_n, par_d; #endif gst_init (&argc, &argv); -#if USE_DRM +#if GST_VAAPI_USE_DRM g_print ("#\n"); g_print ("# Create display with gst_vaapi_display_drm_new()\n"); g_print ("#\n"); @@ -273,7 +273,7 @@ main (int argc, char *argv[]) g_print ("\n"); #endif -#if USE_X11 +#if GST_VAAPI_USE_X11 g_print ("#\n"); g_print ("# Create display with gst_vaapi_display_x11_new()\n"); g_print ("#\n"); @@ -331,7 +331,7 @@ main (int argc, char *argv[]) g_print ("\n"); #endif -#if USE_GLX +#if GST_VAAPI_USE_GLX g_print ("#\n"); g_print ("# Create display with gst_vaapi_display_glx_new()\n"); g_print ("#\n"); @@ -400,7 +400,7 @@ main (int argc, char *argv[]) #endif #endif -#if USE_WAYLAND +#if GST_VAAPI_USE_WAYLAND g_print ("#\n"); g_print ("# Create display with gst_vaapi_display_wayland_new()\n"); g_print ("#\n"); diff --git a/subprojects/gstreamer-vaapi/tests/internal/test-windows.c b/subprojects/gstreamer-vaapi/tests/internal/test-windows.c index b9c9ad1701..66f4e0404b 100644 --- a/subprojects/gstreamer-vaapi/tests/internal/test-windows.c +++ b/subprojects/gstreamer-vaapi/tests/internal/test-windows.c @@ -25,19 +25,19 @@ #include "gst/vaapi/sysdeps.h" #include #include -#if USE_DRM +#if GST_VAAPI_USE_DRM # include # include #endif -#if USE_X11 +#if GST_VAAPI_USE_X11 # include # include #endif -#if USE_WAYLAND +#if GST_VAAPI_USE_WAYLAND # include # include #endif -#if USE_EGL +#if GST_VAAPI_USE_EGL # include # include #endif @@ -108,7 +108,7 @@ main (int argc, char *argv[]) gst_init (&argc, &argv); -#if USE_DRM +#if GST_VAAPI_USE_DRM display = gst_vaapi_display_drm_new (NULL); if (!display) g_error ("could not create Gst/VA (DRM) display"); @@ -138,7 +138,7 @@ main (int argc, char *argv[]) gst_object_unref (display); #endif -#if USE_X11 +#if GST_VAAPI_USE_X11 display = gst_vaapi_display_x11_new (NULL); if (!display) g_error ("could not create Gst/VA display"); @@ -203,7 +203,7 @@ main (int argc, char *argv[]) gst_object_unref (display); #endif -#if USE_WAYLAND +#if GST_VAAPI_USE_WAYLAND display = gst_vaapi_display_wayland_new (NULL); if (!display) g_error ("could not create Gst/VA (Wayland) display");