NVIDIA DeepStream SDK API Reference

9.2 Release
9.2/sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2014-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
18 
19 #ifndef __GST_NVVIDEOCONVERT_H__
20 #define __GST_NVVIDEOCONVERT_H__
21 
22 #include <gst/gst.h>
23 #include <gst/video/video.h>
24 #include <gst/base/gstbasetransform.h>
25 
26 #include <cuda.h>
27 #include <cuda_runtime.h>
28 #include "gstnvdsbufferpool.h"
29 #include "nvbufsurface.h"
30 #include "nvbufsurftransform.h"
31 //#ifndef __aarch64__
32 #include "gst-nvquery.h"
33 #include "gst-nvquery-internal.h"
34 //#endif
35 
36 G_BEGIN_DECLS
37 #define GST_TYPE_NVVIDEOCONVERT \
38  (gst_nvvideoconvert_get_type())
39 #define GST_NVVIDEOCONVERT(obj) \
40  (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_NVVIDEOCONVERT,Gstnvvideoconvert))
41 #define GST_NVVIDEOCONVERT_CLASS(klass) \
42  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_NVVIDEOCONVERT,GstnvvideoconvertClass))
43 #define GST_IS_NVVIDEOCONVERT(obj) \
44  (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_NVVIDEOCONVERT))
45 #define GST_IS_NVVIDEOCONVERT_CLASS(klass) \
46  (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_NVVIDEOCONVERT))
47 
48 /* Name of package */
49 #define PACKAGE "nvvideoconvert"
50 /* Define to the full name of this package. */
51 #define PACKAGE_NAME "GStreamer nvvideoconvert Plugin"
52 /* Define to the full name and version of this package. */
53 #define PACKAGE_STRING "GStreamer nvvideoconvert 1.2.3"
54 /* Information about the purpose of the plugin. */
55 #define PACKAGE_DESCRIPTION "video Colorspace conversion & scaler"
56 /* Define to the home page for this package. */
57 #define PACKAGE_URL "http://nvidia.com/"
58 /* Define to the version of this package. */
59 #define PACKAGE_VERSION "1.2.3"
60 /* Define under which licence the package has been released */
61 #define PACKAGE_LICENSE "Proprietary"
62 /* Version number of package */
63 #define VERSION "1.2.3"
64 
65 #define NVRM_MAX_SURFACES 3
66 #define NVFILTER_MAX_BUF 4
67 #define GST_CAPS_FEATURE_MEMORY_NVMM "memory:NVMM"
68 #define GST_NVSTREAM_MEMORY_TYPE "nvstream"
69 
72 
75 
81 typedef enum
82 {
87 } BufType;
88 
94 typedef enum
95 {
98 } BufMemType;
99 
105 typedef enum
106 {
116 
117 
124 {
125  gint dmabuf_fd;
127 };
128 
134 struct _GstNvInterBuffer
135 {
136  gint idmabuf_fd;
137 };
138 
144 struct _Gstnvvideoconvert
145 {
146  GstBaseTransform element;
147 
148  /* source and sink pad caps */
149  GstCaps *sinkcaps;
150  GstCaps *srccaps;
151 
152  gint to_width;
153  gint to_height;
154  gint from_width;
155  gint from_height;
156  gint tsurf_width;
157  gint tsurf_height;
158  gint compute_hw;
159  gint gpu_id;
160  gint nvbuf_mem_type;
161  gint copy_hw;
162 
163  gint src_crop_left;
164  gint src_crop_top;
165  gint src_crop_width;
166  gint src_crop_height;
167 
168  gint dst_crop_left;
169  gint dst_crop_top;
170  gint dst_crop_width;
171  gint dst_crop_height;
172 
173 
177  GstVideoInfo in_info;
178  GstVideoInfo out_info;
179 
186 
187  guint insurf_count;
188  guint tsurf_count;
189  guint isurf_count;
190  guint ibuf_count;
191  gint flip_method;
192  guint num_output_buf;
194 
195  gboolean silent;
196  gboolean no_dimension;
197  gboolean do_scaling;
198  gboolean do_flip;
199  gboolean do_src_cropping;
200  gboolean do_dst_cropping;
201  gboolean do_mem_type_conversion;
202  gboolean do_gpu_id_conversion;
203  gboolean need_intersurf;
204  gboolean isurf_flag;
205  gboolean negotiated;
206  gboolean nvfilterpool;
207  gboolean enable_blocklinear_output;
208  gboolean allow_odd_crop;
209  gboolean enable_contiguous_bufs;
210  gboolean disable_passthrough;
211  GstBufferPool *pool;
212  GMutex flow_lock;
213 
215  guint num_batch_buffers;
216  guint session_created;
217 };
218 
220 {
221  GstBaseTransformClass parent_class;
222 };
223 
224 GType gst_nvvideoconvert_get_type (void);
225 
226 G_END_DECLS
227 #endif /* __GST_NVVIDEOCONVERT_H__ */
_Gstnvvideoconvert::num_output_buf
guint num_output_buf
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:192
_Gstnvvideoconvert::isurf_count
guint isurf_count
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:189
_Gstnvvideoconvert::do_flip
gboolean do_flip
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:198
GST_VIDEO_NVFLIP_METHOD_VERT
@ GST_VIDEO_NVFLIP_METHOD_VERT
Definition: 9.2/sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:113
_GstnvvideoconvertClass::parent_class
GstBaseTransformClass parent_class
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:221
BufMemType
BufMemType
BufMemType:
Definition: 9.2/sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:94
_Gstnvvideoconvert::from_width
gint from_width
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:154
BUF_MEM_HW
@ BUF_MEM_HW
Definition: 9.2/sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:97
_Gstnvvideoconvert::intermediate_buffer
NvBufSurface * intermediate_buffer
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:184
_Gstnvvideoconvert::srccaps
GstCaps * srccaps
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:150
_Gstnvvideoconvert::disable_passthrough
gboolean disable_passthrough
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:210
BufType
BufType
BufType:
Definition: 9.2/sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:81
_Gstnvvideoconvert::tsurf_count
guint tsurf_count
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:188
_Gstnvvideoconvert::dst_crop_left
gint dst_crop_left
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:168
_Gstnvvideoconvert::out_info
GstVideoInfo out_info
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:178
_Gstnvvideoconvert::do_scaling
gboolean do_scaling
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:197
_Gstnvvideoconvert::gpu_id
gint gpu_id
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:159
_GstnvvideoconvertClass
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:219
_NvBufSurfaceTransformParams
Holds transform parameters for a transform call.
Definition: includes/nvbufsurftransform.h:201
BUF_TYPE_YUV
@ BUF_TYPE_YUV
Definition: 9.2/sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:83
BufMemType
BufMemType
BufMemType:
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:94
_Gstnvvideoconvert::src_crop_top
gint src_crop_top
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:164
_Gstnvvideoconvert::compute_hw
gint compute_hw
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:158
NvBufSurface
Holds information about batched buffers.
Definition: includes/nvbufsurface.h:602
_Gstnvvideoconvert::intermediate_buffer_two
NvBufSurface * intermediate_buffer_two
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:185
_Gstnvvideoconvert::transform_params
NvBufSurfTransformParams transform_params
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:180
_Gstnvvideoconvert::src_crop_left
gint src_crop_left
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:163
_Gstnvvideoconvert::allow_odd_crop
gboolean allow_odd_crop
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:208
_GstNvInterBuffer
GstNvInterBuffer:
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:134
_Gstnvvideoconvert::session_created
guint session_created
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:216
_Gstnvvideoconvert::to_height
gint to_height
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:153
_Gstnvvideoconvert::do_mem_type_conversion
gboolean do_mem_type_conversion
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:201
_Gstnvvideoconvert::dst_crop_height
gint dst_crop_height
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:171
_Gstnvvideoconvert::do_dst_cropping
gboolean do_dst_cropping
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:200
_Gstnvvideoconvert::interbuf
GstNvInterBuffer interbuf
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:214
_Gstnvvideoconvert::from_height
gint from_height
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:155
_Gstnvvideoconvert::in_pix_fmt
NvBufSurfaceColorFormat in_pix_fmt
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:181
_Gstnvvideoconvert::enable_contiguous_bufs
gboolean enable_contiguous_bufs
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:209
BufType
BufType
BufType:
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:81
GstBuffer
struct _GstBuffer GstBuffer
Definition: includes/ds3d/common/idatatype.h:24
_Gstnvvideoconvert::isurf_flag
gboolean isurf_flag
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:204
_Gstnvvideoconvert::nvbuf_mem_type
gint nvbuf_mem_type
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:160
_NvBufSurfTransformConfigParams
Holds configuration parameters for a transform/composite session.
Definition: includes/nvbufsurftransform.h:180
gst_nvvideoconvert_get_type
GType gst_nvvideoconvert_get_type(void)
GST_VIDEO_NVFLIP_METHOD_IDENTITY
@ GST_VIDEO_NVFLIP_METHOD_IDENTITY
Definition: 9.2/sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:107
_Gstnvvideoconvert::silent
gboolean silent
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:195
_Gstnvvideoconvert::ibuf_count
guint ibuf_count
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:190
_Gstnvvideoconvert::negotiated
gboolean negotiated
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:205
GST_VIDEO_NVFLIP_METHOD_90R
@ GST_VIDEO_NVFLIP_METHOD_90R
Definition: 9.2/sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:110
_Gstnvvideoconvert::nvfilterpool
gboolean nvfilterpool
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:206
BUF_MEM_SW
@ BUF_MEM_SW
Definition: 9.2/sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:96
_Gstnvvideoconvert::interpolation_method
gint interpolation_method
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:193
_GstNvInterBuffer::idmabuf_fd
gint idmabuf_fd
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:136
_GstNvVideoConvertBuffer
GstNvVideoConvertBuffer:
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:123
_Gstnvvideoconvert::flip_method
gint flip_method
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:191
_Gstnvvideoconvert::no_dimension
gboolean no_dimension
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:196
GST_VIDEO_NVFLIP_METHOD_HORIZ
@ GST_VIDEO_NVFLIP_METHOD_HORIZ
Definition: 9.2/sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:111
BUF_NOT_SUPPORTED
@ BUF_NOT_SUPPORTED
Definition: 9.2/sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:86
_Gstnvvideoconvert::out_pix_fmt
NvBufSurfaceColorFormat out_pix_fmt
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:182
_Gstnvvideoconvert::outbuf_memtype
BufMemType outbuf_memtype
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:176
_Gstnvvideoconvert::to_width
gint to_width
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:152
_Gstnvvideoconvert::inbuf_memtype
BufMemType inbuf_memtype
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:175
_Gstnvvideoconvert::tsurf_height
gint tsurf_height
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:157
GST_VIDEO_NVFLIP_METHOD_180
@ GST_VIDEO_NVFLIP_METHOD_180
Definition: 9.2/sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:109
_Gstnvvideoconvert::do_gpu_id_conversion
gboolean do_gpu_id_conversion
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:202
_Gstnvvideoconvert
Gstnvvideoconvert:
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:144
GstVideoFlipMethods
GstVideoFlipMethods
GstVideoFlipMethods:
Definition: 9.2/sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:105
_Gstnvvideoconvert::pool
GstBufferPool * pool
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:211
_Gstnvvideoconvert::src_crop_width
gint src_crop_width
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:165
_Gstnvvideoconvert::dst_crop_width
gint dst_crop_width
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:170
GST_VIDEO_NVFLIP_METHOD_90L
@ GST_VIDEO_NVFLIP_METHOD_90L
Definition: 9.2/sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:108
_Gstnvvideoconvert::config_params
NvBufSurfTransformConfigParams config_params
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:183
_Gstnvvideoconvert::flow_lock
GMutex flow_lock
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:212
GST_VIDEO_NVFLIP_METHOD_INVTRANS
@ GST_VIDEO_NVFLIP_METHOD_INVTRANS
Definition: 9.2/sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:112
_Gstnvvideoconvert::insurf_count
guint insurf_count
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:187
_Gstnvvideoconvert::inbuf_type
BufType inbuf_type
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:174
_Gstnvvideoconvert::copy_hw
gint copy_hw
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:161
_Gstnvvideoconvert::do_src_cropping
gboolean do_src_cropping
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:199
BUF_TYPE_GRAY
@ BUF_TYPE_GRAY
Definition: 9.2/sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:84
_Gstnvvideoconvert::tsurf_width
gint tsurf_width
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:156
BUF_TYPE_RGB
@ BUF_TYPE_RGB
Definition: 9.2/sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:85
_Gstnvvideoconvert::src_crop_height
gint src_crop_height
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:166
_Gstnvvideoconvert::enable_blocklinear_output
gboolean enable_blocklinear_output
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:207
_Gstnvvideoconvert::dst_crop_top
gint dst_crop_top
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:169
_Gstnvvideoconvert::num_batch_buffers
guint num_batch_buffers
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:215
_Gstnvvideoconvert::sinkcaps
GstCaps * sinkcaps
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:149
_GstNvVideoConvertBuffer::dmabuf_fd
gint dmabuf_fd
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:125
_Gstnvvideoconvert::need_intersurf
gboolean need_intersurf
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:203
_Gstnvvideoconvert::in_info
GstVideoInfo in_info
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:177
_Gstnvvideoconvert::element
GstBaseTransform element
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:146
_GstNvVideoConvertBuffer::gst_buf
GstBuffer * gst_buf
Definition: sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:126
NvBufSurfaceColorFormat
NvBufSurfaceColorFormat
Defines color formats for NvBufSurface.
Definition: includes/nvbufsurface.h:110
GST_VIDEO_NVFLIP_METHOD_TRANS
@ GST_VIDEO_NVFLIP_METHOD_TRANS
Definition: 9.2/sources/gst-plugins/gst-nvvideoconvert/gstnvvideoconvert.h:114