User:Donnguyen/Building and using Qt5GStreamer on Windows

< User:Donnguyen
Revision as of 19:23, 18 April 2017 by Donnguyen (Talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

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.
noframe
 
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.

noframe
 
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.


This page was last modified on 18 April 2017, at 19:23. Content is available under Creative Commons License SA 4.0 unless otherwise noted.