From e6585c89ea2232b46d3e8b53d097f629916f8583 Mon Sep 17 00:00:00 2001 From: Seungha Yang Date: Thu, 8 Dec 2022 05:58:48 +0900 Subject: [PATCH] cuda: Hide memory copy util function The method was intended to be used by only cudaupload/download elements and not ready to be a part of public API Part-of: --- .../gst-libs/gst/cuda/gstcuda-private.h | 52 +++++++++++++++++ .../gst-libs/gst/cuda/gstcudautils.c | 1 + .../gst-libs/gst/cuda/gstcudautils.h | 57 ------------------- .../sys/nvcodec/gstcudamemorycopy.c | 1 + 4 files changed, 54 insertions(+), 57 deletions(-) create mode 100644 subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcuda-private.h diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcuda-private.h b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcuda-private.h new file mode 100644 index 0000000000..e8c4eff2a4 --- /dev/null +++ b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcuda-private.h @@ -0,0 +1,52 @@ +/* GStreamer + * Copyright (C) 2022 Seungha Yang + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#pragma once + +#include "cuda-prelude.h" +#include "cuda-gst.h" + +#include + +G_BEGIN_DECLS + +typedef enum +{ + GST_CUDA_BUFFER_COPY_SYSTEM, + GST_CUDA_BUFFER_COPY_CUDA, + GST_CUDA_BUFFER_COPY_GL, + GST_CUDA_BUFFER_COPY_D3D11, + GST_CUDA_BUFFER_COPY_NVMM, +} GstCudaBufferCopyType; + +GST_CUDA_API +const gchar * gst_cuda_buffer_copy_type_to_string (GstCudaBufferCopyType type); + +GST_CUDA_API +gboolean gst_cuda_buffer_copy (GstBuffer * dst, + GstCudaBufferCopyType dst_type, + const GstVideoInfo * dst_info, + GstBuffer * src, + GstCudaBufferCopyType src_type, + const GstVideoInfo * src_info, + GstCudaContext * context, + CUstream stream); + +G_END_DECLS + diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.c b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.c index f4d5f5d002..647e23e049 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.c +++ b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.c @@ -23,6 +23,7 @@ #include "gstcudautils.h" #include "gstcudacontext.h" +#include "gstcuda-private.h" #ifdef HAVE_NVCODEC_GST_GL #include diff --git a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.h b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.h index 8bccb8f6cf..eb680c4917 100644 --- a/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.h +++ b/subprojects/gst-plugins-bad/gst-libs/gst/cuda/gstcudautils.h @@ -184,63 +184,6 @@ void gst_cuda_graphics_resource_unmap (GstCudaGraphicsResource * reso GST_CUDA_API void gst_cuda_graphics_resource_free (GstCudaGraphicsResource * resource); -/** - * GstCudaBufferCopyType: - * @GST_CUDA_BUFFER_COPY_SYSTEM: Copy from/to system memory - * @GST_CUDA_BUFFER_COPY_CUDA: Copy from/to cuda memory - * @GST_CUDA_BUFFER_COPY_GL: Copy from/to GL memory - * @GST_CUDA_BUFFER_COPY_D3D11: Copy from/to D3D11 memory - * @GST_CUDA_BUFFER_COPY_NVMM: Copy from/to NVMM memory - * - * Since: 1.22 - */ -typedef enum -{ - GST_CUDA_BUFFER_COPY_SYSTEM, - GST_CUDA_BUFFER_COPY_CUDA, - GST_CUDA_BUFFER_COPY_GL, - GST_CUDA_BUFFER_COPY_D3D11, - GST_CUDA_BUFFER_COPY_NVMM, -} GstCudaBufferCopyType; - -/** - * gst_cuda_buffer_copy_type_to_string: - * @type: The #GstCudaBufferCopyType to get name from - * - * Returns: The human readable name of @type - * - * Since: 1.22 - */ -GST_CUDA_API -const gchar * gst_cuda_buffer_copy_type_to_string (GstCudaBufferCopyType type); - -/** - * gst_cuda_buffer_copy: - * @dst: The buffer into which to copy @src content - * @dst_type: The #GstCudaBufferCopyType to copy @src into - * @dst_info: #GstVideoInfo defining @dst - * @src: The source buffer to copy - * @src_type: The #GstCudaBufferCopyType @src is in - * @src_info: $GstVideoInfo defining @src - * @context: The #GstCudaContext to use to copy @src into @dst - * @stream: The @CUStream to use to copy @src into @dst - * - * Copies @src into @dst with the specified arguments. - * - * Returns: %TRUE if the buffer could be copied %FALSE otherwise - * - * Since: 1.22 - */ -GST_CUDA_API -gboolean gst_cuda_buffer_copy (GstBuffer * dst, - GstCudaBufferCopyType dst_type, - const GstVideoInfo * dst_info, - GstBuffer * src, - GstCudaBufferCopyType src_type, - const GstVideoInfo * src_info, - GstCudaContext * context, - CUstream stream); - G_END_DECLS #endif /* __GST_CUDA_UTILS_H__ */ diff --git a/subprojects/gst-plugins-bad/sys/nvcodec/gstcudamemorycopy.c b/subprojects/gst-plugins-bad/sys/nvcodec/gstcudamemorycopy.c index 3961ee89fc..0a70adc3a4 100644 --- a/subprojects/gst-plugins-bad/sys/nvcodec/gstcudamemorycopy.c +++ b/subprojects/gst-plugins-bad/sys/nvcodec/gstcudamemorycopy.c @@ -42,6 +42,7 @@ #include "gstcudamemorycopy.h" #include "gstcudaformat.h" #include +#include #ifdef HAVE_NVCODEC_NVMM #include "gstcudanvmm.h" #endif