Skip to content

Commit 68d749d

Browse files
authored
Merge pull request #1241 from prominenceai/v0.30.a.alpha
V0.30.a.alpha
2 parents 27da6bf + 494e76a commit 68d749d

13 files changed

+579
-35
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ else
3939
endif
4040

4141
CXX_VERSION:=c++17
42-
DSL_VERSION:='L"v0.30.alpha"'
42+
DSL_VERSION:='L"v0.30.a.alpha"'
4343
GLIB_VERSION:=2.0
4444

4545
GSTREAMER_VERSION:=1.0

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,25 @@ The DeepStream SDK and DSL use the open source [GStreamer](https://gstreamer.fre
3636
---
3737

3838
## Important Bulletins
39-
The latest release `v0.30.alpha` was developed to support DeepSteam 6.4 and 7.0 on Ubuntu 22.04.
39+
The latest release [v0.30.a.alpha](/Release%20Notes/v0.30.a.alpha.md) is a patch for the v0.30.alpha release that fixes a [critical bug](https://github.com/prominenceai/deepstream-services-library/issues/1238) in the V4L2 Sink.
40+
41+
The [v0.30.alpha](/Release%20Notes/v0.30.alpha.md) release was developed to support DeepSteam 6.4 and 7.0 on Ubuntu 22.04.
42+
43+
> WARNING! There is a cricical error in the DeepStream 7.0 Installation Instructions.
44+
45+
Under the section [Install librdkafka](https://docs.nvidia.com/metropolis/deepstream/dev-guide/text/DS_Installation.html#install-librdkafka-to-enable-kafka-protocol-adaptor-for-message-broker), the following instructions
46+
```bash
47+
$ sudo mkdir -p /opt/nvidia/deepstream/deepstream/lib
48+
$ sudo cp /usr/local/lib/librdkafka* /opt/nvidia/deepstream/deepstream/lib
49+
```
50+
Must be replaced with.
51+
```bash
52+
$ sudo mkdir -p /opt/nvidia/deepstream/deepstream-7.0/lib
53+
$ sudo cp /usr/local/lib/librdkafka* /opt/nvidia/deepstream/deepstream-7.0/lib
54+
```
55+
See [Error in DeepStream 7.0 installation instructions - symlink fails to create](https://forums.developer.nvidia.com/t/error-in-deepstream-7-0-installation-instructions-symlink-fails-to-create/296026) for more information.
56+
57+
---
4058

4159
> WARNING! There is a cricical error in the DeepStream 7.0 Installation Instructions.
4260

Release Notes/dsl-releases.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
| Release | Date |
44
| --------------------------------------------------- | ----------- |
5+
| [v0.30.a.alpha (patch)](/Release%20Notes/v0.30.a.alpha.md) | 07/14/2024 |
56
| [v0.30.alpha](/Release%20Notes/v0.30.alpha.md) | 05/28/2024 |
67
| [v0.29.alpha](/Release%20Notes/v0.29.alpha.md) | 03/23/2024 |
78
| [v0.28.alpha](/Release%20Notes/v0.28.alpha.md) | 01/29/2024 |
8-
| [v0.27.b.alpha](/Release%20Notes/v0.27.b.alpha.md) | 11/08/2023 |
9-
| [v0.27.a.alpha](/Release%20Notes/v0.27.a.alpha.md) | 10/24/2023 |
9+
| [v0.27.b.alpha (patch)](/Release%20Notes/v0.27.b.alpha.md) | 11/08/2023 |
10+
| [v0.27.a.alpha (patch)](/Release%20Notes/v0.27.a.alpha.md) | 10/24/2023 |
1011
| [v0.27.alpha](/Release%20Notes/v0.27.alpha.md) | 09/13/2023 |
1112
| [v0.26.a.alpha](/Release%20Notes/v0.26.a.alpha.md) | 06/07/2023 |
1213
| [v0.26.alpha](/Release%20Notes/v0.26.alpha.md) | 05/03/2023 |

Release Notes/v0.30.a.alpha.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# v0.30.a.alpha (patch) Release Notes
2+
**Important!**
3+
* `v0.30.a.alpha` is a **patch** release (patch `a` for the `v0.30.alpha` release).
4+
* The public/client API in DslApi.h has not been changed - i.e there are no new services.
5+
* There is one critical bug fix, 2 new examples, minor documentation updates, and more test coverage.
6+
7+
## Issues closed in this release
8+
### Bugs closed in this release
9+
* Fix and complete the V4L2 Sink - revert previous invalid change, and add test coverage and examples [#1238](https://github.com/prominenceai/deepstream-services-library/issues/1238).
10+
11+
## New Examples in this release
12+
* [1file_pgie_iou_tracker_osd_window_v4l2.py](/examples/python/1file_pgie_iou_tracker_osd_window_v4l2.py)
13+
* [1file_pgie_iou_tracker_osd_window_v4l2.cpp](/examples/python/1file_pgie_iou_tracker_osd_window_v4l2.cpp)
14+

docs/api-sink.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,31 @@ As a general rule
8181
* <b id="f1">1</b> _The NVIDIA Smart Recording Bin - used by the Record Sink - does not support/extern any of the common sink properties._ [↩](#a1)
8282
* <b id="f2">2</b> _The rtspclientsink plugin is not derived from the GStreamer basesink which implements the common sink properties._ [↩](#a2)
8383

84+
## Using the V4L2 Sink with V4L2 Loopback
85+
From the [GStream documentation](https://gstreamer.freedesktop.org/documentation/video4linux2/v4l2sink.html?gi-language=c#v4l2sink-page):
86+
> _"The V4L2 Sink can be used to display video to V4L2 capatible video devices (screen overlays provided by the graphics hardware, tv-out, etc)."_
87+
88+
[V4L2 Loopback](https://github.com/umlaeute/v4l2loopback) can be used to create "virtual V4L2 video devices" allowing applications to read the virtual devices as V4L2 input sources. See: https://github.com/umlaeute/v4l2loopback for more information.
89+
90+
Applicable DSL examples:
91+
* [1file_pgie_iou_tracker_osd_window_v4l2.py](/examples/python/1file_pgie_iou_tracker_osd_window_v4l2.py)
92+
* [1file_pgie_iou_tracker_osd_window_v4l2.cpp](/examples/python/1file_pgie_iou_tracker_osd_window_v4l2.cpp)
93+
94+
You can install v4l2loopback with the command below. Depending on your device, there may be extra steps to install a kernel module. Follow the prompts as directed.
95+
```bash
96+
$ sudo apt-get install v4l2loopback-dkms
97+
```
98+
99+
Run the following to setup '/dev/video3' (used by the examples above)
100+
```bash
101+
$ sudo modprobe v4l2loopback video_nr=3
102+
```
103+
104+
You can use the following GStreamer launch command to test the loopback device when the example pipeline is running.
105+
```bash
106+
$ gst-launch-1.0 v4l2src device=/dev/video3 ! videoconvert ! xvimagesink
107+
```
108+
84109
## Sink API
85110
**Types:**
86111
* [`dsl_recording_info`](#dsl_recording_info)
Lines changed: 220 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,220 @@
1+
/*
2+
The MIT License
3+
4+
Copyright (c) 2024, Prominence AI, Inc.
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in-
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE.
23+
*/
24+
25+
/* ##############################################################################
26+
#
27+
# This simple example demonstrates how to create a set of Pipeline components,
28+
# specifically:
29+
# - A File Source
30+
# - Primary GST Inference Engine (PGIE)
31+
# - IOU Tracker
32+
# - On-Screen Display
33+
# - Window Sink
34+
# - V4L2 Sink
35+
# ...and how to add them to a new Pipeline and play.
36+
#
37+
# The V4L2 Sink is used to display video to v4l2 video devices.
38+
#
39+
# V4L2 Loopback can be used to create "virtual video devices". Normal (v4l2)
40+
# applications will read these devices as if they were ordinary video devices.
41+
# See: https://github.com/umlaeute/v4l2loopback for more information.
42+
#
43+
# You can install v4l2loopback with
44+
# $ sudo apt-get install v4l2loopback-dkms
45+
#
46+
# Run the following to setup '/dev/video3'
47+
# $ sudo modprobe v4l2loopback video_nr=3
48+
#
49+
# When the script is running, you can use the following GStreamer launch
50+
# command to test the loopback
51+
# $ gst-launch-1.0 v4l2src device=/dev/video3 ! videoconvert ! xvimagesink
52+
#
53+
# The example registers handler callback functions for:
54+
# - key-release events
55+
# - delete-window events
56+
# - end-of-stream EOS events
57+
# - Pipeline change-of-state events
58+
#
59+
############################################################################## */
60+
61+
#include <iostream>
62+
#include <glib.h>
63+
#include <gst/gst.h>
64+
#include <gstnvdsmeta.h>
65+
#include <nvdspreprocess_meta.h>
66+
67+
#include "DslApi.h"
68+
69+
std::wstring file_path(
70+
L"/opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h265.mp4");
71+
72+
// Config and model-engine files
73+
std::wstring primary_infer_config_file(
74+
L"/opt/nvidia/deepstream/deepstream/sources/apps/sample_apps/deepstream-preprocess-test/config_infer.txt");
75+
std::wstring primary_model_engine_file(
76+
L"/opt/nvidia/deepstream/deepstream/samples/models/Primary_Detector/resnet18_trafficcamnet.etlt_b8_gpu0_int8.engine");
77+
78+
// Config file used by the IOU Tracker
79+
std::wstring iou_tracker_config_file(
80+
L"/opt/nvidia/deepstream/deepstream/samples/configs/deepstream-app/config_tracker_IOU.yml");
81+
82+
// V4L2 Sink device location to stream to
83+
std::wstring DEVICE_LOCATION = L"/dev/video3";
84+
85+
uint WINDOW_WIDTH = 1280;
86+
uint WINDOW_HEIGHT = 720;
87+
88+
//
89+
// Function to be called on XWindow KeyRelease event
90+
//
91+
void xwindow_key_event_handler(const wchar_t* in_key, void* client_data)
92+
{
93+
std::wstring wkey(in_key);
94+
std::string key(wkey.begin(), wkey.end());
95+
std::cout << "key released = " << key << std::endl;
96+
key = std::toupper(key[0]);
97+
if(key == "P"){
98+
dsl_pipeline_pause(L"pipeline");
99+
} else if (key == "R"){
100+
dsl_pipeline_play(L"pipeline");
101+
} else if (key == "Q" or key == "" or key == ""){
102+
std::cout << "Main Loop Quit" << std::endl;
103+
dsl_pipeline_stop(L"pipeline");
104+
dsl_main_loop_quit();
105+
}
106+
}
107+
108+
//
109+
// Function to be called on XWindow Delete event
110+
//
111+
void xwindow_delete_event_handler(void* client_data)
112+
{
113+
std::cout<<"delete window event"<<std::endl;
114+
dsl_pipeline_stop(L"pipeline");
115+
dsl_main_loop_quit();
116+
}
117+
118+
//
119+
// Function to be called on End-of-Stream (EOS) event
120+
//
121+
void eos_event_listener(void* client_data)
122+
{
123+
std::cout<<"Pipeline EOS event"<<std::endl;
124+
dsl_pipeline_stop(L"pipeline");
125+
dsl_main_loop_quit();
126+
}
127+
128+
//
129+
// Function to be called on every change of Pipeline state
130+
//
131+
void state_change_listener(uint old_state, uint new_state, void* client_data)
132+
{
133+
std::cout<<"previous state = " << dsl_state_value_to_string(old_state)
134+
<< ", new state = " << dsl_state_value_to_string(new_state) << std::endl;
135+
}
136+
137+
int main(int argc, char** argv)
138+
{
139+
DslReturnType retval = DSL_RESULT_FAILURE;
140+
141+
// Since we're not using args, we can Let DSL initialize GST on first call
142+
while(true)
143+
{
144+
145+
// New File Source using the file path specified above, repeat enabled.
146+
retval = dsl_source_file_new(L"file-source", file_path.c_str(), true);
147+
if (retval != DSL_RESULT_SUCCESS) break;
148+
149+
// New Primary GIE using the filespecs defined above, with interval and Id
150+
retval = dsl_infer_gie_primary_new(L"primary-gie",
151+
primary_infer_config_file.c_str(), primary_model_engine_file.c_str(), 0);
152+
if (retval != DSL_RESULT_SUCCESS) break;
153+
154+
// New IOU Tracker, setting operational width and height of input frame
155+
retval = dsl_tracker_new(L"iou-tracker",
156+
iou_tracker_config_file.c_str(), 480, 272);
157+
if (retval != DSL_RESULT_SUCCESS) break;
158+
159+
// New OSD with text, clock and bbox display all enabled.
160+
retval = dsl_osd_new(L"on-screen-display", true, true, true, false);
161+
if (retval != DSL_RESULT_SUCCESS) break;
162+
163+
// New 3D Window Sink with 0 x/y offsets, and same dimensions as Camera Source
164+
// EGL Sink runs on both platforms. 3D Sink is Jetson only.
165+
if (dsl_info_gpu_type_get(0) == DSL_GPU_TYPE_INTEGRATED)
166+
{
167+
retval = dsl_sink_window_3d_new(L"window-sink", 0, 0,
168+
WINDOW_WIDTH, WINDOW_HEIGHT);
169+
}
170+
else
171+
{
172+
retval = dsl_sink_window_egl_new(L"window-sink", 0, 0,
173+
WINDOW_WIDTH, WINDOW_HEIGHT);
174+
}
175+
if (retval != DSL_RESULT_SUCCESS) break;
176+
177+
// Add the XWindow event handler functions defined above
178+
retval = dsl_sink_window_key_event_handler_add(L"window-sink",
179+
xwindow_key_event_handler, NULL);
180+
if (retval != DSL_RESULT_SUCCESS) break;
181+
182+
retval = dsl_sink_window_delete_event_handler_add(L"window-sink",
183+
xwindow_delete_event_handler, NULL);
184+
if (retval != DSL_RESULT_SUCCESS) break;
185+
186+
// New V4L2 Sink
187+
retval = dsl_sink_v4l2_new(L"v4l2-sink", DEVICE_LOCATION.c_str());
188+
if (retval != DSL_RESULT_SUCCESS) break;
189+
190+
// Create a list of Pipeline Components to add to the new Pipeline.
191+
const wchar_t* components[] = {L"file-source", L"primary-gie",
192+
L"iou-tracker", L"on-screen-display", L"window-sink", L"v4l2-sink", NULL};
193+
194+
// Add all the components to our pipeline
195+
retval = dsl_pipeline_new_component_add_many(L"pipeline", components);
196+
if (retval != DSL_RESULT_SUCCESS) break;
197+
198+
// Add the EOS listener function defined above
199+
retval = dsl_pipeline_eos_listener_add(L"pipeline", eos_event_listener, NULL);
200+
if (retval != DSL_RESULT_SUCCESS) break;
201+
202+
// Play the pipeline
203+
retval = dsl_pipeline_play(L"pipeline");
204+
if (retval != DSL_RESULT_SUCCESS) break;
205+
206+
// Start and join the main-loop
207+
dsl_main_loop_run();
208+
break;
209+
210+
}
211+
212+
// Print out the final result
213+
std::cout << dsl_return_value_to_string(retval) << std::endl;
214+
215+
dsl_delete_all();
216+
217+
std::cout<<"Goodbye!"<<std::endl;
218+
return 0;
219+
}
220+

examples/cpp/1v4l2_pgie_iou_tracker_osd_window.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ THE SOFTWARE.
2424

2525
/* ##############################################################################
2626
#
27-
# The simple example demonstrates how to create a set of Pipeline components,
27+
# This example demonstrates how to create a set of Pipeline components,
2828
# specifically:
2929
# - V4L2 Source - Web Camera
3030
# - Primary GST Inference Engine (PGIE)
@@ -62,9 +62,6 @@ int brightness=0;
6262
int contrast=0;
6363
int hue=0;
6464

65-
std::wstring uri_h265(
66-
L"/opt/nvidia/deepstream/deepstream/samples/streams/sample_1080p_h265.mp4");
67-
6865
// Config and model-engine files
6966
std::wstring primary_infer_config_file(
7067
L"/opt/nvidia/deepstream/deepstream/sources/apps/sample_apps/deepstream-preprocess-test/config_infer.txt");

examples/python/1file_pgie_iou_tracker_osd_window_rtsp_h265.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,15 +143,15 @@ def main(args):
143143
break
144144

145145
# New RTSP Server Sink
146-
retVal = dsl_sink_rtsp_server_new('rtsp-sink',
146+
retval = dsl_sink_rtsp_server_new('rtsp-sink',
147147
host = "0.0.0.0", # 0.0.0.0 = "this host, this network."
148148
udp_port = 5400, # UDP port 5400 uses the Datagram Protocol.
149149
rtsp_port = 8554, #
150150
codec = DSL_CODEC_H265, # High Efficiency Video Coding (HEVC)
151151
bitrate = 0, # Set to 0 to use plugin default (4000000)
152152
interval = 0) # 0 = encode everyframe
153-
if retVal != DSL_RETURN_SUCCESS:
154-
print(dsl_return_value_to_string(retVal))
153+
if retval != DSL_RETURN_SUCCESS:
154+
break
155155

156156
# Add all the components to our pipeline
157157
retval = dsl_pipeline_new_component_add_many('pipeline',

0 commit comments

Comments
 (0)