ToolX 1.11.1 [e3f477f]
A GUI debug tool chain for diagnosing GVA systems
Loading...
Searching...
No Matches
srt_utils.cpp File Reference

Helpers shared by the SRT transmit and receive tabs. More...

#include "srt_utils.h"
#include <algorithm>
#include <cctype>
Include dependency graph for srt_utils.cpp:

Functions

const char * toolx::streams::srtModeName (SrtConnectionMode mode)
 The name of a connection mode as shown in the tables.
bool toolx::streams::srtModeFromName (const std::string &name, SrtConnectionMode &mode)
 Parse a connection mode name (case insensitive).
bool toolx::streams::validateSrtLink (const SrtLinkConfig &link, std::string &error)
 Check the settings of a link.
std::string toolx::streams::buildSrtUrl (const SrtLinkConfig &link)
 Build the srt:// URL for a link, with the passphrase percent encoded.
SrtLinkConfig toolx::streams::receiverFor (const SrtLinkConfig &transmit, const std::string &local_address)
 The settings of the receiving end of a link.
QJsonObject toolx::streams::srtLinkToJson (const SrtLinkConfig &link)
 The settings of a link as a JSON object for the configuration file.
SrtLinkConfig toolx::streams::srtLinkFromJson (const QJsonObject &object)
 Read the settings of a link from a JSON object.

Detailed Description

Helpers shared by the SRT transmit and receive tabs.

Function Documentation

◆ buildSrtUrl()

std::string toolx::streams::buildSrtUrl ( const SrtLinkConfig & link)

Build the srt:// URL for a link, with the passphrase percent encoded.

Parameters
linkthe 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
transmitthe transmitting end
local_addressthe 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
objectthe 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
linkthe settings
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
namethe name
modereceives the mode
Returns
true if the name was recognised

◆ srtModeName()

const char * toolx::streams::srtModeName ( SrtConnectionMode mode)

The name of a connection mode as shown in the tables.

Parameters
modethe mode
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
linkthe settings
errorreceives the reason when false is returned
Returns
true if the settings can be used to open a link