summaryrefslogtreecommitdiff
path: root/ext/hls/meson.build
blob: fb5a7d4ccd1778f26b892c0eca8ee609a2921c54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
hls_sources = [
  'gsthlsdemux.c',
  'gsthlsdemux-util.c',
  'gsthlsplugin.c',
  'gsthlssink.c',
  'gsthlssink2.c',
  'gstm3u8playlist.c',
  'm3u8.c',
]

hls_cargs = ['-DGST_USE_UNSTABLE_API']

hls_crypto = get_option('hls-crypto')
hls_option = get_option('hls')

have_hls_crypto = false
if not hls_option.disabled()
  if ['auto', 'nettle'].contains(hls_crypto)
    hls_crypto_dep = dependency('nettle', required : false)
    if hls_crypto_dep.found()
      have_hls_crypto = true
      hls_cargs += ['-DHAVE_NETTLE']
    endif
  endif

  if not hls_crypto_dep.found() and ['auto', 'libgcrypt'].contains(hls_crypto)
    hls_crypto_dep = cc.find_library('gcrypt', required : false)
    if hls_crypto_dep.found()
      have_hls_crypto = true
      hls_cargs += ['-DHAVE_LIBGCRYPT']
    endif
  endif

  if not hls_crypto_dep.found() and ['auto', 'openssl'].contains(hls_crypto)
    hls_crypto_dep = dependency('openssl', required : false)
    if hls_crypto_dep.found()
      have_hls_crypto = true
      hls_cargs += ['-DHAVE_OPENSSL']
    endif
  endif

  if not have_hls_crypto and hls_option.enabled()
    if hls_crypto == 'auto'
      error('HLS plugin enabled, but found none of nettle, libgcrypt, or openssl')
    else
      error('HLS plugin enabled, but crypto library "@0@" not found'.format(hls_crypto))
    endif
  endif
endif

if have_hls_crypto
  gsthls = library('gsthls',
    hls_sources,
    c_args : gst_plugins_bad_args + hls_cargs,
    link_args : noseh_link_args,
    include_directories : [configinc],
    dependencies : [gstpbutils_dep, gsttag_dep, gstvideo_dep,
		    gstadaptivedemux_dep, gsturidownloader_dep,
		    hls_crypto_dep, libm],
    install : true,
    install_dir : plugins_install_dir,
  )
  pkgconfig.generate(gsthls, install_dir : plugins_pkgconfig_install_dir)
  plugins += [gsthls]
endif