Compile vlc-qt under windows (latest)

Brief description of vlc-qt

     VLC-Qt is a free library for connecting Qt and libvlc libraries. It contains core classes for the main media playback and some GUI classes for speeding up the development of media players.
Insert picture description here

     Throwing bricks and attracting jade : All official SDKs are based on Qt 5.6.1 and VLC 2.2.4, which means that you must use Qt 5.6.1 and VLC 2.2.4 when using the official SDK. Then the problem is coming. If you want to use other versions of Qt or VLC in actual development, you can only recompile the source code to get the corresponding SDK.

     Description
          This article is based on Qt 5.12.4 (msvc2015), Vs2015, CMake 3.15.5, VLC 3.0.0, vlc-qt-1.1.1 to introduce how to compile vlc-qt. (Note: All are x64 )

     Link (Bold this article requires download for compilation):
          vlc-qt-official website address (https://vlc-qt.tano.si/)
           vlc-qt-Github address (https://github.com/vlc-qt/ vlc-qt)
          vlc-qt-example address (https://github.com/vlc-qt/examples)
          vlc development library-address (http://download.videolan.org/pub/videolan/vlc/)
          cmake download (Https://cmake.org/download/)

Compile

Qt, Vs, and CMake have been installed by default. And have downloaded vlc development library and vlc-qt source code.

     1. Decompress and configure the vlc 3.0.0 development library
Insert picture description here
          . 4 operations need to be done at this time:

               1. Copy the plugins directory and libvlc.dll, libvlccore.dll to the bin directory under the qt installation directory
                    (for example: D:\Qt\Qt5.7.1\5.7\msvc2015\bin)

               2. Copy the sdk/include/vlc directory to the include directory under the qt installation directory
                    (for example: D:\Qt\Qt5.7.1\5.7\msvc2015\include)

               3. Copy several lib files under sdk/lib to the lib directory under the qt installation directory
                    (for example: D:\Qt\Qt5.7.1\5.7\msvc2015\lib)

               4. Set the environment variables, the location of the plugins folder (pictured below)
                    Variable name: VLC_PLUGIN_PATH
                    Variable value: D:/Qt/Qt5.7.1/5.7/msvc2015/bin/plugins
Insert picture description here

     2. Unzip the vlc-qt source code and compile it with CMakeInsert picture description here

          1. Configure and run CMake

               (1) Select the source code path of vlc-qt at "Where is the source code:"

               (2) In "Where to build the binaries:", select the source code compilation path of vlc-qt. (The directory is generally empty)

               (3) Click the "Configure" button to configure. Here we choose to use Vs2015 to compile to x64-bit version. Then click "Finish" to start execution.

Insert picture description here

          2. Modify the CMake running configuration
Insert picture description here
               (1) " CMAKE_INSTALL_PREFIX " is the directory for setting the final compilation result output, generally not on the C drive. Here we change to " C:/Users/Administrator/Desktop/VLC-Qt "

               (2) " LIBVLCCORE_LIBRARY ". Here you need to change the following " vlccore.lib " to " libvlccore.lib "

               (3) " LIBVLC_LIBRARY ". Here you need to change the following " vlc.lib " to " libvlc.lib "

               (4) Add a CMake environment variable. Click the "Add Entery" button on the CMake software. In order to make the name of the debug version library end with d.
                     Name: CMAKE_DEBUG_POSTFIX
                     Type: STRING
                     Value: d
                     Description: Can be empty

               The modified result is as follows: After
               setting, click configure successfully, and then execute Generate to generate the VS2015 project.
Insert picture description here

     Third, the project generated by Vs compilation

          After the completion of CMake compilation, many files and projects were generated in the vlc-qt-1.1.1_build folder.

          1. Modify cmake_install.cmake
               to open the vlc-qt-1.1.1_build/cmake_install.cmake folder with text. Change the "include" in the figure below to "bin".
Insert picture description here
          2. Open the vlc-qt-1.1.1_build/VLC-Qt.sln project
               with Vs2015 and modify the properties of the Core, PluginQml, Qml, Widgets projects respectively >> Debug/Release >> Linker >> Command Line >> Fill in the other options In/SAFESEH:NO

               Then select "ALL_BUILD" project to compile. After success, select the "INSTALL" project to compile and make the output directory to "VLC-Qt".
Insert picture description here

          So far the compilation is complete, and the results are as follows
Insert picture description here
Insert picture description here


     4. Solving common errors during Vs compilation and use

          Question 1 : error C2065: "libvlc_media_read_cb": undeclared identifier

          Solution : Add typedef __int64 ssize_t; to the vlc.h file to solve this problem

          Question 2 : Compile successfully, run and initialize libvlc_new(0, NULL); always return NULL

          Solution : The plugins folder is not included

          Problem 3 : The program interrupts libvlc_release(m_inst) when exiting.
          Solution : Determine the value of m_inst. If it is empty, it will not be released, otherwise it will be interrupted.

          Problem four : missing libvlc.dll missing libvlccore.dll
          solution : add the corresponding dll file to the running directory

          Question five : libvlc_media_new_path returns NULL if the path parameter is wrong.
          Solution : the correctness of the main path. For example: E:\Doubango.png If it is written as E://Doubango.png, it will be wrong

          Problem 6 : VLC is unable to open the MRL'file:///E:/Doubango%BF%F2%BC%DC.png'.
          Solution : The path needs to be converted to UTF8 for import

          Problem 7 : It is used to receive the stream sent by VLC.
          Solution : The stream used to receive only needs a handle.

          Problem 8 : Report an error that the vlc.lib file is invalid or damaged.
          Solution : Remove the vlc.lib reference first

          Question 9 : Prompt that the poll identifier cannot be found.
          Solution : Locate the poll code area. You will see a macro definition of poll. You need to cut and paste this macro definition to the top of the poll code area.

          Problem ten : It prompts vlc.lib file reading error, file damage
          solution : change libvlc.lib to vlc.lib change the original vlc.lib to other file names or modify the two names to each other

          Question 11 : Close SAFESEH warning, this warning will not shut considered wrong
          to solve : namely modify the properties of Core, PluginQml, Qml, Widgets engineering >> Debug / Release linker >> >> >> other command-line options to fill /SAFESEH:NO No spaces after the slash

          Problem twelve : ssize_t problem
          solved : change the ssize_t type to __int64 This problem is solved (but because ssize_t is a cross-platform type, there may be problems after the program is transplanted).

download

The contents of the download package are: vlc-3.0.0-win64.7z, vlc-qt-1.1.1.tar.gz, the above compiled library (debug, release)

Go to download

     

attention

Search " Qt_io_ " or " Qt Developer Center " on WeChat public account to learn more about Qt and C++ development knowledge.

Author-jxd

Guess you like

Origin blog.csdn.net/automoblie0/article/details/104664327
Recommended