Helpers shared by the SRT transmit and receive tabs: connection settings, srt:// URL building, validation and the transmit to receive mapping.
More...
#include <cstddef>
#include <string>
#include <QJsonObject>
Go to the source code of this file.
|
|
constexpr int | toolx::streams::kSrtMinPort = 1 |
| | Lowest accepted UDP port.
|
|
constexpr int | toolx::streams::kSrtMaxPort = 65535 |
| | Highest accepted UDP port.
|
|
constexpr int | toolx::streams::kSrtMaxLatencyMs = 65535 |
| | Highest accepted latency in milliseconds.
|
|
constexpr size_t | toolx::streams::kSrtMinPassphrase = 10 |
| | Shortest accepted passphrase.
|
|
constexpr size_t | toolx::streams::kSrtMaxPassphrase = 79 |
| | Longest accepted passphrase.
|
Helpers shared by the SRT transmit and receive tabs: connection settings, srt:// URL building, validation and the transmit to receive mapping.
◆ SrtConnectionMode
How an SRT connection is established.
| Enumerator |
|---|
| kCaller | Connect to a listening peer.
|
| kListener | Wait for a caller.
|
| kRendezvous | Both peers connect to each other at the same time.
|
◆ buildSrtUrl()
| std::string toolx::streams::buildSrtUrl |
( |
const SrtLinkConfig & | link | ) |
|
Build the srt:// URL for a link, with the passphrase percent encoded.
- Parameters
-
| link | the settings, validated with validateSrtLink() |
- Returns
- std::string the URL accepted by mediax::srt::ParseSrtUrl()
◆ receiverFor()
| SrtLinkConfig toolx::streams::receiverFor |
( |
const SrtLinkConfig & | transmit, |
|
|
const std::string & | local_address ) |
The settings of the receiving end of a link.
There is no discovery, so a transmit row is turned into the row that connects to it: a caller transmitter gets a listening receiver, a listening transmitter gets a calling receiver that connects to local_address, and a rendezvous pair swap addresses.
- Parameters
-
| transmit | the transmitting end |
| local_address | the address of this machine, used when the transmitter listens |
- Returns
- SrtLinkConfig the receiving end with the same port, latency and passphrase
◆ srtLinkFromJson()
| SrtLinkConfig toolx::streams::srtLinkFromJson |
( |
const QJsonObject & | object | ) |
|
Read the settings of a link from a JSON object.
Missing values keep the defaults of SrtLinkConfig, an unknown mode is a caller. The port and the latency are limited to the accepted range.
- Parameters
-
| object | the object made by srtLinkToJson() |
- Returns
- SrtLinkConfig the settings
◆ srtLinkToJson()
| QJsonObject toolx::streams::srtLinkToJson |
( |
const SrtLinkConfig & | link | ) |
|
The settings of a link as a JSON object for the configuration file.
The passphrase is stored as it is, so a file holding one must be kept private.
- Parameters
-
- Returns
- QJsonObject with mode, host, port, latency and passphrase
◆ srtModeFromName()
| bool toolx::streams::srtModeFromName |
( |
const std::string & | name, |
|
|
SrtConnectionMode & | mode ) |
Parse a connection mode name (case insensitive).
- Parameters
-
| name | the name |
| mode | receives the mode |
- Returns
- true if the name was recognised
◆ srtModeName()
The name of a connection mode as shown in the tables.
- Parameters
-
- Returns
- const char* "Caller", "Listener" or "Rendezvous"
◆ validateSrtLink()
| bool toolx::streams::validateSrtLink |
( |
const SrtLinkConfig & | link, |
|
|
std::string & | error ) |
Check the settings of a link.
- Parameters
-
| link | the settings |
| error | receives the reason when false is returned |
- Returns
- true if the settings can be used to open a link