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

Common base for GStreamer-backed QHwVideoBuffer subclasses. More...

#include <GstHwVideoBuffer.h>

+ Inheritance diagram for GstHwVideoBuffer:
+ Collaboration diagram for GstHwVideoBuffer:

Public Member Functions

 GstHwVideoBuffer (QVideoFrame::HandleType handleType, GstSample *sample, const GstVideoInfo &videoInfo, QVideoFrameFormat format)
 
 ~GstHwVideoBuffer () override
 
QVideoFrameFormat format () const override
 
MapData map (QVideoFrame::MapMode) override
 
virtual bool validatePlaneHandles () const
 Streaming-thread sanity check on per-plane handles; failure routes to CPU memcpy.
 
virtual const char * storageTag () const
 Human-readable GPU path identifier (e.g. "DMABuf"); string literal, safe from any thread.
 
GstSample * takeSample () noexcept
 Transfers GstSample ownership out for early pool-slot release in mapTextures.
 

Static Public Member Functions

static void logFirstSuccess (std::atomic< bool > &flag, const QLoggingCategory &cat, const char *tag, QSize frameSize, QVideoFrameFormat::PixelFormat pixelFormat, int planes)
 One-shot "first zero-copy success" info line; silent after flag first flips.
 

Protected Member Functions

template<class PlanePred >
bool validatePlanes (PlanePred &&planePred) const
 Validate each plane satisfies planePred; predicate runs once per plane on the streaming thread.
 
bool checkMapPreconditions (const QRhi &rhi, int expectedBackend, const QLoggingCategory &cat, GstHw::MapDiagnostics &diag, GstBuffer *&outBuffer) const
 Shared mapTextures preamble; warns once per cause via diag flags, returns false on first failure.
 

Protected Attributes

GstSample * _sample = nullptr
 
GstVideoInfo _videoInfo = {}
 
QVideoFrameFormat _format
 

Detailed Description

Common base for GStreamer-backed QHwVideoBuffer subclasses.

Definition at line 40 of file GstHwVideoBuffer.h.

Constructor & Destructor Documentation

◆ GstHwVideoBuffer()

GstHwVideoBuffer::GstHwVideoBuffer ( QVideoFrame::HandleType  handleType,
GstSample *  sample,
const GstVideoInfo &  videoInfo,
QVideoFrameFormat  format 
)

Definition at line 5 of file GstHwVideoBuffer.cc.

◆ ~GstHwVideoBuffer()

GstHwVideoBuffer::~GstHwVideoBuffer ( )
override

Definition at line 15 of file GstHwVideoBuffer.cc.

References _sample.

Member Function Documentation

◆ checkMapPreconditions()

bool GstHwVideoBuffer::checkMapPreconditions ( const QRhi &  rhi,
int  expectedBackend,
const QLoggingCategory &  cat,
GstHw::MapDiagnostics diag,
GstBuffer *&  outBuffer 
) const
protected

Shared mapTextures preamble; warns once per cause via diag flags, returns false on first failure.

Definition at line 22 of file GstHwVideoBuffer.cc.

References _sample, GstHw::MapDiagnostics::loggedBadBackend, GstHw::MapDiagnostics::loggedNullBuffer, GstHw::MapDiagnostics::loggedNullSample, and GstHw::MapDiagnostics::loggedWrongThread.

◆ format()

QVideoFrameFormat GstHwVideoBuffer::format ( ) const
inlineoverride

Definition at line 47 of file GstHwVideoBuffer.h.

References _format.

◆ logFirstSuccess()

void GstHwVideoBuffer::logFirstSuccess ( std::atomic< bool > &  flag,
const QLoggingCategory &  cat,
const char *  tag,
QSize  frameSize,
QVideoFrameFormat::PixelFormat  pixelFormat,
int  planes 
)
static

One-shot "first zero-copy success" info line; silent after flag first flips.

Definition at line 50 of file GstHwVideoBuffer.cc.

◆ map()

MapData GstHwVideoBuffer::map ( QVideoFrame::MapMode  )
inlineoverride

Definition at line 49 of file GstHwVideoBuffer.h.

◆ storageTag()

virtual const char * GstHwVideoBuffer::storageTag ( ) const
inlinevirtual

Human-readable GPU path identifier (e.g. "DMABuf"); string literal, safe from any thread.

Definition at line 55 of file GstHwVideoBuffer.h.

◆ takeSample()

GstSample * GstHwVideoBuffer::takeSample ( )
inlinenoexcept

Transfers GstSample ownership out for early pool-slot release in mapTextures.

Definition at line 58 of file GstHwVideoBuffer.h.

References _sample.

◆ validatePlaneHandles()

virtual bool GstHwVideoBuffer::validatePlaneHandles ( ) const
inlinevirtual

Streaming-thread sanity check on per-plane handles; failure routes to CPU memcpy.

Definition at line 52 of file GstHwVideoBuffer.h.

◆ validatePlanes()

template<class PlanePred >
bool GstHwVideoBuffer::validatePlanes ( PlanePred &&  planePred) const
inlineprotected

Validate each plane satisfies planePred; predicate runs once per plane on the streaming thread.

Definition at line 72 of file GstHwVideoBuffer.h.

References _sample, and GstHw::kMaxPlanes.

Member Data Documentation

◆ _format

QVideoFrameFormat GstHwVideoBuffer::_format
protected

Definition at line 96 of file GstHwVideoBuffer.h.

Referenced by format().

◆ _sample

GstSample* GstHwVideoBuffer::_sample = nullptr
protected

◆ _videoInfo

GstVideoInfo GstHwVideoBuffer::_videoInfo = {}
protected

Definition at line 95 of file GstHwVideoBuffer.h.


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