NVIDIA DeepStream SDK API Reference

6.4 Release
deepstream_can_context.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2022 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 DS_APP_DEEPSTREAM_CAN_CONTEXT_H
25 #define DS_APP_DEEPSTREAM_CAN_CONTEXT_H
26 
27 #include "gstnvdsmeta.h"
28 
29 #include <sstream>
30 #include <unistd.h>
31 
33 #include <ds3d/common/func_utils.h>
36 // inlucde nvds3d Gst header files
39 #include <ds3d/gst/nvds3d_meta.h>
40 #include <gst/gst.h>
41 
42 #define GST_CAPS_FEATURES_NVMM "memory:NVMM"
43 
44 const uint32_t kNvDsCanResultMeta = (NVDS_GST_CUSTOM_META + 100);
45 
46 using namespace ds3d;
47 
48 enum class NvDsCanContextConfigType : int {
49  kConfigPath = 0,
50  kConfigContent = 1,
51 };
52 
54  void* buf;
55  size_t bufLen;
56  uint32_t fourcc; // GREY, RGBA
57  uint32_t width, height;
58 };
59 
61  float rotation; // normalized result
62 };
63 
64 enum class NvDsCanSrcType : int {
65  kNone = 0,
66  kUri,
67  kFrame,
69 };
70 
72  uint32_t fourcc = 0;
73  uint32_t height = 0;
74  uint32_t width = 0;
75 };
76 
78  std::string devSN; // Basler Camera Device Serial Number
79  std::string pfsPath; // PFS location
80  uint32_t height = 0;
81  uint32_t width = 0;
82  std::string format = "GRAY8";
83 };
84 
87 
88  std::string srcUri;
91  std::string srcFrameRate;
92 
93  uint32_t muxWidth = 1280, muxHeight = 720;
94  int32_t muxBatchTimeout = 40000;
95 
96  std::string templateCustomLibName;
98 
99  std::string inferConfig;
100  uint32_t debugLevel = 0;
101  bool printRes = true;
102  bool enableEglSink = false;
103  bool syncDisplay = true;
104 };
105 
106 #define NVDS_MAKE_FOURCC(c0, c1, c2, c3) \
107  ((uint32_t)(c0) | ((uint32_t)(c1)) << 8 | ((uint32_t)(c2)) << 16 | ((uint32_t)(c3)) << 24)
108 
109 
110 const uint32_t NvDsCanFormatRGBA = NVDS_MAKE_FOURCC('R', 'G', 'B', 'A');
111 const uint32_t NvDsCanFormatGREY = NVDS_MAKE_FOURCC('G', 'R', 'E', 'Y');
112 
113 typedef void (*NvDsCanContextTaskQuitCb)(void* usrData);
114 
115 class DsCanContext;
116 
118 
120  NvDsCanContextConfig* config, const char* str, uint32_t len, NvDsCanContextConfigType type);
122 NvDs_CanContextCreate(DsCanContext** ctx, const NvDsCanContextConfig* config);
124 NvDs_CanContextStart(DsCanContext* ctx, NvDsCanContextTaskQuitCb cb, void* usrData);
126  DsCanContext* ctx, const NvDsCanContextFrame* frame, NvDsCanContextResultMeta* res);
127 DS3D_EXPORT_API bool NvDs_CanContextIsRunning(DsCanContext* ctx);
128 DS3D_EXPORT_API ErrCode NvDs_CanContextStop(DsCanContext* ctx);
130 
132 
133 #endif // DS_APP_DEEPSTREAM_CAN_CONTEXT_H
yaml_config.hpp
NvDs_CanContextParseConfig
DS3D_EXTERN_C_BEGIN DS3D_EXPORT_API ErrCode NvDs_CanContextParseConfig(NvDsCanContextConfig *config, const char *str, uint32_t len, NvDsCanContextConfigType type)
NvDsCanContextConfig::srcFrameInfo
NvDsCanFrameInfo srcFrameInfo
Definition: deepstream_can_context.hpp:90
NVDS_MAKE_FOURCC
#define NVDS_MAKE_FOURCC(c0, c1, c2, c3)
Definition: deepstream_can_context.hpp:106
NvDsCanContextFrame
Definition: deepstream_can_context.hpp:53
nvds3d_gst_plugin.h
NvDsCanContextConfig::cameraInfo
NvDsCanCameraInfo cameraInfo
Definition: deepstream_can_context.hpp:89
NvDsCanFormatRGBA
const uint32_t NvDsCanFormatRGBA
Definition: deepstream_can_context.hpp:110
NvDsCanContextFrame::bufLen
size_t bufLen
Definition: deepstream_can_context.hpp:55
NvDs_CanContextCreate
DS3D_EXPORT_API ErrCode NvDs_CanContextCreate(DsCanContext **ctx, const NvDsCanContextConfig *config)
NvDsCanContextFrame::buf
void * buf
Definition: deepstream_can_context.hpp:54
NvDsCanFrameInfo
Definition: deepstream_can_context.hpp:71
NvDs_CanContextStart
DS3D_EXPORT_API ErrCode NvDs_CanContextStart(DsCanContext *ctx, NvDsCanContextTaskQuitCb cb, void *usrData)
DS3D_EXTERN_C_BEGIN
#define DS3D_EXTERN_C_BEGIN
Definition: defines.h:125
NvDsCanContextConfig::inferConfig
std::string inferConfig
Definition: deepstream_can_context.hpp:99
NvDs_CanContextProcessFrame
DS3D_EXPORT_API ErrCode NvDs_CanContextProcessFrame(DsCanContext *ctx, const NvDsCanContextFrame *frame, NvDsCanContextResultMeta *res)
ds3d::ErrCode
ErrCode
Definition: common.h:43
nvds3d_gst_ptr.h
NvDsCanContextFrame::fourcc
uint32_t fourcc
Definition: deepstream_can_context.hpp:56
NvDsCanContextResultMeta
Definition: deepstream_can_context.hpp:60
kNvDsCanResultMeta
const uint32_t kNvDsCanResultMeta
Definition: deepstream_can_context.hpp:44
DS3D_EXTERN_C_END
#define DS3D_EXTERN_C_END
Definition: defines.h:126
gstnvdsmeta.h
NvDsCanFormatGREY
const uint32_t NvDsCanFormatGREY
Definition: deepstream_can_context.hpp:111
NvDsCanContextConfig::srcUri
std::string srcUri
Definition: deepstream_can_context.hpp:88
NvDsCanContextFrame::width
uint32_t width
Definition: deepstream_can_context.hpp:57
NvDsCanContextConfigType
NvDsCanContextConfigType
Definition: deepstream_can_context.hpp:48
NvDsCanCameraInfo
Definition: deepstream_can_context.hpp:77
NvDsCanContextConfig::templateCustomLibProps
std::string templateCustomLibProps
Definition: deepstream_can_context.hpp:97
NvDs_CanContextIsRunning
DS3D_EXPORT_API bool NvDs_CanContextIsRunning(DsCanContext *ctx)
nvds3d_meta.h
NvDsCanContextResultMeta::rotation
float rotation
Definition: deepstream_can_context.hpp:61
NvDsCanContextConfigType::kConfigContent
@ kConfigContent
nvdsinferserver::InferTensorOrder::kNone
@ kNone
NvDsCanContextTaskQuitCb
void(* NvDsCanContextTaskQuitCb)(void *usrData)
Definition: deepstream_can_context.hpp:113
NvDsCanContextConfig::templateCustomLibName
std::string templateCustomLibName
Definition: deepstream_can_context.hpp:96
NVDS_GST_CUSTOM_META
@ NVDS_GST_CUSTOM_META
Specifies the start of a range of enum values that represent types of NVIDIA-defined Gst metas.
Definition: nvdsmeta.h:169
NvDsCanSrcType::kBaslerCamera
@ kBaslerCamera
NvDsCanContextConfigType::kConfigPath
@ kConfigPath
NvDsCanSrcType
NvDsCanSrcType
Definition: deepstream_can_context.hpp:64
NvDsCanCameraInfo::pfsPath
std::string pfsPath
Definition: deepstream_can_context.hpp:79
profiling.hpp
DS3D_EXPORT_API
#define DS3D_EXPORT_API
Definition: defines.h:124
NvDsCanSrcType::kNone
@ kNone
func_utils.h
NvDsCanSrcType::kUri
@ kUri
NvDsCanContextConfig
Definition: deepstream_can_context.hpp:85
NvDsCanSrcType::kFrame
@ kFrame
NvDsCanContextConfig::srcFrameRate
std::string srcFrameRate
Definition: deepstream_can_context.hpp:91
NvDsCanCameraInfo::devSN
std::string devSN
Definition: deepstream_can_context.hpp:78
ds3d
Definition: lidar_3d_datatype.h:33
NvDs_CanContextStop
DS3D_EXPORT_API ErrCode NvDs_CanContextStop(DsCanContext *ctx)
NvDs_CanContextDestroy
DS3D_EXPORT_API ErrCode NvDs_CanContextDestroy(DsCanContext *ctx)