ToolX 1.11.1 [e3f477f]
A GUI debug tool chain for diagnosing GVA systems
Loading...
Searching...
No Matches
srt_receive_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_RECEIVE_TAB_H
14#define STREAMS_SRT_RECEIVE_TAB_H
15
16#include <map>
17#include <vector>
18
19#include <QObject>
20#include <QJsonArray>
21#include <QPointer>
22#include <QString>
23#include <QWidget>
24
25#include "../ui_toolx.h"
26#include "streams/srt_player.h"
27#include "streams/srt_utils.h"
28
35class SrtReceiveTab : public QObject
36{
37 Q_OBJECT
38
39public:
46 explicit SrtReceiveTab(Ui::Dialog &ui, QWidget *parent = nullptr);
47
51 ~SrtReceiveTab() final;
52
53 SrtReceiveTab(const SrtReceiveTab &) = delete;
54 SrtReceiveTab &operator=(const SrtReceiveTab &) = delete;
55 SrtReceiveTab(SrtReceiveTab &&) = delete;
56 SrtReceiveTab &operator=(SrtReceiveTab &&) = delete;
57
63 int activeCount() const;
64
71 QJsonArray toJson() const;
72
80 void fromJson(const QJsonArray &streams);
81
82public slots:
86 void addStream();
87
91 void removeSelected();
92
96 void playSelected();
97
101 void stopSelected();
102
110 void addEntries(const std::vector<toolx::streams::SrtStreamEntry> &entries);
111
112private:
116 void setRow(int row, const toolx::streams::SrtStreamEntry &entry);
120 int rowOfId(int id) const;
122 int idOfRow(int row) const;
124 void setState(int id, const QString &state);
126 void updateButtons();
128 void save() const;
130 void load();
131
133 Ui::Dialog &m_ui;
135 QWidget *m_parent;
137 std::map<int, QPointer<SrtPlayer>> m_players;
139 int m_next_id = 1;
141 bool m_loading = false;
142};
143
144#endif // STREAMS_SRT_RECEIVE_TAB_H
void playSelected()
Open a player for the selected stream.
Definition srt_receive_tab.cpp:185
int idOfRow(int row) const
The id of the stream in a row.
Definition srt_receive_tab.cpp:341
std::map< int, QPointer< SrtPlayer > > m_players
The active players keyed by stream id.
Definition srt_receive_tab.h:137
void addEntries(const std::vector< toolx::streams::SrtStreamEntry > &entries)
Add receivers for transmit streams and show this tab.
Definition srt_receive_tab.cpp:242
void updateButtons()
Enable the buttons that apply to the selected stream and update the count.
Definition srt_receive_tab.cpp:364
QJsonArray toJson() const
The table as a JSON array for the configuration file.
Definition srt_receive_tab.cpp:109
toolx::streams::SrtStreamEntry entryOfRow(int row) const
Read the settings of a row.
Definition srt_receive_tab.cpp:315
bool m_loading
Set while the table is being filled so edits are not saved.
Definition srt_receive_tab.h:141
~SrtReceiveTab() final
Stop all the players.
Definition srt_receive_tab.cpp:93
void stopSelected()
Close the player of the selected stream.
Definition srt_receive_tab.cpp:229
void load()
Load the saved rows.
Definition srt_receive_tab.cpp:395
int m_next_id
The id given to the next stream.
Definition srt_receive_tab.h:139
int rowOfId(int id) const
Find the row of a stream, -1 if it was removed.
Definition srt_receive_tab.cpp:330
void setState(int id, const QString &state)
Show the state of a stream.
Definition srt_receive_tab.cpp:347
void setRow(int row, const toolx::streams::SrtStreamEntry &entry)
Replace the settings of a row.
Definition srt_receive_tab.cpp:300
void removeSelected()
Stop and remove the selected stream.
Definition srt_receive_tab.cpp:166
Ui::Dialog & m_ui
The main dialogue UI.
Definition srt_receive_tab.h:133
SrtReceiveTab(Ui::Dialog &ui, QWidget *parent=nullptr)
Construct a new SRT receive tab, wire up the widgets and load the saved rows.
Definition srt_receive_tab.cpp:62
void addStream()
Add an empty stream to the table and start editing its host.
Definition srt_receive_tab.cpp:151
QWidget * m_parent
Parent widget for player windows.
Definition srt_receive_tab.h:135
void fromJson(const QJsonArray &streams)
Replace the table with the streams of a JSON array.
Definition srt_receive_tab.cpp:121
int activeCount() const
The number of streams being played.
Definition srt_receive_tab.cpp:104
void save() const
Save the rows.
Definition srt_receive_tab.cpp:377
int insertRow(const toolx::streams::SrtStreamEntry &entry)
Add a row to the table and return its index.
Definition srt_receive_tab.cpp:270
Video player window for SRT streams.
Helpers shared by the SRT transmit and receive tabs: connection settings, srt:// URL building,...
A named SRT link, one row of the transmit or receive table.
Definition srt_utils.h:51