meson: fix build with missing libudev-devel

(cherry picked from commit b4c7973d49)
This commit is contained in:
Wim Taymans 2024-01-26 13:28:07 +01:00 committed by Robert Mader
parent ee5a6f16f9
commit 3a4374ec09
7 changed files with 28 additions and 9 deletions

View file

@ -1,10 +1,15 @@
v4l2_sources = ['v4l2.c',
'v4l2-device.c',
'v4l2-udev.c',
'v4l2-source.c']
v4l2_dependencies = [ spa_dep, libinotify_dep ]
if libudev_dep.found()
v4l2_sources += [ 'v4l2-udev.c' ]
v4l2_dependencies += [ libudev_dep ]
endif
v4l2lib = shared_library('spa-v4l2',
v4l2_sources,
dependencies : [ spa_dep, libudev_dep, libinotify_dep ],
dependencies : v4l2_dependencies,
install : true,
install_dir : spa_plugindir / 'v4l2')

View file

@ -27,8 +27,13 @@ int spa_handle_factory_enum(const struct spa_handle_factory **factory,
*factory = &spa_v4l2_source_factory;
break;
case 1:
#ifdef HAVE_LIBUDEV
*factory = &spa_v4l2_udev_factory;
break;
#else
(*index)++;
SPA_FALLTHROUGH;
#endif
case 2:
*factory = &spa_v4l2_device_factory;
break;