GstRtspSink - Building the plug-in
GstRtspSink can be built natively on Linux systems or cross-compiled for embedded platforms. This page provides step-by-step instructions for native compilation, as well as cross-compilation with Yocto for Linux-based embedded systems and Cerbero for Android-based embedded systems.
Build prerequisites
Before building, confirm:
- You have access to the licensed source package. To obtain access to GstRtspSink, purchase it from the RidgeRun store or contact RidgeRun to obtain a free evaluation version.
- Your toolchain matches the target architecture.
- The target GStreamer development packages are installed. The required build dependencies are:
- libgstrtspserver-1.0-dev
- libgstreamer1.0-dev
- libgstreamer-plugins-base1.0-dev
- libgstreamer-plugins-good1.0-dev
- libgstreamer-plugins-bad1.0-dev
Building Natively
The GstRtspSink source code includes support to build the plugin with Meson (recommended) and Autotools.
Build with Meson (Recommended)
First install the dependencies:
sudo apt install \ python3 \ ninja-build \ meson \ libgstrtspserver-1.0-dev \ libgstreamer1.0-dev \ libgstreamer-plugins-base1.0-dev \ libgstreamer-plugins-good1.0-dev \ libgstreamer-plugins-bad1.0-dev
Then build and install the plugin:
meson setup builddir --prefix=/usr && cd builddir meson compile meson install
Finally, you should be able to inspect the rtspsink element:
gst-inspect-1.0 rtspsink
Build with Autotools
GstRtspSink may be built as a standalone Autotools project. First, make sure the dependencies are fulfilled:
sudo apt-get install \ libgstrtspserver-1.0-dev \ libgstreamer1.0-dev \ libgstreamer-plugins-base1.0-dev \ libgstreamer-plugins-good1.0-dev \ libgstreamer-plugins-bad1.0-dev
After that, proceed to build the package:
./autogen.sh ./configure --libdir=/usr/lib/$(uname -m)-linux-gnu/ # GStreamer will look for its plug-ins in this standard location make sudo make install
The location of the plug-in can vary according to the system. The following table summarizes some standard locations for different setups
| System | Libdir |
|---|---|
| Ubuntu | /usr/lib/x86_64-linux-gnu/ |
| Mac OSX (macports) | /opt/local/lib |
| NVIDIA Jetson | /usr/lib/aarch64-linux-gnu |
| Qualcomm RB5 | /usr/lib/aarch64-linux-gnu/ |
Building with Yocto
RidgeRun provides the meta-ridgerun layer, which includes packaging support for commonly used RidgeRun components.
You can obtain meta-ridgerun from
https://github.com/RidgeRun/meta-ridgerun. Follow the instructions in the meta-ridgerun repository README.
- Once you have access to the repository, please open gst-rtsp-sink_0.5.bb in meta-ridgerun/recipes-multimedia/gstreamer/
- Modify the following line in SRC_URI with the correct gst-rtsp-sink URL by changing <Customer-Directory> with your own.
git://git@gitlab.com/RidgeRun/orders/<Customer-Directory>/gst-rtsp-sink.git;protocol=ssh;branch=${SRCBRANCH} \
- Make sure you have added your ssh key to your GitLab account. For more information: SSH Information
- Finally build recipe:
bitbake gst-rtsp-sink
Note: if there's a problem finding the source code, search the line
S = "${WORKDIR}/git". |
SSH Information
The recipe will fetch the repository using your ssh key, thus it's necessary to add the key in Gitlab page.
For adding it, go to Settings->SSH Keys and add your key, if don't have one you can find there a link about how to generate it.
SSH Issue
If the GitLab key hasn't added to your list of known hosts on the PC, you will have fetch errors when trying to build Gst-RtspSink recipe.
One easy way to add the key is when cloning the repository for the first time from GitLab, it will ask if you want to add the key to your list of known hosts.
Example:
git clone git@gitlab.com:RidgeRun/orders/<Customer-Directory>/gst-rtsp-sink.git
Troubleshooting
The build can fail by QA Issues.
ISSUE: gst-rtsp-sink: Files/directories were installed but not shipped
If this error show up, add the following line to gst-rtsp-sink_0.5.bb:
INSANE_SKIP_${PN} += "installed-vs-shipped"
Then, build the package with:
bitbake gst-rtsp-sink
Building for Android
To include the plugin in an Android, it needs to be compiled as a static library. For this, it is recommended to use the Cerbero build system with the correct configuration for the target system.
After bootstrapping Cerbero with the chosen configuration, include the following recipe template within the recipes directory:
# -*- Mode: Python -*- vi:si:et:sw=4:sts=4:ts=4:syntax=python
class Recipe(recipe.Recipe):
name = 'gst-rr-rtsp-sink'
version = 'gst-rr-rtsp-sink'
commit = '76f30f4ff3c11fcafdec6714faf3b654ce1fe55c'
remotes = {'origin': RTSP_SINK_GIT_REPO}
config_sh = 'cd src && autoreconf -fiv && sh ./configure'
configure_options = '--enable-static-plugins --enable-static --disable-shared PLATFORM=MX6 CFLAGS="-O0 -ggdb3 -I$CERBERO_PREFIX/../../android-ndk-21/sysroot/usr/include/ -I$CERBERO_PREFIX/../../android-ndk-21/sysroot/usr/include/arm-linux-androideabi/ -I$CERBERO_PREFIX/include -DGST_PLUGIN_BUILD_STATIC -funwind-tables -ffunction-sections -funwind-tables -fstack-protector -no-canonical-prefixes -fPIC -mthumb -fomit-frame-pointer -fno-strict-aliasing -finline-limit=64 -march=armv7-a -mfloat-abi=softfp -mfpu=vfpv3-d16 -DANDROID -DPIC -D__ARM_ARCH_7A__ -Wa,--noexecstack"'
make = 'cd src && make'
make_install = 'cd src && make install'
Modify it to include the path to the android NDK version used by Cerbero, the target architecture, and any other compiler flags necessary for the target; for example, the recipe above targets an IMX6 platform with ARM v7 architecture.
For detailed steps on how to cross-compile for Android using Cerbero, check out this guide.
Problems running the examples on this page? See GStreamer Debugging for practical debugging steps.
Related pages
- GstRtspSink
- GstRtspSink - Basic usage
- GstRtspSink - Simple Examples
- GstRtspSink - Advanced examples
- GStreamer Debugging
FAQ
- Can I build GstRtspSink in Yocto?
- Yes. RidgeRun documents a Yocto path through the meta-ridgerun layer.
- What is the first runtime validation step after building?
- Run gst-inspect-1.0 rtspsink on the target system.