Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
backend-notes-gstreamer.qdoc
Go to the documentation of this file.
1
// Copyright (C) 2024 The Qt Company Ltd.
2
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4
/*!
5
\page qtmultimedia-gstreamer.html
6
\title Qt Multimedia GStreamer backend
7
\brief Platform notes for the GStreamer backend
8
9
This page covers the limitations of the GStreamer backend of Qt Multimedia.
10
11
\section1 Limitations and Known Issues
12
13
GStreamer is not bundled with Qt, but it is typically deployed with the Linux distribution.
14
15
\list
16
\li Certain bugs may be due to the GStreamer version being used. We recommend to use the latest
17
GStreamer bug fix release on your platform.
18
\li Certain bugs may also be related to the libraries used by GStreamer, like Pulseaudio. Most
19
notably Pulseaudio v16 has a known bug that causes the GStreamer pipeline to hang and requires
20
backports of these two patches:
21
\list
22
\li \l{https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/745}
23
\li \l{https://gitlab.freedesktop.org/pulseaudio/pulseaudio/-/merge_requests/764}
24
\endlist
25
This bug currently affects most mainstream Linux distributions, including Ubuntu 22.04, 23.10 and
26
24.04, Debian 11 and 12, as well as Fedora 39 and 40.
27
\li Seeking, playback rates, loop, switching sinks have known bugs.
28
\li Audio features requires PulseAudio. See \l{Qt Multimedia on Linux}{Linux platform notes}
29
for details.
30
\endlist
31
32
\section1 Customization points
33
34
Qt Multimedia provides certain customization points to allow access to the underlying GStreamer
35
pipeline. These customization points are considered private APIs and may be subject to change. The
36
entry point is \c{class QGStreamerPlatformSpecificInterface}.
37
38
\section2 Raw pipeline access
39
40
The \c{GstPipeline} underlying the \l{QMediaPlayer} and \l{QMediaCaptureSession} can be accessed.
41
42
\warning This is an unsafe API, as the pipeline is still managed by the Qt implementation. Great
43
care is required when using this API.
44
45
\code
46
#include <QtMultimedia/private/qgstreamer_platformspecificinterface_p.h>
47
48
[...]
49
QMediaMediaPlayer player;
50
GstPipeline *pipeline = QGStreamerPlatformSpecificInterface::instance()->gstPipeline(&player);
51
[...]
52
QMediaCaptureSession session;
53
GstPipeline *pipeline = QGSreamerPlatformSpecificInterface::instance()->gstPipeline(&session);
54
\endcode
55
56
\section2 Custom GStreamer elements as sinks and sources
57
58
It is possible to create GStreamer elements from a GStreamer pipeline decription and wrap them
59
inside a \c{QCamera} or \c{QAudioDevice}:
60
61
\code
62
#include <QtMultimedia/private/qgstreamer_platformspecificinterface_p.h>
63
64
[...]
65
QByteArray pipelineString = "videotestsrc is-live=true ! gamma gamma=2.0";
66
67
QMediaCaptureSession session;
68
session.setVideoSink(wid.videoSink());
69
70
QCamera *cam = QGStreamerPlatformSpecificInterface::instance()->makeCustomGStreamerCamera(
71
pipelineString, &session);
72
session.setCamera(cam);
73
\endcode
74
75
\section2 QMediaPlayer: custom sources
76
77
The \c{QMediaPlayer} accepts a GStreamer pipeline decription as source URI:
78
79
\code
80
QMediaPlayer player;
81
player.setSource(u"gstreamer-pipeline: videotestsrc name=testsrc"_s);
82
\endcode
83
84
This will try to compile the pipeline description to use as source in the QMediaPlayer and will be
85
automatically connected to the sinks of the QMediaPlayer.
86
87
\warning Hic sunt dracones! Custom pipelines are an experimental feature: the custom pipelines do
88
not map well to QMediaPlayer APIs, most notably the media status, metadata APIs, and transport state.
89
Most calls will directly map to the GStreamer pipeline, which can lead to undefined behavior
90
depending on the pipeline. In most cases, the \c{gstreamer-pipeline:} may not be the right choice
91
for application code: for arbitrary video sources, the \c{QMediaCaptureSession} with a custom camera
92
(see above) is the preferred choice. For arbitrarily complex pipelines that only want to draw into a
93
Qt/QML GUI, GStreamer's \c{qml6glsink} (see below) may be a more robust choice.
94
95
\section1 Architectural Considerations.
96
97
Qt Multimedia is not a general purpose streaming framework and not necessarily the architecturally
98
best way to use GStreamer with Qt. Developers, who need a high degree of control over the GStreamer
99
pipeline, but only want to show the video output Qt, may want to consider using GStreamer's
100
\l{https://gstreamer.freedesktop.org/documentation/qml6/index.html}{qml6glsink}.
101
102
103
*/
qtmultimedia
src
multimedia
doc
src
backend-notes-gstreamer.qdoc
Generated on
for Qt by
1.14.0