mirror of
https://github.com/barry-ran/QtScrcpy.git
synced 2025-08-07 16:08:48 +00:00
更新UI
This commit is contained in:
parent
7e9352112d
commit
efecb01edf
13 changed files with 228 additions and 114 deletions
|
@ -34,7 +34,8 @@ SOURCES += \
|
||||||
convert.cpp \
|
convert.cpp \
|
||||||
frames.cpp \
|
frames.cpp \
|
||||||
fpscounter.cpp \
|
fpscounter.cpp \
|
||||||
qyuvopenglwidget.cpp
|
qyuvopenglwidget.cpp \
|
||||||
|
videoform.cpp
|
||||||
|
|
||||||
HEADERS += \
|
HEADERS += \
|
||||||
dialog.h \
|
dialog.h \
|
||||||
|
@ -44,10 +45,12 @@ HEADERS += \
|
||||||
convert.h \
|
convert.h \
|
||||||
frames.h \
|
frames.h \
|
||||||
fpscounter.h \
|
fpscounter.h \
|
||||||
qyuvopenglwidget.h
|
qyuvopenglwidget.h \
|
||||||
|
videoform.h
|
||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
dialog.ui
|
dialog.ui \
|
||||||
|
videoform.ui
|
||||||
|
|
||||||
INCLUDEPATH += \
|
INCLUDEPATH += \
|
||||||
$$PWD/ffmpeg/include
|
$$PWD/ffmpeg/include
|
||||||
|
|
|
@ -239,6 +239,8 @@ runQuit:
|
||||||
avcodec_free_context(&codecCtx);
|
avcodec_free_context(&codecCtx);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit onDecodeStop();
|
||||||
|
|
||||||
if (m_deviceSocket) {
|
if (m_deviceSocket) {
|
||||||
m_deviceSocket->disconnectFromHost();
|
m_deviceSocket->disconnectFromHost();
|
||||||
delete m_deviceSocket;
|
delete m_deviceSocket;
|
||||||
|
@ -252,5 +254,5 @@ void Decoder::pushFrame()
|
||||||
// the previous newFrame will consume this frame
|
// the previous newFrame will consume this frame
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
emit newFrame();
|
emit onNewFrame();
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,8 @@ public:
|
||||||
void stopDecode();
|
void stopDecode();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void newFrame();
|
void onNewFrame();
|
||||||
|
void onDecodeStop();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void run();
|
void run();
|
||||||
|
|
|
@ -4,87 +4,19 @@
|
||||||
#include "dialog.h"
|
#include "dialog.h"
|
||||||
#include "ui_dialog.h"
|
#include "ui_dialog.h"
|
||||||
#include "adbprocess.h"
|
#include "adbprocess.h"
|
||||||
#include "qyuvopenglwidget.h"
|
|
||||||
|
|
||||||
void saveAVFrame_YUV_ToTempFile(const AVFrame *pFrame)
|
|
||||||
{
|
|
||||||
int t_frameWidth = pFrame->width;
|
|
||||||
int t_frameHeight = pFrame->height;
|
|
||||||
int t_yPerRowBytes = pFrame->linesize[0];
|
|
||||||
int t_uPerRowBytes = pFrame->linesize[1];
|
|
||||||
int t_vPerRowBytes = pFrame->linesize[2];
|
|
||||||
qDebug()<<"robin:saveAVFrame_YUV_ToTempFile info:"<<t_frameWidth<<t_frameHeight<<"||"<<t_yPerRowBytes<<t_uPerRowBytes<<t_vPerRowBytes;
|
|
||||||
QFile t_file("E:\\receive_Frame.yuv");
|
|
||||||
t_file.open(QIODevice::WriteOnly | QIODevice::Append);
|
|
||||||
//t_file.write((char *)pFrame->data[0],t_frameWidth * t_frameHeight);
|
|
||||||
//t_file.write((char *)pFrame->data[1],(t_frameWidth/2) * t_frameHeight / 2);
|
|
||||||
//t_file.write((char *)pFrame->data[2],(t_frameWidth/2) * t_frameHeight / 2);
|
|
||||||
|
|
||||||
for(int i = 0;i< t_frameHeight ;i++)
|
|
||||||
{
|
|
||||||
t_file.write((char*)(pFrame->data[0]+i*t_yPerRowBytes),t_frameWidth);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int i = 0;i< t_frameHeight/2 ;i++)
|
|
||||||
{
|
|
||||||
t_file.write((char*)(pFrame->data[1]+i*t_uPerRowBytes),t_frameWidth/2);
|
|
||||||
}
|
|
||||||
|
|
||||||
for(int i = 0;i< t_frameHeight/2 ;i++)
|
|
||||||
{
|
|
||||||
t_file.write((char*)(pFrame->data[2]+i*t_vPerRowBytes),t_frameWidth/2);
|
|
||||||
}
|
|
||||||
|
|
||||||
t_file.flush();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
Dialog::Dialog(QWidget *parent) :
|
Dialog::Dialog(QWidget *parent) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
ui(new Ui::Dialog)
|
ui(new Ui::Dialog)
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
setWindowFlags(windowFlags()
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
| Qt::WindowMaximizeButtonHint
|
//setWindowFlags(windowFlags() | Qt::WindowMaximizeButtonHint | Qt::WindowMinimizeButtonHint);
|
||||||
| Qt::WindowMinimizeButtonHint);
|
|
||||||
|
|
||||||
w = new QYUVOpenGLWidget(this);
|
|
||||||
ui->verticalLayout->addWidget(w);
|
|
||||||
|
|
||||||
Decoder::init();
|
|
||||||
|
|
||||||
frames.init();
|
|
||||||
decoder.setFrames(&frames);
|
|
||||||
|
|
||||||
server = new Server();
|
|
||||||
connect(server, &Server::serverStartResult, this, [this](bool success){
|
|
||||||
if (success) {
|
|
||||||
server->connectTo();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(server, &Server::connectToResult, this, [this](bool success){
|
|
||||||
if (success) {
|
|
||||||
decoder.setDeviceSocket(server->getDeviceSocketByThread(&decoder));
|
|
||||||
decoder.startDecode();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// must be Qt::QueuedConnection, ui update must be main thread
|
|
||||||
QObject::connect(&decoder, &Decoder::newFrame, this, [this](){
|
|
||||||
frames.lock();
|
|
||||||
const AVFrame *frame = frames.consumeRenderedFrame();
|
|
||||||
//saveAVFrame_YUV_ToTempFile(frame);
|
|
||||||
w->setFrameSize(QSize(frame->width, frame->height));
|
|
||||||
w->updateTextures(frame->data[0], frame->data[1], frame->data[2], frame->linesize[0], frame->linesize[1], frame->linesize[2]);
|
|
||||||
frames.unLock();
|
|
||||||
},Qt::QueuedConnection);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Dialog::~Dialog()
|
Dialog::~Dialog()
|
||||||
{
|
{
|
||||||
Decoder::deInit();
|
on_stopServerBtn_clicked();
|
||||||
frames.deInit();
|
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -99,12 +31,15 @@ void Dialog::on_adbProcess_clicked()
|
||||||
|
|
||||||
void Dialog::on_startServerBtn_clicked()
|
void Dialog::on_startServerBtn_clicked()
|
||||||
{
|
{
|
||||||
server->start("P7C0218510000537", 27183, 0, 8000000, "");
|
if (!m_videoForm) {
|
||||||
//server->start("P7CDU17C23010875", 27183, 0, 8000000, "");
|
m_videoForm = new VideoForm();
|
||||||
|
}
|
||||||
|
m_videoForm->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dialog::on_stopServerBtn_clicked()
|
void Dialog::on_stopServerBtn_clicked()
|
||||||
{
|
{
|
||||||
decoder.stopDecode();
|
if (m_videoForm) {
|
||||||
server->stop();
|
m_videoForm->close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
11
src/dialog.h
11
src/dialog.h
|
@ -2,10 +2,9 @@
|
||||||
#define DIALOG_H
|
#define DIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
#include "server.h"
|
#include "videoform.h"
|
||||||
#include "decoder.h"
|
|
||||||
#include "frames.h"
|
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class Dialog;
|
class Dialog;
|
||||||
|
@ -29,10 +28,8 @@ private slots:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::Dialog *ui;
|
Ui::Dialog *ui;
|
||||||
Server* server;
|
|
||||||
Decoder decoder;
|
QPointer<VideoForm> m_videoForm;
|
||||||
Frames frames;
|
|
||||||
QYUVOpenGLWidget* w;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DIALOG_H
|
#endif // DIALOG_H
|
||||||
|
|
|
@ -6,8 +6,8 @@
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>1100</width>
|
<width>354</width>
|
||||||
<height>712</height>
|
<height>81</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
|
|
|
@ -46,7 +46,7 @@ void FpsCounter::timerEvent(QTimerEvent *event)
|
||||||
m_curRendered = m_rendered;
|
m_curRendered = m_rendered;
|
||||||
m_curSkipped = m_skipped;
|
m_curSkipped = m_skipped;
|
||||||
resetCounter();
|
resetCounter();
|
||||||
qInfo("FPS:%d Discard:%d", m_curRendered, m_skipped);
|
//qInfo("FPS:%d Discard:%d", m_curRendered, m_skipped);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
16
src/main.cpp
16
src/main.cpp
|
@ -1,24 +1,28 @@
|
||||||
#include "dialog.h"
|
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QTcpSocket>
|
#include <QTcpSocket>
|
||||||
#include <QTcpServer>
|
#include <QTcpServer>
|
||||||
|
|
||||||
|
#include "dialog.h"
|
||||||
|
#include "decoder.h"
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
//QApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
|
//QApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
|
||||||
//QApplication::setAttribute(Qt::AA_UseOpenGLES);
|
//QApplication::setAttribute(Qt::AA_UseOpenGLES);
|
||||||
//QApplication::setAttribute(Qt::AA_UseSoftwareOpenGL);
|
//QApplication::setAttribute(Qt::AA_UseSoftwareOpenGL);
|
||||||
|
|
||||||
|
Decoder::init();
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
|
|
||||||
qputenv("QTSCRCPY_ADB_PATH", "G:\\mygitcode\\QtScrcpy\\src\\adb.exe");
|
qputenv("QTSCRCPY_ADB_PATH", "G:\\mygitcode\\QtScrcpy\\src\\adb.exe");
|
||||||
qputenv("QTSCRCPY_SERVER_PATH", "G:\\mygitcode\\QtScrcpy\\src\\scrcpy-server.jar");
|
qputenv("QTSCRCPY_SERVER_PATH", "G:\\mygitcode\\QtScrcpy\\src\\scrcpy-server.jar");
|
||||||
|
|
||||||
Dialog w;
|
Dialog* w = new Dialog;
|
||||||
//w.move(50, 930);
|
w->show();
|
||||||
w.show();
|
|
||||||
|
|
||||||
return a.exec();
|
int ret = a.exec();
|
||||||
|
|
||||||
|
Decoder::deInit();
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -90,15 +90,19 @@ void QYUVOpenGLWidget::setFrameSize(const QSize &frameSize)
|
||||||
if (m_frameSize != frameSize) {
|
if (m_frameSize != frameSize) {
|
||||||
m_frameSize = frameSize;
|
m_frameSize = frameSize;
|
||||||
m_needUpdate = true;
|
m_needUpdate = true;
|
||||||
|
// inittexture immediately
|
||||||
|
repaint();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QYUVOpenGLWidget::updateTextures(quint8 *dataY, quint8 *dataU, quint8 *dataV, quint32 linesizeY, quint32 linesizeU, quint32 linesizeV)
|
void QYUVOpenGLWidget::updateTextures(quint8 *dataY, quint8 *dataU, quint8 *dataV, quint32 linesizeY, quint32 linesizeU, quint32 linesizeV)
|
||||||
{
|
{
|
||||||
updateTexture(m_texture[0], 0, dataY, linesizeY);
|
if (m_textureInited) {
|
||||||
updateTexture(m_texture[1], 1, dataU, linesizeU);
|
updateTexture(m_texture[0], 0, dataY, linesizeY);
|
||||||
updateTexture(m_texture[2], 2, dataV, linesizeV);
|
updateTexture(m_texture[1], 1, dataU, linesizeU);
|
||||||
update();
|
updateTexture(m_texture[2], 2, dataV, linesizeV);
|
||||||
|
update();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QYUVOpenGLWidget::initializeGL()
|
void QYUVOpenGLWidget::initializeGL()
|
||||||
|
@ -114,36 +118,35 @@ void QYUVOpenGLWidget::initializeGL()
|
||||||
// 设置背景清理色为黑色
|
// 设置背景清理色为黑色
|
||||||
glClearColor(0.0,0.0,0.0,0.0);
|
glClearColor(0.0,0.0,0.0,0.0);
|
||||||
// 清理颜色背景
|
// 清理颜色背景
|
||||||
glClear(GL_COLOR_BUFFER_BIT);
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QYUVOpenGLWidget::paintGL()
|
void QYUVOpenGLWidget::paintGL()
|
||||||
{
|
{
|
||||||
if (m_needUpdate) {
|
if (m_needUpdate) {
|
||||||
//TODO 需要deInitTextures吗
|
|
||||||
deInitTextures();
|
deInitTextures();
|
||||||
initTextures();
|
initTextures();
|
||||||
m_needUpdate = false;
|
m_needUpdate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
if (m_textureInited) {
|
||||||
glBindTexture(GL_TEXTURE_2D, m_texture[0]);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
|
glBindTexture(GL_TEXTURE_2D, m_texture[0]);
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE1);
|
glActiveTexture(GL_TEXTURE1);
|
||||||
glBindTexture(GL_TEXTURE_2D, m_texture[1]);
|
glBindTexture(GL_TEXTURE_2D, m_texture[1]);
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE2);
|
glActiveTexture(GL_TEXTURE2);
|
||||||
glBindTexture(GL_TEXTURE_2D, m_texture[2]);
|
glBindTexture(GL_TEXTURE_2D, m_texture[2]);
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
|
||||||
|
}
|
||||||
// 没有画面则显示黑屏
|
|
||||||
//glClear(GL_COLOR_BUFFER_BIT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void QYUVOpenGLWidget::resizeGL(int width, int height)
|
void QYUVOpenGLWidget::resizeGL(int width, int height)
|
||||||
{
|
{
|
||||||
glViewport(0, 0, width, height);
|
glViewport(0, 0, width, height);
|
||||||
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
void QYUVOpenGLWidget::initShader()
|
void QYUVOpenGLWidget::initShader()
|
||||||
|
@ -208,12 +211,14 @@ void QYUVOpenGLWidget::initTextures()
|
||||||
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
|
||||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, m_frameSize.width()/2, m_frameSize.height()/2, 0, GL_RED, GL_UNSIGNED_BYTE, NULL);
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RED, m_frameSize.width()/2, m_frameSize.height()/2, 0, GL_RED, GL_UNSIGNED_BYTE, NULL);
|
||||||
|
|
||||||
|
m_textureInited = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QYUVOpenGLWidget::deInitTextures()
|
void QYUVOpenGLWidget::deInitTextures()
|
||||||
{
|
{
|
||||||
glDeleteTextures(3, m_texture);
|
glDeleteTextures(3, m_texture);
|
||||||
memset(m_texture, 0, 3);
|
memset(m_texture, 0, 3);
|
||||||
|
m_textureInited = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QYUVOpenGLWidget::updateTexture(GLuint texture, quint32 textureType, quint8 *pixels, quint32 stride)
|
void QYUVOpenGLWidget::updateTexture(GLuint texture, quint32 textureType, quint8 *pixels, quint32 stride)
|
||||||
|
|
|
@ -33,6 +33,7 @@ private:
|
||||||
// 视频帧尺寸
|
// 视频帧尺寸
|
||||||
QSize m_frameSize = {-1, -1};
|
QSize m_frameSize = {-1, -1};
|
||||||
bool m_needUpdate = false;
|
bool m_needUpdate = false;
|
||||||
|
bool m_textureInited = false;
|
||||||
|
|
||||||
// 顶点缓冲对象(Vertex Buffer Objects, VBO):默认即为VertexBuffer(GL_ARRAY_BUFFER)类型
|
// 顶点缓冲对象(Vertex Buffer Objects, VBO):默认即为VertexBuffer(GL_ARRAY_BUFFER)类型
|
||||||
QOpenGLBuffer m_vbo;
|
QOpenGLBuffer m_vbo;
|
||||||
|
|
87
src/videoform.cpp
Normal file
87
src/videoform.cpp
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
#include <QDesktopWidget>
|
||||||
|
|
||||||
|
#include "videoform.h"
|
||||||
|
#include "ui_videoform.h"
|
||||||
|
|
||||||
|
VideoForm::VideoForm(QWidget *parent) :
|
||||||
|
QWidget(parent),
|
||||||
|
ui(new Ui::videoForm)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
||||||
|
m_server = new Server();
|
||||||
|
m_frames.init();
|
||||||
|
m_decoder.setFrames(&m_frames);
|
||||||
|
|
||||||
|
connect(m_server, &Server::serverStartResult, this, [this](bool success){
|
||||||
|
if (success) {
|
||||||
|
m_server->connectTo();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(m_server, &Server::connectToResult, this, [this](bool success, const QString &deviceName, const QSize &size){
|
||||||
|
if (success) {
|
||||||
|
setWindowTitle(deviceName);
|
||||||
|
|
||||||
|
updateShowSize(size);
|
||||||
|
// 双屏有问题,位置有问题
|
||||||
|
QDesktopWidget* desktop = QApplication::desktop();
|
||||||
|
if (desktop) {
|
||||||
|
QSize screenSize = desktop->size();
|
||||||
|
if (!screenSize.isEmpty()) {
|
||||||
|
move((screenSize.width() - width())/2, (screenSize.height() - height())/2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_decoder.setDeviceSocket(m_server->getDeviceSocketByThread(&m_decoder));
|
||||||
|
m_decoder.startDecode();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(m_server, &Server::onServerStop, this, [this](){
|
||||||
|
close();
|
||||||
|
qDebug() << "server process stop";
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(&m_decoder, &Decoder::onDecodeStop, this, [this](){
|
||||||
|
close();
|
||||||
|
qDebug() << "decoder thread stop";
|
||||||
|
});
|
||||||
|
|
||||||
|
// must be Qt::QueuedConnection, ui update must be main thread
|
||||||
|
QObject::connect(&m_decoder, &Decoder::onNewFrame, this, [this](){
|
||||||
|
m_frames.lock();
|
||||||
|
const AVFrame *frame = m_frames.consumeRenderedFrame();
|
||||||
|
updateShowSize(QSize(frame->width, frame->height));
|
||||||
|
ui->videoWidget->setFrameSize(QSize(frame->width, frame->height));
|
||||||
|
ui->videoWidget->updateTextures(frame->data[0], frame->data[1], frame->data[2], frame->linesize[0], frame->linesize[1], frame->linesize[2]);
|
||||||
|
m_frames.unLock();
|
||||||
|
},Qt::QueuedConnection);
|
||||||
|
|
||||||
|
m_server->start("P7C0218510000537", 27183, 1080, 8000000, "");
|
||||||
|
}
|
||||||
|
|
||||||
|
VideoForm::~VideoForm()
|
||||||
|
{
|
||||||
|
m_decoder.stopDecode();
|
||||||
|
m_server->stop();
|
||||||
|
delete m_server;
|
||||||
|
m_frames.deInit();
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void VideoForm::updateShowSize(const QSize &newSize)
|
||||||
|
{
|
||||||
|
QSize showSize = newSize;
|
||||||
|
QDesktopWidget* desktop = QApplication::desktop();
|
||||||
|
if (desktop) {
|
||||||
|
QSize screenSize = desktop->size();
|
||||||
|
showSize.setWidth(qMin(newSize.width(), screenSize.width()));
|
||||||
|
showSize.setHeight(qMin(newSize.height(), screenSize.height() - 100));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (showSize != size()) {
|
||||||
|
resize(showSize);
|
||||||
|
}
|
||||||
|
}
|
32
src/videoform.h
Normal file
32
src/videoform.h
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
#ifndef VIDEOFORM_H
|
||||||
|
#define VIDEOFORM_H
|
||||||
|
|
||||||
|
#include <QWidget>
|
||||||
|
|
||||||
|
#include "server.h"
|
||||||
|
#include "decoder.h"
|
||||||
|
#include "frames.h"
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class videoForm;
|
||||||
|
}
|
||||||
|
|
||||||
|
class VideoForm : public QWidget
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit VideoForm(QWidget *parent = 0);
|
||||||
|
~VideoForm();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void updateShowSize(const QSize &newSize);
|
||||||
|
|
||||||
|
private:
|
||||||
|
Ui::videoForm *ui;
|
||||||
|
Server* m_server = Q_NULLPTR;
|
||||||
|
Decoder m_decoder;
|
||||||
|
Frames m_frames;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // VIDEOFORM_H
|
47
src/videoform.ui
Normal file
47
src/videoform.ui
Normal file
|
@ -0,0 +1,47 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>videoForm</class>
|
||||||
|
<widget class="QWidget" name="videoForm">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>454</width>
|
||||||
|
<height>908</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QYUVOpenGLWidget" name="videoWidget" native="true"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>QYUVOpenGLWidget</class>
|
||||||
|
<extends>QWidget</extends>
|
||||||
|
<header>qyuvopenglwidget.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
Loading…
Add table
Add a link
Reference in a new issue