Skip to content

Building gstreamer daemon

Carsten Behling edited this page Aug 11, 2015 · 9 revisions

Table of Contents

Host PC build

You can build and run GStreamer Daemon on your host PC. You need the development packages for dbus, dbus-glib, and gstreamer.

Ubuntu host PC

On Debian / Ubuntu, the command to install the packages is something like:

sudo apt-get install libdbus-1-dev libdbus-glib-1-dev libgstreamer0.10-dev libreadline-dev libgstreamer-plugins-base0.10-dev git libreadline-dev

Currently GStreamer daemon has been tested with Vala 0.12.1, which can be found at on the Vala release page. You only need to install Vala if you plan to modify the source code. Do not change the C files - those are derived files. The source files end in .xml and .vala.

Getting GStreamer Daemon source code

The following creates a gstd directory in your current working directory that contains the GStreamer Daemon source code.

git clone git://github.com/RidgeRun/gstd.git gstd
cd gstd

Building GStreamer Daemon

./configure

GStreamer Daemon will detect if your system is using GStreamer 1.0 or GStreamer 0.10 and build appropriately. If you want to force the version to build, add --with-gstreamer-version=1.0 or --with-gstreamer-version=0.10.

make

Installing GStreamer Daemon

sudo make install

This installed a D-Bus configuration file in addition to installing the applications.

Activating GStreamer Daemon D-Bus Configuration

The security protocol will not allow the GStreamer Daemon to be started until the related configuration file is processed

sudo service dbus force-reload

Running GStreamer Daemon

Here is a series of commands showing two pipelines with the the pattern properly of the source videotestsrc element being modified as the pipelines are running.

killall gstd
gstd --session &

gst-client --session create "videotestsrc name=vtest ! ffmpegcolorspace ! ximagesink"
gst-client --session create "videotestsrc name=vtest ! warptv ! ffmpegcolorspace ! ximagesink"
gst-client --session -p 1 play
gst-client --session -p 2 play
gst-client --session help set
gst-client --session -p 1 set vtest pattern integer 1
gst-client --session -p 2 set vtest pattern integer 11
gst-client --session -p 1 set vtest pattern integer 0
gst-client --session -p 1 destroy
gst-client --session -p 2 destroy

killall gstd

Host PC Source Modification

If you going to modify the source code, then you need the Vala compiler.

Removing all Vala

Before you start, make sure you don't have any parts of a Vala toolchain currently installed on your host.

valac --version
aptitude search vala
ls -d /usr/local/share/vala* /usr/share/vala*

Building Vala Toolchain

Once Vala stabilizes, you can use the version that is included with your Linux distribution. Until then, you need to build the Vala compiler.

Install host tools

sudo apt-get install flex bison

You might also want to load up on GStreamer elements:

sudo apt-get install  gstreamer0.10-ffmpeg   gstreamer0.10-plugins-bad gstreamer0.10-plugins-good  gstreamer0.10-plugins-ugly  gstreamer0.10-x

Fetch and compile Vala

GStreamer daemon has been tested with the 0.12.1 Vala compiler. To build and install the Vala compiler:

VALA_MAJOR_VER=0.12
VALA_VER=$VALA_MAJOR_VER.1
wget http://download.gnome.org/sources/vala/$VALA_MAJOR_VER/vala-$VALA_VER.tar.bz2
tar -xjf vala-$VALA_VER.tar.bz2
cd vala-$VALA_VER
./configure --enable-vapigen
make
./compiler/valac --version

Installing Vala toolchain

Install the Vala compiler and update your shared library cache.

sudo make install
sudo ldconfig

valac --version

Modifying source code

Let's say you want to type CREATE instead of create when with gst-client. You can change the source code and rebuild as follows (this is only an example, and a poor one at that):

mv src/gst-client.vala  src/gst-client.orig.vala
sed 's/"create"/"CREATE"/g' < src/gst-client.orig.vala > src/gst-client.vala

Before building the new code, we need to rerun the configuration script since we now have the Vala compiler available.

./configure

Now that we have a change to a Vala source file, we can rebuild the package and show the change takes effect:

make
./src/gst-client help CREATE

Please refer to Command line examples for more ideas on how you can control audio and video streaming using GStreamer Daemon.

Common build problems

The name SIG_BLOCK does not exist in the context of GstdSignals.new

You need to use at least Vala 0.14 when you enable Posix signal handling. (./configure --enable-signals).

usr/local/bin/valac --vapidir=/usr/share/vala-0.12/vapi --vapidir=. --pkg gstd-config --pkg gstreamer-0.10 --pkg gstreamer-interfaces-0.10 --pkg posix --pkg dbus-glib-1 -D GSTREAMER_SUPPORT_STEP  -D GSTD_SUPPORT_SIGNALS  -C main.vala gstd-factory.vala gstd-pipeline.vala gstd-watchdog.vala gstd-signals.vala
gstd-signals.vala:38.22-38.30: error: The name `SIG_BLOCK' does not exist in the context of `GstdSignals.new'
		err = sigprocmask (SIG_BLOCK, _sigset, old_sigset);
		                   ^^^^^^^^^

configure: error: you need gstreamer development packages installed >= 0.10.22 !

You need to install more host packages

sudo apt-get install libdbus-1-dev libdbus-glib-1-dev libgstreamer0.10-dev libreadline-dev libgstreamer-plugins-base0.10-dev

If you still see this problem, it is likely due to your shell PATH pointing to a pkg-config executable not intended for host use.

/bin/sh: --pkg: command not found

You need to install the vala compiler, or stamp file needs to be update:

VALAC gstd_vala.stamp: /usr/local/bin/valac: symbol lookup error: /usr/local/bin/valac: undefined symbol

 touch src/*.stamp

valac:29773: CRITICAL : vala_variable_get_variable_type: assertion self != NULL failed

Looks like Vala toolchain issue. Please report such issues.

The name setlogmask does not exist in the context of Posix

You need to use at least Vala 0.12.

  VALAC  gstd_vala.stamp
warning: D-Bus GLib is deprecated, use GDBus
main.vala:49.5-49.20: error: The name `setlogmask' does not exist in the context of `Posix'
				Posix.setlogmask(Posix.LOG_UPTO(Posix.LOG_ERR));

error Argument 1 Cannot pass out argument to non-output parameter

You need to use at least Vala 0.12.1

make[2]: Entering directory `/local/home/tfischer/work/gstd/src'
  VALAC  gstd_vala.stamp
warning: D-Bus GLib is deprecated, use GDBus
gstd-pipeline.vala:207.23-207.30: error: Argument 1: Cannot pass out argument to non-output parameter
				message.parse_qos(out live, out running_time, out stream_time, out timestamp, out duration);
				                  ^^^^^^^^

valac: error while loading shared libraries: libvala-0.12.so.0: cannot open shared object file

You need to update your dynamic loader cache after adding a shared library.

sudo ldconfig

Common runtime problems

Exit 2 sudo gstd

GStreamer daemon logs all its error messages to syslog. To see what is going on, try:

 sudo tail /var/log/syslog

Gstd: Error: Connection ":1.960" is not allowed

After doing a

 sudo make install

You need to restart the D-Bus daemon.

 sudo service dbus force-reload

which invokes the D-Bus daemon method org.freedesktop.DBus.ReloadConfig.

The name com.ridgerun.gstreamer.gstd was not provided by any .service files

After doing a

 sudo make install

You need to restart the D-Bus daemon.

 sudo service dbus force-reload

which invokes the D-Bus daemon method org.freedesktop.DBus.ReloadConfig.

Failed to register busname

After starting the daemon with

 gstd --session &
 gstd[11674]: Started
 gstd[11674]: Registered busname

You get the following error messages when trying to use gst-client

 gst-client
 dbus[530]: [system] Activating service name='com.ridgerun.gstreamer.gstd' (using servicehelper)
 gstd[11686]: Started
 gstd[11686]: Failed to register busname
 gstd[11686]: Ended

You need to specify the session bus on gst-client as well

 gst-client --session

Creating pipeline Launcher could not run out of memory

You likely are using the dbus. For example, if you started GStreamer Daemon with

gstd --session &

and you ran a client command like

gst-client create "filesrc name=src ! aacparse ! ffdec_aac ! autoaudiosink"

you will get the out of memory error (really misleading error text).

Instead, you need to run the client command on the same dbus, but adding --session, like:

gst-client --session create "filesrc name=src ! aacparse ! ffdec_aac ! autoaudiosink"
Something went wrong with that request. Please try again.