2016-11-10 12:02:55 +00:00
|
|
|
# Developing applications with GStreamer
|
|
|
|
|
2017-06-02 22:34:40 +00:00
|
|
|
## How do I compile programs that use GStreamer?
|
2016-11-10 12:02:55 +00:00
|
|
|
|
2016-11-15 10:20:12 +00:00
|
|
|
<!-- FIXME: update for windows, macOS, and meson build, get rid of libtool things -->
|
2016-11-10 12:02:55 +00:00
|
|
|
|
2016-11-15 10:20:12 +00:00
|
|
|
This depends all a bit on what your development environment and target
|
2017-08-17 00:39:31 +00:00
|
|
|
operating system is. The following is mostly aimed at Linux/unix setups.
|
2016-11-15 10:20:12 +00:00
|
|
|
|
|
|
|
GStreamer uses the `pkg-config` utility to provide applications with the right
|
|
|
|
compiler and linker flags. `pkg-config` is a standard build tool that is widely
|
2017-10-17 19:19:20 +00:00
|
|
|
used in unix systems to locate libraries and retrieve build settings. If
|
|
|
|
you're already familiar with it, then you're basically set.
|
2016-11-15 10:20:12 +00:00
|
|
|
|
2017-08-17 00:39:31 +00:00
|
|
|
If you're not familiar with `pkg-config`, to compile and link a small
|
2016-11-15 10:20:12 +00:00
|
|
|
one-file program, pass the `--cflags` and `--libs` arguments to `pkg-config`.
|
2017-08-17 00:39:31 +00:00
|
|
|
The following should be sufficient for a gstreamer-only program:
|
2016-11-10 12:02:55 +00:00
|
|
|
|
2017-05-29 05:29:44 +00:00
|
|
|
```
|
|
|
|
$ libtool --mode=link gcc `pkg-config --cflags --libs gstreamer-1.0` -o myprog myprog.c
|
|
|
|
```
|
2017-08-17 00:39:31 +00:00
|
|
|
|
|
|
|
If your application also used GTK+ 3.0, you could use
|
2016-11-10 12:02:55 +00:00
|
|
|
|
2017-05-29 05:29:44 +00:00
|
|
|
```
|
|
|
|
$ libtool --mode=link gcc `pkg-config --cflags --libs gstreamer-1.0 gtk+-3.0` -o myprog myprog.c
|
|
|
|
```
|
2016-11-10 12:02:55 +00:00
|
|
|
|
|
|
|
Those are back-ticks (on the same key with the tilde on US keyboards),
|
|
|
|
not single quotes.
|
|
|
|
|
2017-10-17 19:19:20 +00:00
|
|
|
For bigger projects, you should integrate `pkg-config` use in your
|
|
|
|
Makefile, or with autoconf using the pkg.m4 macro (providing
|
2016-11-15 10:20:12 +00:00
|
|
|
`PKG_CONFIG_CHECK`).
|
2016-11-10 12:02:55 +00:00
|
|
|
|
2017-06-02 22:34:40 +00:00
|
|
|
## How do I develop against an uninstalled GStreamer copy?
|
2016-11-10 12:02:55 +00:00
|
|
|
|
2017-08-17 00:39:31 +00:00
|
|
|
It is possible to develop and compile against an uninstalled copy of GStreamer
|
|
|
|
and its plugins, for example, against git checkouts. This enables you to test
|
|
|
|
the latest version of GStreamer without interfering with your system-wide
|
2017-10-17 19:19:20 +00:00
|
|
|
installation.
|
2016-11-10 12:02:55 +00:00
|
|
|
|
2016-11-15 10:20:12 +00:00
|
|
|
There are two ways to achieve such a setup:
|
|
|
|
|
|
|
|
1. [`gst-build`][gst-build] is our new meta-build module based on the
|
2017-08-17 00:39:31 +00:00
|
|
|
[Meson build system][meson]. This is the shiny new option. It's fast and
|
2016-11-15 10:20:12 +00:00
|
|
|
simple to get started with, but you will need a recent version of Meson
|
|
|
|
installed. Just check out the git repository and run the `setup.py` script.
|
2017-10-17 19:19:20 +00:00
|
|
|
Once the initial Meson configure stage has passed, you can enter an
|
2016-11-15 10:20:12 +00:00
|
|
|
uninstalled environment by running `ninja uninstalled` in the build
|
2017-08-17 00:39:31 +00:00
|
|
|
directory. This will make sure tools and plugins from the uninstalled build
|
|
|
|
tree are used. Any problems, let us know.
|
2016-11-15 10:20:12 +00:00
|
|
|
|
2017-10-17 19:19:20 +00:00
|
|
|
2. [`gst-uninstalled`][gst-uninstalled] is our traditional autotools
|
|
|
|
and libtool-based uninstalled setup tool, but it requires a few extra steps,
|
|
|
|
like manually downloading the needed GStreamer repositories. The
|
|
|
|
[`create-uninstalled-setup.sh`][create-uninstalled] script automates this
|
|
|
|
process. Run `create-uninstalled.sh` and follow its instructions to gain
|
|
|
|
access to an environment where uninstalled GStreamer tools and plugins are
|
|
|
|
used by default. Also, `pkg-config` will prefer uninstalled library copies
|
|
|
|
over installed ones.
|
2016-11-15 10:20:12 +00:00
|
|
|
|
|
|
|
Multiple uninstalled setups can be used in parallel, e.g. one for the
|
|
|
|
latest stable branch and one for git master. Have a look at the
|
|
|
|
[gst-uninstalled][gst-uninstalled] script to see how it determines which
|
|
|
|
environment is used.
|
|
|
|
|
2018-08-01 04:20:27 +00:00
|
|
|
[gst-build]: https://gitlab.freedesktop.org/gstreamer/gst-build/
|
2016-11-15 10:20:12 +00:00
|
|
|
[meson]: http://mesonbuild.com
|
2018-08-01 04:20:27 +00:00
|
|
|
[gst-uninstalled]: https://gitlab.freedesktop.org/gstreamer/gstreamer/tree/master/scripts/gst-uninstalled
|
|
|
|
[create-uninstalled]: https://gitlab.freedesktop.org/gstreamer/gstreamer/tree/master/scripts/create-uninstalled-setup.sh
|
2016-11-10 12:02:55 +00:00
|
|
|
|
2017-06-02 22:34:40 +00:00
|
|
|
## How can I use GConf to get the system-wide defaults?
|
2016-11-10 12:02:55 +00:00
|
|
|
|
2017-07-21 21:41:04 +00:00
|
|
|
<!-- FIXME: Consider removing. GConf was deprecated half a decade ago -->
|
|
|
|
|
|
|
|
GStreamer used to have GConf-based elements but these were removed in 2011,
|
|
|
|
after `GConf` itself was deprecated in favor of `GSettings`.
|
|
|
|
|
|
|
|
If what you want is automatic audio/video sinks, consider using the
|
|
|
|
`autovideosink` and `autoaudiosink` elements.
|
2016-11-10 12:02:55 +00:00
|
|
|
|
2017-06-02 22:34:40 +00:00
|
|
|
## How do I debug these funny shell scripts that libtool makes?
|
2016-11-10 12:02:55 +00:00
|
|
|
|
|
|
|
When you link a program against uninstalled GStreamer using
|
|
|
|
libtool, funny shell scripts are made to modify your shared object
|
|
|
|
search path and then run your program. For instance, to debug
|
2017-06-16 06:12:47 +00:00
|
|
|
`gst-launch`, try:
|
2016-11-10 12:02:55 +00:00
|
|
|
|
2017-05-29 05:29:44 +00:00
|
|
|
```
|
|
|
|
libtool --mode=execute gdb /path/to/gst-launch
|
|
|
|
```
|
2016-11-10 12:02:55 +00:00
|
|
|
|
2017-04-05 12:37:49 +00:00
|
|
|
If this does not work, you're probably using a broken version of
|
2016-11-10 12:02:55 +00:00
|
|
|
libtool.
|
|
|
|
|
2016-11-15 10:20:12 +00:00
|
|
|
If you build GStreamer using the Meson build system, libtool will not
|
|
|
|
be used and this is not a problem. You can run `gdb`, `valgrind` or any
|
|
|
|
debugging tools directly on the binaries Meson creates in the build
|
|
|
|
directory.
|
|
|
|
|
2017-06-02 22:34:40 +00:00
|
|
|
## Why is mail traffic so low on gstreamer-devel?
|
2016-11-10 12:02:55 +00:00
|
|
|
|
2018-08-01 04:20:27 +00:00
|
|
|
Our main arenas for coordination and discussion are IRC and Gitlab, not
|
2017-08-17 00:39:31 +00:00
|
|
|
the mailing lists. Join us in [`#gstreamer`][irc-gstreamer] on irc.freenode.net.
|
2016-11-15 10:20:12 +00:00
|
|
|
There is also a [webchat interface][webchat-gstreamer]. For larger picture
|
|
|
|
questions or getting more input from more people, a mail to the gstreamer-devel
|
|
|
|
mailing list is never a bad idea, however.
|
|
|
|
|
|
|
|
[irc-gstreamer]: irc://irc.freenode.net/#gstreamer
|
|
|
|
[webchat-gstreamer]: https://webchat.freenode.net
|
2016-11-10 12:02:55 +00:00
|
|
|
|
2017-06-02 22:34:40 +00:00
|
|
|
## What kind of versioning scheme does GStreamer use?
|
2016-11-10 12:02:55 +00:00
|
|
|
|
|
|
|
For public releases, GStreamer uses a standard MAJOR.MINOR.MICRO
|
|
|
|
version scheme. If the release consists of mostly bug fixes or
|
|
|
|
incremental changes, the MICRO version is incremented. If the release
|
2016-11-15 10:20:12 +00:00
|
|
|
contains big changes, the MINOR version is incremented. A change in the
|
|
|
|
MAJOR version indicates incompatible API or ABI changes, which happens
|
|
|
|
very rarely (the last one dates back to 2012). This is also known as
|
|
|
|
[semantic versioning](http://semver.org).
|
|
|
|
|
|
|
|
Even MINOR numbers indicate *stable releases*: 1.0.x, 1.2.x, 1.4.x, 1.6.x,
|
|
|
|
1.8.x, and 1.10.x are our stable release series. Odd MINOR numbers are used
|
|
|
|
for *unstable development releases* and *prereleases* which should only be
|
|
|
|
used temporarily for testing; your help in testing these tarballs and packages
|
|
|
|
is very much appreciated!
|
2016-11-10 12:02:55 +00:00
|
|
|
|
|
|
|
During the development cycle, GStreamer also uses a fourth or NANO
|
|
|
|
number. If this number is 1, then it's a git development version. Any
|
|
|
|
tarball or package that has a nano number of 1 is made from git and thus
|
|
|
|
not supported. Additionally, if you didn't get this package or tarball
|
|
|
|
from the GStreamer team, don't have high hopes on it doing whatever you
|
|
|
|
want it to do.
|
|
|
|
|
2017-05-29 05:29:44 +00:00
|
|
|
## What is the coding style for GStreamer code?
|
2016-11-10 12:02:55 +00:00
|
|
|
|
2017-08-17 00:39:31 +00:00
|
|
|
Basically, the core and almost all plugin modules use K\&R with 2-space
|
|
|
|
indenting. Just follow what's already there and you'll be fine. We only require
|
|
|
|
code files to be indented, header may be indented manually for better
|
|
|
|
readability. Please use spaces for indenting, not tabs, even in header files.
|
2016-11-10 12:02:55 +00:00
|
|
|
|
|
|
|
Individual plugins in gst-plugins-\* or plugins that you want considered
|
2017-08-17 00:39:31 +00:00
|
|
|
for addition to these modules should use the same style. It's easier if
|
|
|
|
everything is consistent. Consistency is, of course, the goal.
|
2016-11-10 12:02:55 +00:00
|
|
|
|
2017-08-17 00:39:31 +00:00
|
|
|
One way to make sure you are following our coding style is to run your code
|
|
|
|
(remember, only the `*.c` files, not the headers) through GNU Indent using the
|
|
|
|
following options:
|
2016-11-10 12:02:55 +00:00
|
|
|
|
2017-05-29 05:29:44 +00:00
|
|
|
```
|
|
|
|
indent \
|
|
|
|
--braces-on-if-line \
|
|
|
|
--case-brace-indentation0 \
|
|
|
|
--case-indentation2 \
|
|
|
|
--braces-after-struct-decl-line \
|
|
|
|
--line-length80 \
|
|
|
|
--no-tabs \
|
|
|
|
--cuddle-else \
|
|
|
|
--dont-line-up-parentheses \
|
|
|
|
--continuation-indentation4 \
|
|
|
|
--honour-newlines \
|
|
|
|
--tab-size8 \
|
|
|
|
--indent-level2
|
|
|
|
```
|
2016-11-10 12:02:55 +00:00
|
|
|
|
2017-08-17 00:39:31 +00:00
|
|
|
There is also a `gst-indent` script in the GStreamer core source tree in the
|
|
|
|
tools directory which wraps GNU Indent and uses the right options.
|
|
|
|
|
|
|
|
The easiest way to get the indenting right is probably to develop against a git
|
|
|
|
checkout. The local git commit hook will ensure correct indentation.
|
2016-11-10 12:02:55 +00:00
|
|
|
|
2016-11-15 10:20:12 +00:00
|
|
|
Comments should be in `/* ANSI C comment style */` and code should generally
|
|
|
|
be compatible with ANSI C89, so please declare all variables at the beginning
|
2017-08-17 00:39:31 +00:00
|
|
|
of the block, etc.
|
2016-11-10 12:02:55 +00:00
|
|
|
|
2018-08-01 04:20:27 +00:00
|
|
|
Merge requests should ideally be made against git master or a recent release.
|
|
|
|
Please don't send patches to the mailing list. They will likely get lost there.
|
2016-11-10 12:02:55 +00:00
|
|
|
|
2016-12-10 11:57:22 +00:00
|
|
|
See [How to submit patches][submit-patches] for more details.
|
|
|
|
|
|
|
|
[submit-patches]: contribute/index.md#how-to-submit-patches
|
|
|
|
|
2017-05-29 05:29:44 +00:00
|
|
|
## How do I get my translations included?
|
|
|
|
|
|
|
|
I have translated one of the module .po files into a new language. How do I get it included?
|
2016-11-10 12:02:55 +00:00
|
|
|
|
|
|
|
GStreamer translations are uniformly managed through the
|
2016-11-15 10:20:12 +00:00
|
|
|
[Translation Project](http://translationproject.org). There are some
|
2016-11-10 12:02:55 +00:00
|
|
|
instructions on how to join the Translation Project team and submit new
|
|
|
|
translations at http://translationproject.org/html/translators.html.
|
|
|
|
|
|
|
|
New translations submitted via the Translation Project are merged
|
2016-11-15 10:20:12 +00:00
|
|
|
periodically into git by the maintainers by running `make download-po`
|
|
|
|
in the various modules when preparing a new release.
|
|
|
|
|
2017-08-17 00:39:31 +00:00
|
|
|
We don't merge new translations or translation fixes directly, everything
|
2016-11-15 10:20:12 +00:00
|
|
|
must go via the Translation Project.
|