From 43910ae33c0d74b9434b74d1174be151c511b167 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Mon, 5 Feb 2024 17:56:37 +0800 Subject: [PATCH] GStreamer media backend: Fix building and running on Windows Visual Studio (and possibly other non-GCC compilers) do not like uses of #-preprocessor directives in macro usage (warning C5101: use of preprocessor directive in function-like macro argument list is undefined behavior is also shown), so fix the build by defining another macro accordingly. --- modules/media/gtkgstsink.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/media/gtkgstsink.c b/modules/media/gtkgstsink.c index 83fadc6a4b..b870d6de3a 100644 --- a/modules/media/gtkgstsink.c +++ b/modules/media/gtkgstsink.c @@ -72,14 +72,17 @@ GST_DEBUG_CATEGORY (gtk_debug_gst_sink); #define NOGL_CAPS GST_VIDEO_CAPS_MAKE (FORMATS) +#ifdef HAVE_GSTREAMER_DRM +# define GST_VIDEO_DMA_DRM_CAPS_MAKE_STR GST_VIDEO_DMA_DRM_CAPS_MAKE "; " +#else +# define GST_VIDEO_DMA_DRM_CAPS_MAKE_STR +#endif + static GstStaticPadTemplate gtk_gst_sink_template = GST_STATIC_PAD_TEMPLATE ("sink", GST_PAD_SINK, GST_PAD_ALWAYS, - GST_STATIC_CAPS ( -#ifdef HAVE_GSTREAMER_DRM - GST_VIDEO_DMA_DRM_CAPS_MAKE "; " -#endif + GST_STATIC_CAPS (GST_VIDEO_DMA_DRM_CAPS_MAKE_STR "video/x-raw(" GST_CAPS_FEATURE_MEMORY_GL_MEMORY "), " "format = (string) RGBA, " "width = " GST_VIDEO_SIZE_RANGE ", " @@ -89,6 +92,8 @@ GST_STATIC_PAD_TEMPLATE ("sink", "; " NOGL_CAPS) ); +#undef GST_VIDEO_DMA_DRM_CAPS_MAKE_STR + G_DEFINE_TYPE_WITH_CODE (GtkGstSink, gtk_gst_sink, GST_TYPE_VIDEO_SINK, GST_DEBUG_CATEGORY_INIT (gtk_debug_gst_sink,