mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-29 21:21:12 +00:00
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:
parent
b2fcc177f5
commit
59f359eb99
9 changed files with 79 additions and 79 deletions
|
@ -26,7 +26,7 @@
|
||||||
#include "gstcuda-private.h"
|
#include "gstcuda-private.h"
|
||||||
#include <atomic>
|
#include <atomic>
|
||||||
|
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
#include <gst/gl/gl.h>
|
#include <gst/gl/gl.h>
|
||||||
#include <gst/gl/gstglfuncs.h>
|
#include <gst/gl/gstglfuncs.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -612,7 +612,7 @@ gst_cuda_graphics_resource_unmap (GstCudaGraphicsResource * resource,
|
||||||
resource->mapped = FALSE;
|
resource->mapped = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
static void
|
static void
|
||||||
unregister_resource_from_gl_thread (GstGLContext * gl_context,
|
unregister_resource_from_gl_thread (GstGLContext * gl_context,
|
||||||
GstCudaGraphicsResource * resource)
|
GstCudaGraphicsResource * resource)
|
||||||
|
@ -668,7 +668,7 @@ gst_cuda_graphics_resource_free (GstCudaGraphicsResource * resource)
|
||||||
g_return_if_fail (resource != nullptr);
|
g_return_if_fail (resource != nullptr);
|
||||||
|
|
||||||
if (resource->registered) {
|
if (resource->registered) {
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
if (resource->type == GST_CUDA_GRAPHICS_RESOURCE_GL_BUFFER) {
|
if (resource->type == GST_CUDA_GRAPHICS_RESOURCE_GL_BUFFER) {
|
||||||
gst_gl_context_thread_add ((GstGLContext *) resource->graphics_context,
|
gst_gl_context_thread_add ((GstGLContext *) resource->graphics_context,
|
||||||
(GstGLContextThreadFunc) unregister_resource_from_gl_thread,
|
(GstGLContextThreadFunc) unregister_resource_from_gl_thread,
|
||||||
|
@ -1019,7 +1019,7 @@ unmap_and_out:
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
static gboolean
|
static gboolean
|
||||||
ensure_gl_interop (void)
|
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);
|
dst_mem = gst_buffer_peek_memory (dst, 0);
|
||||||
src_mem = gst_buffer_peek_memory (src, 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)) {
|
if (src_type == GST_CUDA_BUFFER_COPY_GL && gst_is_gl_memory_pbo (src_mem)) {
|
||||||
GstGLMemory *gl_mem = (GstGLMemory *) src_mem;
|
GstGLMemory *gl_mem = (GstGLMemory *) src_mem;
|
||||||
GstGLContext *gl_context = gl_mem->mem.context;
|
GstGLContext *gl_context = gl_mem->mem.context;
|
||||||
|
|
|
@ -41,7 +41,7 @@ extra_args = ['-DGST_USE_UNSTABLE_API',
|
||||||
'-DG_LOG_DOMAIN="GStreamer-Cuda"']
|
'-DG_LOG_DOMAIN="GStreamer-Cuda"']
|
||||||
|
|
||||||
if gstgl_dep.found()
|
if gstgl_dep.found()
|
||||||
extra_args += ['-DHAVE_NVCODEC_GST_GL=1']
|
extra_args += ['-DHAVE_CUDA_GST_GL']
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if host_system == 'windows'
|
if host_system == 'windows'
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
#include "gstcudanvmm.h"
|
#include "gstcudanvmm.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
#include <gst/gl/gl.h>
|
#include <gst/gl/gl.h>
|
||||||
#endif
|
#endif
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
|
@ -72,7 +72,7 @@ struct _GstCudaMemoryCopy
|
||||||
|
|
||||||
gboolean downstream_supports_video_meta;
|
gboolean downstream_supports_video_meta;
|
||||||
|
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
GstGLDisplay *gl_display;
|
GstGLDisplay *gl_display;
|
||||||
GstGLContext *gl_context;
|
GstGLContext *gl_context;
|
||||||
GstGLContext *other_gl_context;
|
GstGLContext *other_gl_context;
|
||||||
|
@ -168,13 +168,13 @@ static void
|
||||||
gst_cuda_memory_copy_set_context (GstElement * element, GstContext * context)
|
gst_cuda_memory_copy_set_context (GstElement * element, GstContext * context)
|
||||||
{
|
{
|
||||||
/* CUDA context is handled by parent class, handle only non-CUDA 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);
|
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,
|
gst_gl_handle_set_context (element, context, &self->gl_display,
|
||||||
&self->other_gl_context);
|
&self->other_gl_context);
|
||||||
#endif /* HAVE_NVCODEC_GST_GL */
|
#endif /* HAVE_CUDA_GST_GL */
|
||||||
|
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
GstCudaBaseTransform *base = GST_CUDA_BASE_TRANSFORM (element);
|
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 /* 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);
|
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
|
static gboolean
|
||||||
gst_cuda_memory_copy_transform_stop (GstBaseTransform * trans)
|
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);
|
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_display);
|
||||||
gst_clear_object (&self->gl_context);
|
gst_clear_object (&self->gl_context);
|
||||||
gst_clear_object (&self->other_gl_context);
|
gst_clear_object (&self->other_gl_context);
|
||||||
# endif
|
#endif
|
||||||
# ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
gst_clear_object (&self->d3d11_device);
|
gst_clear_object (&self->d3d11_device);
|
||||||
# endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
return GST_BASE_TRANSFORM_CLASS (parent_class)->stop (trans);
|
return GST_BASE_TRANSFORM_CLASS (parent_class)->stop (trans);
|
||||||
|
@ -297,7 +297,7 @@ create_transform_caps (GstCaps * caps, gboolean to_cuda)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
new_caps = _set_caps_features (caps, GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
|
new_caps = _set_caps_features (caps, GST_CAPS_FEATURE_MEMORY_GL_MEMORY);
|
||||||
ret = gst_caps_merge (ret, new_caps);
|
ret = gst_caps_merge (ret, new_caps);
|
||||||
#endif
|
#endif
|
||||||
|
@ -345,7 +345,7 @@ gst_cuda_memory_copy_transform_caps (GstBaseTransform * trans,
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
static void
|
static void
|
||||||
gst_cuda_memory_copy_ensure_gl_interop (GstGLContext * context, gboolean * ret)
|
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_CAPS_FEATURE_MEMORY_CUDA_MEMORY)) {
|
||||||
GST_DEBUG_OBJECT (self, "upstream support CUDA memory");
|
GST_DEBUG_OBJECT (self, "upstream support CUDA memory");
|
||||||
pool = gst_cuda_buffer_pool_new (ctrans->context);
|
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,
|
} else if (features && gst_caps_features_contains (features,
|
||||||
GST_CAPS_FEATURE_MEMORY_GL_MEMORY) &&
|
GST_CAPS_FEATURE_MEMORY_GL_MEMORY) &&
|
||||||
gst_cuda_memory_copy_ensure_gl_context (self)) {
|
gst_cuda_memory_copy_ensure_gl_context (self)) {
|
||||||
|
@ -612,7 +612,7 @@ gst_cuda_memory_copy_decide_allocation (GstBaseTransform * trans,
|
||||||
gboolean update_pool = FALSE;
|
gboolean update_pool = FALSE;
|
||||||
GstCapsFeatures *features;
|
GstCapsFeatures *features;
|
||||||
gboolean need_cuda = FALSE;
|
gboolean need_cuda = FALSE;
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
gboolean need_gl = FALSE;
|
gboolean need_gl = FALSE;
|
||||||
#endif
|
#endif
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
|
@ -638,7 +638,7 @@ gst_cuda_memory_copy_decide_allocation (GstBaseTransform * trans,
|
||||||
GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY)) {
|
GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY)) {
|
||||||
need_cuda = TRUE;
|
need_cuda = TRUE;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
else if (features && gst_caps_features_contains (features,
|
else if (features && gst_caps_features_contains (features,
|
||||||
GST_CAPS_FEATURE_MEMORY_GL_MEMORY) &&
|
GST_CAPS_FEATURE_MEMORY_GL_MEMORY) &&
|
||||||
gst_cuda_memory_copy_ensure_gl_context (self)) {
|
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");
|
GST_DEBUG_OBJECT (self, "creating cuda pool");
|
||||||
pool = gst_cuda_buffer_pool_new (ctrans->context);
|
pool = gst_cuda_buffer_pool_new (ctrans->context);
|
||||||
}
|
}
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
else if (need_gl) {
|
else if (need_gl) {
|
||||||
GST_DEBUG_OBJECT (self, "creating gl pool");
|
GST_DEBUG_OBJECT (self, "creating gl pool");
|
||||||
pool = gst_gl_buffer_pool_new (self->gl_context);
|
pool = gst_gl_buffer_pool_new (self->gl_context);
|
||||||
|
@ -778,25 +778,25 @@ static gboolean
|
||||||
gst_cuda_memory_copy_query (GstBaseTransform * trans,
|
gst_cuda_memory_copy_query (GstBaseTransform * trans,
|
||||||
GstPadDirection direction, GstQuery * query)
|
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);
|
GstCudaMemoryCopy *self = GST_CUDA_MEMORY_COPY (trans);
|
||||||
|
|
||||||
switch (GST_QUERY_TYPE (query)) {
|
switch (GST_QUERY_TYPE (query)) {
|
||||||
case GST_QUERY_CONTEXT:
|
case GST_QUERY_CONTEXT:
|
||||||
{
|
{
|
||||||
gboolean ret;
|
gboolean ret;
|
||||||
# ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
ret = gst_gl_handle_context_query (GST_ELEMENT (self), query,
|
ret = gst_gl_handle_context_query (GST_ELEMENT (self), query,
|
||||||
self->gl_display, self->gl_context, self->other_gl_context);
|
self->gl_display, self->gl_context, self->other_gl_context);
|
||||||
if (ret)
|
if (ret)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
# endif
|
#endif
|
||||||
# ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
ret = gst_d3d11_handle_context_query (GST_ELEMENT (self), query,
|
ret = gst_d3d11_handle_context_query (GST_ELEMENT (self), query,
|
||||||
self->d3d11_device);
|
self->d3d11_device);
|
||||||
if (ret)
|
if (ret)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
# endif
|
#endif
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -831,7 +831,7 @@ gst_cuda_memory_copy_set_info (GstCudaBaseTransform * btrans,
|
||||||
GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY)) {
|
GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY)) {
|
||||||
self->out_type = GST_CUDA_BUFFER_COPY_CUDA;
|
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,
|
if (in_features && gst_caps_features_contains (in_features,
|
||||||
GST_CAPS_FEATURE_MEMORY_GL_MEMORY)) {
|
GST_CAPS_FEATURE_MEMORY_GL_MEMORY)) {
|
||||||
self->in_type = GST_CUDA_BUFFER_COPY_GL;
|
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)) {
|
} else if (gst_is_cuda_memory (in_mem)) {
|
||||||
in_type = GST_CUDA_BUFFER_COPY_CUDA;
|
in_type = GST_CUDA_BUFFER_COPY_CUDA;
|
||||||
use_device_copy = TRUE;
|
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)) {
|
} else if (self->gl_context && gst_is_gl_memory_pbo (in_mem)) {
|
||||||
in_type = GST_CUDA_BUFFER_COPY_GL;
|
in_type = GST_CUDA_BUFFER_COPY_GL;
|
||||||
#endif
|
#endif
|
||||||
|
@ -936,7 +936,7 @@ gst_cuda_memory_copy_transform (GstBaseTransform * trans, GstBuffer * inbuf,
|
||||||
} else if (gst_is_cuda_memory (out_mem)) {
|
} else if (gst_is_cuda_memory (out_mem)) {
|
||||||
out_type = GST_CUDA_BUFFER_COPY_CUDA;
|
out_type = GST_CUDA_BUFFER_COPY_CUDA;
|
||||||
use_device_copy = TRUE;
|
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)) {
|
} else if (self->gl_context && gst_is_gl_memory_pbo (out_mem)) {
|
||||||
out_type = GST_CUDA_BUFFER_COPY_GL;
|
out_type = GST_CUDA_BUFFER_COPY_GL;
|
||||||
#endif
|
#endif
|
||||||
|
@ -1158,7 +1158,7 @@ gst_cuda_memory_copy_register (GstPlugin * plugin, guint rank)
|
||||||
#ifdef HAVE_NVCODEC_NVMM
|
#ifdef HAVE_NVCODEC_NVMM
|
||||||
GstCaps *nvmm_caps = NULL;
|
GstCaps *nvmm_caps = NULL;
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
GstCaps *gl_caps;
|
GstCaps *gl_caps;
|
||||||
#endif
|
#endif
|
||||||
#ifdef G_OS_WIN32
|
#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));
|
(GST_CAPS_FEATURE_MEMORY_CUDA_NVMM_MEMORY, GST_CUDA_NVMM_FORMATS));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
gl_caps =
|
gl_caps =
|
||||||
gst_caps_from_string (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
|
gst_caps_from_string (GST_VIDEO_CAPS_MAKE_WITH_FEATURES
|
||||||
(GST_CAPS_FEATURE_MEMORY_GL_MEMORY, GST_CUDA_GL_FORMATS));
|
(GST_CAPS_FEATURE_MEMORY_GL_MEMORY, GST_CUDA_GL_FORMATS));
|
||||||
|
@ -1197,7 +1197,7 @@ gst_cuda_memory_copy_register (GstPlugin * plugin, guint rank)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
upload_sink_caps = gst_caps_copy (sys_caps);
|
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));
|
upload_sink_caps = gst_caps_merge (upload_sink_caps, gst_caps_copy (gl_caps));
|
||||||
#endif
|
#endif
|
||||||
#ifdef G_OS_WIN32
|
#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));
|
gst_caps_merge (download_sink_caps, gst_caps_copy (sys_caps));
|
||||||
|
|
||||||
download_src_caps = 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);
|
download_src_caps = gst_caps_merge (download_src_caps, gl_caps);
|
||||||
#endif
|
#endif
|
||||||
#ifdef G_OS_WIN32
|
#ifdef G_OS_WIN32
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
GST_DEBUG_CATEGORY_EXTERN (gst_nvenc_debug);
|
GST_DEBUG_CATEGORY_EXTERN (gst_nvenc_debug);
|
||||||
#define GST_CAT_DEFAULT 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>
|
#include <gst/gl/gl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -513,7 +513,7 @@ gst_nv_base_enc_set_context (GstElement * element, GstContext * context)
|
||||||
&nvenc->cuda_ctx)) {
|
&nvenc->cuda_ctx)) {
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
#if HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
gst_gl_handle_set_context (element, context,
|
gst_gl_handle_set_context (element, context,
|
||||||
(GstGLDisplay **) & nvenc->display,
|
(GstGLDisplay **) & nvenc->display,
|
||||||
(GstGLContext **) & nvenc->other_context);
|
(GstGLContext **) & nvenc->other_context);
|
||||||
|
@ -537,7 +537,7 @@ gst_nv_base_enc_sink_query (GstVideoEncoder * enc, GstQuery * query)
|
||||||
query, nvenc->cuda_ctx))
|
query, nvenc->cuda_ctx))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
#if HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
{
|
{
|
||||||
gboolean ret;
|
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);
|
return GST_VIDEO_ENCODER_CLASS (parent_class)->sink_query (enc, query);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_nv_base_enc_ensure_gl_context (GstNvBaseEnc * nvenc)
|
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);
|
features = gst_caps_get_features (caps, 0);
|
||||||
#if HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
if (features && gst_caps_features_contains (features,
|
if (features && gst_caps_features_contains (features,
|
||||||
GST_CAPS_FEATURE_MEMORY_GL_MEMORY)) {
|
GST_CAPS_FEATURE_MEMORY_GL_MEMORY)) {
|
||||||
GST_DEBUG_OBJECT (nvenc, "upsteram support 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->init_params, 0, sizeof (NV_ENC_INITIALIZE_PARAMS));
|
||||||
memset (&nvenc->config, 0, sizeof (NV_ENC_CONFIG));
|
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),
|
gst_gl_ensure_element_data (GST_ELEMENT (nvenc),
|
||||||
(GstGLDisplay **) & nvenc->display,
|
(GstGLDisplay **) & nvenc->display,
|
||||||
|
@ -1873,7 +1873,7 @@ gst_nv_base_enc_set_format (GstVideoEncoder * enc, GstVideoCodecState * state)
|
||||||
GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY)) {
|
GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY)) {
|
||||||
nvenc->mem_type = GST_NVENC_MEM_TYPE_CUDA;
|
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,
|
else if (gst_caps_features_contains (features,
|
||||||
GST_CAPS_FEATURE_MEMORY_GL_MEMORY)) {
|
GST_CAPS_FEATURE_MEMORY_GL_MEMORY)) {
|
||||||
nvenc->mem_type = GST_NVENC_MEM_TYPE_GL;
|
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
|
typedef struct _GstNvEncRegisterResourceData
|
||||||
{
|
{
|
||||||
GstMemory *mem;
|
GstMemory *mem;
|
||||||
|
@ -2429,7 +2429,7 @@ gst_nv_base_enc_handle_frame (GstVideoEncoder * enc, GstVideoCodecFrame * frame)
|
||||||
/* reconfigured encode session should start from keyframe */
|
/* reconfigured encode session should start from keyframe */
|
||||||
GST_VIDEO_CODEC_FRAME_SET_FORCE_KEYFRAME (frame);
|
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)
|
if (nvenc->mem_type == GST_NVENC_MEM_TYPE_GL)
|
||||||
in_map_flags |= GST_MAP_GL;
|
in_map_flags |= GST_MAP_GL;
|
||||||
#endif
|
#endif
|
||||||
|
@ -2477,7 +2477,7 @@ gst_nv_base_enc_handle_frame (GstVideoEncoder * enc, GstVideoCodecFrame * frame)
|
||||||
|
|
||||||
resource = state->in_buf;
|
resource = state->in_buf;
|
||||||
|
|
||||||
#if HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
if (nvenc->mem_type == GST_NVENC_MEM_TYPE_GL) {
|
if (nvenc->mem_type == GST_NVENC_MEM_TYPE_GL) {
|
||||||
GstGLMemory *gl_mem;
|
GstGLMemory *gl_mem;
|
||||||
GstNvEncGLMapData data;
|
GstNvEncGLMapData data;
|
||||||
|
|
|
@ -46,7 +46,7 @@ enum
|
||||||
PROP_CUDA_DEVICE_ID,
|
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)
|
#define SUPPORTED_GL_APIS (GST_GL_API_OPENGL | GST_GL_API_OPENGL3 | GST_GL_API_GLES2)
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
|
@ -58,7 +58,7 @@ static gboolean
|
||||||
gst_nvdec_copy_device_to_memory (GstNvDec * nvdec,
|
gst_nvdec_copy_device_to_memory (GstNvDec * nvdec,
|
||||||
CUVIDPARSERDISPINFO * dispinfo, GstBuffer * output_buffer);
|
CUVIDPARSERDISPINFO * dispinfo, GstBuffer * output_buffer);
|
||||||
|
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
typedef struct _GstNvDecRegisterResourceData
|
typedef struct _GstNvDecRegisterResourceData
|
||||||
{
|
{
|
||||||
GstMemory *mem;
|
GstMemory *mem;
|
||||||
|
@ -148,7 +148,7 @@ ensure_cuda_graphics_resource (GstMemory * mem, GstNvDec * nvdec)
|
||||||
|
|
||||||
return cgr_info;
|
return cgr_info;
|
||||||
}
|
}
|
||||||
#endif /* HAVE_NVCODEC_GST_GL */
|
#endif /* HAVE_CUDA_GST_GL */
|
||||||
|
|
||||||
static gboolean gst_nvdec_open (GstVideoDecoder * decoder);
|
static gboolean gst_nvdec_open (GstVideoDecoder * decoder);
|
||||||
static gboolean gst_nvdec_start (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_drain (GstVideoDecoder * decoder);
|
||||||
static GstFlowReturn gst_nvdec_finish (GstVideoDecoder * decoder);
|
static GstFlowReturn gst_nvdec_finish (GstVideoDecoder * decoder);
|
||||||
static gboolean gst_nvdec_negotiate (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);
|
static gboolean gst_nvdec_ensure_gl_context (GstNvDec * nvdec);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -638,7 +638,7 @@ gst_nvdec_negotiate (GstVideoDecoder * decoder)
|
||||||
have_cuda = TRUE;
|
have_cuda = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
if (nvdec->gl_display &&
|
if (nvdec->gl_display &&
|
||||||
features && gst_caps_features_contains (features,
|
features && gst_caps_features_contains (features,
|
||||||
GST_CAPS_FEATURE_MEMORY_GL_MEMORY)) {
|
GST_CAPS_FEATURE_MEMORY_GL_MEMORY)) {
|
||||||
|
@ -656,7 +656,7 @@ gst_nvdec_negotiate (GstVideoDecoder * decoder)
|
||||||
gst_clear_caps (&caps);
|
gst_clear_caps (&caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
if (nvdec->mem_type == GST_NVDEC_MEM_TYPE_GL &&
|
if (nvdec->mem_type == GST_NVDEC_MEM_TYPE_GL &&
|
||||||
!gst_nvdec_ensure_gl_context (nvdec)) {
|
!gst_nvdec_ensure_gl_context (nvdec)) {
|
||||||
GST_WARNING_OBJECT (nvdec,
|
GST_WARNING_OBJECT (nvdec,
|
||||||
|
@ -671,7 +671,7 @@ gst_nvdec_negotiate (GstVideoDecoder * decoder)
|
||||||
gst_caps_set_features (state->caps, 0,
|
gst_caps_set_features (state->caps, 0,
|
||||||
gst_caps_features_new (GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY, NULL));
|
gst_caps_features_new (GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY, NULL));
|
||||||
break;
|
break;
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
case GST_NVDEC_MEM_TYPE_GL:
|
case GST_NVDEC_MEM_TYPE_GL:
|
||||||
GST_DEBUG_OBJECT (nvdec, "use gl memory");
|
GST_DEBUG_OBJECT (nvdec, "use gl memory");
|
||||||
gst_caps_set_features (state->caps, 0,
|
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) {
|
if (nvdec->mem_type == GST_NVDEC_MEM_TYPE_GL) {
|
||||||
copy_ret = gst_nvdec_copy_device_to_gl (nvdec, dispinfo, output_buffer);
|
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,
|
GST_WARNING_OBJECT (nvdec,
|
||||||
"Could not create CUDA stream, will use default stream");
|
"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),
|
gst_gl_ensure_element_data (GST_ELEMENT (nvdec),
|
||||||
&nvdec->gl_display, &nvdec->other_gl_context);
|
&nvdec->gl_display, &nvdec->other_gl_context);
|
||||||
if (nvdec->gl_display)
|
if (nvdec->gl_display)
|
||||||
|
@ -1012,7 +1012,7 @@ gst_nvdec_stop (GstVideoDecoder * decoder)
|
||||||
if (!maybe_destroy_decoder_and_parser (nvdec))
|
if (!maybe_destroy_decoder_and_parser (nvdec))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
gst_clear_object (&nvdec->gl_context);
|
gst_clear_object (&nvdec->gl_context);
|
||||||
gst_clear_object (&nvdec->other_gl_context);
|
gst_clear_object (&nvdec->other_gl_context);
|
||||||
gst_clear_object (&nvdec->gl_display);
|
gst_clear_object (&nvdec->gl_display);
|
||||||
|
@ -1124,7 +1124,7 @@ gst_nvdec_set_format (GstVideoDecoder * decoder, GstVideoCodecState * state)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
GstNvDec *nvdec;
|
GstNvDec *nvdec;
|
||||||
|
@ -1760,7 +1760,7 @@ gst_nvdec_finish (GstVideoDecoder * decoder)
|
||||||
return gst_nvdec_drain (decoder);
|
return gst_nvdec_drain (decoder);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
static void
|
static void
|
||||||
gst_nvdec_check_cuda_device_from_context (GstGLContext * context,
|
gst_nvdec_check_cuda_device_from_context (GstGLContext * context,
|
||||||
gboolean * ret)
|
gboolean * ret)
|
||||||
|
@ -1942,7 +1942,7 @@ gst_nvdec_decide_allocation (GstVideoDecoder * decoder, GstQuery * query)
|
||||||
if (nvdec->mem_type == GST_NVDEC_MEM_TYPE_SYSTEM)
|
if (nvdec->mem_type == GST_NVDEC_MEM_TYPE_SYSTEM)
|
||||||
goto done;
|
goto done;
|
||||||
|
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
if (nvdec->mem_type == GST_NVDEC_MEM_TYPE_GL) {
|
if (nvdec->mem_type == GST_NVDEC_MEM_TYPE_GL) {
|
||||||
if (!gst_nvdec_ensure_gl_pool (nvdec, query))
|
if (!gst_nvdec_ensure_gl_pool (nvdec, query))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
@ -1968,7 +1968,7 @@ gst_nvdec_src_query (GstVideoDecoder * decoder, GstQuery * query)
|
||||||
query, nvdec->cuda_ctx)) {
|
query, nvdec->cuda_ctx)) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
if (gst_gl_handle_context_query (GST_ELEMENT (decoder), query,
|
if (gst_gl_handle_context_query (GST_ELEMENT (decoder), query,
|
||||||
nvdec->gl_display, nvdec->gl_context, nvdec->other_gl_context)) {
|
nvdec->gl_display, nvdec->gl_context, nvdec->other_gl_context)) {
|
||||||
if (nvdec->gl_display)
|
if (nvdec->gl_display)
|
||||||
|
@ -1999,7 +1999,7 @@ gst_nvdec_set_context (GstElement * element, GstContext * context)
|
||||||
context, klass->cuda_device_id, &nvdec->cuda_ctx)) {
|
context, klass->cuda_device_id, &nvdec->cuda_ctx)) {
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
gst_gl_handle_set_context (element, context, &nvdec->gl_display,
|
gst_gl_handle_set_context (element, context, &nvdec->gl_display,
|
||||||
&nvdec->other_gl_context);
|
&nvdec->other_gl_context);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
#ifndef __GST_NVDEC_H__
|
#ifndef __GST_NVDEC_H__
|
||||||
#define __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/gl.h>
|
||||||
#include <gst/gl/gstglfuncs.h>
|
#include <gst/gl/gstglfuncs.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -70,7 +70,7 @@ struct _GstNvDec
|
||||||
{
|
{
|
||||||
GstVideoDecoder parent;
|
GstVideoDecoder parent;
|
||||||
|
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
GstGLDisplay *gl_display;
|
GstGLDisplay *gl_display;
|
||||||
GstGLContext *gl_context;
|
GstGLContext *gl_context;
|
||||||
GstGLContext *other_gl_context;
|
GstGLContext *other_gl_context;
|
||||||
|
|
|
@ -45,7 +45,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
#include <gst/gl/gl.h>
|
#include <gst/gl/gl.h>
|
||||||
#include <gst/gl/gstglfuncs.h>
|
#include <gst/gl/gstglfuncs.h>
|
||||||
#endif
|
#endif
|
||||||
|
@ -63,7 +63,7 @@ extern "C"
|
||||||
|
|
||||||
#define GST_CAT_DEFAULT gst_nv_decoder_debug
|
#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)
|
#define SUPPORTED_GL_APIS (GstGLAPI) (GST_GL_API_OPENGL | GST_GL_API_OPENGL3)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -405,7 +405,7 @@ gst_nv_decoder_decode (GstNvDecoder * decoder, CUVIDPICPARAMS * params)
|
||||||
return gst_nv_dec_object_decode (decoder->object, params);
|
return gst_nv_dec_object_decode (decoder->object, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_nv_decoder_register_cuda_resource (GstNvDecoder * self, GstMemory * mem,
|
gst_nv_decoder_register_cuda_resource (GstNvDecoder * self, GstMemory * mem,
|
||||||
GstCudaGraphicsResource * resource)
|
GstCudaGraphicsResource * resource)
|
||||||
|
@ -791,7 +791,7 @@ gst_nv_decoder_finish_surface (GstNvDecoder * decoder,
|
||||||
case GST_NV_DECODER_OUTPUT_TYPE_SYSTEM:
|
case GST_NV_DECODER_OUTPUT_TYPE_SYSTEM:
|
||||||
ret = gst_nv_decoder_copy_frame_to_system (decoder, surface, outbuf);
|
ret = gst_nv_decoder_copy_frame_to_system (decoder, surface, outbuf);
|
||||||
break;
|
break;
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
case GST_NV_DECODER_OUTPUT_TYPE_GL:
|
case GST_NV_DECODER_OUTPUT_TYPE_GL:
|
||||||
g_assert (decoder->gl_context != nullptr);
|
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_set_features_simple (cuda_caps,
|
||||||
gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY));
|
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);
|
GstCaps *gl_caps = gst_caps_copy (src_templ);
|
||||||
gst_caps_set_features_simple (gl_caps,
|
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));
|
gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY));
|
||||||
|
|
||||||
/* OpenGL specific */
|
/* OpenGL specific */
|
||||||
#if HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
{
|
{
|
||||||
GstCaps *gl_caps = gst_caps_copy (src_templ);
|
GstCaps *gl_caps = gst_caps_copy (src_templ);
|
||||||
gst_caps_set_features_simple (gl_caps,
|
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_NV_DECODER (decoder), FALSE);
|
||||||
g_return_val_if_fail (GST_IS_ELEMENT (videodec), 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,
|
if (gst_gl_handle_set_context (videodec, context,
|
||||||
(GstGLDisplay **) & decoder->gl_display,
|
(GstGLDisplay **) & decoder->gl_display,
|
||||||
(GstGLContext **) & decoder->other_gl_context)) {
|
(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_NV_DECODER (decoder), FALSE);
|
||||||
g_return_val_if_fail (GST_IS_ELEMENT (videodec), 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,
|
if (gst_gl_handle_context_query (GST_ELEMENT (videodec), query,
|
||||||
(GstGLDisplay *) decoder->gl_display,
|
(GstGLDisplay *) decoder->gl_display,
|
||||||
(GstGLContext *) decoder->gl_context,
|
(GstGLContext *) decoder->gl_context,
|
||||||
|
@ -1306,7 +1306,7 @@ gst_nv_decoder_handle_context_query (GstNvDecoder * decoder,
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
static void
|
static void
|
||||||
gst_nv_decoder_check_cuda_device_from_context (GstGLContext * context,
|
gst_nv_decoder_check_cuda_device_from_context (GstGLContext * context,
|
||||||
gboolean * ret)
|
gboolean * ret)
|
||||||
|
@ -1444,7 +1444,7 @@ gst_nv_decoder_negotiate (GstNvDecoder * decoder,
|
||||||
have_cuda = TRUE;
|
have_cuda = TRUE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
if (features && gst_caps_features_contains (features,
|
if (features && gst_caps_features_contains (features,
|
||||||
GST_CAPS_FEATURE_MEMORY_GL_MEMORY)) {
|
GST_CAPS_FEATURE_MEMORY_GL_MEMORY)) {
|
||||||
GST_DEBUG_OBJECT (videodec, "found GL memory feature");
|
GST_DEBUG_OBJECT (videodec, "found GL memory feature");
|
||||||
|
@ -1461,7 +1461,7 @@ gst_nv_decoder_negotiate (GstNvDecoder * decoder,
|
||||||
gst_clear_caps (&caps);
|
gst_clear_caps (&caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
if (decoder->output_type == GST_NV_DECODER_OUTPUT_TYPE_GL &&
|
if (decoder->output_type == GST_NV_DECODER_OUTPUT_TYPE_GL &&
|
||||||
!gst_nv_decoder_ensure_gl_context (decoder, GST_ELEMENT (videodec))) {
|
!gst_nv_decoder_ensure_gl_context (decoder, GST_ELEMENT (videodec))) {
|
||||||
GST_WARNING_OBJECT (videodec,
|
GST_WARNING_OBJECT (videodec,
|
||||||
|
@ -1476,7 +1476,7 @@ gst_nv_decoder_negotiate (GstNvDecoder * decoder,
|
||||||
gst_caps_set_features (state->caps, 0,
|
gst_caps_set_features (state->caps, 0,
|
||||||
gst_caps_features_new (GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY, nullptr));
|
gst_caps_features_new (GST_CAPS_FEATURE_MEMORY_CUDA_MEMORY, nullptr));
|
||||||
break;
|
break;
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
case GST_NV_DECODER_OUTPUT_TYPE_GL:
|
case GST_NV_DECODER_OUTPUT_TYPE_GL:
|
||||||
GST_DEBUG_OBJECT (videodec, "using GL memory");
|
GST_DEBUG_OBJECT (videodec, "using GL memory");
|
||||||
gst_caps_set_features (state->caps, 0,
|
gst_caps_set_features (state->caps, 0,
|
||||||
|
@ -1558,7 +1558,7 @@ gst_nv_decoder_ensure_cuda_pool (GstNvDecoder * decoder, GstQuery * query)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_nv_decoder_ensure_gl_pool (GstNvDecoder * decoder, GstQuery * query)
|
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:
|
case GST_NV_DECODER_OUTPUT_TYPE_SYSTEM:
|
||||||
/* GstVideoDecoder will take care this case */
|
/* GstVideoDecoder will take care this case */
|
||||||
break;
|
break;
|
||||||
#ifdef HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
case GST_NV_DECODER_OUTPUT_TYPE_GL:
|
case GST_NV_DECODER_OUTPUT_TYPE_GL:
|
||||||
ret = gst_nv_decoder_ensure_gl_pool (decoder, query);
|
ret = gst_nv_decoder_ensure_gl_pool (decoder, query);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -30,7 +30,7 @@
|
||||||
|
|
||||||
#include <gmodule.h>
|
#include <gmodule.h>
|
||||||
|
|
||||||
#if HAVE_NVCODEC_GST_GL
|
#ifdef HAVE_CUDA_GST_GL
|
||||||
#include <gst/gl/gl.h>
|
#include <gst/gl/gl.h>
|
||||||
#endif
|
#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);
|
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);
|
GstCaps *gl_caps = gst_caps_copy (sink_templ);
|
||||||
gst_caps_set_features_simple (gl_caps,
|
gst_caps_set_features_simple (gl_caps,
|
||||||
gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_GL_MEMORY));
|
gst_caps_features_from_string (GST_CAPS_FEATURE_MEMORY_GL_MEMORY));
|
||||||
|
|
|
@ -43,7 +43,7 @@ plugin_incdirs = [configinc, cuda_stubinc]
|
||||||
extra_args = ['-DGST_USE_UNSTABLE_API']
|
extra_args = ['-DGST_USE_UNSTABLE_API']
|
||||||
|
|
||||||
if gstgl_dep.found()
|
if gstgl_dep.found()
|
||||||
extra_args += ['-DHAVE_NVCODEC_GST_GL=1']
|
extra_args += ['-DHAVE_CUDA_GST_GL']
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if host_system == 'linux'
|
if host_system == 'linux'
|
||||||
|
|
Loading…
Reference in a new issue