#ifndef VIDEOVIEWERWIDGET_H #define VIDEOVIEWERWIDGET_H #include #include #include #include #include #include class VideoViewerWidget : public QWidget { Q_OBJECT public: explicit VideoViewerWidget(QWidget *parent = nullptr); ~VideoViewerWidget(); protected: void showEvent(QShowEvent* event) override; private slots: void onStartViewer(); void onStopViewer(); void onSourceTypeChanged(int index); private: void setupUI(); void initGStreamer(); void cleanupGStreamer(); 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); // UI elements QWidget* m_videoContainer; QPushButton* m_startBtn; QPushButton* m_stopBtn; QComboBox* m_sourceType; QLineEdit* m_hostEdit; QLineEdit* m_portEdit; QLabel* m_statusLabel; // GStreamer elements GstElement* m_pipeline; GstElement* m_videoSink; guint m_busWatchId; WId m_windowId; }; #endif // VIDEOVIEWERWIDGET_H