ToolX 1.11.1 [e3f477f]
A GUI debug tool chain for diagnosing GVA systems
Loading...
Searching...
No Matches
srt_utils.h
Go to the documentation of this file.
1//
2// Copyright (c) 2026, Astute Systems PTY LTD
3//
4// This file is part of the VivoeX project developed by Astute Systems.
5//
6// License. See the LICENSE file in the project root for full license details.
7//
13
14#ifndef STREAMS_SRT_UTILS_H
15#define STREAMS_SRT_UTILS_H
16
17#include <cstddef>
18#include <string>
19
20#include <QJsonObject>
21
22namespace toolx::streams {
23
33
36{
40 std::string host;
42 int port = 9000;
44 int latency_ms = 120;
46 std::string passphrase;
47};
48
51{
53 std::string name;
56};
57
59constexpr int kSrtMinPort = 1;
61constexpr int kSrtMaxPort = 65535;
63constexpr int kSrtMaxLatencyMs = 65535;
65constexpr size_t kSrtMinPassphrase = 10;
67constexpr size_t kSrtMaxPassphrase = 79;
68
75const char *srtModeName(SrtConnectionMode mode);
76
84bool srtModeFromName(const std::string &name, SrtConnectionMode &mode);
85
93bool validateSrtLink(const SrtLinkConfig &link, std::string &error);
94
101std::string buildSrtUrl(const SrtLinkConfig &link);
102
114SrtLinkConfig receiverFor(const SrtLinkConfig &transmit, const std::string &local_address);
115
124QJsonObject srtLinkToJson(const SrtLinkConfig &link);
125
135SrtLinkConfig srtLinkFromJson(const QJsonObject &object);
136
137} // namespace toolx::streams
138
139#endif // STREAMS_SRT_UTILS_H
const char * srtModeName(SrtConnectionMode mode)
The name of a connection mode as shown in the tables.
Definition srt_utils.cpp:50
SrtLinkConfig srtLinkFromJson(const QJsonObject &object)
Read the settings of a link from a JSON object.
Definition srt_utils.cpp:164
QJsonObject srtLinkToJson(const SrtLinkConfig &link)
The settings of a link as a JSON object for the configuration file.
Definition srt_utils.cpp:153
SrtLinkConfig receiverFor(const SrtLinkConfig &transmit, const std::string &local_address)
The settings of the receiving end of a link.
Definition srt_utils.cpp:131
std::string buildSrtUrl(const SrtLinkConfig &link)
Build the srt:// URL for a link, with the passphrase percent encoded.
Definition srt_utils.cpp:103
bool srtModeFromName(const std::string &name, SrtConnectionMode &mode)
Parse a connection mode name (case insensitive).
Definition srt_utils.cpp:63
bool validateSrtLink(const SrtLinkConfig &link, std::string &error)
Check the settings of a link.
Definition srt_utils.cpp:80
constexpr int kSrtMinPort
Lowest accepted UDP port.
Definition srt_utils.h:59
constexpr size_t kSrtMinPassphrase
Shortest accepted passphrase.
Definition srt_utils.h:65
constexpr int kSrtMaxLatencyMs
Highest accepted latency in milliseconds.
Definition srt_utils.h:63
SrtConnectionMode
How an SRT connection is established.
Definition srt_utils.h:25
@ kCaller
Connect to a listening peer.
Definition srt_utils.h:27
@ kListener
Wait for a caller.
Definition srt_utils.h:29
@ kRendezvous
Both peers connect to each other at the same time.
Definition srt_utils.h:31
constexpr size_t kSrtMaxPassphrase
Longest accepted passphrase.
Definition srt_utils.h:67
constexpr int kSrtMaxPort
Highest accepted UDP port.
Definition srt_utils.h:61
The settings of one end of an SRT link.
Definition srt_utils.h:36
int latency_ms
Receiver buffer latency in milliseconds.
Definition srt_utils.h:44
std::string host
Peer address for caller and rendezvous, local address to bind for a listener (may be empty).
Definition srt_utils.h:40
std::string passphrase
AES passphrase, empty for no encryption.
Definition srt_utils.h:46
int port
UDP port.
Definition srt_utils.h:42
SrtConnectionMode mode
Connection mode.
Definition srt_utils.h:38
A named SRT link, one row of the transmit or receive table.
Definition srt_utils.h:51
SrtLinkConfig link
The connection settings.
Definition srt_utils.h:55
std::string name
Session name.
Definition srt_utils.h:53