rocket-welder-sdk 1.0.5__tar.gz → 1.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {rocket_welder_sdk-1.0.5 → rocket_welder_sdk-1.1.0}/PKG-INFO +18 -11
- rocket_welder_sdk-1.1.0/README.md +454 -0
- rocket_welder_sdk-1.1.0/pyproject.toml +137 -0
- rocket_welder_sdk-1.1.0/rocket_welder_sdk/__init__.py +34 -0
- rocket_welder_sdk-1.1.0/rocket_welder_sdk/bytes_size.py +234 -0
- rocket_welder_sdk-1.1.0/rocket_welder_sdk/connection_string.py +232 -0
- rocket_welder_sdk-1.1.0/rocket_welder_sdk/controllers.py +609 -0
- rocket_welder_sdk-1.1.0/rocket_welder_sdk/gst_metadata.py +240 -0
- rocket_welder_sdk-1.1.0/rocket_welder_sdk/py.typed +2 -0
- rocket_welder_sdk-1.1.0/rocket_welder_sdk/rocket_welder_client.py +170 -0
- {rocket_welder_sdk-1.0.5 → rocket_welder_sdk-1.1.0}/rocket_welder_sdk.egg-info/PKG-INFO +18 -11
- rocket_welder_sdk-1.1.0/rocket_welder_sdk.egg-info/SOURCES.txt +22 -0
- rocket_welder_sdk-1.1.0/rocket_welder_sdk.egg-info/requires.txt +12 -0
- {rocket_welder_sdk-1.0.5 → rocket_welder_sdk-1.1.0}/setup.py +9 -4
- rocket_welder_sdk-1.1.0/tests/test_bytes_size.py +169 -0
- rocket_welder_sdk-1.1.0/tests/test_connection_string.py +169 -0
- rocket_welder_sdk-1.1.0/tests/test_controllers.py +315 -0
- rocket_welder_sdk-1.1.0/tests/test_gst_metadata.py +305 -0
- rocket_welder_sdk-1.0.5/rocket_welder_sdk/__init__.py +0 -8
- rocket_welder_sdk-1.0.5/rocket_welder_sdk/client.py +0 -183
- rocket_welder_sdk-1.0.5/rocket_welder_sdk/rocket_welder_sdk/__init__.py +0 -20
- rocket_welder_sdk-1.0.5/rocket_welder_sdk/rocket_welder_sdk/client.py +0 -326
- rocket_welder_sdk-1.0.5/rocket_welder_sdk/rocket_welder_sdk/connection_string.py +0 -190
- rocket_welder_sdk-1.0.5/rocket_welder_sdk/rocket_welder_sdk/exceptions.py +0 -23
- rocket_welder_sdk-1.0.5/rocket_welder_sdk/rocket_welder_sdk/gst_caps.py +0 -224
- rocket_welder_sdk-1.0.5/rocket_welder_sdk/rocket_welder_sdk/gst_metadata.py +0 -43
- rocket_welder_sdk-1.0.5/rocket_welder_sdk.egg-info/SOURCES.txt +0 -17
- rocket_welder_sdk-1.0.5/rocket_welder_sdk.egg-info/requires.txt +0 -8
- {rocket_welder_sdk-1.0.5 → rocket_welder_sdk-1.1.0}/MANIFEST.in +0 -0
- {rocket_welder_sdk-1.0.5 → rocket_welder_sdk-1.1.0}/logo.png +0 -0
- {rocket_welder_sdk-1.0.5 → rocket_welder_sdk-1.1.0}/rocket_welder_sdk.egg-info/dependency_links.txt +0 -0
- {rocket_welder_sdk-1.0.5 → rocket_welder_sdk-1.1.0}/rocket_welder_sdk.egg-info/top_level.txt +0 -0
- {rocket_welder_sdk-1.0.5 → rocket_welder_sdk-1.1.0}/setup.cfg +0 -0
|
@@ -1,37 +1,44 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: rocket-welder-sdk
|
|
3
|
-
Version: 1.0
|
|
4
|
-
Summary: High-performance video streaming
|
|
3
|
+
Version: 1.1.0
|
|
4
|
+
Summary: High-performance video streaming SDK for RocketWelder services using ZeroBuffer IPC
|
|
5
5
|
Home-page: https://github.com/modelingevolution/rocket-welder-sdk
|
|
6
6
|
Author: ModelingEvolution
|
|
7
|
-
|
|
7
|
+
Author-email: ModelingEvolution <info@modelingevolution.com>
|
|
8
|
+
Maintainer-email: ModelingEvolution <info@modelingevolution.com>
|
|
9
|
+
License: MIT
|
|
10
|
+
Project-URL: Homepage, https://github.com/modelingevolution/rocket-welder-sdk
|
|
11
|
+
Project-URL: Repository, https://github.com/modelingevolution/rocket-welder-sdk.git
|
|
12
|
+
Project-URL: Issues, https://github.com/modelingevolution/rocket-welder-sdk/issues
|
|
13
|
+
Keywords: video,streaming,gstreamer,ipc,shared-memory,zerobuffer,computer-vision
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
8
15
|
Classifier: Intended Audience :: Developers
|
|
9
16
|
Classifier: Topic :: Multimedia :: Video
|
|
17
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
10
18
|
Classifier: License :: OSI Approved :: MIT License
|
|
11
19
|
Classifier: Programming Language :: Python :: 3
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
13
20
|
Classifier: Programming Language :: Python :: 3.9
|
|
14
21
|
Classifier: Programming Language :: Python :: 3.10
|
|
15
22
|
Classifier: Programming Language :: Python :: 3.11
|
|
16
23
|
Classifier: Programming Language :: Python :: 3.12
|
|
24
|
+
Classifier: Operating System :: OS Independent
|
|
25
|
+
Classifier: Typing :: Typed
|
|
17
26
|
Requires-Python: >=3.8
|
|
18
27
|
Description-Content-Type: text/markdown
|
|
19
28
|
Requires-Dist: numpy>=1.20.0
|
|
20
29
|
Requires-Dist: opencv-python>=4.5.0
|
|
21
|
-
Requires-Dist: zerobuffer-ipc>=1.1.
|
|
30
|
+
Requires-Dist: zerobuffer-ipc>=1.1.10
|
|
22
31
|
Provides-Extra: dev
|
|
23
32
|
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
33
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
34
|
+
Requires-Dist: pytest-asyncio>=0.21; extra == "dev"
|
|
24
35
|
Requires-Dist: black>=22.0; extra == "dev"
|
|
25
36
|
Requires-Dist: mypy>=1.0; extra == "dev"
|
|
37
|
+
Requires-Dist: ruff>=0.1.0; extra == "dev"
|
|
38
|
+
Requires-Dist: types-setuptools; extra == "dev"
|
|
26
39
|
Dynamic: author
|
|
27
|
-
Dynamic: classifier
|
|
28
|
-
Dynamic: description
|
|
29
|
-
Dynamic: description-content-type
|
|
30
40
|
Dynamic: home-page
|
|
31
|
-
Dynamic: provides-extra
|
|
32
|
-
Dynamic: requires-dist
|
|
33
41
|
Dynamic: requires-python
|
|
34
|
-
Dynamic: summary
|
|
35
42
|
|
|
36
43
|
# Rocket Welder SDK
|
|
37
44
|
|
|
@@ -0,0 +1,454 @@
|
|
|
1
|
+
# Rocket Welder SDK
|
|
2
|
+
|
|
3
|
+
[](https://www.nuget.org/packages/RocketWelder.SDK/)
|
|
4
|
+
[](https://pypi.org/project/rocket-welder-sdk/)
|
|
5
|
+
[](https://github.com/modelingevolution/rocket-welder-sdk-vcpkg-registry)
|
|
6
|
+
[](https://opensource.org/licenses/MIT)
|
|
7
|
+
|
|
8
|
+
Multi-language client libraries for interacting with RocketWelder video streaming services.
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
The Rocket Welder SDK provides high-performance video streaming capabilities for containerized applications. It offers native client libraries in C++, C#, and Python, enabling seamless integration with RocketWelder video streaming pipelines.
|
|
13
|
+
|
|
14
|
+
## Features
|
|
15
|
+
|
|
16
|
+
- **High Performance**: Optimized for minimal latency and maximum throughput
|
|
17
|
+
- **Multi-Language Support**: Native libraries for C++, C#, and Python
|
|
18
|
+
- **Protocol Flexibility**: Support for multiple streaming protocols via connection strings
|
|
19
|
+
- **Container-Ready**: Designed for Docker/Kubernetes deployments
|
|
20
|
+
- **Simple Integration**: Easy-to-use API with minimal configuration
|
|
21
|
+
|
|
22
|
+
## Client Libraries
|
|
23
|
+
|
|
24
|
+
| Language | Package Manager | Package Name |
|
|
25
|
+
|----------|----------------|--------------|
|
|
26
|
+
| C++ | vcpkg | rocket-welder-sdk |
|
|
27
|
+
| C# | NuGet | RocketWelder.SDK |
|
|
28
|
+
| Python | pip | rocket-welder-sdk |
|
|
29
|
+
|
|
30
|
+
## Connection String Format
|
|
31
|
+
|
|
32
|
+
The SDK uses URI-style connection strings to specify data sources and protocols:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
protocol://[host[:port]]/[path][?param1=value1¶m2=value2]
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### Supported Protocols
|
|
39
|
+
|
|
40
|
+
#### Shared Memory (High-Performance Local)
|
|
41
|
+
```
|
|
42
|
+
shm://<buffer_name>
|
|
43
|
+
shm://<buffer_name>?buffer_size=10MB&metadata_size=1024KB
|
|
44
|
+
shm://<buffer_name>?mode=duplex&buffer_size=10MB
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
**Optional Parameters:**
|
|
48
|
+
- `mode`: Communication mode (`duplex` for bidirectional/mutable, `oneway` for one-way communication; default: `duplex`)
|
|
49
|
+
- `buffer_size`: Size of the data buffer (default: 20MB, supports units: B, KB, MB, GB)
|
|
50
|
+
- `metadata_size`: Size of the metadata buffer (default: 4KB, supports units: B, KB, MB)
|
|
51
|
+
|
|
52
|
+
#### MJPEG over HTTP
|
|
53
|
+
```
|
|
54
|
+
mjpeg+http://192.168.1.100:8080
|
|
55
|
+
mjpeg+http://camera.local:8080
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
#### MJPEG over TCP
|
|
59
|
+
```
|
|
60
|
+
mjpeg+tcp://192.168.1.100:5000
|
|
61
|
+
mjpeg+tcp://camera.local:5000
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Environment Variable
|
|
65
|
+
|
|
66
|
+
When deployed in a Rocket Welder container, the connection string is provided via:
|
|
67
|
+
```bash
|
|
68
|
+
CONNECTION_STRING=shm://camera_feed?buffer_size=20MB&metadata_size=4KB
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
## Installation
|
|
72
|
+
|
|
73
|
+
### C++ with vcpkg
|
|
74
|
+
|
|
75
|
+
Configure the custom registry in your `vcpkg-configuration.json`:
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"registries": [
|
|
79
|
+
{
|
|
80
|
+
"kind": "git",
|
|
81
|
+
"repository": "https://github.com/modelingevolution/rocket-welder-sdk-vcpkg-registry",
|
|
82
|
+
"baseline": "YOUR_BASELINE_HERE",
|
|
83
|
+
"packages": ["rocket-welder-sdk"]
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Then install:
|
|
90
|
+
```bash
|
|
91
|
+
# Install via vcpkg
|
|
92
|
+
vcpkg install rocket-welder-sdk
|
|
93
|
+
|
|
94
|
+
# Or integrate with CMake
|
|
95
|
+
find_package(rocket-welder-sdk CONFIG REQUIRED)
|
|
96
|
+
target_link_libraries(your_app PRIVATE rocket-welder-sdk::rocket-welder-sdk)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### C# with NuGet
|
|
100
|
+
|
|
101
|
+
[](https://www.nuget.org/packages/RocketWelder.SDK/)
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
# Package Manager Console
|
|
105
|
+
Install-Package RocketWelder.SDK
|
|
106
|
+
|
|
107
|
+
# .NET CLI
|
|
108
|
+
dotnet add package RocketWelder.SDK
|
|
109
|
+
|
|
110
|
+
# PackageReference in .csproj
|
|
111
|
+
<PackageReference Include="RocketWelder.SDK" Version="1.0.*" />
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
### Python with pip
|
|
115
|
+
|
|
116
|
+
[](https://pypi.org/project/rocket-welder-sdk/)
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
# Install from PyPI
|
|
120
|
+
pip install rocket-welder-sdk
|
|
121
|
+
|
|
122
|
+
# Install with optional dependencies
|
|
123
|
+
pip install rocket-welder-sdk[opencv] # Includes OpenCV
|
|
124
|
+
pip install rocket-welder-sdk[all] # All optional dependencies
|
|
125
|
+
|
|
126
|
+
# Install specific version
|
|
127
|
+
pip install rocket-welder-sdk==1.0.0
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Quick Start
|
|
131
|
+
|
|
132
|
+
### C++ Quick Start
|
|
133
|
+
```cpp
|
|
134
|
+
#include <rocket_welder/client.hpp>
|
|
135
|
+
|
|
136
|
+
auto client = rocket_welder::Client::from_connection_string("shm://my-buffer");
|
|
137
|
+
client.on_frame([](cv::Mat& frame) {
|
|
138
|
+
// Process frame
|
|
139
|
+
});
|
|
140
|
+
client.start();
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
### C# Quick Start
|
|
144
|
+
```csharp
|
|
145
|
+
using RocketWelder.SDK;
|
|
146
|
+
|
|
147
|
+
var client = RocketWelderClient.FromConnectionString("shm://my-buffer");
|
|
148
|
+
client.Start(frame => {
|
|
149
|
+
// Process frame
|
|
150
|
+
});
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Python Quick Start
|
|
154
|
+
```python
|
|
155
|
+
import rocket_welder_sdk as rw
|
|
156
|
+
|
|
157
|
+
client = rw.Client.from_connection_string("shm://my-buffer")
|
|
158
|
+
|
|
159
|
+
@client.on_frame
|
|
160
|
+
def process(frame):
|
|
161
|
+
# Process frame
|
|
162
|
+
pass
|
|
163
|
+
|
|
164
|
+
client.start()
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Usage Examples
|
|
168
|
+
|
|
169
|
+
### C++
|
|
170
|
+
|
|
171
|
+
```cpp
|
|
172
|
+
#include <rocket_welder/client.hpp>
|
|
173
|
+
#include <opencv2/opencv.hpp>
|
|
174
|
+
|
|
175
|
+
int main(int argc, char* argv[]) {
|
|
176
|
+
// Best practice: use from() which:
|
|
177
|
+
// 1. Checks environment variable (CONNECTION_STRING)
|
|
178
|
+
// 2. Overrides with command line args if provided
|
|
179
|
+
auto client = rocket_welder::Client::from(argc, argv);
|
|
180
|
+
|
|
181
|
+
// Or specify connection string directly
|
|
182
|
+
auto client = rocket_welder::Client::from_connection_string(
|
|
183
|
+
"shm://camera_feed?buffer_size=20MB&metadata_size=4KB"
|
|
184
|
+
);
|
|
185
|
+
|
|
186
|
+
// Process frames as OpenCV Mat (mutable by default)
|
|
187
|
+
client.on_frame([](cv::Mat& frame) {
|
|
188
|
+
// Add overlay text - zero copy!
|
|
189
|
+
cv::putText(frame, "Processing", cv::Point(10, 30),
|
|
190
|
+
cv::FONT_HERSHEY_SIMPLEX, 1.0, cv::Scalar(0, 255, 0), 2);
|
|
191
|
+
|
|
192
|
+
// Add timestamp overlay
|
|
193
|
+
auto now = std::chrono::system_clock::now();
|
|
194
|
+
auto time_t = std::chrono::system_clock::to_time_t(now);
|
|
195
|
+
cv::putText(frame, std::ctime(&time_t), cv::Point(10, 60),
|
|
196
|
+
cv::FONT_HERSHEY_SIMPLEX, 0.5, cv::Scalar(255, 255, 255), 1);
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
client.start();
|
|
200
|
+
return 0;
|
|
201
|
+
}
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
### C#
|
|
205
|
+
|
|
206
|
+
```csharp
|
|
207
|
+
using RocketWelder.SDK;
|
|
208
|
+
using OpenCvSharp;
|
|
209
|
+
|
|
210
|
+
class Program
|
|
211
|
+
{
|
|
212
|
+
static void Main(string[] args)
|
|
213
|
+
{
|
|
214
|
+
// Best practice: use From() which:
|
|
215
|
+
// 1. Checks environment variable (CONNECTION_STRING)
|
|
216
|
+
// 2. Overrides with command line args if provided
|
|
217
|
+
var client = RocketWelderClient.From(args);
|
|
218
|
+
|
|
219
|
+
// Or specify connection string directly
|
|
220
|
+
var client = RocketWelderClient.FromConnectionString(
|
|
221
|
+
"shm://camera_feed?buffer_size=20MB&metadata_size=4KB"
|
|
222
|
+
);
|
|
223
|
+
|
|
224
|
+
int frameCount = 0;
|
|
225
|
+
|
|
226
|
+
// Process frames as OpenCV Mat
|
|
227
|
+
client.Start((Mat frame) =>
|
|
228
|
+
{
|
|
229
|
+
// Add overlay text
|
|
230
|
+
Cv2.PutText(frame, "Processing", new Point(10, 30),
|
|
231
|
+
HersheyFonts.HersheySimplex, 1.0, new Scalar(0, 255, 0), 2);
|
|
232
|
+
|
|
233
|
+
// Add frame counter overlay
|
|
234
|
+
Cv2.PutText(frame, $"Frame: {frameCount++}", new Point(10, 60),
|
|
235
|
+
HersheyFonts.HersheySimplex, 0.5, new Scalar(255, 255, 255), 1);
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
### Python
|
|
242
|
+
|
|
243
|
+
```python
|
|
244
|
+
import rocket_welder_sdk as rw
|
|
245
|
+
import cv2
|
|
246
|
+
import sys
|
|
247
|
+
|
|
248
|
+
# Best practice: use from_args() which:
|
|
249
|
+
# 1. Checks environment variable (CONNECTION_STRING)
|
|
250
|
+
# 2. Overrides with command line args if provided
|
|
251
|
+
client = rw.Client.from_args(sys.argv)
|
|
252
|
+
|
|
253
|
+
# Or specify connection string directly
|
|
254
|
+
client = rw.Client.from_connection_string("shm://camera_feed?buffer_size=20MB&metadata_size=4KB")
|
|
255
|
+
|
|
256
|
+
# Process frames as numpy arrays (OpenCV compatible)
|
|
257
|
+
@client.on_frame
|
|
258
|
+
def process_frame(frame: np.ndarray):
|
|
259
|
+
# Add overlay text - zero copy!
|
|
260
|
+
cv2.putText(frame, "Processing", (10, 30),
|
|
261
|
+
cv2.FONT_HERSHEY_SIMPLEX, 1.0, (0, 255, 0), 2)
|
|
262
|
+
|
|
263
|
+
# Add timestamp overlay
|
|
264
|
+
from datetime import datetime
|
|
265
|
+
timestamp = datetime.now().strftime("%Y-%m-%d %H:%M:%S")
|
|
266
|
+
cv2.putText(frame, timestamp, (10, 60),
|
|
267
|
+
cv2.FONT_HERSHEY_SIMPLEX, 0.5, (255, 255, 255), 1)
|
|
268
|
+
|
|
269
|
+
client.start()
|
|
270
|
+
|
|
271
|
+
# Or use iterator pattern
|
|
272
|
+
for frame in client.frames():
|
|
273
|
+
# Each frame is a numpy array
|
|
274
|
+
print(f"Received frame: {frame.shape}")
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
## Docker Integration
|
|
278
|
+
|
|
279
|
+
### C++ Dockerfile
|
|
280
|
+
|
|
281
|
+
```dockerfile
|
|
282
|
+
FROM ubuntu:22.04 AS builder
|
|
283
|
+
|
|
284
|
+
# Install build tools and OpenCV
|
|
285
|
+
RUN apt-get update && apt-get install -y \
|
|
286
|
+
build-essential \
|
|
287
|
+
cmake \
|
|
288
|
+
libopencv-dev
|
|
289
|
+
|
|
290
|
+
# Install Rocket Welder SDK via vcpkg
|
|
291
|
+
RUN vcpkg install rocket-welder-sdk
|
|
292
|
+
|
|
293
|
+
# Build your application
|
|
294
|
+
WORKDIR /app
|
|
295
|
+
COPY . .
|
|
296
|
+
RUN cmake . && make
|
|
297
|
+
|
|
298
|
+
FROM ubuntu:22.04
|
|
299
|
+
RUN apt-get update && apt-get install -y libopencv-dev
|
|
300
|
+
COPY --from=builder /app/my_app /usr/local/bin/
|
|
301
|
+
CMD ["my_app"]
|
|
302
|
+
```
|
|
303
|
+
|
|
304
|
+
### C# Dockerfile
|
|
305
|
+
|
|
306
|
+
```dockerfile
|
|
307
|
+
FROM mcr.microsoft.com/dotnet/sdk:8.0 AS builder
|
|
308
|
+
|
|
309
|
+
WORKDIR /app
|
|
310
|
+
COPY *.csproj ./
|
|
311
|
+
RUN dotnet restore
|
|
312
|
+
|
|
313
|
+
COPY . ./
|
|
314
|
+
RUN dotnet publish -c Release -o out
|
|
315
|
+
|
|
316
|
+
FROM mcr.microsoft.com/dotnet/runtime:8.0
|
|
317
|
+
WORKDIR /app
|
|
318
|
+
COPY --from=builder /app/out .
|
|
319
|
+
CMD ["dotnet", "MyApp.dll"]
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### Python Dockerfile
|
|
323
|
+
|
|
324
|
+
```dockerfile
|
|
325
|
+
FROM python:3.11-slim
|
|
326
|
+
|
|
327
|
+
# Install OpenCV and other dependencies
|
|
328
|
+
RUN apt-get update && apt-get install -y \
|
|
329
|
+
python3-opencv \
|
|
330
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
331
|
+
|
|
332
|
+
# Install Rocket Welder SDK and ML frameworks
|
|
333
|
+
RUN pip install --no-cache-dir \
|
|
334
|
+
rocket-welder-sdk \
|
|
335
|
+
numpy \
|
|
336
|
+
ultralytics # Example: YOLO
|
|
337
|
+
|
|
338
|
+
WORKDIR /app
|
|
339
|
+
COPY . .
|
|
340
|
+
|
|
341
|
+
CMD ["python", "app.py"]
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
## Protocol Details
|
|
345
|
+
|
|
346
|
+
### Shared Memory Protocol (shm://)
|
|
347
|
+
|
|
348
|
+
High-performance local data transfer between processes:
|
|
349
|
+
|
|
350
|
+
- **Performance**: Minimal latency, maximum throughput
|
|
351
|
+
- **Use Cases**: Local processing, multi-container applications on same host
|
|
352
|
+
|
|
353
|
+
### MJPEG over HTTP (mjpeg+http://)
|
|
354
|
+
|
|
355
|
+
Motion JPEG streaming over HTTP:
|
|
356
|
+
|
|
357
|
+
- **Performance**: Good balance of quality and bandwidth
|
|
358
|
+
- **Advantages**: Wide compatibility, firewall-friendly, browser support
|
|
359
|
+
- **Use Cases**: Network streaming, web applications, remote monitoring
|
|
360
|
+
|
|
361
|
+
### MJPEG over TCP (mjpeg+tcp://)
|
|
362
|
+
|
|
363
|
+
Motion JPEG streaming over raw TCP socket:
|
|
364
|
+
|
|
365
|
+
- **Performance**: Lower latency than HTTP, less protocol overhead
|
|
366
|
+
- **Advantages**: Direct socket connection, minimal overhead, suitable for local networks
|
|
367
|
+
- **Use Cases**: Low-latency streaming, embedded systems, industrial applications
|
|
368
|
+
|
|
369
|
+
## Building from Source
|
|
370
|
+
|
|
371
|
+
### Prerequisites
|
|
372
|
+
|
|
373
|
+
- CMake 3.20+
|
|
374
|
+
- C++20 compiler
|
|
375
|
+
- Python 3.8+ (for Python bindings)
|
|
376
|
+
- .NET 6.0+ SDK (for C# bindings)
|
|
377
|
+
- OpenCV 4.0+ (optional, for image processing)
|
|
378
|
+
|
|
379
|
+
### Build Instructions
|
|
380
|
+
|
|
381
|
+
```bash
|
|
382
|
+
git clone https://github.com/modelingevolution/rocket-welder-sdk.git
|
|
383
|
+
cd rocket-welder-sdk
|
|
384
|
+
|
|
385
|
+
# Build all libraries
|
|
386
|
+
mkdir build && cd build
|
|
387
|
+
cmake ..
|
|
388
|
+
make -j$(nproc)
|
|
389
|
+
|
|
390
|
+
# Run tests
|
|
391
|
+
ctest
|
|
392
|
+
|
|
393
|
+
# Install
|
|
394
|
+
sudo make install
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
## API Reference
|
|
398
|
+
|
|
399
|
+
Detailed API documentation for each language:
|
|
400
|
+
|
|
401
|
+
- [C++ API Reference](docs/cpp-api.md)
|
|
402
|
+
- [C# API Reference](docs/csharp-api.md)
|
|
403
|
+
- [Python API Reference](docs/python-api.md)
|
|
404
|
+
|
|
405
|
+
## Examples
|
|
406
|
+
|
|
407
|
+
See the [examples](examples/) directory for complete working examples:
|
|
408
|
+
|
|
409
|
+
- [Simple Frame Reader](examples/simple-reader/)
|
|
410
|
+
- [Frame Processor](examples/frame-processor/)
|
|
411
|
+
- [Multi-Stream Handler](examples/multi-stream/)
|
|
412
|
+
- [Performance Benchmark](examples/benchmark/)
|
|
413
|
+
|
|
414
|
+
## Contributing
|
|
415
|
+
|
|
416
|
+
Contributions are welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.
|
|
417
|
+
|
|
418
|
+
## License
|
|
419
|
+
|
|
420
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
421
|
+
|
|
422
|
+
## Support
|
|
423
|
+
|
|
424
|
+
- **Issues**: [GitHub Issues](https://github.com/modelingevolution/rocket-welder-sdk/issues)
|
|
425
|
+
- **Discussions**: [GitHub Discussions](https://github.com/modelingevolution/rocket-welder-sdk/discussions)
|
|
426
|
+
- **Documentation**: [https://docs.rocket-welder.io](https://docs.rocket-welder.io)
|
|
427
|
+
|
|
428
|
+
## Technical Details
|
|
429
|
+
|
|
430
|
+
### GStreamer Integration
|
|
431
|
+
|
|
432
|
+
The SDK integrates with GStreamer pipelines through specialized elements:
|
|
433
|
+
- **zerosink**: Simple sink element for writing video frames
|
|
434
|
+
- **zerobuffer**: Processing element with bidirectional communication using DuplexChannel
|
|
435
|
+
|
|
436
|
+
### Zero-Copy Buffer Technology
|
|
437
|
+
|
|
438
|
+
For shared memory protocol, the SDK uses:
|
|
439
|
+
- **C++**: Zero-Copy-Buffer (via vcpkg) - Returns cv::Mat with zero-copy access
|
|
440
|
+
- **C#**: ZeroBuffer (via NuGet) - Returns OpenCvSharp.Mat with zero-copy access
|
|
441
|
+
- **Python**: zero-buffer (via pip) - Returns numpy arrays compatible with OpenCV
|
|
442
|
+
|
|
443
|
+
The SDK leverages DuplexChannel for bidirectional communication, enabling:
|
|
444
|
+
- Zero-copy frame access as OpenCV Mat objects
|
|
445
|
+
- In-place frame processing without memory allocation
|
|
446
|
+
- Direct memory mapping between producer and consumer
|
|
447
|
+
- Efficient metadata passing alongside frame data
|
|
448
|
+
|
|
449
|
+
This technology enables direct memory access without data duplication, providing maximum performance for local processing scenarios.
|
|
450
|
+
|
|
451
|
+
## Acknowledgments
|
|
452
|
+
|
|
453
|
+
- GStreamer Project for the multimedia framework
|
|
454
|
+
- ZeroBuffer contributors for the zero-copy buffer implementation
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "rocket-welder-sdk"
|
|
7
|
+
version = "1.1.0"
|
|
8
|
+
description = "High-performance video streaming SDK for RocketWelder services using ZeroBuffer IPC"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = {text = "MIT"}
|
|
12
|
+
authors = [
|
|
13
|
+
{name = "ModelingEvolution", email = "info@modelingevolution.com"}
|
|
14
|
+
]
|
|
15
|
+
maintainers = [
|
|
16
|
+
{name = "ModelingEvolution", email = "info@modelingevolution.com"}
|
|
17
|
+
]
|
|
18
|
+
keywords = ["video", "streaming", "gstreamer", "ipc", "shared-memory", "zerobuffer", "computer-vision"]
|
|
19
|
+
classifiers = [
|
|
20
|
+
"Development Status :: 4 - Beta",
|
|
21
|
+
"Intended Audience :: Developers",
|
|
22
|
+
"Topic :: Multimedia :: Video",
|
|
23
|
+
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
24
|
+
"License :: OSI Approved :: MIT License",
|
|
25
|
+
"Programming Language :: Python :: 3",
|
|
26
|
+
"Programming Language :: Python :: 3.9",
|
|
27
|
+
"Programming Language :: Python :: 3.10",
|
|
28
|
+
"Programming Language :: Python :: 3.11",
|
|
29
|
+
"Programming Language :: Python :: 3.12",
|
|
30
|
+
"Operating System :: OS Independent",
|
|
31
|
+
"Typing :: Typed",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
dependencies = [
|
|
35
|
+
"numpy>=1.20.0",
|
|
36
|
+
"opencv-python>=4.5.0",
|
|
37
|
+
"zerobuffer-ipc>=1.1.10",
|
|
38
|
+
]
|
|
39
|
+
|
|
40
|
+
[project.optional-dependencies]
|
|
41
|
+
dev = [
|
|
42
|
+
"pytest>=7.0",
|
|
43
|
+
"pytest-cov>=4.0",
|
|
44
|
+
"pytest-asyncio>=0.21",
|
|
45
|
+
"black>=22.0",
|
|
46
|
+
"mypy>=1.0",
|
|
47
|
+
"ruff>=0.1.0",
|
|
48
|
+
"types-setuptools",
|
|
49
|
+
]
|
|
50
|
+
|
|
51
|
+
[project.urls]
|
|
52
|
+
Homepage = "https://github.com/modelingevolution/rocket-welder-sdk"
|
|
53
|
+
Repository = "https://github.com/modelingevolution/rocket-welder-sdk.git"
|
|
54
|
+
Issues = "https://github.com/modelingevolution/rocket-welder-sdk/issues"
|
|
55
|
+
|
|
56
|
+
[tool.setuptools.packages.find]
|
|
57
|
+
where = ["."]
|
|
58
|
+
include = ["rocket_welder_sdk*"]
|
|
59
|
+
|
|
60
|
+
[tool.setuptools.package-data]
|
|
61
|
+
rocket_welder_sdk = ["py.typed"]
|
|
62
|
+
|
|
63
|
+
[tool.mypy]
|
|
64
|
+
python_version = "3.9"
|
|
65
|
+
strict = true
|
|
66
|
+
warn_return_any = true
|
|
67
|
+
warn_unused_configs = true
|
|
68
|
+
no_implicit_reexport = true
|
|
69
|
+
namespace_packages = true
|
|
70
|
+
show_error_codes = true
|
|
71
|
+
show_column_numbers = true
|
|
72
|
+
pretty = true
|
|
73
|
+
|
|
74
|
+
[[tool.mypy.overrides]]
|
|
75
|
+
module = [
|
|
76
|
+
"cv2",
|
|
77
|
+
"cv2.*",
|
|
78
|
+
"zerobuffer",
|
|
79
|
+
"zerobuffer.*",
|
|
80
|
+
]
|
|
81
|
+
ignore_missing_imports = true
|
|
82
|
+
|
|
83
|
+
[tool.black]
|
|
84
|
+
line-length = 100
|
|
85
|
+
target-version = ['py39', 'py310', 'py311', 'py312']
|
|
86
|
+
include = '\.pyi?$'
|
|
87
|
+
|
|
88
|
+
[tool.ruff]
|
|
89
|
+
line-length = 100
|
|
90
|
+
target-version = "py39"
|
|
91
|
+
|
|
92
|
+
[tool.ruff.lint]
|
|
93
|
+
select = [
|
|
94
|
+
"E", # pycodestyle errors
|
|
95
|
+
"W", # pycodestyle warnings
|
|
96
|
+
"F", # pyflakes
|
|
97
|
+
"I", # isort
|
|
98
|
+
"B", # flake8-bugbear
|
|
99
|
+
"C4", # flake8-comprehensions
|
|
100
|
+
"UP", # pyupgrade
|
|
101
|
+
"N", # pep8-naming
|
|
102
|
+
"TID", # flake8-tidy-imports
|
|
103
|
+
"SIM", # flake8-simplify
|
|
104
|
+
"TCH", # flake8-type-checking
|
|
105
|
+
"RUF", # Ruff-specific rules
|
|
106
|
+
]
|
|
107
|
+
ignore = [
|
|
108
|
+
"E501", # line too long (handled by black)
|
|
109
|
+
"B008", # do not perform function calls in argument defaults
|
|
110
|
+
"C901", # too complex
|
|
111
|
+
]
|
|
112
|
+
|
|
113
|
+
[tool.ruff.lint.per-file-ignores]
|
|
114
|
+
"__init__.py" = ["F401"] # imported but unused
|
|
115
|
+
"tests/*" = ["S101"] # use of assert
|
|
116
|
+
|
|
117
|
+
[tool.pytest.ini_options]
|
|
118
|
+
minversion = "7.0"
|
|
119
|
+
testpaths = ["tests"]
|
|
120
|
+
pythonpath = ["."]
|
|
121
|
+
addopts = [
|
|
122
|
+
"--strict-markers",
|
|
123
|
+
"--tb=short",
|
|
124
|
+
"--cov=rocket_welder_sdk",
|
|
125
|
+
"--cov-report=term-missing",
|
|
126
|
+
"--cov-report=html",
|
|
127
|
+
"--cov-fail-under=55", # Adjusted due to ZeroBuffer dependency for controllers
|
|
128
|
+
]
|
|
129
|
+
|
|
130
|
+
[tool.coverage.run]
|
|
131
|
+
source = ["rocket_welder_sdk"]
|
|
132
|
+
branch = true
|
|
133
|
+
|
|
134
|
+
[tool.coverage.report]
|
|
135
|
+
precision = 2
|
|
136
|
+
show_missing = true
|
|
137
|
+
skip_covered = false
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"""
|
|
2
|
+
RocketWelder SDK - Enterprise-grade Python client library for video streaming services.
|
|
3
|
+
|
|
4
|
+
High-performance video streaming using shared memory (ZeroBuffer) for zero-copy operations.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from .bytes_size import BytesSize
|
|
8
|
+
from .connection_string import ConnectionMode, ConnectionString, Protocol
|
|
9
|
+
from .controllers import DuplexShmController, IController, OneWayShmController
|
|
10
|
+
from .gst_metadata import GstCaps, GstMetadata
|
|
11
|
+
from .rocket_welder_client import RocketWelderClient
|
|
12
|
+
|
|
13
|
+
# Alias for backward compatibility
|
|
14
|
+
Client = RocketWelderClient
|
|
15
|
+
|
|
16
|
+
__version__ = "1.1.0"
|
|
17
|
+
|
|
18
|
+
__all__ = [
|
|
19
|
+
# Core types
|
|
20
|
+
"BytesSize",
|
|
21
|
+
"Client", # Backward compatibility
|
|
22
|
+
"ConnectionMode",
|
|
23
|
+
"ConnectionString",
|
|
24
|
+
"DuplexShmController",
|
|
25
|
+
# GStreamer metadata
|
|
26
|
+
"GstCaps",
|
|
27
|
+
"GstMetadata",
|
|
28
|
+
# Controllers
|
|
29
|
+
"IController",
|
|
30
|
+
"OneWayShmController",
|
|
31
|
+
"Protocol",
|
|
32
|
+
# Main client
|
|
33
|
+
"RocketWelderClient",
|
|
34
|
+
]
|