mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-04-20 11:35:56 +00:00
update:VideoForm成员变量m_decoder改为堆上创建
This commit is contained in:
parent
61f2b0582c
commit
aa899d7ad7
4 changed files with 11 additions and 15 deletions
|
@ -4,8 +4,9 @@
|
|||
#include "videobuffer.h"
|
||||
#include "decoder.h"
|
||||
|
||||
Decoder::Decoder()
|
||||
Decoder::Decoder(VideoBuffer* vb)
|
||||
: QObject(Q_NULLPTR)
|
||||
, m_vb(vb)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -15,11 +16,6 @@ Decoder::~Decoder()
|
|||
|
||||
}
|
||||
|
||||
void Decoder::setVideoBuffer(VideoBuffer* vb)
|
||||
{
|
||||
m_vb = vb;
|
||||
}
|
||||
|
||||
bool Decoder::open(const AVCodec *codec)
|
||||
{
|
||||
// codec context
|
||||
|
|
|
@ -12,10 +12,9 @@ class Decoder : public QObject
|
|||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
Decoder();
|
||||
Decoder(VideoBuffer* vb);
|
||||
virtual ~Decoder();
|
||||
|
||||
void setVideoBuffer(VideoBuffer* vb);
|
||||
bool open(const AVCodec *codec);
|
||||
void close();
|
||||
bool push(const AVPacket *packet);
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
#include "videoform.h"
|
||||
#include "recorder.h"
|
||||
#include "videobuffer.h"
|
||||
#include "decoder.h"
|
||||
#include "ui_videoform.h"
|
||||
#include "iconhelper.h"
|
||||
#include "toolform.h"
|
||||
|
@ -34,8 +35,8 @@ VideoForm::VideoForm(const QString& serial, quint16 maxSize, quint32 bitRate, co
|
|||
m_server = new Server();
|
||||
m_vb = new VideoBuffer();
|
||||
m_vb->init();
|
||||
m_decoder.setVideoBuffer(m_vb);
|
||||
m_stream.setDecoder(&m_decoder);
|
||||
m_decoder = new Decoder(m_vb);
|
||||
m_stream.setDecoder(m_decoder);
|
||||
if (!fileName.trimmed().isEmpty()) {
|
||||
m_recorder = new Recorder(fileName.trimmed());
|
||||
m_stream.setRecoder(m_recorder);
|
||||
|
@ -189,7 +190,7 @@ void VideoForm::initSignals()
|
|||
});
|
||||
|
||||
// must be Qt::QueuedConnection, ui update must be main thread
|
||||
connect(&m_decoder, &Decoder::onNewFrame, this, [this](){
|
||||
connect(m_decoder, &Decoder::onNewFrame, this, [this](){
|
||||
if (ui->videoWidget->isHidden()) {
|
||||
if (m_loadingWidget) {
|
||||
m_loadingWidget->close();
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include "server.h"
|
||||
#include "stream.h"
|
||||
#include "decoder.h"
|
||||
#include "inputconvertnormal.h"
|
||||
#include "inputconvertgame.h"
|
||||
#include "filehandler.h"
|
||||
|
@ -19,6 +18,7 @@ class videoForm;
|
|||
class ToolForm;
|
||||
class Recorder;
|
||||
class VideoBuffer;
|
||||
class Decoder;
|
||||
class VideoForm : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -72,7 +72,8 @@ private:
|
|||
QSize frameSize;
|
||||
Server* m_server = Q_NULLPTR;
|
||||
Stream m_stream;
|
||||
VideoBuffer* m_vb;
|
||||
VideoBuffer* m_vb = Q_NULLPTR;
|
||||
Decoder* m_decoder = Q_NULLPTR;
|
||||
//InputConvertNormal m_inputConvert;
|
||||
InputConvertGame m_inputConvert;
|
||||
FileHandler m_fileHandler;
|
||||
|
@ -82,8 +83,7 @@ private:
|
|||
QPoint m_dragPosition;
|
||||
float m_widthHeightRatio = 0.5f;
|
||||
QPointer<ToolForm> m_toolForm;
|
||||
Recorder* m_recorder = Q_NULLPTR;
|
||||
Decoder m_decoder;
|
||||
Recorder* m_recorder = Q_NULLPTR;
|
||||
QTime m_startTimeCount;
|
||||
QPointer<QWidget> m_loadingWidget;
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue