NVIDIA DeepStream SDK API Reference

6.4 Release
includes/gstnvvideotestsrc.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2021-2023 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: MIT
4  *
5  * Permission is hereby granted, free of charge, to any person obtaining a
6  * copy of this software and associated documentation files (the "Software"),
7  * to deal in the Software without restriction, including without limitation
8  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9  * and/or sell copies of the Software, and to permit persons to whom the
10  * Software is furnished to do so, subject to the following conditions:
11  *
12  * The above copyright notice and this permission notice shall be included in
13  * all copies or substantial portions of the Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18  * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20  * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21  * DEALINGS IN THE SOFTWARE.
22  */
23 
24 #ifndef _GST_NV_VIDEO_TEST_SRC_H_
25 #define _GST_NV_VIDEO_TEST_SRC_H_
26 
27 #undef __noinline__
28 
29 #include <stdio.h>
30 #include <gst/gst.h>
31 #include <gst/base/base.h>
32 #include <gst/video/video.h>
33 
34 #if defined(__CUDACC__) || defined(__CUDA_ARCH__) || defined(__CUDA_LIBDEVICE__)
35  #define __noinline__ __attribute__((noinline))
36 #endif
37 
38 #include <nvbufsurface.h>
39 
40 G_BEGIN_DECLS
41 
42 #define GST_TYPE_NV_VIDEO_TEST_SRC (gst_nv_video_test_src_get_type())
43 #define GST_NV_VIDEO_TEST_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GST_TYPE_NV_VIDEO_TEST_SRC, GstNvVideoTestSrc))
44 #define GST_NV_VIDEO_TEST_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GST_TYPE_NV_VIDEO_TEST_SRC, GstNvVideoTestSrcClass))
45 #define GST_IS_NV_VIDEO_TEST_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GST_TYPE_NV_VIDEO_TEST_SRC))
46 #define GST_IS_NV_VIDEO_TEST_SRC_CLASS(obj) (G_TYPE_CHECK_CLASS_TYPE((klass), GST_TYPE_NV_VIDEO_TEST_SRC))
47 
48 typedef enum {
53 
54 typedef enum {
59 
62 
63 struct _GstNvVideoTestSrc {
64  GstPushSrc parent;
65 
66  // Plugin parameters.
69  guint gpu_id;
71  gboolean enable_rdma;
72 
73  // Stream details set during caps negotiation.
74  GstCaps *caps;
75  GstVideoInfo info;
76 
77  // Runtime state.
78  GstClockTime running_time;
79  guint filled_frames;
80 
82  unsigned int cuda_block_size;
83  unsigned int cuda_num_blocks;
84  void (*cuda_fill_image)(GstNvVideoTestSrc *src);
85 
86  // File read related
87  gchar *filename; /* filename */
88  FILE *file_handle;
89  guint64 read_position; /* position of fd */
90  NvBufSurface *file_read_surface = NULL; /* surface for file read */
91  gboolean file_loop;
92 
93  // Jitter related
94  guint max_jitter = 0; // max jitter in ms
95  GstClockTime last_buffer_start_timestamp = 0;
96  void *p_fixed_jitter_list = NULL;
97 };
98 
100  GstPushSrcClass parent_class;
101 };
102 
104 
105 G_END_DECLS
106 
107 #endif
GST_NV_VIDEO_TEST_SRC_RUNNING_TIME
@ GST_NV_VIDEO_TEST_SRC_RUNNING_TIME
Definition: includes/gstnvvideotestsrc.h:57
_GstNvVideoTestSrc::pattern
GstNvVideoTestSrcPattern pattern
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:67
GST_NV_VIDEO_TEST_SRC_WALL_TIME
@ GST_NV_VIDEO_TEST_SRC_WALL_TIME
Definition: includes/gstnvvideotestsrc.h:56
GST_NV_VIDEO_TEST_SRC_FRAMES
@ GST_NV_VIDEO_TEST_SRC_FRAMES
Definition: includes/gstnvvideotestsrc.h:55
GST_NV_VIDEO_TEST_SRC_GRADIENT
@ GST_NV_VIDEO_TEST_SRC_GRADIENT
Definition: includes/gstnvvideotestsrc.h:51
_GstNvVideoTestSrc::parent
GstPushSrc parent
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:64
NvBufSurface
Holds information about batched buffers.
Definition: nvbufsurface.h:503
GstNvVideoTestSrcAnimationMode
GstNvVideoTestSrcAnimationMode
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:54
_GstNvVideoTestSrc
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:63
GST_NV_VIDEO_TEST_SRC_MANDELBROT
@ GST_NV_VIDEO_TEST_SRC_MANDELBROT
Definition: includes/gstnvvideotestsrc.h:50
_GstNvVideoTestSrc::info
GstVideoInfo info
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:75
_GstNvVideoTestSrc::caps
GstCaps * caps
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:74
_GstNvVideoTestSrc::p_fixed_jitter_list
void * p_fixed_jitter_list
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:96
_GstNvVideoTestSrc::filename
gchar * filename
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:87
_GstNvVideoTestSrc::file_handle
FILE * file_handle
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:88
_GstNvVideoTestSrc::filled_frames
guint filled_frames
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:79
_GstNvVideoTestSrc::file_read_surface
NvBufSurface * file_read_surface
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:90
_GstNvVideoTestSrc::max_jitter
guint max_jitter
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:94
NvBufSurfaceParams
Hold the information of single buffer in the batch.
Definition: nvbufsurface.h:470
_GstNvVideoTestSrc::cuda_block_size
unsigned int cuda_block_size
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:82
gst_nv_video_test_src_get_type
GType gst_nv_video_test_src_get_type(void)
_GstNvVideoTestSrc::animation_mode
GstNvVideoTestSrcAnimationMode animation_mode
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:68
_GstNvVideoTestSrc::cuda_fill_image
void(* cuda_fill_image)(GstNvVideoTestSrc *src)
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:84
_GstNvVideoTestSrc::gpu_id
guint gpu_id
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:69
_GstNvVideoTestSrc::file_loop
gboolean file_loop
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:91
_GstNvVideoTestSrcClass
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:99
_GstNvVideoTestSrc::cuda_surf
NvBufSurfaceParams * cuda_surf
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:81
NvBufSurfaceMemType
NvBufSurfaceMemType
Specifies memory types for NvBufSurface.
Definition: nvbufsurface.h:300
_GstNvVideoTestSrc::running_time
GstClockTime running_time
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:78
_GstNvVideoTestSrc::last_buffer_start_timestamp
GstClockTime last_buffer_start_timestamp
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:95
_GstNvVideoTestSrcClass::parent_class
GstPushSrcClass parent_class
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:100
_GstNvVideoTestSrc::cuda_num_blocks
unsigned int cuda_num_blocks
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:83
GstNvVideoTestSrcPattern
GstNvVideoTestSrcPattern
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:48
_GstNvVideoTestSrc::enable_rdma
gboolean enable_rdma
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:71
GstNvVideoTestSrcAnimationMode
GstNvVideoTestSrcAnimationMode
Definition: includes/gstnvvideotestsrc.h:54
GST_NV_VIDEO_TEST_SRC_SMPTE
@ GST_NV_VIDEO_TEST_SRC_SMPTE
Definition: includes/gstnvvideotestsrc.h:49
_GstNvVideoTestSrc::memtype
NvBufSurfaceMemType memtype
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:70
_GstNvVideoTestSrc::read_position
guint64 read_position
Definition: gst-plugins/gst-nvvideotestsrc/gstnvvideotestsrc.h:89
GstNvVideoTestSrcPattern
GstNvVideoTestSrcPattern
Definition: includes/gstnvvideotestsrc.h:48
nvbufsurface.h