cuda: Rename macro HAVE_NVCODEC_GST_GL -> HAVE_CUDA_GST_GL

... and always use #ifdef instead of #if

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/3992>
This commit is contained in:
Seungha Yang 2023-02-18 00:36:29 +09:00
parent b2fcc177f5
commit 59f359eb99
9 changed files with 79 additions and 79 deletions

View file

@ -26,7 +26,7 @@
#include "gstcuda-private.h"
#include <atomic>
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
#include <gst/gl/gl.h>
#include <gst/gl/gstglfuncs.h>
#endif
@ -612,7 +612,7 @@ gst_cuda_graphics_resource_unmap (GstCudaGraphicsResource * resource,
resource->mapped = FALSE;
}
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
static void
unregister_resource_from_gl_thread (GstGLContext * gl_context,
GstCudaGraphicsResource * resource)
@ -668,7 +668,7 @@ gst_cuda_graphics_resource_free (GstCudaGraphicsResource * resource)
g_return_if_fail (resource != nullptr);
if (resource->registered) {
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
if (resource->type == GST_CUDA_GRAPHICS_RESOURCE_GL_BUFFER) {
gst_gl_context_thread_add ((GstGLContext *) resource->graphics_context,
(GstGLContextThreadFunc) unregister_resource_from_gl_thread,
@ -1019,7 +1019,7 @@ unmap_and_out:
return ret;
}
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
static gboolean
ensure_gl_interop (void)
{
@ -1524,7 +1524,7 @@ gst_cuda_buffer_copy (GstBuffer * dst, GstCudaBufferCopyType dst_type,
dst_mem = gst_buffer_peek_memory (dst, 0);
src_mem = gst_buffer_peek_memory (src, 0);
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
if (src_type == GST_CUDA_BUFFER_COPY_GL && gst_is_gl_memory_pbo (src_mem)) {
GstGLMemory *gl_mem = (GstGLMemory *) src_mem;
GstGLContext *gl_context = gl_mem->mem.context;

View file

@ -41,7 +41,7 @@ extra_args = ['-DGST_USE_UNSTABLE_API',
'-DG_LOG_DOMAIN="GStreamer-Cuda"']
if gstgl_dep.found()
extra_args += ['-DHAVE_NVCODEC_GST_GL=1']
extra_args += ['-DHAVE_CUDA_GST_GL']
endif
if host_system == 'windows'

View file

@ -46,7 +46,7 @@
#include "gstcudanvmm.h"
#endif
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
#include <gst/gl/gl.h>
#endif
#ifdef G_OS_WIN32
@ -72,7 +72,7 @@ struct _GstCudaMemoryCopy
gboolean downstream_supports_video_meta;
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
GstGLDisplay *gl_display;
GstGLContext *gl_context;
GstGLContext *other_gl_context;
@ -168,13 +168,13 @@ 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 (G_OS_WIN32)
#if defined (HAVE_CUDA_GST_GL) || defined (G_OS_WIN32)
GstCudaMemoryCopy *self = GST_CUDA_MEMORY_COPY (element);
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
gst_gl_handle_set_context (element, context, &self->gl_display,
&self->other_gl_context);
#endif /* HAVE_NVCODEC_GST_GL */
#endif /* HAVE_CUDA_GST_GL */
#ifdef G_OS_WIN32
GstCudaBaseTransform *base = GST_CUDA_BASE_TRANSFORM (element);
@ -212,7 +212,7 @@ gst_cuda_memory_copy_set_context (GstElement * element, GstContext * context)
}
}
#endif /* G_OS_WIN32 */
#endif /* defined (HAVE_NVCODEC_GST_GL) || defined (G_OS_WIN32) */
#endif /* defined (HAVE_CUDA_GST_GL) || defined (G_OS_WIN32) */
GST_ELEMENT_CLASS (parent_class)->set_context (element, context);
}
@ -220,17 +220,17 @@ 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(G_OS_WIN32)
#if defined(HAVE_CUDA_GST_GL) || defined(G_OS_WIN32)
GstCudaMemoryCopy *self = GST_CUDA_MEMORY_COPY (trans);
# ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
gst_clear_object (&self->gl_display);
gst_clear_object (&self->gl_context);
gst_clear_object (&self->other_gl_context);
# endif
# ifdef G_OS_WIN32
#endif
#ifdef G_OS_WIN32
gst_clear_object (&self->d3d11_device);
# endif
#endif
#endif
return GST_BASE_TRANSFORM_CLASS (parent_class)->stop (trans);
@ -297,7 +297,7 @@ create_transform_caps (GstCaps * caps, gboolean to_cuda)
}
#endif
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
new_caps = _set_caps_features (caps, GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
ret = gst_caps_merge (ret, new_caps);
#endif
@ -345,7 +345,7 @@ gst_cuda_memory_copy_transform_caps (GstBaseTransform * trans,
return result;
}
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
static void
gst_cuda_memory_copy_ensure_gl_interop (GstGLContext * context, gboolean * ret)
{
@ -513,7 +513,7 @@ gst_cuda_memory_copy_propose_allocation (GstBaseTransform * trans,
GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY)) {
GST_DEBUG_OBJECT (self, "upstream support CUDA memory");
pool = gst_cuda_buffer_pool_new (ctrans->context);
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
} else if (features && gst_caps_features_contains (features,
GST_CAPS_FEATURE_MEMORY_GL_MEMORY) &&
gst_cuda_memory_copy_ensure_gl_context (self)) {
@ -612,7 +612,7 @@ gst_cuda_memory_copy_decide_allocation (GstBaseTransform * trans,
gboolean update_pool = FALSE;
GstCapsFeatures *features;
gboolean need_cuda = FALSE;
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
gboolean need_gl = FALSE;
#endif
#ifdef G_OS_WIN32
@ -638,7 +638,7 @@ gst_cuda_memory_copy_decide_allocation (GstBaseTransform * trans,
GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY)) {
need_cuda = TRUE;
}
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
else if (features && gst_caps_features_contains (features,
GST_CAPS_FEATURE_MEMORY_GL_MEMORY) &&
gst_cuda_memory_copy_ensure_gl_context (self)) {
@ -693,7 +693,7 @@ gst_cuda_memory_copy_decide_allocation (GstBaseTransform * trans,
GST_DEBUG_OBJECT (self, "creating cuda pool");
pool = gst_cuda_buffer_pool_new (ctrans->context);
}
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
else if (need_gl) {
GST_DEBUG_OBJECT (self, "creating gl pool");
pool = gst_gl_buffer_pool_new (self->gl_context);
@ -778,25 +778,25 @@ static gboolean
gst_cuda_memory_copy_query (GstBaseTransform * trans,
GstPadDirection direction, GstQuery * query)
{
#if defined(HAVE_NVCODEC_GST_GL) || defined(G_OS_WIN32)
#if defined(HAVE_CUDA_GST_GL) || defined(G_OS_WIN32)
GstCudaMemoryCopy *self = GST_CUDA_MEMORY_COPY (trans);
switch (GST_QUERY_TYPE (query)) {
case GST_QUERY_CONTEXT:
{
gboolean ret;
# ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
ret = gst_gl_handle_context_query (GST_ELEMENT (self), query,
self->gl_display, self->gl_context, self->other_gl_context);
if (ret)
return TRUE;
# endif
# ifdef G_OS_WIN32
#endif
#ifdef G_OS_WIN32
ret = gst_d3d11_handle_context_query (GST_ELEMENT (self), query,
self->d3d11_device);
if (ret)
return TRUE;
# endif
#endif
break;
}
default:
@ -831,7 +831,7 @@ gst_cuda_memory_copy_set_info (GstCudaBaseTransform * btrans,
GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY)) {
self->out_type = GST_CUDA_BUFFER_COPY_CUDA;
}
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
if (in_features && gst_caps_features_contains (in_features,
GST_CAPS_FEATURE_MEMORY_GL_MEMORY)) {
self->in_type = GST_CUDA_BUFFER_COPY_GL;
@ -916,7 +916,7 @@ gst_cuda_memory_copy_transform (GstBaseTransform * trans, GstBuffer * inbuf,
} else if (gst_is_cuda_memory (in_mem)) {
in_type = GST_CUDA_BUFFER_COPY_CUDA;
use_device_copy = TRUE;
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
} else if (self->gl_context && gst_is_gl_memory_pbo (in_mem)) {
in_type = GST_CUDA_BUFFER_COPY_GL;
#endif
@ -936,7 +936,7 @@ gst_cuda_memory_copy_transform (GstBaseTransform * trans, GstBuffer * inbuf,
} else if (gst_is_cuda_memory (out_mem)) {
out_type = GST_CUDA_BUFFER_COPY_CUDA;
use_device_copy = TRUE;
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
} else if (self->gl_context && gst_is_gl_memory_pbo (out_mem)) {
out_type = GST_CUDA_BUFFER_COPY_GL;
#endif
@ -1158,7 +1158,7 @@ gst_cuda_memory_copy_register (GstPlugin * plugin, guint rank)
#ifdef HAVE_NVCODEC_NVMM
GstCaps *nvmm_caps = NULL;
#endif
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
GstCaps *gl_caps;
#endif
#ifdef G_OS_WIN32
@ -1185,7 +1185,7 @@ gst_cuda_memory_copy_register (GstPlugin * plugin, guint rank)
(GST_CAPS_FEATURE_MEMORY_CUDA_NVMM_MEMORY, GST_CUDA_NVMM_FORMATS));
}
#endif
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
gl_caps =
gst_caps_from_string (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
(GST_CAPS_FEATURE_MEMORY_GL_MEMORY, GST_CUDA_GL_FORMATS));
@ -1197,7 +1197,7 @@ gst_cuda_memory_copy_register (GstPlugin * plugin, guint rank)
#endif
upload_sink_caps = gst_caps_copy (sys_caps);
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
upload_sink_caps = gst_caps_merge (upload_sink_caps, gst_caps_copy (gl_caps));
#endif
#ifdef G_OS_WIN32
@ -1233,7 +1233,7 @@ gst_cuda_memory_copy_register (GstPlugin * plugin, guint rank)
gst_caps_merge (download_sink_caps, gst_caps_copy (sys_caps));
download_src_caps = sys_caps;
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
download_src_caps = gst_caps_merge (download_src_caps, gl_caps);
#endif
#ifdef G_OS_WIN32

View file

@ -30,7 +30,7 @@
GST_DEBUG_CATEGORY_EXTERN (gst_nvenc_debug);
#define GST_CAT_DEFAULT gst_nvenc_debug
#if HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
#include <gst/gl/gl.h>
#endif
@ -513,7 +513,7 @@ gst_nv_base_enc_set_context (GstElement * element, GstContext * context)
&nvenc->cuda_ctx)) {
goto done;
}
#if HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
gst_gl_handle_set_context (element, context,
(GstGLDisplay **) & nvenc->display,
(GstGLContext **) & nvenc->other_context);
@ -537,7 +537,7 @@ gst_nv_base_enc_sink_query (GstVideoEncoder * enc, GstQuery * query)
query, nvenc->cuda_ctx))
return TRUE;
#if HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
{
gboolean ret;
@ -562,7 +562,7 @@ gst_nv_base_enc_sink_query (GstVideoEncoder * enc, GstQuery * query)
return GST_VIDEO_ENCODER_CLASS (parent_class)->sink_query (enc, query);
}
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
static gboolean
gst_nv_base_enc_ensure_gl_context (GstNvBaseEnc * nvenc)
{
@ -633,7 +633,7 @@ gst_nv_base_enc_propose_allocation (GstVideoEncoder * enc, GstQuery * query)
}
features = gst_caps_get_features (caps, 0);
#if HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
if (features && gst_caps_features_contains (features,
GST_CAPS_FEATURE_MEMORY_GL_MEMORY)) {
GST_DEBUG_OBJECT (nvenc, "upsteram support GL memory");
@ -725,7 +725,7 @@ gst_nv_base_enc_start (GstVideoEncoder * enc)
memset (&nvenc->init_params, 0, sizeof (NV_ENC_INITIALIZE_PARAMS));
memset (&nvenc->config, 0, sizeof (NV_ENC_CONFIG));
#if HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
{
gst_gl_ensure_element_data (GST_ELEMENT (nvenc),
(GstGLDisplay **) & nvenc->display,
@ -1873,7 +1873,7 @@ gst_nv_base_enc_set_format (GstVideoEncoder * enc, GstVideoCodecState * state)
GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY)) {
nvenc->mem_type = GST_NVENC_MEM_TYPE_CUDA;
}
#if HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
else if (gst_caps_features_contains (features,
GST_CAPS_FEATURE_MEMORY_GL_MEMORY)) {
nvenc->mem_type = GST_NVENC_MEM_TYPE_GL;
@ -2011,7 +2011,7 @@ _get_cuda_device_stride (GstVideoInfo * info, guint plane, gsize cuda_stride)
}
}
#if HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
typedef struct _GstNvEncRegisterResourceData
{
GstMemory *mem;
@ -2429,7 +2429,7 @@ gst_nv_base_enc_handle_frame (GstVideoEncoder * enc, GstVideoCodecFrame * frame)
/* reconfigured encode session should start from keyframe */
GST_VIDEO_CODEC_FRAME_SET_FORCE_KEYFRAME (frame);
}
#if HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
if (nvenc->mem_type == GST_NVENC_MEM_TYPE_GL)
in_map_flags |= GST_MAP_GL;
#endif
@ -2477,7 +2477,7 @@ gst_nv_base_enc_handle_frame (GstVideoEncoder * enc, GstVideoCodecFrame * frame)
resource = state->in_buf;
#if HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
if (nvenc->mem_type == GST_NVENC_MEM_TYPE_GL) {
GstGLMemory *gl_mem;
GstNvEncGLMapData data;

View file

@ -46,7 +46,7 @@ enum
PROP_CUDA_DEVICE_ID,
};
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
#define SUPPORTED_GL_APIS (GST_GL_API_OPENGL | GST_GL_API_OPENGL3 | GST_GL_API_GLES2)
static gboolean
@ -58,7 +58,7 @@ static gboolean
gst_nvdec_copy_device_to_memory (GstNvDec * nvdec,
CUVIDPARSERDISPINFO * dispinfo, GstBuffer * output_buffer);
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
typedef struct _GstNvDecRegisterResourceData
{
GstMemory *mem;
@ -148,7 +148,7 @@ ensure_cuda_graphics_resource (GstMemory * mem, GstNvDec * nvdec)
return cgr_info;
}
#endif /* HAVE_NVCODEC_GST_GL */
#endif /* HAVE_CUDA_GST_GL */
static gboolean gst_nvdec_open (GstVideoDecoder * decoder);
static gboolean gst_nvdec_start (GstVideoDecoder * decoder);
@ -167,7 +167,7 @@ static gboolean gst_nvdec_flush (GstVideoDecoder * decoder);
static GstFlowReturn gst_nvdec_drain (GstVideoDecoder * decoder);
static GstFlowReturn gst_nvdec_finish (GstVideoDecoder * decoder);
static gboolean gst_nvdec_negotiate (GstVideoDecoder * decoder);
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
static gboolean gst_nvdec_ensure_gl_context (GstNvDec * nvdec);
#endif
@ -638,7 +638,7 @@ gst_nvdec_negotiate (GstVideoDecoder * decoder)
have_cuda = TRUE;
break;
}
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
if (nvdec->gl_display &&
features && gst_caps_features_contains (features,
GST_CAPS_FEATURE_MEMORY_GL_MEMORY)) {
@ -656,7 +656,7 @@ gst_nvdec_negotiate (GstVideoDecoder * decoder)
gst_clear_caps (&caps);
}
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
if (nvdec->mem_type == GST_NVDEC_MEM_TYPE_GL &&
!gst_nvdec_ensure_gl_context (nvdec)) {
GST_WARNING_OBJECT (nvdec,
@ -671,7 +671,7 @@ gst_nvdec_negotiate (GstVideoDecoder * decoder)
gst_caps_set_features (state->caps, 0,
gst_caps_features_new (GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY, NULL));
break;
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
case GST_NVDEC_MEM_TYPE_GL:
GST_DEBUG_OBJECT (nvdec, "use gl memory");
gst_caps_set_features (state->caps, 0,
@ -828,7 +828,7 @@ parser_display_callback (GstNvDec * nvdec, CUVIDPARSERDISPINFO * dispinfo)
}
}
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
if (nvdec->mem_type == GST_NVDEC_MEM_TYPE_GL) {
copy_ret = gst_nvdec_copy_device_to_gl (nvdec, dispinfo, output_buffer);
@ -910,7 +910,7 @@ gst_nvdec_open (GstVideoDecoder * decoder)
GST_WARNING_OBJECT (nvdec,
"Could not create CUDA stream, will use default stream");
}
#if HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
gst_gl_ensure_element_data (GST_ELEMENT (nvdec),
&nvdec->gl_display, &nvdec->other_gl_context);
if (nvdec->gl_display)
@ -1012,7 +1012,7 @@ gst_nvdec_stop (GstVideoDecoder * decoder)
if (!maybe_destroy_decoder_and_parser (nvdec))
return FALSE;
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
gst_clear_object (&nvdec->gl_context);
gst_clear_object (&nvdec->other_gl_context);
gst_clear_object (&nvdec->gl_display);
@ -1124,7 +1124,7 @@ gst_nvdec_set_format (GstVideoDecoder * decoder, GstVideoCodecState * state)
return ret;
}
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
typedef struct
{
GstNvDec *nvdec;
@ -1760,7 +1760,7 @@ gst_nvdec_finish (GstVideoDecoder * decoder)
return gst_nvdec_drain (decoder);
}
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
static void
gst_nvdec_check_cuda_device_from_context (GstGLContext * context,
gboolean * ret)
@ -1942,7 +1942,7 @@ gst_nvdec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
if (nvdec->mem_type == GST_NVDEC_MEM_TYPE_SYSTEM)
goto done;
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
if (nvdec->mem_type == GST_NVDEC_MEM_TYPE_GL) {
if (!gst_nvdec_ensure_gl_pool (nvdec, query))
return FALSE;
@ -1968,7 +1968,7 @@ gst_nvdec_src_query (GstVideoDecoder * decoder, GstQuery * query)
query, nvdec->cuda_ctx)) {
return TRUE;
}
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
if (gst_gl_handle_context_query (GST_ELEMENT (decoder), query,
nvdec->gl_display, nvdec->gl_context, nvdec->other_gl_context)) {
if (nvdec->gl_display)
@ -1999,7 +1999,7 @@ gst_nvdec_set_context (GstElement * element, GstContext * context)
context, klass->cuda_device_id, &nvdec->cuda_ctx)) {
goto done;
}
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
gst_gl_handle_set_context (element, context, &nvdec->gl_display,
&nvdec->other_gl_context);
#endif

View file

@ -28,7 +28,7 @@
#ifndef __GST_NVDEC_H__
#define __GST_NVDEC_H__
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
#include <gst/gl/gl.h>
#include <gst/gl/gstglfuncs.h>
#endif
@ -70,7 +70,7 @@ struct _GstNvDec
{
GstVideoDecoder parent;
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
GstGLDisplay *gl_display;
GstGLContext *gl_context;
GstGLContext *other_gl_context;

View file

@ -45,7 +45,7 @@
#include "config.h"
#endif
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
#include <gst/gl/gl.h>
#include <gst/gl/gstglfuncs.h>
#endif
@ -63,7 +63,7 @@ extern "C"
#define GST_CAT_DEFAULT gst_nv_decoder_debug
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
#define SUPPORTED_GL_APIS (GstGLAPI) (GST_GL_API_OPENGL | GST_GL_API_OPENGL3)
#endif
@ -405,7 +405,7 @@ gst_nv_decoder_decode (GstNvDecoder * decoder, CUVIDPICPARAMS * params)
return gst_nv_dec_object_decode (decoder->object, params);
}
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
static gboolean
gst_nv_decoder_register_cuda_resource (GstNvDecoder * self, GstMemory * mem,
GstCudaGraphicsResource * resource)
@ -791,7 +791,7 @@ gst_nv_decoder_finish_surface (GstNvDecoder * decoder,
case GST_NV_DECODER_OUTPUT_TYPE_SYSTEM:
ret = gst_nv_decoder_copy_frame_to_system (decoder, surface, outbuf);
break;
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
case GST_NV_DECODER_OUTPUT_TYPE_GL:
g_assert (decoder->gl_context != nullptr);
@ -1065,7 +1065,7 @@ gst_nv_decoder_check_device_caps (CUcontext cuda_ctx, cudaVideoCodec codec,
gst_caps_set_features_simple (cuda_caps,
gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY));
#if HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
{
GstCaps *gl_caps = gst_caps_copy (src_templ);
gst_caps_set_features_simple (gl_caps,
@ -1204,7 +1204,7 @@ gst_nv_decoder_check_device_caps (CUcontext cuda_ctx, cudaVideoCodec codec,
gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY));
/* OpenGL specific */
#if HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
{
GstCaps *gl_caps = gst_caps_copy (src_templ);
gst_caps_set_features_simple (gl_caps,
@ -1273,7 +1273,7 @@ gst_nv_decoder_handle_set_context (GstNvDecoder * decoder,
g_return_val_if_fail (GST_IS_NV_DECODER (decoder), FALSE);
g_return_val_if_fail (GST_IS_ELEMENT (videodec), FALSE);
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
if (gst_gl_handle_set_context (videodec, context,
(GstGLDisplay **) & decoder->gl_display,
(GstGLContext **) & decoder->other_gl_context)) {
@ -1291,7 +1291,7 @@ gst_nv_decoder_handle_context_query (GstNvDecoder * decoder,
g_return_val_if_fail (GST_IS_NV_DECODER (decoder), FALSE);
g_return_val_if_fail (GST_IS_ELEMENT (videodec), FALSE);
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
if (gst_gl_handle_context_query (GST_ELEMENT (videodec), query,
(GstGLDisplay *) decoder->gl_display,
(GstGLContext *) decoder->gl_context,
@ -1306,7 +1306,7 @@ gst_nv_decoder_handle_context_query (GstNvDecoder * decoder,
return FALSE;
}
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
static void
gst_nv_decoder_check_cuda_device_from_context (GstGLContext * context,
gboolean * ret)
@ -1444,7 +1444,7 @@ gst_nv_decoder_negotiate (GstNvDecoder * decoder,
have_cuda = TRUE;
break;
}
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
if (features && gst_caps_features_contains (features,
GST_CAPS_FEATURE_MEMORY_GL_MEMORY)) {
GST_DEBUG_OBJECT (videodec, "found GL memory feature");
@ -1461,7 +1461,7 @@ gst_nv_decoder_negotiate (GstNvDecoder * decoder,
gst_clear_caps (&caps);
}
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
if (decoder->output_type == GST_NV_DECODER_OUTPUT_TYPE_GL &&
!gst_nv_decoder_ensure_gl_context (decoder, GST_ELEMENT (videodec))) {
GST_WARNING_OBJECT (videodec,
@ -1476,7 +1476,7 @@ gst_nv_decoder_negotiate (GstNvDecoder * decoder,
gst_caps_set_features (state->caps, 0,
gst_caps_features_new (GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY, nullptr));
break;
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
case GST_NV_DECODER_OUTPUT_TYPE_GL:
GST_DEBUG_OBJECT (videodec, "using GL memory");
gst_caps_set_features (state->caps, 0,
@ -1558,7 +1558,7 @@ gst_nv_decoder_ensure_cuda_pool (GstNvDecoder * decoder, GstQuery * query)
return TRUE;
}
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
static gboolean
gst_nv_decoder_ensure_gl_pool (GstNvDecoder * decoder, GstQuery * query)
{
@ -1624,7 +1624,7 @@ gst_nv_decoder_decide_allocation (GstNvDecoder * decoder,
case GST_NV_DECODER_OUTPUT_TYPE_SYSTEM:
/* GstVideoDecoder will take care this case */
break;
#ifdef HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
case GST_NV_DECODER_OUTPUT_TYPE_GL:
ret = gst_nv_decoder_ensure_gl_pool (decoder, query);
break;

View file

@ -30,7 +30,7 @@
#include <gmodule.h>
#if HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
#include <gst/gl/gl.h>
#endif
@ -827,7 +827,7 @@ gst_nv_enc_register (GstPlugin * plugin, GUID codec_id, const gchar * codec,
{
GstCaps *cuda_caps = gst_caps_copy (sink_templ);
#if HAVE_NVCODEC_GST_GL
#ifdef HAVE_CUDA_GST_GL
GstCaps *gl_caps = gst_caps_copy (sink_templ);
gst_caps_set_features_simple (gl_caps,
gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_GL_MEMORY));

View file

@ -43,7 +43,7 @@ plugin_incdirs = [configinc, cuda_stubinc]
extra_args = ['-DGST_USE_UNSTABLE_API']
if gstgl_dep.found()
extra_args += ['-DHAVE_NVCODEC_GST_GL=1']
extra_args += ['-DHAVE_CUDA_GST_GL']
endif
if host_system == 'linux'