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.
I also 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 each path except the last one):
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
ninja -C build
Jump to step 8.
File \ Import menu, choose
import C++\Existing code as Makefile Project and select the
%SOURCE_DIR%gst-build folder. 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
build folder from the project by:
Alt Enter to open the project
Resource \ Resource Filters, add a filter to exclude the
build folder (choose the
Project Relative Path setting)
Eclipse by default does not save files before building. Under
Windows \ Preferences \ General \ Workspace \ Build. select
Save automatically before build
Right click on the gst-build project, select
Properties \ C++ Build, un-check
Use default build command and enter
ninja -C build as the build command
Ctrl + B to build GStreamer
When the build is complete, return to the x64 command prompt and run
ninja -C build install to install GStreamer to
Open your project in Visual Studio. Your compile and link settings should use the
GSTREAMER_1_0_ROOT_X86_64 environment variable to ensure you are linking to the gst-build version of GStreamer
To set breakpoints in GStreamer, open the file from the appropriate sub-project inside
GST_SRC_BUILD_PATH and set the breakpoint
To modify GStreamer code, edit the code and build in Eclipse (or your favorite editor) - your Visual Studio project will automagically pick up the changes when it next runs. Don't forget to run the
ninja -C build install step.
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:
GNU indent 2.2.11
sudo apt install git autoconf autopoint libtool make texi2html
mkdir src && cd src
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:
Finally, we take the potentially dangerous step of removing the
gst-indent pre-commit hook from the GStreamer sub-project we are working on:
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.
With the advent of meson and gst-build, it is now possible to set up a GStreamer Windows development environment that rivals the finest…
I recently went to XDC 2019, where I gave yet another talk about Zink. I kinda forgot to write a blog-post about it, so here’s me trying…
Prior to joining Collabora, I took part in Round 17 of the Outreachy internships, to work on the virtual drivers in the media subsystem…
What HDCP is, and why supporting HDCP in Weston is justified in both an economical and technical context.
With the release of virglrenderer 0.8.0, getting accelerated OpenGL within a virtual machine (VM) made a big leap forward. Since virglrenderer-0.7.0,…
Ongoing work on the reverse-engineered Panfrost OpenGL ES driver for Arm Mali GPUs has turned the RK3399 SoC into a very attractive platform…