83 lines
2.0 KiB
C++
83 lines
2.0 KiB
C++
#ifndef VIDEOVIEWERWIDGET_H
|
|
#define VIDEOVIEWERWIDGET_H
|
|
|
|
#include <QWidget>
|
|
#include <QPushButton>
|
|
#include <QComboBox>
|
|
#include <QLineEdit>
|
|
#include <QLabel>
|
|
#include <QImage>
|
|
#include <QSlider>
|
|
#include <QScrollArea>
|
|
#include <QCheckBox>
|
|
#include <gst/gst.h>
|
|
#include <gst/app/gstappsink.h>
|
|
|
|
class VideoViewerWidget : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
explicit VideoViewerWidget(QWidget *parent = nullptr);
|
|
~VideoViewerWidget() override;
|
|
|
|
signals:
|
|
void newFrameAvailable(const QImage& frame);
|
|
|
|
private slots:
|
|
void onStartViewer();
|
|
void onStopViewer();
|
|
void onSourceTypeChanged(int index);
|
|
void onZoomChanged(int value);
|
|
void onRotationChanged(int index);
|
|
void onFlipHorizontalChanged(Qt::CheckState state);
|
|
void onFlipVerticalChanged(Qt::CheckState state);
|
|
void displayFrame(const QImage& frame);
|
|
|
|
private:
|
|
void setupUI();
|
|
void initGStreamer();
|
|
void cleanupGStreamer();
|
|
void startPipeline();
|
|
void stopPipeline();
|
|
QString buildPipelineString() const;
|
|
|
|
static gboolean busCallback(GstBus* bus, GstMessage* msg, gpointer data);
|
|
static GstFlowReturn newSampleCallback(GstAppSink* appsink, gpointer user_data);
|
|
|
|
// UI elements (8-byte pointers)
|
|
QScrollArea* m_scrollArea;
|
|
QLabel* m_videoDisplay;
|
|
QPushButton* m_startBtn;
|
|
QPushButton* m_stopBtn;
|
|
QComboBox* m_sourceType;
|
|
QLineEdit* m_hostEdit;
|
|
QLineEdit* m_portEdit;
|
|
QLabel* m_statusLabel;
|
|
QSlider* m_zoomSlider;
|
|
QLabel* m_zoomLabel;
|
|
QComboBox* m_rotationCombo;
|
|
QCheckBox* m_flipHorizontal;
|
|
QCheckBox* m_flipVertical;
|
|
|
|
// GStreamer elements (8-byte pointers)
|
|
GstElement* m_pipeline;
|
|
GstElement* m_appSink;
|
|
|
|
// Zoom factor (8-byte double)
|
|
double m_zoomFactor;
|
|
|
|
// Bus watch ID (4-byte unsigned int)
|
|
guint m_busWatchId;
|
|
|
|
// Transformation settings (4 bytes + 2 bytes)
|
|
int m_rotationAngle;
|
|
bool m_flipHorizontalEnabled;
|
|
bool m_flipVerticalEnabled;
|
|
|
|
// Video state (large object at end)
|
|
QImage m_currentFrame;
|
|
};
|
|
|
|
#endif // VIDEOVIEWERWIDGET_H
|