NVIDIA DeepStream SDK API Reference

6.4 Release
gstnvstreammux_ntp.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 __GSTNVSTREAMMUX_NTP__
25 #define __GSTNVSTREAMMUX_NTP__
26 
27 #include <glib.h>
28 #include <gst/gst.h>
29 
30 G_BEGIN_DECLS
31 
32 #define NVDS_RFC3339_STR_BUF_LEN 32
33 
34 void generate_rfc3339_str_from_ts (gchar *buf, GstClockTime ts);
35 
36 typedef enum
37 {
41 
42 /* Modes of NTP timestamp correction based on frame rate */
43 typedef enum
44 {
45  /* Frame rate based correction disabled */
47  /* Use the average frame rate provided in the NTP query to correct
48  * NTP timestamp. (PTS based frame rate calculation at rtpjitterbuffer.) */
50  /* Use the frame rate provided by application to correct NTP timestamp.
51  * This mode is required frame rate is different at rtpjitterbuffer and
52  * nvstreammux. Bug 3620472, 3626628 */
55 
56 typedef struct _GstNvDsNtpCalculator GstNvDsNtpCalculator;
57 
59  GstClockTime frame_duration, GstElement *elem, guint source_id);
60 
62  GstClockTime ntp_time_epoch_ns, GstClockTime ntp_frame_timestamp,
63  GstClockTime avg_frame_time);
64 
66 
68  GstClockTime *ntp_time_epoch_ns, GstClockTime *ntp_frame_timestamp,
69  GstClockTime *avg_frame_time, GstClockTime *ntp_time_epoch_ns_next,
70  GstClockTime *ntp_frame_timestamp_next);
71 
73  GstClockTime buf_pts);
74 
76 
78 
79 G_END_DECLS
80 
81 #endif
gst_nvds_ntp_calculator_add_ntp_sync_values
void gst_nvds_ntp_calculator_add_ntp_sync_values(GstNvDsNtpCalculator *calc, GstClockTime ntp_time_epoch_ns, GstClockTime ntp_frame_timestamp, GstClockTime avg_frame_time)
GST_NVDS_NTP_CALC_MODE_RTCP
@ GST_NVDS_NTP_CALC_MODE_RTCP
Definition: gstnvstreammux_ntp.h:39
gst_nvds_ntp_calculator_get_ntp_sync_values
void gst_nvds_ntp_calculator_get_ntp_sync_values(GstNvDsNtpCalculator *calc, GstClockTime *ntp_time_epoch_ns, GstClockTime *ntp_frame_timestamp, GstClockTime *avg_frame_time, GstClockTime *ntp_time_epoch_ns_next, GstClockTime *ntp_frame_timestamp_next)
generate_rfc3339_str_from_ts
void generate_rfc3339_str_from_ts(gchar *buf, GstClockTime ts)
GST_NVDS_NTP_CALC_MODE_SYSTEM_TIME
@ GST_NVDS_NTP_CALC_MODE_SYSTEM_TIME
Definition: gstnvstreammux_ntp.h:38
GST_NVDS_NTP_CORRECTION_USER_FRAME_RATE
@ GST_NVDS_NTP_CORRECTION_USER_FRAME_RATE
Definition: gstnvstreammux_ntp.h:53
GstNvDsNtpCorrectionMode
GstNvDsNtpCorrectionMode
Definition: gstnvstreammux_ntp.h:43
GstNvDsNtpCalculatorMode
GstNvDsNtpCalculatorMode
Definition: gstnvstreammux_ntp.h:36
gst_nvds_ntp_calculator_have_ntp_sync_values
gboolean gst_nvds_ntp_calculator_have_ntp_sync_values(GstNvDsNtpCalculator *calc)
gst_nvds_ntp_calculator_reset
void gst_nvds_ntp_calculator_reset(GstNvDsNtpCalculator *calc)
GST_NVDS_NTP_CORRECTION_DISABLED
@ GST_NVDS_NTP_CORRECTION_DISABLED
Definition: gstnvstreammux_ntp.h:46
gst_nvds_ntp_calculator_new
GstNvDsNtpCalculator * gst_nvds_ntp_calculator_new(GstNvDsNtpCalculatorMode mode, GstClockTime frame_duration, GstElement *elem, guint source_id)
gst_nvds_ntp_calculator_get_buffer_ntp
GstClockTime gst_nvds_ntp_calculator_get_buffer_ntp(GstNvDsNtpCalculator *calc, GstClockTime buf_pts)
GST_NVDS_NTP_CORRECTION_AUTOMATIC
@ GST_NVDS_NTP_CORRECTION_AUTOMATIC
Definition: gstnvstreammux_ntp.h:49
GstNvDsNtpCalculator
struct _GstNvDsNtpCalculator GstNvDsNtpCalculator
Definition: gstnvstreammux_ntp.h:56
gst_nvds_ntp_calculator_free
void gst_nvds_ntp_calculator_free(GstNvDsNtpCalculator *calc)