QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GstAppSinkAdapter Class Reference

Bridges a GStreamer appsink to a Qt QVideoSink. More...

#include <GstAppSinkAdapter.h>

+ Inheritance diagram for GstAppSinkAdapter:
+ Collaboration diagram for GstAppSinkAdapter:

Signals

void frameCountsChanged ()
 

Public Member Functions

 GstAppSinkAdapter (QObject *parent=nullptr)
 Frames that reached the appsink sink pad (counted via pad probe).
 
 ~GstAppSinkAdapter () override
 
bool setup (GstElement *sinkBin, QVideoSink *videoSink)
 
void teardown ()
 Disconnect the callback (safe to call multiple times).
 
void requestLatencyRefresh () noexcept
 Signal the adapter to refresh pipeline latency on the next streaming-thread tick.
 
void setActive (bool active)
 
void setRefreshRate (qreal hz)
 
void setSmoothingEnabled (bool enabled, qreal refreshHz)
 
quint64 gpuFrameCount () const noexcept
 
quint64 cpuFrameCount () const noexcept
 
quint64 gpuFallbackCount () const noexcept
 
quint64 appsinkInputFrames () const noexcept
 
quint64 appsinkDroppedFrames () const noexcept
 

Detailed Description

Bridges a GStreamer appsink to a Qt QVideoSink.

Each decoded frame arriving at the appsink is copied into a QVideoFrame and pushed to the QVideoSink, which renders through Qt's native RHI backend (Metal on macOS, Vulkan/D3D elsewhere).

Definition at line 43 of file GstAppSinkAdapter.h.

Constructor & Destructor Documentation

◆ GstAppSinkAdapter()

GstAppSinkAdapter::GstAppSinkAdapter ( QObject *  parent = nullptr)
explicit

Frames that reached the appsink sink pad (counted via pad probe).

Frames the appsink dropped because of max-buffers=1, drop=true queue overflow. Distinct from decoder-level QoS drops surfaced by GstVideoReceiver.

Definition at line 339 of file GstAppSinkAdapter.cc.

◆ ~GstAppSinkAdapter()

GstAppSinkAdapter::~GstAppSinkAdapter ( )
override

Definition at line 345 of file GstAppSinkAdapter.cc.

References teardown().

Member Function Documentation

◆ appsinkDroppedFrames()

quint64 GstAppSinkAdapter::appsinkDroppedFrames ( ) const
noexcept

Definition at line 1281 of file GstAppSinkAdapter.cc.

◆ appsinkInputFrames()

quint64 GstAppSinkAdapter::appsinkInputFrames ( ) const
noexcept

Definition at line 1276 of file GstAppSinkAdapter.cc.

◆ cpuFrameCount()

quint64 GstAppSinkAdapter::cpuFrameCount ( ) const
noexcept

Definition at line 1236 of file GstAppSinkAdapter.cc.

◆ frameCountsChanged

void GstAppSinkAdapter::frameCountsChanged ( )
signal

Referenced by setup().

◆ gpuFallbackCount()

quint64 GstAppSinkAdapter::gpuFallbackCount ( ) const
noexcept

Definition at line 1242 of file GstAppSinkAdapter.cc.

◆ gpuFrameCount()

quint64 GstAppSinkAdapter::gpuFrameCount ( ) const
noexcept

Definition at line 1211 of file GstAppSinkAdapter.cc.

◆ requestLatencyRefresh()

void GstAppSinkAdapter::requestLatencyRefresh ( )
inlinenoexcept

Signal the adapter to refresh pipeline latency on the next streaming-thread tick.

Definition at line 68 of file GstAppSinkAdapter.h.

Referenced by GStreamer::setupAppSinkAdapter().

◆ setActive()

void GstAppSinkAdapter::setActive ( bool  active)

Gate frame delivery without tearing the pipeline down. When set to false the next frame seen is a single empty QVideoFrame (clears the sink), and subsequent samples are dropped at the appsink callback until re-enabled. Mirrors Qt's QVideoSink::isActive gate (qgstvideorenderersink.cpp:345-355). Use when switching streams to avoid the previous stream's last frame ghosting on the QML output.

Definition at line 727 of file GstAppSinkAdapter.cc.

Referenced by GStreamer::setAppSinkAdaptersActive(), and GStreamer::setupAppSinkAdapter().

◆ setRefreshRate()

void GstAppSinkAdapter::setRefreshRate ( qreal  hz)

Display refresh-rate baseline for appsink max-time (max(1/refreshHz, 1/streamFps) applied at each caps change). Call once from the GUI thread after setup(); pass 0 to leave the bin's 33 ms default.

Definition at line 499 of file GstAppSinkAdapter.cc.

◆ setSmoothingEnabled()

void GstAppSinkAdapter::setSmoothingEnabled ( bool  enabled,
qreal  refreshHz 
)

Opt-in OBS-style smoothing: 3-deep ring, display-rate timer picks the frame nearest the PTS-anchored expected presentation time. Adds up to one frame of latency. refreshHz <= 0 falls back to 60 Hz tick.

Definition at line 518 of file GstAppSinkAdapter.cc.

◆ setup()

bool GstAppSinkAdapter::setup ( GstElement sinkBin,
QVideoSink *  videoSink 
)

Connect to the named appsink inside sinkBin and push frames to videoSink. Returns true on success.

Definition at line 350 of file GstAppSinkAdapter.cc.

References frameCountsChanged(), gst_qgc_video_sink_bin_get_appsink(), and teardown().

◆ teardown()

void GstAppSinkAdapter::teardown ( )

Disconnect the callback (safe to call multiple times).

Definition at line 614 of file GstAppSinkAdapter.cc.

Referenced by setup(), and ~GstAppSinkAdapter().


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