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
QSyntheticPipeWireVideoSource Class Reference

#include <qsyntheticpipewirevideosource_p.h>

Collaboration diagram for QSyntheticPipeWireVideoSource:

Classes

class  Private

Public Member Functions

 QSyntheticPipeWireVideoSource ()
 ~QSyntheticPipeWireVideoSource ()
q23::expected< void, QString > start (const SyntheticVideoScene &scene, const QSyntheticPipeWireVideoSourceConfig &config=QSyntheticPipeWireVideoSourceConfig::screenCast())
 Connects to the PipeWire daemon and publishes the source.
void stop ()
QtPipeWire::ObjectId nodeId () const
 The PipeWire node id to hand to a consumer. Valid only after a successful start().
void setScene (const SyntheticVideoScene &scene)
 Replaces the published content. Safe to call from any thread.
void renderNextFrame ()
 Renders and publishes the next frame. Safe to call from any thread.

Detailed Description

A synthetic PipeWire video source: an output pw_stream advertising {media.class = Stream/Output/Video} that publishes frames rendered by paintSyntheticVideoScene(). It stands in for a compositor's screen-cast stream, so QPipeWireCaptureHelper can be exercised without a real desktop portal.

The pixel format is fixed to SPA_VIDEO_FORMAT_BGRx, which maps to QVideoFrameFormat::Format_BGRX8888 on the consuming side and is byte-identical to QImage::Format_RGB32 on little-endian, avoiding a pixel format conversion.

The source also acts as its own session manager: when it is used against a private pipewire daemon there is no WirePlumber, so nothing honours PW_STREAM_FLAG_AUTOCONNECT and the consumer would sit in "paused" forever. The source therefore links itself, via the link-factory, to consumers meant for it.

Which consumers are "meant for it" is determined by matching media.role, not by the target passed to pw_stream_connect(): PipeWire consumes that target internally, and the resulting consumer node advertises neither target.object nor node.target. media.role is the one property a consumer does advertise – QPipeWireCaptureHelper sets Screen, a camera client sets Camera – so the source links only consumer nodes whose media.role matches its own. This matters as soon as one graph holds both a screen-cast and a camera source: matching by media.role is what keeps camera frames from being linked to a screen-capture client.

Definition at line 85 of file qsyntheticpipewirevideosource_p.h.

Constructor & Destructor Documentation

◆ QSyntheticPipeWireVideoSource()

QSyntheticPipeWireVideoSource::QSyntheticPipeWireVideoSource ( )

Definition at line 299 of file qsyntheticpipewirevideosource.cpp.

◆ ~QSyntheticPipeWireVideoSource()

QSyntheticPipeWireVideoSource::~QSyntheticPipeWireVideoSource ( )

Definition at line 301 of file qsyntheticpipewirevideosource.cpp.

References stop().

Here is the call graph for this function:

Member Function Documentation

◆ nodeId()

QtPipeWire::ObjectId QSyntheticPipeWireVideoSource::nodeId ( ) const
nodiscard

The PipeWire node id to hand to a consumer. Valid only after a successful start().

Definition at line 438 of file qsyntheticpipewirevideosource.cpp.

◆ renderNextFrame()

void QSyntheticPipeWireVideoSource::renderNextFrame ( )

Renders and publishes the next frame. Safe to call from any thread.

Definition at line 451 of file qsyntheticpipewirevideosource.cpp.

◆ setScene()

void QSyntheticPipeWireVideoSource::setScene ( const SyntheticVideoScene & scene)

Replaces the published content. Safe to call from any thread.

Definition at line 443 of file qsyntheticpipewirevideosource.cpp.

◆ start()

q23::expected< void, QString > QSyntheticPipeWireVideoSource::start ( const SyntheticVideoScene & scene,
const QSyntheticPipeWireVideoSourceConfig & config = QSyntheticPipeWireVideoSourceConfig::screenCast() )

Connects to the PipeWire daemon and publishes the source.

Blocks until the node id is known, so that nodeId() is usable as soon as this returns.

Definition at line 307 of file qsyntheticpipewirevideosource.cpp.

◆ stop()

void QSyntheticPipeWireVideoSource::stop ( )

Definition at line 416 of file qsyntheticpipewirevideosource.cpp.

Referenced by ~QSyntheticPipeWireVideoSource().

Here is the caller graph for this function:

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