13#ifndef STREAMS_GIGE_PLAYER_H
14#define STREAMS_GIGE_PLAYER_H
23#include <QElapsedTimer>
24#include <QGraphicsPixmapItem>
25#include <QGraphicsScene>
26#include <QGraphicsView>
35#include "mediax/gev/gev.h"
52 explicit GigEPlayer(QWidget *parent =
nullptr);
72 void play(
const QString name,
const QString ip_address);
86 bool eventFilter(QObject *obj, QEvent *event)
override;
92 void onFrame(::mediax::gev::Frame &&frame);
std::atomic< bool > m_connected
The connection succeeded, the camera can be read from the GUI thread.
Definition gige_player.h:126
std::atomic< uint64_t > m_frame_count
Frames received.
Definition gige_player.h:135
QGraphicsPixmapItem * m_pixmapItem
The pixmap item, kept to avoid flicker.
Definition gige_player.h:103
std::unique_ptr<::mediax::gev::Camera > m_camera
The device, set by the connection thread. Acquisition runs while it is held.
Definition gige_player.h:120
QLabel * m_stream_label
Device address label.
Definition gige_player.h:109
QPointer< QDialog > m_dialog
The player dialog.
Definition gige_player.h:97
GigEPlayer(QWidget *parent=nullptr)
Construct a new GigE player and show the window.
Definition gige_player.cpp:37
QGraphicsScene * m_scene
The scene.
Definition gige_player.h:99
std::atomic< bool > m_closing
Set when the player is being destroyed.
Definition gige_player.h:124
void renderFrame()
Render the latest received frame at the display rate.
Definition gige_player.cpp:174
QLabel * m_format_label
Resolution and pixel format label.
Definition gige_player.h:111
std::vector< uint8_t > m_convert_buffer
Conversion buffer (RGB24).
Definition gige_player.h:137
void connectionResult(bool success, const QString &message)
Called on the GUI thread when the connection attempt completes.
Definition gige_player.cpp:151
std::thread m_connect_thread
Connects and starts acquisition without blocking the GUI.
Definition gige_player.h:122
QTimer m_render_timer
Display refresh timer.
Definition gige_player.h:115
QTimer m_blank_timer
No-frame blanking timer.
Definition gige_player.h:117
void onFrame(::mediax::gev::Frame &&frame)
Frame callback, runs on the receive thread.
Definition gige_player.cpp:164
::mediax::gev::Frame m_pending_frame
The latest frame from the receive thread.
Definition gige_player.h:131
void noFrame()
Blank the display when no frames are arriving.
Definition gige_player.cpp:217
QLabel * m_frame_label
Frame counter label.
Definition gige_player.h:113
QPixmap m_pixmap
The displayed image.
Definition gige_player.h:105
~GigEPlayer() final
Stop the acquisition and close the window.
Definition gige_player.cpp:85
QStatusBar * m_status_bar
The status bar.
Definition gige_player.h:107
static int activeCount()
The number of open GigE player windows.
Definition gige_player.cpp:92
void shutdown()
Stop the connection thread and the camera.
Definition gige_player.cpp:97
bool eventFilter(QObject *obj, QEvent *event) override
Event filter to keep the image fitted to the dialog on resize.
Definition gige_player.cpp:223
QGraphicsView * m_view
The view.
Definition gige_player.h:101
bool m_frame_pending
A new frame is waiting to be rendered.
Definition gige_player.h:133
std::mutex m_frame_mutex
Guards the pending frame.
Definition gige_player.h:129
void play(const QString name, const QString ip_address)
Connect to a device and start acquisition.
Definition gige_player.cpp:113