ToolX 1.11.1 [e3f477f]
A GUI debug tool chain for diagnosing GVA systems
Loading...
Searching...
No Matches
rtsp_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_RTSP_PLAYER_H
14#define STREAMS_RTSP_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/QtRtspDepayloader.h"
30
36class RtspPlayer : public QObject
37{
38 Q_OBJECT
39
40public:
46 explicit RtspPlayer(QWidget *parent = nullptr);
47
51 ~RtspPlayer() final;
52
53public slots:
62 void play(const QString name, const QString url, const QString user, const QString password);
63
67 void stop();
68
69signals:
75 void stateChanged(const QString &state);
76
77protected:
79 bool eventFilter(QObject *obj, QEvent *event) override;
80
81private slots:
83 void showFrame(const QImage &image);
85 void sessionState(mediax::qt6::QtRtspDepayloader::State state);
87 void noFrame();
88
89private:
91 void setLabelColour(const QString &colour);
92
94 QPointer<QDialog> m_dialog;
96 QGraphicsScene *m_scene = nullptr;
98 QGraphicsView *m_view = nullptr;
100 QGraphicsPixmapItem *m_pixmap_item = nullptr;
102 QPixmap m_pixmap;
104 QLabel *m_stream_label = nullptr;
106 QLabel *m_format_label = nullptr;
108 QLabel *m_frame_label = nullptr;
112 mediax::qt6::QtRtspDepayloader *m_receiver = nullptr;
114 quint64 m_frame_count = 0;
115};
116
117#endif // STREAMS_RTSP_PLAYER_H
void stop()
Stop the stream, close the window and destroy this object.
Definition rtsp_player.cpp:114
void setLabelColour(const QString &colour)
Set the colour of the stream label.
Definition rtsp_player.cpp:180
mediax::qt6::QtRtspDepayloader * m_receiver
The RTSP receiver.
Definition rtsp_player.h:112
void noFrame()
Blank the display when no frames are arriving.
Definition rtsp_player.cpp:174
bool eventFilter(QObject *obj, QEvent *event) override
Event filter to keep the image fitted to the dialog on resize.
Definition rtsp_player.cpp:185
quint64 m_frame_count
Frames received.
Definition rtsp_player.h:114
~RtspPlayer() final
Stop the stream and close the window.
Definition rtsp_player.cpp:92
void sessionState(mediax::qt6::QtRtspDepayloader::State state)
Update the status bar and report the new state.
Definition rtsp_player.cpp:139
QLabel * m_frame_label
Frame counter label.
Definition rtsp_player.h:108
QLabel * m_stream_label
Stream address label (without credentials).
Definition rtsp_player.h:104
QGraphicsPixmapItem * m_pixmap_item
The pixmap item, kept to avoid flicker.
Definition rtsp_player.h:100
void stateChanged(const QString &state)
The state of the stream changed.
QGraphicsScene * m_scene
The scene.
Definition rtsp_player.h:96
QGraphicsView * m_view
The view.
Definition rtsp_player.h:98
QTimer m_blank_timer
No-frame blanking timer.
Definition rtsp_player.h:110
QPixmap m_pixmap
The displayed image.
Definition rtsp_player.h:102
void showFrame(const QImage &image)
Show a received frame.
Definition rtsp_player.cpp:122
QLabel * m_format_label
Resolution label.
Definition rtsp_player.h:106
QPointer< QDialog > m_dialog
The player dialog.
Definition rtsp_player.h:94
RtspPlayer(QWidget *parent=nullptr)
Construct a new RTSP player and show the window.
Definition rtsp_player.cpp:42
void play(const QString name, const QString url, const QString user, const QString password)
Connect to the camera in the background and start playing.
Definition rtsp_player.cpp:101