111 lines
1.8 KiB
C++
111 lines
1.8 KiB
C++
#ifndef QRTSPTHREAD_H
|
|
#define QRTSPTHREAD_H
|
|
|
|
#include <QThread>
|
|
#include <QMutex>
|
|
#include <QDebug>
|
|
#include <qvideowidget.h>
|
|
|
|
#include <gst/gst.h>
|
|
#include <gst/app/gstappsink.h>
|
|
|
|
#include <sys/types.h>
|
|
#include <unistd.h>
|
|
|
|
class QGstreamerPlayer;
|
|
|
|
class QRTSPThread : public QThread
|
|
{
|
|
Q_OBJECT
|
|
|
|
public:
|
|
QRTSPThread();
|
|
virtual ~QRTSPThread();
|
|
|
|
void SetVideoWidget(QVideoWidget* pWidget);
|
|
|
|
void SaveFile(QString strFilename);
|
|
void SaveEnd();
|
|
|
|
void SetCameraMode(bool bMode);
|
|
|
|
void SetOpenFilename(QString strFilename);
|
|
|
|
bool IsWorkingRTSP();
|
|
|
|
bool IsVideoLink();
|
|
|
|
bool IsStartRTSP();
|
|
|
|
bool IsError();
|
|
|
|
void CaptureImage();
|
|
|
|
QGstreamerPlayer* GetGstreamerPlayer();
|
|
|
|
virtual int InitRTSP();
|
|
|
|
virtual int InitRTSP_VideoCapture();
|
|
|
|
int GetCaptureIndex();
|
|
|
|
void Restart();
|
|
|
|
void ExitThread();
|
|
|
|
public slots:
|
|
void stop();
|
|
void StartRTSP();
|
|
void StopRTSP();
|
|
|
|
void ChangeState(int nState);
|
|
int GetState();
|
|
|
|
void exitRTSP();
|
|
|
|
void ReceivedFinish();
|
|
|
|
|
|
|
|
void Seek(gint64 nPos);
|
|
|
|
void Pause();
|
|
void Resume();
|
|
|
|
gint64 GetSeekPos();
|
|
|
|
gint64 GetVideoLinkTime();
|
|
|
|
void SetCaptureMode(int nMode);
|
|
int GetCaptureMode();
|
|
|
|
void SetVideoFilename(QString strFilename);
|
|
QString GetVideoFilename();
|
|
|
|
signals:
|
|
void SendFinish();
|
|
void VideoButtonChange(bool bEncodingVideo);
|
|
|
|
|
|
private:
|
|
bool m_bStartRTSP;
|
|
int m_nCaptureIndex;
|
|
QString m_strFilename;
|
|
QString m_strParameterMPEG;
|
|
QString m_strVideoFilename;
|
|
bool m_bCameraMode;
|
|
volatile int m_nCurrentState;
|
|
QMutex m_mutex;
|
|
bool m_stop;
|
|
|
|
volatile bool m_bTerminate;
|
|
|
|
QVideoWidget* m_pVideoWidget;
|
|
|
|
QGstreamerPlayer* m_pPlayer;
|
|
|
|
void run();
|
|
};
|
|
|
|
#endif // QRTSPTHREAD_H
|