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
QGStreamerInterface Class Referenceabstract

Provides GStreamer-specific integration points for Qt Multimedia. More...

#include <qgstreamerinterface.h>

Collaboration diagram for QGStreamerInterface:

Public Member Functions

virtual ~QGStreamerInterface ()
 Destroys the interface.
virtual QCameramakeCustomGStreamerCamera (const QByteArray &gstBinDescription, QObject *parent)=0
virtual QCameramakeCustomGStreamerCamera (GstElement *element, QObject *parent)=0
virtual QAudioDevice makeCustomGStreamerAudioInput (const QByteArray &gstreamerPipeline)=0
 Creates a custom audio input device from a GStreamer pipeline description.
virtual QAudioDevice makeCustomGStreamerAudioOutput (const QByteArray &gstreamerPipeline)=0
 Creates a custom audio output device from a GStreamer pipeline description.
virtual GstPipelinegstPipeline (QMediaPlayer *)=0
 Returns the underlying GStreamer pipeline for player, or nullptr if player is not backed by the GStreamer media backend.
virtual GstPipelinegstPipeline (QMediaCaptureSession *)=0
 Returns the underlying GStreamer pipeline for session, or nullptr if session is not backed by the GStreamer media backend.
virtual GstBuffergstBuffer (const QVideoFrame &frame)=0
 Returns the GStreamer buffer backing frame, or nullptr if frame does not hold GStreamer-backed video memory.
virtual QVideoFrame createFrameFromGstBuffer (GstBuffer *buffer, const GstVideoInfo &videoInfo)=0
 Creates a \l QVideoFrame that wraps buffer using the format described by videoInfo.
virtual QVideoFrame createFrameFromGstBuffer (GstBuffer *buffer, const GstVideoInfoDmaDrm &videoInfo)=0
 Creates a \l QVideoFrame that wraps a DMA-BUF-backed buffer using the format described by videoInfo.

Static Public Member Functions

static QGStreamerInterfaceinstance ()
 Returns the GStreamer interface for the active Qt Multimedia backend, or nullptr if the GStreamer backend is not in use.

Detailed Description

Provides GStreamer-specific integration points for Qt Multimedia.

Since
6.12

\inmodule QtMultimedia

Warning
The QGStreamerInterface class offers limited compatibility guarantees. There are no source or binary compatibility guarantees for this API, meaning it is only guaranteed to work with the Qt version the application has been developed against. Incompatible changes are aimed to be kept at a minimum and will only be made in minor releases.

To use this class in an application, link to Qt::MultimediaPrivate (if using CMake), and include the header {#include <QtMultimedia/spi/qgstreamerinterface.h>}.

QGStreamerInterface is the entry point for customizing the GStreamer backend: wrapping custom pipeline elements as Qt audio and video devices, accessing the underlying GstPipeline of high-level Qt objects, and converting between \l QVideoFrame and GStreamer buffers.

By default, the class is available in meta-qt6 builds. In custom builds with GStreamer support, the gstreamer_qt_api feature can enable it.

QtMultimedia must be run with the gstreamer media backend to get a valid instance of the class.

Definition at line 29 of file qgstreamerinterface.h.

Constructor & Destructor Documentation

◆ ~QGStreamerInterface()

QGStreamerInterface::~QGStreamerInterface ( )
virtualdefault

Destroys the interface.

Member Function Documentation

◆ createFrameFromGstBuffer() [1/2]

virtual QVideoFrame QGStreamerInterface::createFrameFromGstBuffer ( GstBuffer * buffer,
const GstVideoInfo & videoInfo )
pure virtual

Creates a \l QVideoFrame that wraps buffer using the format described by videoInfo.

The created frame shares ownership of the specified GstBuffer with the caller.

See also
createFrameFromGstBuffer(GstBuffer *, const GstVideoInfoDmaDrm &), gstBuffer()

◆ createFrameFromGstBuffer() [2/2]

virtual QVideoFrame QGStreamerInterface::createFrameFromGstBuffer ( GstBuffer * buffer,
const GstVideoInfoDmaDrm & videoInfo )
pure virtual

Creates a \l QVideoFrame that wraps a DMA-BUF-backed buffer using the format described by videoInfo.

Requires GStreamer 1.24 or later with DMA-BUF video format support. If unsupported, returns an invalid \l QVideoFrame and logs a warning.

The created frame shares ownership of the specified GstBuffer with the caller.

See also
createFrameFromGstBuffer(GstBuffer *, const GstVideoInfo &), gstBuffer()

◆ gstBuffer()

virtual GstBuffer * QGStreamerInterface::gstBuffer ( const QVideoFrame & frame)
pure virtual

Returns the GStreamer buffer backing frame, or nullptr if frame does not hold GStreamer-backed video memory.

Ownership of the returned buffer is not transferred.

See also
createFrameFromGstBuffer()

◆ gstPipeline() [1/2]

virtual GstPipeline * QGStreamerInterface::gstPipeline ( QMediaCaptureSession * session)
pure virtual

Returns the underlying GStreamer pipeline for session, or nullptr if session is not backed by the GStreamer media backend.

Warning
The pipeline is still owned and driven by Qt Multimedia. Modifying its state or topology without coordinating with the capture session can cause undefined behavior.
See also
QMediaCaptureSession

◆ gstPipeline() [2/2]

virtual GstPipeline * QGStreamerInterface::gstPipeline ( QMediaPlayer * player)
pure virtual

Returns the underlying GStreamer pipeline for player, or nullptr if player is not backed by the GStreamer media backend.

Warning
The pipeline is still owned and driven by Qt Multimedia. Modifying its state or topology without coordinating with \l QMediaPlayer can cause undefined behavior.
See also
QMediaPlayer

◆ instance()

QGStreamerInterface * QGStreamerInterface::instance ( )
static

Returns the GStreamer interface for the active Qt Multimedia backend, or nullptr if the GStreamer backend is not in use.

Definition at line 46 of file qgstreamerinterface.cpp.

◆ makeCustomGStreamerAudioInput()

virtual QAudioDevice QGStreamerInterface::makeCustomGStreamerAudioInput ( const QByteArray & gstreamerPipeline)
pure virtual

Creates a custom audio input device from a GStreamer pipeline description.

The gstreamerPipeline string is parsed as a GStreamer bin description. The resulting elements are connected as the audio source of a \l QMediaCaptureSession when the returned \l QAudioDevice is passed to \l QAudioInput and assigned with \l{QMediaCaptureSession::setAudioInput()}.

Element names in the description can be used to locate nodes in the session pipeline via gst_bin_get_by_name() after the capture session is active.

#include <QtMultimedia/spi/qgstreamerinterface.h>
"audiotestsrc wave=2 freq=200 ! identity name=myConverter") };
session.setAudioInput(&input);
\qmltype AudioInput \nativetype QAudioInput
Definition qaudioinput.h:19
static QGStreamerInterface * instance()
Returns the GStreamer interface for the active Qt Multimedia backend, or nullptr if the GStreamer bac...
virtual QAudioDevice makeCustomGStreamerAudioInput(const QByteArray &gstreamerPipeline)=0
Creates a custom audio input device from a GStreamer pipeline description.
The QMediaCaptureSession class allows capturing of audio and video content.
void setAudioInput(QAudioInput *input)
Sets the audio input device to input.
GLenum GLenum GLenum input
See also
makeCustomGStreamerAudioOutput(), QAudioInput, QMediaCaptureSession

◆ makeCustomGStreamerAudioOutput()

virtual QAudioDevice QGStreamerInterface::makeCustomGStreamerAudioOutput ( const QByteArray & gstreamerPipeline)
pure virtual

Creates a custom audio output device from a GStreamer pipeline description.

The gstreamerPipeline string is parsed as a GStreamer bin description. The resulting elements are connected as the audio sink of a \l QMediaCaptureSession when the returned \l QAudioDevice is passed to \l QAudioOutput and assigned with \l{QMediaCaptureSession::setAudioOutput()}.

See also
makeCustomGStreamerAudioInput(), QAudioOutput, QMediaCaptureSession

◆ makeCustomGStreamerCamera() [1/2]

virtual QCamera * QGStreamerInterface::makeCustomGStreamerCamera ( const QByteArray & gstBinDescription,
QObject * parent )
pure virtual

◆ makeCustomGStreamerCamera() [2/2]

virtual QCamera * QGStreamerInterface::makeCustomGStreamerCamera ( GstElement * element,
QObject * parent )
pure virtual

The documentation for this class was generated from the following files: