Qt5.14.2 compiling and deploying qtav player environment

DS Little Dragon 2021-11-25 17:47:54

One 、 Compiling environment and QTAV Introduce

QTAV Is an open source cross platform player framework , The framework is based on QT Developed , Can be in Android、IOS、WINDOWS、Linux Each platform compiles, deploys and runs .

QTAV website : http://www.qtav.org/

QTAV Source code download address GitHub: https://github.com/wang-bin/QtAV

image.png
Directly in GitHub Just download the latest source code from .

What I'm using now QT The environment is QT5.14.2, The compiler is minGW and VS2017 They all use 32 Bit compiler .

QT Download address :https://download.qt.io/archive/qt/5.14/5.14.2/

image.png

Current compile time , I use ffmpeg The version is 4.2.2 , You can also use the latest version ,QTAV In the description of , It's best to use the latest ffmpeg edition .

ffmpeg4.2.2 The library address of :https://download.csdn.net/download/xiaolong1126626497/13328939

Or go straight to ffmpeg Official download of :http://www.ffmpeg.org/download.html

image.png

Two 、 compile QTAV Source code

stay GitHub The author also introduced , How to compile and deploy QTAV.
Address : https://github.com/wang-bin/QtAV/wiki/Build-QtAV

image.png

stay windows Compile below , The author recommends 2 Methods :

The first one is : Put... Directly ffmpeg Copy the header and library files to QT In the compiler directory under the installation directory , It's simple and rude .

The second kind : open QTAV Source project , modify qmake.conf file , Appoint ffmpeg Header file and library file path
Give Way QT The compiler can find ffmpeg Where are the libraries and header files .

Here is the second method I use , Specify the path directly , No pollution QT Files in the installation directory .

INCLUDEPATH += C:/FFMPEG/ffmpeg_x86_4.2.2/include
LIBS += -LC:/FFMPEG/ffmpeg_x86_4.2.2/lib

image.png

After setting the path , Click build directly .

image.png

If there is no problem with building , There will be an automatic installation script in the generated directory , Double click Run to automatically copy files to QT Installation directory .

Can be used separately VS2017 compiler 、minGW The compiler builds it again QTAV Source code , In this way, both compilers can reference QTAV Develop player .

image.png

After compiling , You can use QTAV 了 .

In the use of QTAV When the framework , If you are using VS2017 compiler , Compilation may report errors , Tips max Function does not recognize .

The solution is as follows :
image.png

stay QT Of pro Reference is required in engineering documents QTAV Framework library for :


#LIBS += -L$$quote(C:\Qt\Qt5.14.2\5.14.2\mingw73_32\lib) -lQtAV1 -lQtAVWidgets1
LIBS += -L$$quote(C:\Qt\Qt5.14.2\5.14.2\msvc2017\lib) -lQtAV1 -lQtAVWidgets1
LIBS += -lopengl32 -lglu32

image.png

3、 ... and 、 Use QTAV Develop player

3.1 mainwindow.cpp Source code

#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{

ui->setupUi(this);
Widgets::registerRenderers();
VideoOutput *m_vo;
AVPlayer *m_player;
m_player = new AVPlayer(this);
m_vo = new VideoOutput(this);
m_player->setRenderer(m_vo);
setCentralWidget(m_vo->widget());
m_player->play("D:/test1080.flv");
}
MainWindow::~MainWindow()
{

delete ui;
}

3.2 mainwindow.h Source code

#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QtAV>
#include <QtAVWidgets>
using namespace QtAV;
namespace Ui {

class MainWindow;
}
class MainWindow : public QMainWindow
{

Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
~MainWindow();
private:
Ui::MainWindow *ui;
};
#endif // MAINWINDOW_H

3.3 Running effect

image.png

Please bring the original link to reprint ,thank
Similar articles

2021-11-25

2021-11-25

2021-11-25

2021-11-25

2021-11-25

2021-11-25