summaryrefslogtreecommitdiff
path: root/sys/d3d11/meson.build
blob: 24f2debf8d1199c8920ab1ef526ed8766330ceeb (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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
d3d11_sources = [
  'gstd3d11basefilter.cpp',
  'gstd3d11convert.cpp',
  'gstd3d11converter.cpp',
  'gstd3d11compositor.cpp',
  'gstd3d11compositorbin.cpp',
  'gstd3d11download.cpp',
  'gstd3d11overlaycompositor.cpp',
  'gstd3d11pluginutils.cpp',
  'gstd3d11shader.cpp',
  'gstd3d11upload.cpp',
  'gstd3d11videoprocessor.cpp',
  'gstd3d11videosink.cpp',
  'gstd3d11window.cpp',
  'gstd3d11window_dummy.cpp',
  'plugin.c',
]

d3d11_dec_sources = [
  'gstd3d11av1dec.cpp',
  'gstd3d11decoder.cpp',
  'gstd3d11h264dec.cpp',
  'gstd3d11vp9dec.cpp',
  'gstd3d11h265dec.cpp',
  'gstd3d11mpeg2dec.cpp',
  'gstd3d11vp8dec.cpp',
]

extra_c_args = ['-DCOBJMACROS', '-DGST_USE_UNSTABLE_API']
extra_cpp_args = ['-DGST_USE_UNSTABLE_API']
extra_dep = []

d3d11_option = get_option('d3d11')
if host_system != 'windows' or d3d11_option.disabled()
  subdir_done()
endif

if not gstd3d11_dep.found()
  if d3d11_option.enabled()
    error('The d3d11 was enabled explicitly, but required dependencies were not found.')
  endif
  subdir_done()
endif

d3dcompiler_lib = cc.find_library('d3dcompiler', required: d3d11_option)
runtimeobject_lib = cc.find_library('runtimeobject', required : false)
winmm_lib = cc.find_library('winmm', required: false)
has_decoder = false

have_d3d11 = cc.has_header('d3dcompiler.h')
if not have_d3d11
  if d3d11_option.enabled()
    error('The d3d11 plugin was enabled explicitly, but required dependencies were not found.')
  endif
  subdir_done()
endif

# d3d11 video api uses dxva structure for decoding, and dxva.h needs d3d9 types
if cc.has_header('dxva.h') and cc.has_header('d3d9.h')
  d3d11_sources += d3d11_dec_sources
  extra_c_args += ['-DHAVE_DXVA_H']
  extra_dep += [gstcodecs_dep]
  has_decoder = true
endif

if d3d11_winapi_only_app and (not d3dcompiler_lib.found() or not runtimeobject_lib.found())
  if d3d11_option.enabled()
    error('The d3d11 plugin was enabled explicitly, but required dependencies were not found.')
  endif
  subdir_done()
endif

# if build target is Windows 10 and WINAPI_PARTITION_APP is allowed,
# we can build UWP only modules as well
if d3d11_winapi_app
  d3d11_sources += ['gstd3d11window_corewindow.cpp',
                    'gstd3d11window_swapchainpanel.cpp']
  extra_dep += [runtimeobject_lib, d3dcompiler_lib]
endif

if d3d11_winapi_desktop
  d3d11_sources += ['gstd3d11window_win32.cpp']
  if d3d11_conf.get('GST_D3D11_DXGI_HEADER_VERSION') >= 6
    # Desktop Duplication API is unavailable for UWP
    # and MinGW is not supported due to some missing headers
    extra_c_args += ['-DHAVE_DXGI_DESKTOP_DUP']
    d3d11_sources += ['gstd3d11desktopdup.cpp', 'gstd3d11desktopdupsrc.cpp']
    message('Enable D3D11 Desktop Duplication API')
  endif
  # multimedia clock is desktop only API
  if has_decoder and winmm_lib.found() and cc.has_header('timeapi.h')
    extra_cpp_args += ['-DHAVE_WINMM']
    extra_dep += [winmm_lib]
  endif
endif

# need dxgi1_5.h for HDR10 processing and d3d11_4.h for ID3D11VideoContext2 interface
if d3d11_conf.get('GST_D3D11_DXGI_HEADER_VERSION') >= 5 and d3d11_conf.get('GST_D3D11_HEADER_VERSION') >= 4
  d3d11_sources += ['gstd3d11deinterlace.cpp']
  extra_c_args += ['-DHAVE_D3D11_VIDEO_PROC']
endif

# MinGW 32bits compiler seems to be complaining about redundant-decls
# when ComPtr is in use. Let's just disable the warning
if cc.get_id() != 'msvc'
  extra_args = cc.get_supported_arguments([
    '-Wno-redundant-decls',
  ])

  extra_c_args += extra_args
  extra_cpp_args += extra_args
endif

gstd3d11 = library('gstd3d11',
  d3d11_sources,
  c_args : gst_plugins_bad_args + extra_c_args,
  cpp_args: gst_plugins_bad_args + extra_cpp_args,
  include_directories : [configinc],
  dependencies : [gstbase_dep, gstvideo_dep, gmodule_dep, gstcontroller_dep, gstd3d11_dep] + extra_dep,
  install : true,
  install_dir : plugins_install_dir,
)
pkgconfig.generate(gstd3d11, install_dir : plugins_pkgconfig_install_dir)
plugins += [gstd3d11]