ToolX 1.11.1 [e3f477f]
A GUI debug tool chain for diagnosing GVA systems
Loading...
Searching...
No Matches
srt_transmit_tab.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//
12
13#ifndef STREAMS_SRT_TRANSMIT_TAB_H
14#define STREAMS_SRT_TRANSMIT_TAB_H
15
16#include <map>
17#include <memory>
18#include <string>
19#include <vector>
20
21#include <QObject>
22#include <QJsonArray>
23#include <QString>
24#include <QTimer>
25#include <QWidget>
26
27#include "../ui_toolx.h"
29#include "streams/srt_utils.h"
31
39class SrtTransmitTab : public QObject
40{
41 Q_OBJECT
42
43public:
50 explicit SrtTransmitTab(Ui::Dialog &ui, QWidget *parent = nullptr);
51
55 ~SrtTransmitTab() final;
56
57 SrtTransmitTab(const SrtTransmitTab &) = delete;
58 SrtTransmitTab &operator=(const SrtTransmitTab &) = delete;
59 SrtTransmitTab(SrtTransmitTab &&) = delete;
60 SrtTransmitTab &operator=(SrtTransmitTab &&) = delete;
61
67 int activeCount() const;
68
76 QJsonArray toJson() const;
77
86 void fromJson(const QJsonArray &streams);
87
88public slots:
92 void addStream();
93
97 void removeSelected();
98
102 void enableAll();
103
108 void copyToReceive();
109
110signals:
116 void receiversRequested(const std::vector<toolx::streams::SrtStreamEntry> &entries);
117
118private:
124 int idOfRow(int row) const;
126 void toggle(int row);
128 void lockRow(int row, bool locked);
130 void setStateText(int row, const QString &text, bool good, bool bad);
132 void updateStates();
134 void updateButtons();
136 std::string localAddress(const toolx::streams::SrtLinkConfig &link) const;
138 void save() const;
140 void load();
141
143 Ui::Dialog &m_ui;
145 QWidget *m_parent;
147 std::map<int, std::unique_ptr<toolx::streams::SrtGenerator>> m_streams;
149 std::map<int, uint64_t> m_last_bytes;
151 QTimer m_timer;
153 int m_next_id = 1;
155 bool m_loading = false;
156};
157
158#endif // STREAMS_SRT_TRANSMIT_TAB_H
void removeSelected()
Stop and remove the selected stream.
Definition srt_transmit_tab.cpp:295
bool m_loading
Set while the table is changed by the program so the edits are not acted on.
Definition srt_transmit_tab.h:155
void receiversRequested(const std::vector< toolx::streams::SrtStreamEntry > &entries)
Receivers for transmit streams were requested.
void setStateText(int row, const QString &text, bool good, bool bad)
Show the state of a row.
Definition srt_transmit_tab.cpp:499
void load()
Load the saved rows.
Definition srt_transmit_tab.cpp:595
~SrtTransmitTab() final
Stop all the streams.
Definition srt_transmit_tab.cpp:213
Ui::Dialog & m_ui
The main dialogue UI.
Definition srt_transmit_tab.h:143
std::map< int, uint64_t > m_last_bytes
Bytes sent at the last refresh, to show the bit rate.
Definition srt_transmit_tab.h:149
void fromJson(const QJsonArray &streams)
Replace the table with the streams of a JSON array.
Definition srt_transmit_tab.cpp:242
void addStream()
Add a stream with default settings.
Definition srt_transmit_tab.cpp:279
std::string localAddress(const toolx::streams::SrtLinkConfig &link) const
The address of this machine, for the receiver of a listening transmitter.
Definition srt_transmit_tab.cpp:558
void save() const
Save the rows.
Definition srt_transmit_tab.cpp:572
int activeCount() const
The number of streams being transmitted.
Definition srt_transmit_tab.cpp:220
QTimer m_timer
Refreshes the state column.
Definition srt_transmit_tab.h:151
QJsonArray toJson() const
The table as a JSON array for the configuration file.
Definition srt_transmit_tab.cpp:225
int idOfRow(int row) const
The id of the stream in a row.
Definition srt_transmit_tab.cpp:441
SrtTransmitTab(Ui::Dialog &ui, QWidget *parent=nullptr)
Construct a new SRT transmit tab, wire up the widgets and load the saved rows.
Definition srt_transmit_tab.cpp:168
void lockRow(int row, bool locked)
Allow or prevent editing the settings of a row (the pattern can always change).
Definition srt_transmit_tab.cpp:484
void updateButtons()
Enable the buttons that apply to the selection and update the count.
Definition srt_transmit_tab.cpp:548
QWidget * m_parent
Parent widget for message boxes.
Definition srt_transmit_tab.h:145
void copyToReceive()
Send the receiving end of the selected streams (all if none is selected) to the receive tab.
Definition srt_transmit_tab.cpp:330
void toggle(int row)
Start or stop the stream of a row after its checkbox changed.
Definition srt_transmit_tab.cpp:447
void enableAll()
Enable every stream.
Definition srt_transmit_tab.cpp:321
std::map< int, std::unique_ptr< toolx::streams::SrtGenerator > > m_streams
The running streams keyed by row id.
Definition srt_transmit_tab.h:147
int insertRow(const toolx::streams::SrtTransmitConfig &config)
Add a row to the table and return its index.
Definition srt_transmit_tab.cpp:356
void updateStates()
Refresh the state column from the running streams.
Definition srt_transmit_tab.cpp:512
int m_next_id
The id given to the next stream.
Definition srt_transmit_tab.h:153
toolx::streams::SrtTransmitConfig configOfRow(int row) const
Read the settings of a row.
Definition srt_transmit_tab.cpp:420
Transmits an H.264 or H.265 encoded test pattern over SRT.
Helpers shared by the SRT transmit and receive tabs: connection settings, srt:// URL building,...
Session Announcement Protocol (SDP) implementation for listening to announcements of stream data....
The settings of one end of an SRT link.
Definition srt_utils.h:36
The configuration of one SRT transmit stream.
Definition srt_generator.h:45