NVIDIA DeepStream SDK API Reference

9.1 Release
9.1/sources/includes/gst-nvdssr.h
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2019-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 
29 #ifndef NVDSSR_H_
30 #define NVDSSR_H_
31 
32 #include <gst/gst.h>
33 
34 #define _DS_DEPRECATED_(STR) __attribute__ ((deprecated (STR)))
35 
45 #ifdef __cplusplus
46 extern "C"
47 {
48 #endif
49 
51 
52 typedef gpointer (*NvDsSRCallbackFunc) (NvDsSRRecordingInfo *info, gpointer userData);
53 
54 typedef guint32 NvDsSRSessionId;
55 
59 typedef enum {
63 
67 typedef enum {
72 
76 } NvDsSRStatus;
77 
81 typedef struct NvDsSRInitParams
82 {
88  guint width;
90  guint height;
92  gchar *fileNamePrefix;
94  gchar *dirpath;
96  guint defaultDuration;
97  union {
99  guint videoCacheSize _DS_DEPRECATED_("videoCacheSize is deprecated. Use cacheSize instead");
101  guint cacheSize;
102  };
104 
108 typedef struct NvDsSRContext
109 {
111  GstElement *recordbin;
113  GstElement *recordQue;
115  GstElement *encodebin;
117  GstElement *filesink;
119  gboolean gotKeyFrame;
121  gboolean recordOn;
123  gboolean resetDone;
125  gboolean isPlaying;
129  GMutex flowLock;
131  GThread *resetThread;
133  gpointer uData;
135  gpointer privData;
136 } NvDsSRContext;
137 
141 typedef struct NvDsSRRecordingInfo
142 {
148  gchar *filename;
150  gchar *dirpath;
152  guint64 duration;
156  guint width;
158  guint height;
160  gboolean containsVideo;
162  guint channels;
164  guint samplingRate;
166  gboolean containsAudio;
168 
188 
211  guint startTime, guint duration, gpointer userData);
212 
222 
233 
234 #ifdef __cplusplus
235 }
236 #endif
237 #endif /* NVDSSR_H_ */
238 
NvDsSRContext
struct NvDsSRContext NvDsSRContext
Holds information about smart record instance.
NvDsSRSessionId
guint32 NvDsSRSessionId
Definition: 9.1/sources/includes/gst-nvdssr.h:54
NvDsSRInitParams::callback
NvDsSRCallbackFunc callback
callback function gets called once recording is complete
Definition: sources/includes/gst-nvdssr.h:84
NVDSSR_STATUS_CUSTOM1
@ NVDSSR_STATUS_CUSTOM1
Definition: 9.1/sources/includes/gst-nvdssr.h:73
NvDsSRRecordingInfo::channels
guint channels
channels in recorded audio
Definition: sources/includes/gst-nvdssr.h:162
NVDSSR_STATUS_INVALID_OP
@ NVDSSR_STATUS_INVALID_OP
Definition: 9.1/sources/includes/gst-nvdssr.h:70
NvDsSRStart
NvDsSRStatus NvDsSRStart(NvDsSRContext *ctx, NvDsSRSessionId *sessionId, guint startTime, guint duration, gpointer userData)
Starts the video recording.
NvDsSRDestroy
NvDsSRStatus NvDsSRDestroy(NvDsSRContext *ctx)
Destroys the instance of smart record.
NvDsSRContext::resetDone
gboolean resetDone
flag to check if encodebin is reset
Definition: sources/includes/gst-nvdssr.h:123
NvDsSRRecordingInfo::ctx
NvDsSRContext * ctx
SR bin context.
Definition: sources/includes/gst-nvdssr.h:144
NvDsSRStatus
NvDsSRStatus
Specifies API return status.
Definition: 9.1/sources/includes/gst-nvdssr.h:67
NvDsSRInitParams::cacheSize
guint cacheSize
size of cache in seconds, applies to video and audio.
Definition: sources/includes/gst-nvdssr.h:101
NvDsSRRecordingInfo
struct NvDsSRRecordingInfo NvDsSRRecordingInfo
Hold information about video recorded.
Definition: 9.1/sources/includes/gst-nvdssr.h:50
NvDsSRInitParams::dirpath
gchar * dirpath
store recorded file under directory path
Definition: sources/includes/gst-nvdssr.h:94
NvDsSRContext::isPlaying
gboolean isPlaying
flag to check if encodebin is in playing state.
Definition: sources/includes/gst-nvdssr.h:125
NVDSSR_CONTAINER_MKV
@ NVDSSR_CONTAINER_MKV
Definition: 9.1/sources/includes/gst-nvdssr.h:61
NvDsSRRecordingInfo::sessionId
NvDsSRSessionId sessionId
recording session-id
Definition: sources/includes/gst-nvdssr.h:146
NvDsSRRecordingInfo::containerType
NvDsSRContainerType containerType
recorded video container, MP4 / MKV
Definition: sources/includes/gst-nvdssr.h:154
NVDSSR_STATUS_CUSTOM3
@ NVDSSR_STATUS_CUSTOM3
Definition: 9.1/sources/includes/gst-nvdssr.h:75
NvDsSRRecordingInfo::height
guint height
recorded video height
Definition: sources/includes/gst-nvdssr.h:158
NvDsSRRecordingInfo::dirpath
gchar * dirpath
recorded file dir path
Definition: sources/includes/gst-nvdssr.h:150
NvDsSRRecordingInfo::width
guint width
recorded video width
Definition: sources/includes/gst-nvdssr.h:156
_DS_DEPRECATED_
#define _DS_DEPRECATED_(STR)
Definition: 9.1/sources/includes/gst-nvdssr.h:34
NvDsSRContext::uData
gpointer uData
pointer to user provided data
Definition: sources/includes/gst-nvdssr.h:133
NvDsSRInitParams::fileNamePrefix
gchar * fileNamePrefix
recorded file name prefix
Definition: sources/includes/gst-nvdssr.h:92
NvDsSRContext::flowLock
GMutex flowLock
mutex to control the flow
Definition: sources/includes/gst-nvdssr.h:129
NVDSSR_STATUS_CUSTOM2
@ NVDSSR_STATUS_CUSTOM2
Definition: 9.1/sources/includes/gst-nvdssr.h:74
NvDsSRCreate
NvDsSRStatus NvDsSRCreate(NvDsSRContext **ctx, NvDsSRInitParams *params)
Creates the instance of smart record.
NvDsSRRecordingInfo::filename
gchar * filename
recorded file name
Definition: sources/includes/gst-nvdssr.h:148
NvDsSRCallbackFunc
gpointer(* NvDsSRCallbackFunc)(NvDsSRRecordingInfo *info, gpointer userData)
Definition: 9.1/sources/includes/gst-nvdssr.h:52
NvDsSRContext::recordQue
GstElement * recordQue
queue element to cache the content.
Definition: sources/includes/gst-nvdssr.h:113
NvDsSRContext::initParams
NvDsSRInitParams initParams
initialization parameters
Definition: sources/includes/gst-nvdssr.h:127
NvDsSRInitParams::width
guint width
optional, recording video width, 0 means no transcode
Definition: sources/includes/gst-nvdssr.h:88
NvDsSRRecordingInfo::containsAudio
gboolean containsAudio
Boolean indicating if recorded stream contains audio.
Definition: sources/includes/gst-nvdssr.h:166
NVDSSR_STATUS_INVALID_VAL
@ NVDSSR_STATUS_INVALID_VAL
Definition: 9.1/sources/includes/gst-nvdssr.h:69
NvDsSRContext
Holds information about smart record instance.
Definition: sources/includes/gst-nvdssr.h:108
NvDsSRRecordingInfo::duration
guint64 duration
duration in milliseconds
Definition: sources/includes/gst-nvdssr.h:152
NvDsSRInitParams
Holds initializtion paramerters required to create NvDsSRContext.
Definition: sources/includes/gst-nvdssr.h:81
NVDSSR_STATUS_OK
@ NVDSSR_STATUS_OK
Definition: 9.1/sources/includes/gst-nvdssr.h:68
NvDsSRRecordingInfo::samplingRate
guint samplingRate
sampling rate of recorded audio in Hz
Definition: sources/includes/gst-nvdssr.h:164
NvDsSRContext::gotKeyFrame
gboolean gotKeyFrame
flag to check the key frame.
Definition: sources/includes/gst-nvdssr.h:119
NvDsSRInitParams::height
guint height
optional, recording video height, 0 means no transcode
Definition: sources/includes/gst-nvdssr.h:90
NvDsSRContainerType
NvDsSRContainerType
Specifies container types.
Definition: 9.1/sources/includes/gst-nvdssr.h:59
NVDSSR_CONTAINER_MP4
@ NVDSSR_CONTAINER_MP4
Definition: 9.1/sources/includes/gst-nvdssr.h:60
NVDSSR_STATUS_ERROR
@ NVDSSR_STATUS_ERROR
Definition: 9.1/sources/includes/gst-nvdssr.h:71
NvDsSRStop
NvDsSRStatus NvDsSRStop(NvDsSRContext *ctx, NvDsSRSessionId sessionId)
Stops the previously started recording.
NvDsSRContext::filesink
GstElement * filesink
filesink element
Definition: sources/includes/gst-nvdssr.h:117
NvDsSRInitParams::defaultDuration
guint defaultDuration
default recording duration in seconds
Definition: sources/includes/gst-nvdssr.h:96
NvDsSRContext::encodebin
GstElement * encodebin
child bin to save the content to file.
Definition: sources/includes/gst-nvdssr.h:115
NvDsSRContext::recordbin
GstElement * recordbin
parent bin element.
Definition: sources/includes/gst-nvdssr.h:111
NvDsSRInitParams::containerType
NvDsSRContainerType containerType
recording video container, MP4 / MKV
Definition: sources/includes/gst-nvdssr.h:86
NvDsSRContext::resetThread
GThread * resetThread
thread to reset the encodebin
Definition: sources/includes/gst-nvdssr.h:131
NvDsSRRecordingInfo::containsVideo
gboolean containsVideo
Boolean indicating if recorded stream contains video.
Definition: sources/includes/gst-nvdssr.h:160
NvDsSRInitParams
struct NvDsSRInitParams NvDsSRInitParams
Holds initializtion paramerters required to create NvDsSRContext.
NvDsSRContext::recordOn
gboolean recordOn
flag to check if recording is on
Definition: sources/includes/gst-nvdssr.h:121
NvDsSRRecordingInfo
Hold information about video recorded.
Definition: sources/includes/gst-nvdssr.h:141
NvDsSRContext::privData
gpointer privData
pointer to private data
Definition: sources/includes/gst-nvdssr.h:135