1v4l2_sources = [
2  'gstv4l2.c',
3  'gstv4l2allocator.c',
4  'gstv4l2colorbalance.c',
5  'gstv4l2deviceprovider.c',
6  'gstv4l2object.c',
7  'gstv4l2bufferpool.c',
8  'gstv4l2sink.c',
9  'gstv4l2src.c',
10  'gstv4l2radio.c',
11  'gstv4l2tuner.c',
12  'gstv4l2transform.c',
13  'gstv4l2videodec.c',
14  'gstv4l2videoenc.c',
15  'gstv4l2fwhtenc.c',
16  'gstv4l2h263enc.c',
17  'gstv4l2h264enc.c',
18  'gstv4l2h265enc.c',
19  'gstv4l2jpegenc.c',
20  'gstv4l2mpeg4enc.c',
21  'gstv4l2vidorient.c',
22  'gstv4l2vp8enc.c',
23  'gstv4l2vp9enc.c',
24  'v4l2_calls.c',
25  'v4l2-utils.c',
26  'tuner.c',
27  'tunerchannel.c',
28  'tunernorm.c'
29]
30
31v4l2 = get_option('v4l2')
32if v4l2.disabled()
33  have_v4l2 = false
34  message('V4L2 plugin is disabled')
35else
36  have_v4l2 = cc.has_header('linux/videodev2.h') or cc.has_header('sys/videodev2.h') or cc.has_header('sys/videoio.h')
37  if v4l2.enabled() and not have_v4l2
38    error('V4L2 is requested but headers were not found')
39  endif
40endif
41
42cdata.set('GST_V4L2_ENABLE_PROBE', get_option('v4l2-probe'))
43
44if have_v4l2
45  message('building v4l2 plugin')
46  cdata.set('HAVE_GST_V4L2', true)
47  gudev_dep = dependency('gudev-1.0', version : '>=147', required : get_option('v4l2-gudev'))
48  cdata.set('HAVE_GUDEV', gudev_dep.found())
49
50  # libv4l2 is only needed for converting some obscure formats
51  # FIXME: Add a full list of the formats here
52  libv4l2_dep = dependency('libv4l2', required : get_option('v4l2-libv4l2'))
53  cdata.set('HAVE_LIBV4L2', libv4l2_dep.found())
54
55  gstv4l2 = library('gstvideo4linux2',
56    v4l2_sources,
57    c_args : gst_plugins_good_args,
58    include_directories : [configinc, libsinc],
59    dependencies : [gstbase_dep, gstvideo_dep, gstallocators_dep, gudev_dep, libv4l2_dep],
60    install : true,
61    install_dir : plugins_install_dir,
62  )
63  pkgconfig.generate(gstv4l2, install_dir : plugins_pkgconfig_install_dir)
64endif
65