Skip to content

Instantly share code, notes, and snippets.

@atlury
Last active March 20, 2021 11:03
Show Gist options
  • Save atlury/f4c2589d0eee2d3950d3 to your computer and use it in GitHub Desktop.
Save atlury/f4c2589d0eee2d3950d3 to your computer and use it in GitHub Desktop.
Quick-start guide to gst-uninstalled for GStreamer 1.x
PARTA
One of the first tools that you should get if you’re hacking with GStreamer or want to play with the latest version without doing evil things to your system is probably the gst-uninstalled script. It’s the equivalent of Python’s virtualenv for hacking on GStreamer. :)
The documentation around getting this set up is a bit frugal, though, so here’s my attempt to clarify things. I was going to put this on our wiki, but that’s a bit search-engine unfriendly, so probably easiest to just keep it here. The setup I outline below can probably be automated further, and comments/suggestions are welcome.
First, get build dependencies for GStreamer core and plugins on your distribution. Commands to do this on some popular distributions follow. This will install a lot of packages, but should mean that you won’t have to play find-the-plugin-dependency for your local build.
Fedora: $ sudo yum-builddep gstreamer1-*
Debian/Ubuntu: $ sudo apt-get build-dep gstreamer1.0-plugins-{base,good,bad,ugly}
Gentoo: having the GStreamer core and plugin packages should suffice
Others: drop me a note with the command for your favourite distro, and I’ll add it here
Next, check out the code (by default, it will turn up in ~/gst/master)
$ curl http://cgit.freedesktop.org/gstreamer/gstreamer/plain/scripts/create-uninstalled-setup.sh | sh
Ignore the pointers to documentation that you see — they’re currently defunct
Now put the gst-uninstalled script somewhere you can get to it easily:
$ ln -sf ~/gst/master/gstreamer/scripts/gst-uninstalled ~/bin/gst-master
(the -master suffix for the script is important to how the script works)
Enter the uninstalled environment:
$ ~/bin/gst-master
(this puts you in the directory with all the checkouts, and sets up a bunch of environment variables to use your uninstalled setup – check with echo $GST_PLUGIN_PATH)
Time to build
$ ./gstreamer/scripts/git-update.sh
Take it out for a spin
$ gst-inspect-1.0 filesrc
$ gst-launch-1.0 playbin uri=file:///path/to/some/file
$ gst-discoverer-1.0 /path/to/some/file
That’s it! Some tips:
Remember that you need to run ~/bin/gst-master to enter the environment for each new shell
If you start up a GStreamer app from your system in this environment, it will use your uninstalled libraries and plugins
You can and should periodically update you tree by rerunning the git-update.sh script
To run gdb on gst-launch, you need to do something like:
$ libtool --mode=execute gdb --args gstreamer/tools/gst-launch-1.0 videotestsrc ! videoconvert ! xvimagesink
I find it useful to run cscope on the top-level tree, and use that for quick code browsing
PARTB
In your folder just git clone all the modules and use the gst-uninstalled
script in gstreamer (core module)/scripts
http://gstreamer.freedesktop.org/wiki/UninstalledSetup
Or you can use jhbuild
http://wiki.pitivi.org/wiki/GStreamer_using_jhbuild
I prefer gst-uninstalled though, but it is a matter of personal taste.
PARTC
I'd like to build a stand-alone, static, debug'-g' version of GStreamer so I can step through simulations, bugs, and new plugin development with a source-debugger. I'd like to install the executables, libraries, includes, and debug versions of plugins in a directory ~/BIN under my user account. I'd also like to leave the system GStreamer working so I can switch back and forth between development and a known, working system.
Is there a better way of doing this? Please let me know. This is what I've been able to figure out on my own:
I've successfully built gstreamer-0.10 ( from http://gstreamer.freedesktop.org/src/ ). And I've installed my local copy to compile and build against by doing:
$ cd ~/DEV/gstreamer-0.10/
$ ./configure --enable-debug --enable-gst-debug --enable-profiling --enable-parse --enable-option-parsing --enable-static --disable-shared --prefix=/home/user/BIN
$ make
$ make install
So now I've got my own debug version of the Gstreamer launcher, inspector, includes, and libs. Everything appears to be happy, so far.
$ cd ~/BIN
$ tree -d
.
|-- bin
|-- include
| `-- gstreamer-0.10
| `-- gst
| |-- base
| |-- check
| |-- controller
| |-- dataprotocol
| `-- net
|-- lib
| |-- gstreamer-0.10
| `-- pkgconfig
|-- libexec
| `-- gstreamer-0.10
`-- share
|-- aclocal
[[...]]
Next I downloaded the gst-plugins-base-0.10, built, and statically linked against my development version:
$ cd ~/DEV/gst-plugins-base-0.10/
$ export GST_CFLAGS="-I/home/user/BIN/include/gstreamer-0.10 \
-I/home/user/BIN/include/gstreamer-0.10/gst -I/usr/include/glib-2.0 \
-I/usr/lib/glib-2.0/include -I/usr/include/libxml2"
$ export GST_LIBS="-pthread -static -L/home/user/BIN/lib -lgstreamer-0.10 \
-lxml2 -lgthread-2.0 -lrt -lgobject-2.0 -lglib-2.0"
$ ./configure --enable-debug --enable-static --enable-profiling --disable-shared --prefix=/home/user/BIN
$ make
$ make install
I can verify my debug versions of the gst-plugins-base were correctly installed and visible:
$ cd ~/BIN/bin/
$ ./gst-inspect
audioresample: audioresample: Audio resampler
playback: subtitleoverlay: Subtitle Overlay
[[...]]
audiotestsrc: audiotestsrc: Audio test source
alsa: alsasink: Audio sink (ALSA)
alsa: alsasrc: Audio source (ALSA)
alsa: alsamixer: Alsa mixer
coreelements: valve: Valve element
[[...]]
typefindfunctions: audio/x-musepack: mpc, mpp, mp+
typefindfunctions: video/x-ms-asf: asf, wm, wma, wmv
staticelements: bin: Generic bin
staticelements: pipeline: Pipeline object
Total count: 26 plugins, 178 features
However, when I try inspect one of the plugins, or use ./gst-launch, I get "GLib-GObject-CRITICAL" errors:
use gst-uninstalled script after cloning all repos
$ chmod u+x gstreamer-generic.sh
$ ./gstreamer-generic.sh
export GST_PLUGIN_SYSTEM_PATH=/usr/lib/arm-linux-gnueabihf/gstreamer-0.10
export GST_PLUGIN_SYSTEM_PATH_1_0=/usr/lib/arm-linux-gnueabihf/gstreamer-1.0
export GST_REGISTRY=~/.gstreamer-0.10/registry.arm.bin
export GST_REGISTRY_1_0=~/.gstreamer-1.0/registry.arm.bin
export PATH=$GST_PLUGIN_SYSTEM_PATH_1_0:$GST_PLUGIN_SYSTEM_PATH:$PATH
PARTE
xbps-query -R -f gst-plugins-bad1
xbps-query -R -f gst-plugins-ugly1
xbps-install -S gstreamer1
//incase of voidlinux for musl libc build
gstreamer-1.0 ...
gst-omx
apt-get install autoconf automake libtool gtk-doc-tools libglib2.0-dev
git clone git://anongit.freedesktop.org/gstreamer/gst-omx
cd gst-omx
./autogen.sh
autoconf
pkg-config
automake
libtool
gtk-doc-tools
libglib2.0-dev
xbps-install -S gstreamer1-core
./autogen.sh --disable-gtk-doc --with-omx-target=rpi
xbps-install -S gstreamer1-devel
xbps-install -S gst-plugins-base1-devel
xbps-install -S gcc
git clone git://anongit.freedesktop.org/gstreamer/gst-omx
cd gst-omx
./autogen.sh --disable-gtk-doc --with-omx-header-path=/home/rahul/firmware-master/opt/vc/include/IL --with-omx-target=rpi
make -j 4
https://github.com/raspberrypi/firmware/archive/master.zip
PARTF
–enable-introspection=no –disable-examples –enable-static-plugins –disable-shared –enable-static –disable-gtk-doc –disable-docbook –disable-gtk-doc –enable-static –disable-maintainer-mode –disable-silent-rules –disable-introspection –host=arm-linux-androideabi’
PARTG
I'm having quite some troubles to load gstreamer in my application statically.
I've built gstreamer from the 1.4.5 source package.
Configured with --enable-static --disable-shared --prefix=/somedir/gst_build
Then I've built gstreamer plugin base from the 1.4.5 source package.
Configured with --enable-static --disable-shared --enable-static-plugins --enable-app --prefix=/somedir/gst_build
Now, when I run /somedir/gst_build/gst-inspect-1.0, it doesn't report much of installed plugins. Is this to be expected?
gst_build/bin $ ./gst-inspect-1.0
staticelements: bin: Generic bin
staticelements: pipeline: Pipeline object
Total count: 1 plugin, 2 features
I guess you will need to link gst-inspect-1.0 with all static plugins that it should show. Which kind of defeats the purpose of gst-inspect... but
that's what you want when using static plugins.
For app you need to link to libgstapp-1.0 and libgstapp. The former being the library that provides appsrc/appsink, the latter being the
plugin that registers the element factories (and would provide gst_plugin_app_register()).
I do notice with grep that gst_plugin_app_register is located in the
> gst_build/lib/gstreamer-1.0/libgstapp.a.
> So I've included:
> LIBS += -L$$PWD/gst_build/lib -l:libgstapp-1.0.a
> LIBS += -L$$PWD/gst_build/lib/gstreamer-1.0 -l:libgstapp.a
Found the last problem with the undefined ref...The GST_PLUGIN_STATIC_DECLARE was not placed in an extern c. That gave the issue.
PARTH
http://gstreamer.freedesktop.org/wiki/UninstalledSetup/
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gst-building.html
http://englanders.us/~jason/howtos.php?howto=gstreamer
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment