• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1---
2short-description:  GStreamer core API reference.
3...
4
5# GStreamer Core
6
7GStreamer is a streaming media framework. It uses graphs of elements
8which operate on data. The functionality to process media is provided by
9plug-ins which provide features like elements, typefinding, and so on.
10This allows new functionality to be added simply by installing new
11plug-ins.
12
13GStreamer is cross-platform and works on most UNIX-like platforms as
14well as Windows. It is released under the GNU Library General Public
15License (GNU LGPL).
16
17![ Relation between gstreamer core objects. ]
18
19  [ Relation between gstreamer core objects. ]: images/gst-universe.svg
20
21## Building on UNIX
22
23On UNIX, GStreamer uses the standard GNU build system, using autoconf
24for package configuration and resolving portability issues, automake for
25building makefiles that comply with the GNU Coding Standards, and
26libtool for building shared libraries on multiple platforms. The normal
27sequence for compiling and installing the GStreamer library is thus:
28`./configure` `make` `make install`
29
30The standard options provided by GNU autoconf may be passed to the
31`configure` script. Please see the autoconf documentation or run
32`./configure --help` for information about the standard options.
33
34In addition there are several options to activate or deactivate
35features. E.g. passing `--disable-gst-debug` to `configure` will turn
36the debugging subsystem into a non-functional stub and remove all macro
37based invocations from within the library (and anything compiled against
38the library afterwards.)
39
40If library size matters and one builds in a controlled environment, it
41is also possible to totally remove subsystem code. This is intentionally
42not offered as a configure option as it causes an ABI break. Code built
43against a version of GStreamer without these modifications needs to be
44recompiled.
45
46`make CFLAGS="-DGST_REMOVE_DEPRECATED -DGST_REMOVE_DISABLED"`
47
48-   `GST_REMOVE_DEPRECATED` - Omit deprecated functions from the
49    library.
50
51-   `GST_REMOVE_DISABLED` - Omit stubs for disabled subsystems from the
52    library.
53
54## Building GStreamer Applications
55
56Applications and libraries can use `pkg-config` to get all the needed
57compiler and linker flags to build against GStreamer. Please note that
58GStreamer is split into several libraries itself.
59`pkg-config --list-all | grep gstreamer` will list the available
60libraries.
61
62## Running and debugging GStreamer Applications
63
64### Environment variables
65
66GStreamer inspects a few of environment variables in addition to
67standard variables like LANG, PATH or HOME.
68
69**GST_PLUGIN_SYSTEM_PATH, GST_PLUGIN_SYSTEM_PATH_1_0.**
70
71This environment variable can be set to a colon-separated list of paths
72(or semicolon-separated list on Windows). If this variable is not set,
73GStreamer will fill in this list for you with
74
75-   plug-ins in the user's home directory, or rather the user's "data
76    home" directory according to the xdg base dir specification. Usually
77    this will be a directory called `plugins` inside the
78    `.local/share/gstreamer-GST_API_VERSION` directory in the user's
79    home directory by default, though this search path may change if the
80    XDG_DATA_HOME environment variable is set.
81
82-   plug-ins installed system-wide. On this system, they are stored in
83    `GST_PLUGINS_DIR`.
84
85GStreamer will scan these paths for GStreamer plug-ins. These plug-ins
86will be loaded after the plug-ins in the GST_PLUGIN_PATH variable
87below. The paths are scanned in the given order. This allows a user to
88override system-installed plug-ins with his own versions.
89
90The GST_PLUGIN_SYSTEM_PATH_1_0 variant is useful if both the old
91GStreamer 0.10 version and the new GStreamer 1.0 version need to be
92pointed to new plugin paths. The latter will use the _1_0 variant over
93the non-versioned one if it is set.
94
95Setting this variable to an empty string will cause GStreamer not to
96scan any system paths at all for plug-ins. This can be useful if you're
97running a development environment (for development purposes) or while running
98testsuites.
99
100**GST_PLUGIN_PATH, GST_PLUGIN_PATH_1_0.**
101
102This environment variable can be set to a colon-separated list of paths
103(or a semicolon-separated list on Windows). GStreamer will scan these
104paths for GStreamer plug-ins. These plug-ins will be loaded in addition
105to, and before, the plug-ins in the system paths.
106
107The GST_PLUGIN_PATH_1_0 variant is useful if both the old GStreamer
1080.10 version and the new GStreamer 1.0 version need to be pointed to new
109plugin paths. The latter will use the _1_0 variant over the
110non-versioned one if it is set.
111
112**GST_DEBUG.**
113
114If GStreamer has been configured with `--enable-gst-debug=yes`, this
115variable can be set to a list of debug options, which cause GStreamer to
116print out different types of debugging information to stderr.
117
118The variable takes a comma-separated list of "category_name:level"
119pairs to set specific levels for the individual categories. The level
120value ranges from 0 (nothing) to 9 (MEMDUMP).
121
122* 1 - `ERROR`: Logs all fatal errors. These are errors that do not allow the core
123    or elements to perform the requested action. The application can
124    still recover if programmed to handle the conditions that triggered
125    the error.
126* 2 - `WARNING`: Logs all warnings. Typically these are non-fatal, but user-visible
127    problems are expected to happen.
128* 3 - `FIXME`: Logs all fixme messages. Fixme messages are messages that indicate
129    that something in the executed code path is not fully implemented or
130    handled yet. The purpose of this message is to make it easier to
131    spot incomplete/unfinished pieces of code when reading the debug
132    log.
133* 4 - `INFO`: Logs all informational messages. These are typically used for events
134    in the system that only happen once, or are important and rare
135    enough to be logged at this level.
136* 5 - `DEBUG`: Logs all debug messages. These are general debug messages for events
137    that happen only a limited number of times during an object's
138    lifetime; these include setup, teardown, change of parameters, ...
139* 6 - `LOG`: Logs all log messages. These are messages for events that happen
140    repeatedly during an object's lifetime; these include streaming and
141    steady-state conditions.
142* 7 - `TRACE`: Logs all trace messages. These messages for events that happen
143    repeatedly during an object's lifetime such as the ref/unref cycles.
144* 9 - `MEMDUMP`: Log all memory dump messages. Memory dump messages are used to log
145    (small) chunks of data as memory dumps in the log. They will be
146    displayed as hexdump with ASCII characters.
147
148The category_name can contain "`*"` as a wildcard.
149
150For example, setting GST_DEBUG to `GST_AUTOPLUG:6,GST_ELEMENT_*:4`,
151will cause the `GST_AUTOPLUG` category to be logged at full `LOG` level,
152while all categories starting with `GST_ELEMENT_` will be logged at
153`INFO` level.
154
155To get all possible debug output, set GST_DEBUG to `*:9`. For debugging
156purposes a `*:6` debug log is usually the most useful, as it contains
157all important information, but hides a lot of noise such as refs/unrefs.
158For bug reporting purposes, a `*:6` log is also what will be requested
159usually. It's often also worth running with `*:3` to see if there are
160any non-fatal errors or warnings that might be related to the problem at
161hand.
162
163Since GStreamer 1.2 it is also possible to specify debug levels by name,
164e.g. GST_DEBUG=*:WARNING,*audio*:LOG
165
166**GST_DEBUG_NO_COLOR.**
167
168Set this environment variable to any value ("1" typically) to switch off
169colouring in GST_DEBUG output. This has the same effect as specifying
170the `--gst-debug-no-color` or `--gst-debug-color-mode`=off command line
171option to well-behaved GStreamer applications (ie. those that pass
172command-line options correctly to GStreamer). This is particularly
173useful to reduce the size of debug output and also allows for the output
174to be compressed much better than with colours turned on.
175
176Has the same effect as setting GST_DEBUG_COLOR_MODE environment
177variable to "off".
178
179**GST_DEBUG_COLOR_MODE.**
180
181Set this environment variable to change log colouring in GST_DEBUG
182output. Possible values:
183
184* `on`: Enables debug log output coloring. Uses default coloring method for
185  current platform. This is the default.
186* `off`: Disables debug log output coloring. This has the same effect as
187  specifying the `--gst-debug-color-mode`=off command line option to
188  well-behaved GStreamer applications (ie. those that pass
189  command-line options correctly to GStreamer). This is particularly
190  useful to reduce the size of debug output and also allows for the
191  output to be compressed much better than with colours turned on.
192
193  Has the same effect as setting GST_DEBUG_NO_COLOR environment
194  variable to any value.
195* `auto`: Same as `on`.
196* `disable`: Same as `off`.
197* `unix`: Enables debug log output coloring and forces the use of UNIX termial
198  codes for coloring, even if this method is not normally used on
199  current platform. This has the same effect as specifying the
200  `--gst-debug-color-mode`=unix command line option to well-behaved
201  GStreamer applications (ie. those that pass command-line options
202  correctly to GStreamer). This is particularly useful to dump debug
203  output into a file on non-UNIX platforms to be sent to developers
204  who have viewers that support UNIX terminal codes.
205
206**GST_DEBUG_OPTIONS.**
207
208This environment variable can be used to tweak the behaviour of the
209debugging system. Currently the only options supported are "pretty-tags"
210and "full-tags". In "pretty-tags" mode (the default), taglists in the
211debug log will be serialized so that only the first few and last few
212bytes of a buffer-type tag will be serialized into the log, to avoid
213dumping hundreds of lines of useless output into the log in case of
214large image tags and the like.
215
216**GST_DEBUG_DUMP_DOT_DIR.**
217
218Set this environment variable to a path to turn on all
219#GST_DEBUG_BIN_TO_DOT_FILE or
220#GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS calls and have the dot files
221in that location.
222
223This will only work if the application in question makes these calls in
224strategic places (like when the pipeline state changes or an error
225occurs). gst-launch-GST_API_VERSION is one such application.
226
227These .dot files can then be turned into images using the 'dot' utility
228from the graphviz set of tools, like this:
229`dot foo.dot -Tsvg -o foo.svg` or `dot foo.dot -Tpng -o foo.png` or
230`dot foo.dot -Tjpg -o foo.jpg`.
231
232There is also a utility called `xdot` which allows you to view the dot
233file directly without converting it first.
234
235**GST_REGISTRY, GST_REGISTRY_1_0.**
236
237Set this environment variable to make GStreamer use a different file for
238the plugin cache / registry than the default one. This is useful when
239operating in a separate environment which should not affect the default
240cache in the user's home directory.
241
242**GST_REGISTRY_FORK.**
243
244Set this environment variable to "no" to prevent GStreamer from forking
245on startup in order to update the plugin registry. This is useful for
246debugging purposes, but should not be used under normal circumstances,
247since it means that plugins may be loaded into memory even if they are
248not needed by the application.
249
250**GST_REGISTRY_UPDATE.**
251
252Set this environment variable to "no" to prevent GStreamer from updating
253the plugin registry. This is useful for embedded device which is not
254updating the plugins frequently, it will save time when doing
255gst_init().
256
257**GST_TRACE.**
258
259Enable memory allocation tracing. Most GStreamer objects have support
260for tracing the number of unfreed objects and their memory pointers.
261
262The variable takes a comma-separated list of tracing options to enable.
263
264* live: Counts all live objects and dumps an overview of the number of
265    unfreed objects at program exit.
266
267* mem-live: Keep track of the unfreed memory pointers and dump an overview of
268    all unfreed memory at program exit. Together with a level 9 debug
269    log this can be used to follow the lifecycle of leaked objects in
270    order to track down where they are leaked. This can be useful for
271    debugging memory leaks in situations where tools such as valgrind
272    are not available, or not an option.
273
274Use `all` to enable all tracing flags.
275
276**GST_DEBUG_FILE.**
277
278Set this variable to a file path to redirect all GStreamer debug
279messages to this file. If left unset, debug messages with be output unto
280the standard error.
281
282**ORC_CODE.**
283
284Useful Orc environment variable. Set ORC_CODE=debug to enable debuggers
285such as gdb to create useful backtraces from Orc-generated code. Set
286ORC_CODE=backup or ORC_CODE=emulate if you suspect Orc's SIMD code
287generator is producing incorrect code (Quite a few important GStreamer
288plugins like videotestsrc, audioconvert or audioresample use Orc). One
289can also combine flags like ORC_CODE=backup,debug.
290
291**G_DEBUG.**
292
293Useful GLib environment variable. Set G_DEBUG=fatal_warnings to make
294GStreamer programs abort when a critical warning such as an assertion
295failure occurs. This is useful if you want to find out which part of the
296code caused that warning to be triggered and under what circumstances.
297Simply set G_DEBUG as mentioned above and run the program in gdb (or
298let it core dump). Then get a stack trace in the usual way.
299
300**G_SLICE.**
301
302Useful GLib environment variable. Set G_SLICE=always-malloc when
303running GStreamer programs in valgrind, or debugging memory leaks with
304other tools. See the GLib API reference for more details.
305
306**GST_TAG_ENCODING.**
307
308Try this character encoding first for tag-related strings where the
309encoding is not defined and which are not UTF-8 already. By default the
310current locale will be tried (if not UTF-8).
311
312**GST_TAG_ID3_ENCODING.**
313
314Try this character encoding first for ID3 tag-related strings where the
315encoding is not defined and which are not UTF-8 already. By default the
316current locale will be tried (if not UTF-8).
317
318**GST_TAG_ID3V1_ENCODING.**
319
320Try this character encoding first for ID3v1 tag-related strings where
321the encoding does not look like UTF-8.
322
323**GST_GL_WINDOW.**
324
325Influences the window system to use by the GStreamer OpenGL library.
326Common values are 'x11', 'wayland', 'win32' or 'cocoa'.
327
328**GST_GL_PLATFORM.**
329
330Influences the OpenGL platform to use by the GStreamer OpenGL library.
331Common values are 'egl', 'glx', 'wgl' or 'cgl'.
332
333**GST_GL_API.**
334
335Influences the OpenGL API requested by the OpenGL platform. Common
336values are 'opengl' or 'gles2'.
337