From e7cc0f69e3c0bba9d29ff286c5a1825162883ceb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Cerveau?= Date: Tue, 9 Jun 2020 18:50:06 +0200 Subject: [PATCH] libcamera: fix implicit dependency to libdrm libcamera is depending on libdrm in libcamera_wrapper.cpp but it was implicitely including the header drm_fourcc.h with libcamera file pixel_format.h With this patch, the libcamera plugin should explicitely depends on libdrm as it needs DRM fourcc and should not depend on multiple inclusion from libcamera. Add a FourCC for Motion-JPEG compressed format. This is a temporary addition until the format gets merged in the upstream kernel. --- spa/plugins/libcamera/libcamera_wrapper.cpp | 10 ++++++++++ spa/plugins/libcamera/meson.build | 6 +++++- 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/spa/plugins/libcamera/libcamera_wrapper.cpp b/spa/plugins/libcamera/libcamera_wrapper.cpp index fdadda2d7..aed3dccf5 100644 --- a/spa/plugins/libcamera/libcamera_wrapper.cpp +++ b/spa/plugins/libcamera/libcamera_wrapper.cpp @@ -39,6 +39,8 @@ #include #include +#include + #include #include #include @@ -63,6 +65,14 @@ using namespace controls; #define DEFAULT_HEIGHT 480 #define DEFAULT_PIXEL_FMT DRM_FORMAT_YUYV +/* Compressed formats + * + * TODO: Should be removed when the format gets merged in the + * libdrm.*/ +#ifndef DRM_FORMAT_MJPEG +# define DRM_FORMAT_MJPEG fourcc_code('M', 'J', 'P', 'G') /* Motion-JPEG */ +#endif + extern "C" { static struct { diff --git a/spa/plugins/libcamera/meson.build b/spa/plugins/libcamera/meson.build index 75d378cec..eeb4e72bf 100644 --- a/spa/plugins/libcamera/meson.build +++ b/spa/plugins/libcamera/meson.build @@ -4,9 +4,13 @@ libcamera_sources = ['libcamera.c', 'libcamera-source.c', 'libcamera_wrapper.cpp'] +libdrm_dep = dependency('libdrm', version : '>= 2.4.98', + required : get_option('libcamera')) +if libdrm_dep.found() libcameralib = shared_library('spa-libcamera', libcamera_sources, include_directories : [ spa_inc ], - dependencies : [ libudev_dep, libcamera_dep, pthread_lib ], + dependencies : [ libudev_dep, libcamera_dep, pthread_lib, libdrm_dep ], install : true, install_dir : join_paths(spa_plugindir, 'libcamera')) +endif