ToolX 1.11.1 [e3f477f]
A GUI debug tool chain for diagnosing GVA systems
Loading...
Searching...
No Matches
srt_player.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_PLAYER_H
14#define STREAMS_SRT_PLAYER_H
15
16#include <QDialog>
17#include <QGraphicsPixmapItem>
18#include <QGraphicsScene>
19#include <QGraphicsView>
20#include <QImage>
21#include <QLabel>
22#include <QObject>
23#include <QPixmap>
24#include <QPointer>
25#include <QStatusBar>
26#include <QString>
27#include <QTimer>
28
29#include "qt6/QtSrtDepayloader.h"
30
36class SrtPlayer : public QObject
37{
38 Q_OBJECT
39
40public:
46 explicit SrtPlayer(QWidget *parent = nullptr);
47
51 ~SrtPlayer() final;
52
58 static int activeCount();
59
60public slots:
68 void play(const QString name, const QString url, const QString description);
69
73 void stop();
74
75signals:
81 void stateChanged(const QString &state);
82
83protected:
85 bool eventFilter(QObject *obj, QEvent *event) override;
86
87private slots:
89 void showFrame(const QImage &image);
91 void linkState(mediax::qt6::QtSrtDepayloader::State state);
93 void linkError(const QString &message);
95 void noFrame();
97 void updateStatistics();
98
99private:
101 void setLabelColour(const QString &colour);
102
104 QPointer<QDialog> m_dialog;
106 QGraphicsScene *m_scene = nullptr;
108 QGraphicsView *m_view = nullptr;
110 QGraphicsPixmapItem *m_pixmap_item = nullptr;
112 QPixmap m_pixmap;
114 QLabel *m_stream_label = nullptr;
116 QLabel *m_format_label = nullptr;
118 QLabel *m_link_label = nullptr;
120 QLabel *m_frame_label = nullptr;
126 mediax::qt6::QtSrtDepayloader *m_receiver = nullptr;
128 quint64 m_frame_count = 0;
129};
130
131#endif // STREAMS_SRT_PLAYER_H
QPointer< QDialog > m_dialog
The player dialog.
Definition srt_player.h:104
QLabel * m_format_label
Resolution label.
Definition srt_player.h:116
void stateChanged(const QString &state)
The state of the stream changed.
QLabel * m_link_label
Link statistics label.
Definition srt_player.h:118
mediax::qt6::QtSrtDepayloader * m_receiver
The SRT receiver.
Definition srt_player.h:126
QTimer m_statistics_timer
Statistics refresh timer.
Definition srt_player.h:124
QPixmap m_pixmap
The displayed image.
Definition srt_player.h:112
QGraphicsView * m_view
The view.
Definition srt_player.h:108
void setLabelColour(const QString &colour)
Set the colour of the stream label.
Definition srt_player.cpp:193
void updateStatistics()
Show the link statistics.
Definition srt_player.cpp:173
QLabel * m_frame_label
Frame counter label.
Definition srt_player.h:120
void play(const QString name, const QString url, const QString description)
Start the SRT connection in the background and play.
Definition srt_player.cpp:110
void linkState(mediax::qt6::QtSrtDepayloader::State state)
Update the status bar and report the new state.
Definition srt_player.cpp:145
QGraphicsPixmapItem * m_pixmap_item
The pixmap item, kept to avoid flicker.
Definition srt_player.h:110
void showFrame(const QImage &image)
Show a received frame.
Definition srt_player.cpp:128
void noFrame()
Blank the display when no frames are arriving.
Definition srt_player.cpp:187
QLabel * m_stream_label
Stream description label.
Definition srt_player.h:114
SrtPlayer(QWidget *parent=nullptr)
Construct a new SRT player and show the window.
Definition srt_player.cpp:39
~SrtPlayer() final
Stop the stream and close the window.
Definition srt_player.cpp:94
void stop()
Stop the stream, close the window and destroy this object.
Definition srt_player.cpp:120
void linkError(const QString &message)
Report a connection error.
Definition srt_player.cpp:166
quint64 m_frame_count
Frames received.
Definition srt_player.h:128
static int activeCount()
The number of players that are open.
Definition srt_player.cpp:105
QGraphicsScene * m_scene
The scene.
Definition srt_player.h:106
QTimer m_blank_timer
No-frame blanking timer.
Definition srt_player.h:122
bool eventFilter(QObject *obj, QEvent *event) override
Event filter to keep the image fitted to the dialog on resize.
Definition srt_player.cpp:198