• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1nvdec_sources = [
2  'gstnvdec.c',
3  'plugin.c'
4]
5
6nvcuvid_dep_found = false
7nvcuvid_incdirs = []
8
9nvdec_option = get_option('nvdec')
10if nvdec_option.disabled()
11  subdir_done()
12endif
13
14if host_machine.system() == 'windows'
15  cuda_libdirs = [cuda_libdir]
16  # NOTE: Newer CUDA toolkit versions do not ship with the nvcuvid library, and
17  # you must get it from the Nvidia Video Codec SDK. The SDK ships as a zip
18  # file, so there's no installer and you have to set this env var yourself.
19  video_sdk_root = run_command(python3, '-c', 'import os; print(os.environ.get("NVIDIA_VIDEO_CODEC_SDK_PATH"))').stdout().strip()
20  if video_sdk_root != '' and video_sdk_root != 'None'
21    cuda_libdirs += [join_paths(video_sdk_root, 'Samples', 'NvCodec', 'Lib', arc)]
22    nvcuvid_incdirs = include_directories(join_paths(video_sdk_root, 'Samples', 'NvCodec', 'NvDecoder'))
23  endif
24  nvcuvid_lib = cc.find_library('nvcuvid', dirs: cuda_libdirs, required: nvdec_option)
25else
26  nvcuvid_lib = cc.find_library('nvcuvid', required: nvdec_option)
27endif
28
29if nvcuvid_lib.found() and cc.has_function('cuvidCtxLock', dependencies: nvcuvid_lib)
30  nvcuvid_dep = declare_dependency(dependencies: nvcuvid_lib,
31                                   include_directories: nvcuvid_incdirs)
32  nvcuvid_dep_found = true
33endif
34
35if nvdec_option.enabled() and not nvcuvid_dep_found
36  error('The nvdec plugin was enabled explicitly, but required nvcuvid library was not found.')
37endif
38
39if nvcuvid_dep_found
40  gstnvdec = library('gstnvdec',
41    nvdec_sources,
42    c_args : gst_plugins_bad_args,
43    include_directories : [configinc],
44    dependencies : [gstbase_dep, gstvideo_dep, gstpbutils_dep, gstgl_dep, cuda_dep, cudart_dep, nvcuvid_dep],
45    install : true,
46    install_dir : plugins_install_dir,
47  )
48  pkgconfig.generate(gstnvdec, install_dir : plugins_pkgconfig_install_dir)
49endif
50
51