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

Connects to an RTSP camera and displays the video in a window. More...

#include <rtsp_player.h>

Inheritance diagram for RtspPlayer:
Inheritance graph
Collaboration diagram for RtspPlayer:
Collaboration graph

Public Slots

void play (const QString name, const QString url, const QString user, const QString password)
 Connect to the camera in the background and start playing.
void stop ()
 Stop the stream, close the window and destroy this object.

Signals

void stateChanged (const QString &state)
 The state of the stream changed.

Public Member Functions

 RtspPlayer (QWidget *parent=nullptr)
 Construct a new RTSP player and show the window.
 ~RtspPlayer () final
 Stop the stream and close the window.

Protected Member Functions

bool eventFilter (QObject *obj, QEvent *event) override
 Event filter to keep the image fitted to the dialog on resize.

Private Slots

void showFrame (const QImage &image)
 Show a received frame.
void sessionState (mediax::qt6::QtRtspDepayloader::State state)
 Update the status bar and report the new state.
void noFrame ()
 Blank the display when no frames are arriving.

Private Member Functions

void setLabelColour (const QString &colour)
 Set the colour of the stream label.

Private Attributes

QPointer< QDialog > m_dialog
 The player dialog.
QGraphicsScene * m_scene = nullptr
 The scene.
QGraphicsView * m_view = nullptr
 The view.
QGraphicsPixmapItem * m_pixmap_item = nullptr
 The pixmap item, kept to avoid flicker.
QPixmap m_pixmap
 The displayed image.
QLabel * m_stream_label = nullptr
 Stream address label (without credentials).
QLabel * m_format_label = nullptr
 Resolution label.
QLabel * m_frame_label = nullptr
 Frame counter label.
QTimer m_blank_timer
 No-frame blanking timer.
mediax::qt6::QtRtspDepayloader * m_receiver = nullptr
 The RTSP receiver.
quint64 m_frame_count = 0
 Frames received.

Detailed Description

Connects to an RTSP camera and displays the video in a window.

The stream stops and the object is destroyed when the window is closed or stop() is called.

Constructor & Destructor Documentation

◆ RtspPlayer()

RtspPlayer::RtspPlayer ( QWidget * parent = nullptr)
explicit

Construct a new RTSP player and show the window.

Parameters
parentthe parent widget (the player closes when the parent closes)

Member Function Documentation

◆ play

void RtspPlayer::play ( const QString name,
const QString url,
const QString user,
const QString password )
slot

Connect to the camera in the background and start playing.

Parameters
namethe camera name shown in the window title
urlthe stream URL, rtsp://[user[:password]@]host[:port]/path
userthe user name, empty to use any credentials in the URL
passwordthe password

◆ stateChanged

void RtspPlayer::stateChanged ( const QString & state)
signal

The state of the stream changed.

Parameters
statea short description, e.g. "Playing" or "Failed: Connection refused"

The documentation for this class was generated from the following files: