59 lines
1.2 KiB
C++
59 lines
1.2 KiB
C++
#ifndef VIDEOPLAYER_H
|
|
#define VIDEOPLAYER_H
|
|
|
|
#include <QWidget>
|
|
#include <QLayout>
|
|
#include <gst/gst.h>
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
class QAbstractButton;
|
|
QT_END_NAMESPACE
|
|
|
|
class VideoPlayer : public QWidget
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
VideoPlayer(QWidget *parent = nullptr);
|
|
~VideoPlayer();
|
|
|
|
void load(const QUrl &url);
|
|
|
|
public slots:
|
|
void play();
|
|
void pause();
|
|
void playPause();
|
|
void stop();
|
|
|
|
private slots:
|
|
void debugSlot();
|
|
void useTcp(bool value);
|
|
void setRtspUrl(QString url);
|
|
void benSlot();
|
|
|
|
private:
|
|
QList<QWidget *> videoDisplays = {};
|
|
QWidget *playerWidget = nullptr;
|
|
|
|
QAbstractButton *m_stopButton = nullptr;
|
|
QAbstractButton *m_playButton = nullptr;
|
|
QAbstractButton *m_seekBackwardButton = nullptr;
|
|
QAbstractButton *m_seekForwardButton = nullptr;
|
|
bool playing = false;
|
|
GstElement *pipeline = nullptr;
|
|
GstElement *video_sink = nullptr;
|
|
|
|
bool use_tcp = true;
|
|
QString rtspUrl = "rtsp://127.0.0.1:8554/test";
|
|
|
|
void print_status_of_all();
|
|
|
|
void initGst();
|
|
void setGstTestVideo();
|
|
void setGstTestVideo(int pattern);
|
|
void setGstFileVideo();
|
|
void setGstRtspVideo();
|
|
};
|
|
|
|
#endif
|