cuda, nvcodec: Make GstD3D11 dependency mandatory

GstD3D11 build-time dependencies should be always available on Windows already
and runtime dependencies as well, since required external
(non-GStreamer) depends are all system DLLs

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3884>
This commit is contained in:
Seungha Yang 2023-02-06 02:41:57 +09:00 committed by GStreamer Marge Bot
parent f212bd901b
commit 992406cf4f
12 changed files with 82 additions and 79 deletions

View file

@ -27,7 +27,7 @@
#include "gstcudamemory.h"
#include "gstcuda-private.h"
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
#include <gst/d3d11/gstd3d11.h>
#include <wrl.h>
@ -102,7 +102,7 @@ gst_cuda_context_class_init (GstCudaContextClass * klass)
(GParamFlags) (G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE |
G_PARAM_STATIC_STRINGS)));
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
g_object_class_install_property (gobject_class, PROP_DXGI_ADAPTER_LUID,
g_param_spec_int64 ("dxgi-adapter-luid", "DXGI Adapter LUID",
"Associated DXGI Adapter LUID (Locally Unique Identifier) ",
@ -162,7 +162,7 @@ gst_cuda_context_get_property (GObject * object, guint prop_id,
}
}
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
static gint64
gst_cuda_context_find_dxgi_adapter_luid (CUdevice cuda_device)
{
@ -561,7 +561,7 @@ gst_cuda_context_new_wrapped (CUcontext handler, CUdevice device)
self->priv->tex_align = tex_align;
gst_object_ref_sink (self);
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
self->priv->dxgi_adapter_luid =
gst_cuda_context_find_dxgi_adapter_luid (self->priv->device);
#endif

View file

@ -30,7 +30,7 @@
#include <gst/gl/gstglfuncs.h>
#endif
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
#include <gst/d3d11/gstd3d11.h>
#endif
@ -631,7 +631,7 @@ unregister_resource_from_gl_thread (GstGLContext * gl_context,
}
#endif
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
static void
unregister_d3d11_resource (GstCudaGraphicsResource * resource)
{
@ -674,7 +674,7 @@ gst_cuda_graphics_resource_free (GstCudaGraphicsResource * resource)
resource);
} else
#endif
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
if (resource->type == GST_CUDA_GRAPHICS_RESOURCE_D3D11_RESOURCE) {
unregister_d3d11_resource (resource);
} else
@ -1276,7 +1276,7 @@ cuda_copy_gl_interop (GstBuffer * dst_buf, const GstVideoInfo * dst_info,
}
#endif
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
static gboolean
ensure_d3d11_interop (GstCudaContext * context, GstD3D11Device * device)
{
@ -1480,7 +1480,7 @@ gst_cuda_buffer_copy (GstBuffer * dst, GstCudaBufferCopyType dst_type,
{
gboolean use_copy_2d = FALSE;
GstMemory *dst_mem, *src_mem;
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
D3D11_TEXTURE2D_DESC desc;
#endif
GstCudaContext *cuda_context = context;
@ -1570,7 +1570,7 @@ gst_cuda_buffer_copy (GstBuffer * dst, GstCudaBufferCopyType dst_type,
}
#endif
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
if (src_type == GST_CUDA_BUFFER_COPY_D3D11 && gst_is_d3d11_memory (src_mem) &&
gst_d3d11_memory_get_texture_desc (GST_D3D11_MEMORY_CAST (src_mem), &desc)
&& desc.Usage == D3D11_USAGE_DEFAULT && gst_is_cuda_memory (dst_mem)) {

View file

@ -36,14 +36,6 @@ cuda_win32_headers = [
'dxgi.h',
]
if host_system == 'windows'
foreach h : cuda_win32_headers
if not cc.has_header(h)
subdir_done()
endif
endforeach
endif
extra_args = ['-DGST_USE_UNSTABLE_API',
'-DBUILDING_GST_CUDA',
'-DG_LOG_DOMAIN="GStreamer-Cuda"']
@ -52,8 +44,23 @@ if gstgl_dep.found()
extra_args += ['-DHAVE_NVCODEC_GST_GL=1']
endif
if gstd3d11_dep.found()
extra_args += ['-DGST_CUDA_HAS_D3D']
if host_system == 'windows'
foreach h : cuda_win32_headers
if not cc.has_header(h)
subdir_done()
endif
endforeach
if not gstd3d11_dep.found()
subdir_done()
endif
# MinGW 32bits build workaround
if cc.get_id() != 'msvc'
extra_args += cc.get_supported_arguments([
'-Wno-redundant-decls',
])
endif
endif
pkg_name = 'gstreamer-cuda-' + api_version

View file

@ -49,7 +49,7 @@
#ifdef HAVE_NVCODEC_GST_GL
#include <gst/gl/gl.h>
#endif
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
#include <gst/d3d11/gstd3d11.h>
#endif
@ -77,7 +77,7 @@ struct _GstCudaMemoryCopy
GstGLContext *gl_context;
GstGLContext *other_gl_context;
#endif
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
GstD3D11Device *d3d11_device;
#endif
};
@ -127,7 +127,7 @@ static gboolean gst_cuda_memory_copy_set_info (GstCudaBaseTransform * btrans,
GstVideoInfo * out_info);
static GstFlowReturn gst_cuda_memory_copy_transform (GstBaseTransform * trans,
GstBuffer * inbuf, GstBuffer * outbuf);
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
static gboolean
gst_cuda_memory_copy_ensure_d3d11_interop (GstCudaContext * context,
GstD3D11Device * device);
@ -168,7 +168,7 @@ static void
gst_cuda_memory_copy_set_context (GstElement * element, GstContext * context)
{
/* CUDA context is handled by parent class, handle only non-CUDA context */
#if defined (HAVE_NVCODEC_GST_GL) || defined (GST_CUDA_HAS_D3D)
#if defined (HAVE_NVCODEC_GST_GL) || defined (G_OS_WIN32)
GstCudaMemoryCopy *self = GST_CUDA_MEMORY_COPY (element);
#ifdef HAVE_NVCODEC_GST_GL
@ -176,7 +176,7 @@ gst_cuda_memory_copy_set_context (GstElement * element, GstContext * context)
&self->other_gl_context);
#endif /* HAVE_NVCODEC_GST_GL */
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
GstCudaBaseTransform *base = GST_CUDA_BASE_TRANSFORM (element);
if (gst_d3d11_handle_set_context (element, context, -1, &self->d3d11_device)) {
gboolean compatible = TRUE;
@ -211,8 +211,8 @@ gst_cuda_memory_copy_set_context (GstElement * element, GstContext * context)
self->d3d11_device);
}
}
#endif /* GST_CUDA_HAS_D3D */
#endif /* defined (HAVE_NVCODEC_GST_GL) || defined (GST_CUDA_HAS_D3D) */
#endif /* G_OS_WIN32 */
#endif /* defined (HAVE_NVCODEC_GST_GL) || defined (G_OS_WIN32) */
GST_ELEMENT_CLASS (parent_class)->set_context (element, context);
}
@ -220,7 +220,7 @@ gst_cuda_memory_copy_set_context (GstElement * element, GstContext * context)
static gboolean
gst_cuda_memory_copy_transform_stop (GstBaseTransform * trans)
{
#if defined(HAVE_NVCODEC_GST_GL) || defined(GST_CUDA_HAS_D3D)
#if defined(HAVE_NVCODEC_GST_GL) || defined(G_OS_WIN32)
GstCudaMemoryCopy *self = GST_CUDA_MEMORY_COPY (trans);
# ifdef HAVE_NVCODEC_GST_GL
@ -228,7 +228,7 @@ gst_cuda_memory_copy_transform_stop (GstBaseTransform * trans)
gst_clear_object (&self->gl_context);
gst_clear_object (&self->other_gl_context);
# endif
# ifdef GST_CUDA_HAS_D3D
# ifdef G_OS_WIN32
gst_clear_object (&self->d3d11_device);
# endif
#endif
@ -301,7 +301,7 @@ create_transform_caps (GstCaps * caps, gboolean to_cuda)
new_caps = _set_caps_features (caps, GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
ret = gst_caps_merge (ret, new_caps);
#endif
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
new_caps = _set_caps_features (caps, GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY);
ret = gst_caps_merge (ret, new_caps);
#endif
@ -426,7 +426,7 @@ gst_cuda_memory_copy_ensure_gl_context (GstCudaMemoryCopy * self)
}
#endif
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
static gboolean
gst_cuda_memory_copy_ensure_d3d11_interop (GstCudaContext * context,
GstD3D11Device * device)
@ -521,7 +521,7 @@ gst_cuda_memory_copy_propose_allocation (GstBaseTransform * trans,
pool = gst_gl_buffer_pool_new (self->gl_context);
#endif
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
} else if (features && gst_caps_features_contains (features,
GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY) &&
gst_cuda_memory_copy_ensure_d3d11_context (self)) {
@ -615,7 +615,7 @@ gst_cuda_memory_copy_decide_allocation (GstBaseTransform * trans,
#ifdef HAVE_NVCODEC_GST_GL
gboolean need_gl = FALSE;
#endif
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
gboolean need_d3d11 = FALSE;
#endif
#ifdef HAVE_NVCODEC_NVMM
@ -645,7 +645,7 @@ gst_cuda_memory_copy_decide_allocation (GstBaseTransform * trans,
need_gl = TRUE;
}
#endif
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
else if (features && gst_caps_features_contains (features,
GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY) &&
gst_cuda_memory_copy_ensure_d3d11_context (self)) {
@ -699,7 +699,7 @@ gst_cuda_memory_copy_decide_allocation (GstBaseTransform * trans,
pool = gst_gl_buffer_pool_new (self->gl_context);
}
#endif
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
else if (need_d3d11) {
GST_DEBUG_OBJECT (self, "creating d3d11 pool");
pool = gst_d3d11_buffer_pool_new (self->d3d11_device);
@ -778,7 +778,7 @@ static gboolean
gst_cuda_memory_copy_query (GstBaseTransform * trans,
GstPadDirection direction, GstQuery * query)
{
#if defined(HAVE_NVCODEC_GST_GL) || defined(GST_CUDA_HAS_D3D)
#if defined(HAVE_NVCODEC_GST_GL) || defined(G_OS_WIN32)
GstCudaMemoryCopy *self = GST_CUDA_MEMORY_COPY (trans);
switch (GST_QUERY_TYPE (query)) {
@ -791,7 +791,7 @@ gst_cuda_memory_copy_query (GstBaseTransform * trans,
if (ret)
return TRUE;
# endif
# ifdef GST_CUDA_HAS_D3D
# ifdef G_OS_WIN32
ret = gst_d3d11_handle_context_query (GST_ELEMENT (self), query,
self->d3d11_device);
if (ret)
@ -843,7 +843,7 @@ gst_cuda_memory_copy_set_info (GstCudaBaseTransform * btrans,
}
#endif
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
if (in_features && gst_caps_features_contains (in_features,
GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY)) {
self->in_type = GST_CUDA_BUFFER_COPY_D3D11;
@ -891,7 +891,7 @@ gst_cuda_memory_copy_transform (GstBaseTransform * trans, GstBuffer * inbuf,
GstCudaBufferCopyType in_type = GST_CUDA_BUFFER_COPY_SYSTEM;
GstCudaBufferCopyType out_type = GST_CUDA_BUFFER_COPY_SYSTEM;
gboolean use_device_copy = FALSE;
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
D3D11_TEXTURE2D_DESC desc;
#endif
@ -920,7 +920,7 @@ gst_cuda_memory_copy_transform (GstBaseTransform * trans, GstBuffer * inbuf,
} else if (self->gl_context && gst_is_gl_memory_pbo (in_mem)) {
in_type = GST_CUDA_BUFFER_COPY_GL;
#endif
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
} else if (self->d3d11_device && gst_is_d3d11_memory (in_mem)
&& gst_d3d11_memory_get_texture_desc (GST_D3D11_MEMORY_CAST (in_mem),
&desc) && desc.Usage == D3D11_USAGE_DEFAULT) {
@ -940,7 +940,7 @@ gst_cuda_memory_copy_transform (GstBaseTransform * trans, GstBuffer * inbuf,
} else if (self->gl_context && gst_is_gl_memory_pbo (out_mem)) {
out_type = GST_CUDA_BUFFER_COPY_GL;
#endif
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
} else if (self->d3d11_device && gst_is_d3d11_memory (out_mem)
&& gst_d3d11_memory_get_texture_desc (GST_D3D11_MEMORY_CAST (out_mem),
&desc) && desc.Usage == D3D11_USAGE_DEFAULT) {
@ -1161,7 +1161,7 @@ gst_cuda_memory_copy_register (GstPlugin * plugin, guint rank)
#ifdef HAVE_NVCODEC_GST_GL
GstCaps *gl_caps;
#endif
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
GstCaps *d3d11_caps;
#endif
GstCaps *upload_sink_caps;
@ -1190,7 +1190,7 @@ gst_cuda_memory_copy_register (GstPlugin * plugin, guint rank)
gst_caps_from_string (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
(GST_CAPS_FEATURE_MEMORY_GL_MEMORY, GST_CUDA_GL_FORMATS));
#endif
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
d3d11_caps =
gst_caps_from_string (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
(GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY, GST_CUDA_D3D11_FORMATS));
@ -1200,7 +1200,7 @@ gst_cuda_memory_copy_register (GstPlugin * plugin, guint rank)
#ifdef HAVE_NVCODEC_GST_GL
upload_sink_caps = gst_caps_merge (upload_sink_caps, gst_caps_copy (gl_caps));
#endif
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
upload_sink_caps =
gst_caps_merge (upload_sink_caps, gst_caps_copy (d3d11_caps));
#endif
@ -1236,7 +1236,7 @@ gst_cuda_memory_copy_register (GstPlugin * plugin, guint rank)
#ifdef HAVE_NVCODEC_GST_GL
download_src_caps = gst_caps_merge (download_src_caps, gl_caps);
#endif
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
download_src_caps = gst_caps_merge (download_src_caps, d3d11_caps);
#endif
#ifdef HAVE_NVCODEC_NVMM

View file

@ -29,7 +29,7 @@
#include <gst/cuda/gstcudastream.h>
#include <string.h>
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
#include <gst/d3d11/gstd3d11.h>
#endif
@ -61,7 +61,7 @@ struct _GstNvEncoderPrivate
GstCudaContext *context;
GstCudaStream *stream;
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
GstD3D11Device *device;
GstD3D11Fence *fence;
#endif
@ -208,7 +208,7 @@ gst_nv_encoder_set_context (GstElement * element, GstContext * context)
g_rec_mutex_lock (&priv->context_lock);
switch (priv->selected_device_mode) {
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
case GST_NV_ENCODER_DEVICE_D3D11:
gst_d3d11_handle_set_context_for_adapter_luid (element,
context, priv->dxgi_adapter_luid, &priv->device);
@ -261,7 +261,7 @@ gst_nv_encoder_device_lock (GstNvEncoder * self)
gboolean ret = TRUE;
switch (priv->selected_device_mode) {
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
case GST_NV_ENCODER_DEVICE_D3D11:
gst_d3d11_device_lock (priv->device);
break;
@ -283,7 +283,7 @@ gst_nv_encoder_device_unlock (GstNvEncoder * self)
gboolean ret = TRUE;
switch (priv->selected_device_mode) {
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
case GST_NV_ENCODER_DEVICE_D3D11:
gst_d3d11_device_unlock (priv->device);
break;
@ -387,7 +387,7 @@ gst_nv_encoder_drain (GstNvEncoder * self, gboolean locked)
return TRUE;
}
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
static gboolean
gst_nv_encoder_open_d3d11_device (GstNvEncoder * self)
{
@ -427,7 +427,7 @@ gst_nv_encoder_open (GstVideoEncoder * encoder)
case GST_NV_ENCODER_DEVICE_AUTO_SELECT:
/* Will open GPU later */
return TRUE;
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
case GST_NV_ENCODER_DEVICE_D3D11:
return gst_nv_encoder_open_d3d11_device (self);
#endif
@ -456,7 +456,7 @@ gst_nv_encoder_close (GstVideoEncoder * encoder)
gst_clear_cuda_stream (&priv->stream);
gst_clear_object (&priv->context);
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
gst_clear_d3d11_fence (&priv->fence);
gst_clear_object (&priv->device);
#endif
@ -477,7 +477,7 @@ gst_nv_encoder_stop (GstVideoEncoder * encoder)
if (priv->subclass_device_mode == GST_NV_ENCODER_DEVICE_AUTO_SELECT) {
gst_clear_cuda_stream (&priv->stream);
gst_clear_object (&priv->context);
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
gst_clear_object (&priv->device);
#endif
priv->selected_device_mode = GST_NV_ENCODER_DEVICE_AUTO_SELECT;
@ -497,7 +497,7 @@ gst_nv_encoder_handle_context_query (GstNvEncoder * self, GstQuery * query)
g_rec_mutex_lock (&priv->context_lock);
switch (priv->selected_device_mode) {
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
case GST_NV_ENCODER_DEVICE_D3D11:
ret = gst_d3d11_handle_context_query (GST_ELEMENT (self),
query, priv->device);
@ -590,7 +590,7 @@ gst_nv_encoder_propose_allocation (GstVideoEncoder * encoder, GstQuery * query)
gst_query_add_allocation_meta (query, GST_VIDEO_META_API_TYPE, nullptr);
gst_query_add_allocation_pool (query, nullptr, info.size, min_buffers, 0);
return TRUE;
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
case GST_NV_ENCODER_DEVICE_D3D11:
if (features && gst_caps_features_contains (features,
GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY)) {
@ -1085,7 +1085,7 @@ gst_nv_encoder_open_encode_session (GstNvEncoder * self, gpointer * session)
NVENCSTATUS status;
switch (priv->selected_device_mode) {
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
case GST_NV_ENCODER_DEVICE_D3D11:
session_params.deviceType = NV_ENC_DEVICE_TYPE_DIRECTX;
session_params.device = gst_d3d11_device_get_device_handle (priv->device);
@ -1110,7 +1110,7 @@ gst_nv_encoder_open_encode_session (GstNvEncoder * self, gpointer * session)
return TRUE;
}
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
static GstBufferPool *
gst_nv_encoder_create_d3d11_pool (GstNvEncoder * self,
GstVideoCodecState * state)
@ -1157,7 +1157,7 @@ gst_nv_encoder_create_pool (GstNvEncoder * self, GstVideoCodecState * state)
/* At this moment device type must be selected already */
switch (priv->selected_device_mode) {
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
case GST_NV_ENCODER_DEVICE_D3D11:
return gst_nv_encoder_create_d3d11_pool (self, state);
#endif
@ -1256,7 +1256,7 @@ gst_nv_encoder_init_session (GstNvEncoder * self, GstBuffer * in_buf)
priv->stream = gst_cuda_stream_new (priv->context);
}
}
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
gst_clear_object (&priv->device);
if (data.device_mode == GST_NV_ENCODER_DEVICE_D3D11)
priv->device = (GstD3D11Device *) data.device;
@ -1617,7 +1617,7 @@ gst_nv_encoder_prepare_task_input_cuda (GstNvEncoder * self,
return GST_FLOW_OK;
}
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
static GstBuffer *
gst_nv_encoder_copy_d3d11 (GstNvEncoder * self,
GstBuffer * src_buffer, GstBufferPool * pool, gboolean shared)
@ -1892,7 +1892,7 @@ gst_nv_encoder_prepare_task_input (GstNvEncoder * self,
GstFlowReturn ret = GST_FLOW_ERROR;
switch (priv->selected_device_mode) {
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
case GST_NV_ENCODER_DEVICE_D3D11:
ret = gst_nv_encoder_prepare_task_input_d3d11 (self, info, buffer,
session, pool, task);

View file

@ -22,7 +22,7 @@
#include <gst/gst.h>
#include <gst/video/video.h>
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
#include <gst/d3d11/gstd3d11.h>
#endif

View file

@ -1688,7 +1688,7 @@ gst_nv_h264_encoder_select_device (GstNvEncoder * encoder,
return TRUE;
}
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
if (klass->adapter_luid_size > 0 && gst_is_d3d11_memory (mem)) {
GstD3D11Memory *dmem = GST_D3D11_MEMORY_CAST (mem);
GstD3D11Device *device = dmem->device;
@ -1893,7 +1893,7 @@ gst_nv_h264_encoder_create_class_data (GstObject * device, gpointer session,
system_caps = gst_caps_from_string (sink_caps_str.c_str ());
sink_caps = gst_caps_copy (system_caps);
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
if (device_mode == GST_NV_ENCODER_DEVICE_D3D11) {
gst_caps_set_features (sink_caps, 0,
gst_caps_features_new (GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY, nullptr));
@ -2014,7 +2014,7 @@ gst_nv_h264_encoder_register_cuda (GstPlugin * plugin, GstCudaContext * context,
return cdata;
}
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
GstNvEncoderClassData *
gst_nv_h264_encoder_register_d3d11 (GstPlugin * plugin, GstD3D11Device * device,
guint rank)
@ -2217,7 +2217,7 @@ gst_nv_h264_encoder_register_auto_select (GstPlugin * plugin,
gst_caps_features_new (GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY, nullptr));
gst_caps_append (sink_caps, cuda_caps);
}
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
if (adapter_luid_size > 0) {
GstCaps *d3d11_caps = gst_caps_copy (system_caps);
gst_caps_set_features (d3d11_caps, 0,

View file

@ -27,7 +27,7 @@ GstNvEncoderClassData * gst_nv_h264_encoder_register_cuda (GstPlugin * plugin,
GstCudaContext * context,
guint rank);
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
GstNvEncoderClassData * gst_nv_h264_encoder_register_d3d11 (GstPlugin * plugin,
GstD3D11Device * device,
guint rank);

View file

@ -1700,7 +1700,7 @@ gst_nv_h265_encoder_select_device (GstNvEncoder * encoder,
return TRUE;
}
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
if (klass->adapter_luid_size > 0 && gst_is_d3d11_memory (mem)) {
GstD3D11Memory *dmem = GST_D3D11_MEMORY_CAST (mem);
GstD3D11Device *device = dmem->device;
@ -1904,7 +1904,7 @@ gst_nv_h265_encoder_create_class_data (GstObject * device, gpointer session,
system_caps = gst_caps_from_string (sink_caps_str.c_str ());
sink_caps = gst_caps_copy (system_caps);
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
if (device_mode == GST_NV_ENCODER_DEVICE_D3D11) {
gst_caps_set_features (sink_caps, 0,
gst_caps_features_new (GST_CAPS_FEATURE_MEMORY_D3D11_MEMORY, nullptr));
@ -2025,7 +2025,7 @@ gst_nv_h265_encoder_register_cuda (GstPlugin * plugin, GstCudaContext * context,
return cdata;
}
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
GstNvEncoderClassData *
gst_nv_h265_encoder_register_d3d11 (GstPlugin * plugin, GstD3D11Device * device,
guint rank)
@ -2223,7 +2223,7 @@ gst_nv_h265_encoder_register_auto_select (GstPlugin * plugin,
gst_caps_features_new (GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY, nullptr));
gst_caps_append (sink_caps, cuda_caps);
}
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
if (adapter_luid_size > 0) {
GstCaps *d3d11_caps = gst_caps_copy (system_caps);
gst_caps_set_features (d3d11_caps, 0,

View file

@ -27,7 +27,7 @@ GstNvEncoderClassData * gst_nv_h265_encoder_register_cuda (GstPlugin * plugin,
GstCudaContext * context,
guint rank);
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
GstNvEncoderClassData * gst_nv_h265_encoder_register_d3d11 (GstPlugin * plugin,
GstD3D11Device * device,
guint rank);

View file

@ -44,10 +44,6 @@ if gstgl_dep.found()
extra_args += ['-DHAVE_NVCODEC_GST_GL=1']
endif
if gstd3d11_dep.found()
extra_args += ['-DGST_CUDA_HAS_D3D=1', '-DCOBJMACROS']
endif
if host_system == 'linux'
have_nvmm = false
if cc.has_header('nvbufsurface.h')

View file

@ -44,7 +44,7 @@
#include "gstcudanvmm.h"
#endif
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
#include <gst/d3d11/gstd3d11.h>
#endif
#include "gstnvh264encoder.h"
@ -255,7 +255,7 @@ plugin_init (GstPlugin * plugin)
if (nvenc_available) {
GstNvEncoderClassData *cdata;
#ifdef GST_CUDA_HAS_D3D
#ifdef G_OS_WIN32
if (g_win32_check_windows_version (6, 0, 0, G_WIN32_OS_ANY)) {
gint64 adapter_luid;
GstD3D11Device *d3d11_device;