Jump to content

User:Donnguyen/Building and using Qt5GStreamer on Windows: Difference between revisions

From KDE Community Wiki
Donnguyen (talk | contribs)
Donnguyen (talk | contribs)
No edit summary
 
(6 intermediate revisions by the same user not shown)
Line 1: Line 1:
This document guides you through the process of building, installing, and using Qt5GStreamer on Windows.
This document guides you through the process of building, installing, and using Qt5GStreamer on Windows.
==Setting up dependencies==
=Setting up dependencies=
===Boost===
==Boost==
Boost is required to build and use Qt5GStreamer.  Set up is rather simple.  Download the .zip from the [http://www.boost.org/ boost.org website], extract it, and set the environment variable BOOST_ROOT  to the root directory of the boost installation(C:\boost\boost_1_63_0).  Verify this is correctly set up by opening a command prompt and typing <code>dir %BOOST_ROOT%\libs</code>.  You should see a bunch of directories.
Boost is required to build and use Qt5GStreamer.  Set up is rather simple.  Download the .zip from the [http://www.boost.org/ boost.org website], extract it, and set the environment variable BOOST_ROOT  to the root directory of the boost installation(C:\boost\boost_1_63_0).  Verify this is correctly set up by opening a command prompt and typing <code>dir %BOOST_ROOT%\libs</code>.  You should see a bunch of directories.


===Gstreamer===
==Gstreamer==
Download and install at least the runtime and development files from the [https://gstreamer.freedesktop.org/ Gstreamer web site].  Set both environment variables GSTREAMER_ROOT_X86 and GSTREAMER_1_0_ROOT_X86 to the installation directory(C:\gstreamer\1.0\x86).  Add %GSTREAMER_ROOT_X86%\bin to your PATH.  Verify you have this set up correctly by opening a command prompt and type <code>gst-launch-1.0 -h</code>.  You should see the usage output from the gst-launch command.
Download and install at least the runtime and development files from the [https://gstreamer.freedesktop.org/ Gstreamer web site].  Set both environment variables GSTREAMER_ROOT_X86 and GSTREAMER_1_0_ROOT_X86 to the installation directory(C:\gstreamer\1.0\x86).  Add %GSTREAMER_ROOT_X86%\bin to your PATH.  Verify you have this set up correctly by opening a command prompt and type <code>gst-launch-1.0 -h</code>.  You should see the usage output from the gst-launch command.


===Cmake===
==Cmake==
You will need CMake to configure and build Qt5GStreamer.  Download and install it from the [https://cmake.org/ CMake website].  If you choose to add cmake to your path (more convenient), make sure you add it AFTER %QTDIR%\bin.  The cmake bin directory has qt .dll's that will likely cause conflicts, so I would recommend making it the last item in your path just to be safe.  If chose to add cmake to your PATH, verify it is correctly set up by opening a command prompt and typing <code>cmake -version</code>.  You should see the version of cmake printed on the screen.
You will need CMake to configure and build Qt5GStreamer.  Download and install it from the [https://cmake.org/ CMake website].  {{Warning|2=Warning|1=If you choose to add cmake to your path (more convenient), make sure you add it AFTER %QTDIR%\bin.  The cmake bin directory has qt .dll's that will likely cause conflicts, so I would recommend making it the last item in your path just to be safe.}}  
If chose to add cmake to your PATH, verify it is correctly set up by opening a command prompt and typing <code>cmake -version</code>.  You should see the version of cmake printed on the screen.


==Building Qt5GStreamer==
=Building Qt5GStreamer=
Using the default install path of "C:/Program Files (x86)/QtGStreamer" can cause problems because of the special characters in the path, and special permissions required, so we'll install it to C:\QtGStreamer.
Using the default install path of "C:/Program Files (x86)/QtGStreamer" can cause problems because of the special characters in the path, and special permissions required, so we'll install it to C:\QtGStreamer.
{{Warning|2=Important|1=Make sure you have cmake set up with Qt Creator.}}
{{Warning|2=Important|1=Make sure you have cmake set up with Qt Creator.}}
Line 19: Line 20:
#Build the project.
#Build the project.
#Finally, add %QTGSTREAMER_ROOT%\bin to PATH to complete the set up.   
#Finally, add %QTGSTREAMER_ROOT%\bin to PATH to complete the set up.   
Verify Qt5GStreamer is properly built and installed by opening a command prompt and typing <code>dir %QTGSTREAMER%\bin</code>.  You should see some .dll files starting with Qt5G.
Verify Qt5GStreamer is properly built and installed by opening a command prompt and typing <code>dir %QTGSTREAMER_ROOT%\bin</code>.  You should see some .dll files starting with Qt5G.


==Using Qt5GStreamer==
=Using Qt5GStreamer=
If you're going to use cmake, you're all set.  If you want to use qmake, there are additional steps to set up.
If you're going to use cmake, you're all set.  If you want to use qmake, there are additional steps to set up.
===Installing and setting up pkg-config===
==Installing and setting up pkg-config==
===Installing pkg-confg===
There are several ways to set up pkg-config.  Some set-ups are complicated, and some don't work :-/  Fortunately, I found a simple set up that works.  Download pkg-config-lite from https://sourceforge.net/projects/pkgconfiglite/files/
There are several ways to set up pkg-config.  Some set-ups are complicated, and some don't work :-/  Fortunately, I found a simple set up that works.  Download pkg-config-lite from https://sourceforge.net/projects/pkgconfiglite/files/
Unzip, and add the bin directory to your path.  Verify this is set up correctly by opening a command prompt and typing <code>pkg-config --help</code>.  You should see the help for pkg-config.
Unzip, and add the bin directory to your path.  Verify this is set up correctly by opening a command prompt and typing <code>pkg-config --help</code>.  You should see the help for pkg-config.


===Using Qt5GStreamer via PKGCONFIG in .pro file===
===Setting PKG_CONFIG_PATH===
Set PKG_CONFIG_PATH to %GSTREAMER_ROOT_X86%\lib\pkgconfig;%QTDIR%\lib\pkgconfig;%QTGSTREAMER_ROOT%\lib\pkgconfig.  Verify pkg-config can find Qt5Streamer-1.0 by opening a command prompt and typing <code>pkg-config --cflags Qt5GStreamer-1.0</code>.  You should not see any errors.  If you see errors, you will need to resolve them.  If you're using the MSVC compiler, check the MSVC section below.
 
==Using Qt5GStreamer via PKGCONFIG in .pro file==
Add the following to .pro file:
Add the following to .pro file:
<syntaxhighlight lang="qmake">
<syntaxhighlight lang="qmake">
Line 38: Line 43:
Try opening the example .pro included with the qt-gstreamer source, make some edits, and try to build it.  If you can build and run the example, you're all done.
Try opening the example .pro included with the qt-gstreamer source, make some edits, and try to build it.  If you can build and run the example, you're all done.


===MSVC hack===
==MSVC hack==
Edit two files under %QTGSTREAMER_ROOT%\lib\pkgconfig.
Edit two files under %QTGSTREAMER_ROOT%\lib\pkgconfig.
Qt5Glib.pc and Qt5GStreamerUi.pc: comment Qt5Core and Qt5Widgets.  pkg-config can't find them because they don't exist for MSVC.
Qt5Glib.pc and Qt5GStreamerUi.pc: comment Qt5Core and Qt5Widgets.  pkg-config can't find them because they don't exist for MSVC.


==Troubleshooting==
=Troubleshooting=
As a general rule, don't mix 32 and 64 bit, debug and release, libraries.
As a general rule, don't mix 32 and 64 bit, debug and release, libraries.

Latest revision as of 19:23, 18 April 2017

This document guides you through the process of building, installing, and using Qt5GStreamer on Windows.

Setting up dependencies

Boost

Boost is required to build and use Qt5GStreamer. Set up is rather simple. Download the .zip from the boost.org website, extract it, and set the environment variable BOOST_ROOT to the root directory of the boost installation(C:\boost\boost_1_63_0). Verify this is correctly set up by opening a command prompt and typing dir %BOOST_ROOT%\libs. You should see a bunch of directories.

Gstreamer

Download and install at least the runtime and development files from the Gstreamer web site. Set both environment variables GSTREAMER_ROOT_X86 and GSTREAMER_1_0_ROOT_X86 to the installation directory(C:\gstreamer\1.0\x86). Add %GSTREAMER_ROOT_X86%\bin to your PATH. Verify you have this set up correctly by opening a command prompt and type gst-launch-1.0 -h. You should see the usage output from the gst-launch command.

Cmake

You will need CMake to configure and build Qt5GStreamer. Download and install it from the CMake website.

Warning

If you choose to add cmake to your path (more convenient), make sure you add it AFTER %QTDIR%\bin. The cmake bin directory has qt .dll's that will likely cause conflicts, so I would recommend making it the last item in your path just to be safe.

If chose to add cmake to your PATH, verify it is correctly set up by opening a command prompt and typing cmake -version. You should see the version of cmake printed on the screen.

Building Qt5GStreamer

Using the default install path of "C:/Program Files (x86)/QtGStreamer" can cause problems because of the special characters in the path, and special permissions required, so we'll install it to C:\QtGStreamer.

Important

Make sure you have cmake set up with Qt Creator.

Steps:

  1. Set environment variable QTGSTREAMER_ROOT to C:\QtGStreamer
  2. Download source via: git clone https://github.com/GStreamer/qt-gstreamer
  3. Start Qt Creator and open CMakeLists.txt. Switch to Projects and edit the Build Settings. Under the CMake section, edit CMAKE_INSTALL_PREFIX and set it to %QTGSTREAMER_ROOT%. Edit QT_VERSION and set it to 5. Click on "Apply Configuration Changes". Under Build Steps, click on Details, and select the target "install".
  4. Build the project.
  5. Finally, add %QTGSTREAMER_ROOT%\bin to PATH to complete the set up.

Verify Qt5GStreamer is properly built and installed by opening a command prompt and typing dir %QTGSTREAMER_ROOT%\bin. You should see some .dll files starting with Qt5G.

Using Qt5GStreamer

If you're going to use cmake, you're all set. If you want to use qmake, there are additional steps to set up.

Installing and setting up pkg-config

Installing pkg-confg

There are several ways to set up pkg-config. Some set-ups are complicated, and some don't work :-/ Fortunately, I found a simple set up that works. Download pkg-config-lite from https://sourceforge.net/projects/pkgconfiglite/files/ Unzip, and add the bin directory to your path. Verify this is set up correctly by opening a command prompt and typing pkg-config --help. You should see the help for pkg-config.

Setting PKG_CONFIG_PATH

Set PKG_CONFIG_PATH to %GSTREAMER_ROOT_X86%\lib\pkgconfig;%QTDIR%\lib\pkgconfig;%QTGSTREAMER_ROOT%\lib\pkgconfig. Verify pkg-config can find Qt5Streamer-1.0 by opening a command prompt and typing pkg-config --cflags Qt5GStreamer-1.0. You should not see any errors. If you see errors, you will need to resolve them. If you're using the MSVC compiler, check the MSVC section below.

Using Qt5GStreamer via PKGCONFIG in .pro file

Add the following to .pro file:

CONFIG += link_pkgconfig
PKGCONFIG += Qt5GStreamer-1.0 Qt5GStreamerUi-1.0
QT += widgets
INCLUDEPATH += $$(BOOST_ROOT)

Try opening the example .pro included with the qt-gstreamer source, make some edits, and try to build it. If you can build and run the example, you're all done.

MSVC hack

Edit two files under %QTGSTREAMER_ROOT%\lib\pkgconfig. Qt5Glib.pc and Qt5GStreamerUi.pc: comment Qt5Core and Qt5Widgets. pkg-config can't find them because they don't exist for MSVC.

Troubleshooting

As a general rule, don't mix 32 and 64 bit, debug and release, libraries.