build: Detect Gstreamer 1.24 using code, add Autoconf support

Signed-off-by: Frediano Ziglio <freddy77@gmail.com>
Acked-by: Michael Scherle <michael.scherle@rz.uni-freiburg.de>
This commit is contained in:
Frediano Ziglio 2025-03-31 20:10:01 +01:00
parent 47c910fbd4
commit 272964dd34
3 changed files with 7 additions and 11 deletions

View File

@ -56,7 +56,7 @@ AX_CXX_COMPILE_STDCXX_11
AX_APPEND_COMPILE_FLAGS([-fno-exceptions -fno-check-new])
AC_LANG_POP([C++])
AC_CHECK_HEADERS([sys/time.h execinfo.h linux/sockios.h pthread_np.h])
AC_CHECK_HEADERS([sys/time.h execinfo.h linux/sockios.h pthread_np.h drm/drm_fourcc.h])
AC_CHECK_DECL([TCP_KEEPIDLE], [have_tcp_keepidle="yes"],,
[#include <netinet/tcp.h>])
AS_IF([test "x$have_tcp_keepidle" = "xyes"],

View File

@ -72,7 +72,8 @@ spice_protocol_version = spice_common.get_variable('spice_protocol_version')
headers = ['sys/time.h',
'execinfo.h',
'linux/sockios.h',
'pthread_np.h']
'pthread_np.h',
'drm/drm_fourcc.h']
foreach header : headers
if compiler.has_header(header)
@ -131,23 +132,15 @@ endforeach
spice_server_has_gstreamer = false
spice_server_gst_version = get_option('gstreamer')
if spice_server_gst_version != 'no'
gstreamer_version = ''
gst_deps = ['gstreamer', 'gstreamer-base', 'gstreamer-app', 'gstreamer-video', 'gstreamer-allocators']
foreach dep : gst_deps
dep = '@0@-@1@'.format(dep, spice_server_gst_version)
dep = dependency(dep)
if gstreamer_version == '' or dep.version().version_compare('< ' + gstreamer_version)
gstreamer_version = dep.version()
endif
spice_server_deps += dep
spice_server_deps += dependency(dep)
endforeach
spice_server_deps += dependency('orc-0.4')
gst_def = 'HAVE_GSTREAMER_1_0'
spice_server_config_data.set(gst_def, '1')
if compiler.has_header('drm/drm_fourcc.h') and gstreamer_version.version_compare('>= 1.24')
spice_server_config_data.set('HAVE_GSTREAMER_DMABUF_ENCODING', '1')
endif
spice_server_has_gstreamer = true
endif

View File

@ -30,6 +30,9 @@
#include <gst/app/gstappsrc.h>
#include <gst/app/gstappsink.h>
#include <gst/video/video.h>
#if defined(HAVE_DRM_DRM_FOURCC_H) && GST_CHECK_VERSION(1, 24, 0)
#define HAVE_GSTREAMER_DMABUF_ENCODING 1
#endif
#ifdef HAVE_GSTREAMER_DMABUF_ENCODING
#include <gst/video/video-info-dma.h>
#include <gst/allocators/gstdmabuf.h>