use appsink instead of videosink

This commit is contained in:
Maik Jurischka
2025-12-19 06:40:58 +01:00
parent 69e2f3ae1d
commit 34148a592a
3 changed files with 153 additions and 56 deletions

View File

@@ -6,7 +6,9 @@
#include <QComboBox>
#include <QLineEdit>
#include <QLabel>
#include <QImage>
#include <gst/gst.h>
#include <gst/app/gstappsink.h>
class VideoViewerWidget : public QWidget
{
@@ -16,13 +18,14 @@ public:
explicit VideoViewerWidget(QWidget *parent = nullptr);
~VideoViewerWidget();
protected:
void showEvent(QShowEvent* event) override;
signals:
void newFrameAvailable(const QImage& frame);
private slots:
void onStartViewer();
void onStopViewer();
void onSourceTypeChanged(int index);
void displayFrame(const QImage& frame);
private:
void setupUI();
@@ -31,13 +34,12 @@ private:
void startPipeline();
void stopPipeline();
QString buildPipelineString();
void setupVideoOverlay();
static gboolean busCallback(GstBus* bus, GstMessage* msg, gpointer data);
static void onPrepareWindowHandle(GstBus* bus, GstMessage* msg, gpointer data);
static GstFlowReturn newSampleCallback(GstAppSink* appsink, gpointer user_data);
// UI elements
QWidget* m_videoContainer;
QLabel* m_videoDisplay;
QPushButton* m_startBtn;
QPushButton* m_stopBtn;
QComboBox* m_sourceType;
@@ -47,9 +49,8 @@ private:
// GStreamer elements
GstElement* m_pipeline;
GstElement* m_videoSink;
GstElement* m_appSink;
guint m_busWatchId;
WId m_windowId;
};
#endif // VIDEOVIEWERWIDGET_H