November 26, 2019
Given GStreamer's roots in the Linux/GTK world, Windows has seemed at times like a second-class citizen when it came to hacking GStreamer code. With the advent of meson and gst-build, however, this is no longer the case. It is now possible to set up a Windows development environment that rivals the finest Linux has to offer, with full support for Visual Studio debugging into the library.
We are going to use not one but two IDEs ! Vi vs EMACS people : Nothing to see here, move along.
(note on step 3: we will be running
meson from source, so please skip the
pip install of
While not frequently used on Windows,
pkg-config allows us to manage GStreamer dependencies on other projects. After unzipping the binaries, put their location on your Windows
meson, create a
meson.cmd file with the following contents:
@echo off c:\\PATH\TO\CLONED\MESON\SRC\meson.py %*
and put the file location on your Windows
I recommend the superb Git client Git Extensions.
Important: once Git is installed, ensure that line endings are configured to
core.autocrlf in your Git configuration. Otherwise, you may get Windows line endings breaking GStreamer shell scripts.
Next, we set up a few environment variables (note the backslash at the end of the first three variables):
Now, we will clone
gst-build into our
SOURCE_DIR directory, like so:
> cd %SOURCE_DIR% > git clone https://gitlab.freedesktop.org/gstreamer/gst-build.git
And finally we add the following entry to our
PATH environment variable
Visual Studio 2019 \ x64 Native Tools Command Prompt
> cd %SOURCE_DIR%gst-build > meson --prefix=%GSTREAMER_1_0_ROOT_X86_64% build
ninjato build and install
> ninja -C build install
File \ Importmenu, choose
import C++\Existing code as Makefile Projectand select the
%SOURCE_DIR%gst-buildfolder. You now have a fully-indexed, fully searchable project containing GStreamer code for base, plugins etc. Since gst-build is a big project, and Eclipse uses a lot of resources, we can filter out the
buildfolder from the project by:
Alt Enterto open the project
Resource \ Resource Filters, add a filter to exclude the
buildfolder (choose the
Project Relative Pathsetting)
Windows \ Preferences \ General \ Workspace \ Build. select
Save automatically before build.
Properties \ C++ Build \ Builder Settings, un-check
Use default build commandand enter
ninja -C build installas the build command.
Properties \ C++ Build \ Behaviourand delete
Build (incremental build)box.
Ctrl + Bto build and install GStreamer.
GSTREAMER_1_0_ROOT_X86_64environment variable to ensure you are linking to the gst-build version of GStreamer.
GST_SRC_BUILD_PATHand set the breakpoint.
ninja -C build installstep.
GST_SRC_BUILD_PATH, the Git repositories can be modified to point to different branches. The only issue here is when executing
ninja -C build update, which will stop on the modified repositories.
The only tool missing on Windows is
gst-indent. To indent new code, we need to:
$ sudo apt install git autoconf autopoint libtool make texi2html wget $ mkdir src && cd src $ wget https://ftp.gnu.org/gnu/indent/indent-2.2.11.tar.gz $ tar xvzf indent-2.2.11.tar.gz $ cd indent-2.2.11 && ./configure $ make && sudo make install
Now we can indent new code in the Ubuntu terminal like so:
$ /mnt/c/PATH/TO/SOURCE/gst-build/subprojects/gstreamer/tools/gst-indent /mnt/c/PATH/TO/FILE.c
Finally, we take the potentially dangerous step of removing the
gst-indent pre-commit hook from the GStreamer sub-project we are working on:
> cd %SOURCE_DIR%gst-build\subprojects\SOME_GST_SUBPROJECT\.git\hooks > del pre-commit
We must now be careful to remember to run
gst-indent from the Ubuntu terminal before committing.
Now sit back and give yourself a big high-five !
If you have any questions about GStreamer on Windows or any other platform, please contact us.
Did you know you could run a permissively-licensed MTP implementation with minimal dependencies on an embedded device? Here's a step-by-step…
Earlier this year, the Rust compiler gained support for LLVM source-base code coverage. In this post we'll explain how to setup a CI job…
Over the past few months, I've been working on a side project to improve Meson sub-project support. The best stress test is to build projects…
The most complete automated testing and continuous integration tool for the Linux kernel continues to evolve at a rapid pace. Here's a look…
In the embedded world, many modern SoCs such as the ST Microelectronics STM32MP1 now include coprocessor cores which can be used for a wide…
Our recent efforts on the Hantro kernel driver have resulted in the addition of H.264 decoding support and multiple performance improvements.…