• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1vpx_sources = [
2  'gstvp8dec.c',
3  'gstvp8enc.c',
4  'gstvp8utils.c',
5  'gstvp9dec.c',
6  'gstvp9enc.c',
7  'gstvpxdec.c',
8  'gstvpxenc.c',
9  'gstvpxelement.c',
10  'plugin.c',
11]
12
13vpx_features = [
14  [ 'vpx/vp8cx.h', 'vpx_codec_vp8_cx_algo', '-DHAVE_VP8_ENCODER', 'VP8 encoder' ],
15  [ 'vpx/vp8dx.h', 'vpx_codec_vp8_dx_algo', '-DHAVE_VP8_DECODER', 'VP8 decoder' ],
16  [ 'vpx/vp8cx.h', 'vpx_codec_vp9_cx_algo', '-DHAVE_VP9_ENCODER', 'VP9 encoder' ],
17  [ 'vpx/vp8dx.h', 'vpx_codec_vp9_dx_algo', '-DHAVE_VP9_DECODER', 'VP9 decoder' ],
18]
19
20vpx_option = get_option('vpx')
21vpx_dep = dependency('vpx', version : '>=1.7.0', required : vpx_option)
22
23if vpx_dep.found()
24  vpx_args = []
25  foreach f : vpx_features
26    header = f.get(0)
27    codec_iface = f.get(1)
28    extra_define = f.get(2)
29    link_code = '''#include <@0@>
30                   int main (int a, char ** g) {
31                     const vpx_codec_iface_t *c = &@1@;
32                     return c != 0;
33                   }'''.format(header,codec_iface)
34    if cc.links(link_code, dependencies : vpx_dep)
35      vpx_args += extra_define
36      message('libvpx provides @0@ interface (@1@)'.format(f.get(3),f.get(1)))
37      have_vpx_feature = true
38    else
39      message('libvpx does not provide @0@ interface (@1@)'.format(f.get(3),f.get(1)))
40      have_vpx_feature = false
41    endif
42    set_variable('have_' + f.get(3).to_lower().underscorify(), have_vpx_feature)
43  endforeach
44
45  if vpx_args.length() == 0
46    msg = 'libvpx was built without any encoder or decoder features!'
47    # Error out if explicitly enabled, but continue with a warning if the
48    # plugin is in auto-detect mode to reduce build-time friction.
49    if vpx_option.enabled()
50      error(msg)
51    endif
52    warning(msg)
53  endif
54
55  if vpx_dep.version().version_compare('>= 1.8.0')
56    message('Found vpx >= 1.8.0')
57    vpx_args += '-DHAVE_VPX_1_8'
58  endif
59
60  gnome = import('gnome')
61
62  gstvpx_enums = gnome.mkenums_simple('gstvpx-enumtypes',
63    sources : ['gstvpxenums.h'],
64    decorator : 'G_GNUC_INTERNAL',
65    install_header: false)
66
67  gstvpx = library('gstvpx',
68    vpx_sources, gstvpx_enums,
69    c_args : gst_plugins_good_args + vpx_args,
70    include_directories : [configinc],
71    dependencies : [gstbase_dep, gsttag_dep, gstvideo_dep, vpx_dep],
72    install : true,
73    install_dir : plugins_install_dir,
74  )
75  pkgconfig.generate(gstvpx, install_dir : plugins_pkgconfig_install_dir)
76  plugins += [gstvpx]
77
78  install_data(sources: ['GstVP8Enc.prs'], install_dir: presetdir)
79endif
80