15 const auto rounded = [evenSizes](
int extent) {
return evenSizes ? ((extent + 1) & ~1) : extent; };
16 return (textureSize.width() > rounded(picture.width())) || (textureSize.height() > rounded(picture.height()));
20 : QHwVideoBuffer(QVideoFrame::RhiTextureHandle)
21 ,
_sample(sample ? gst_sample_ref(sample) : nullptr)
24 , _memoryPixelFormat(
_format.pixelFormat())
41 const QVideoFrameFormat::PixelFormat advertised =
_format.pixelFormat();
42 if ((mode != QVideoFrame::ReadOnly) || (advertised == QVideoFrameFormat::Format_SamplerExternalOES) ||
43 (advertised != _memoryPixelFormat)) {
61 if (!rhi.thread()->isCurrentThread()) {
65 if (
static_cast<int>(rhi.backend()) != expectedBackend) {
68 "mapTextures: QRhi backend is" << rhi.backendName() <<
"(backend id" << expectedBackend <<
"required)");
71 outBuffer = gst_sample_get_buffer(
_sample);
HwVideoBufferPath
GPU zero-copy path a frame is imported through; None means the frame takes the CPU path.
#define QGC_HW_WARN_ONCE(LOGCAT, FLAG,...)
Logs once via qCWarning(LOGCAT) the first time FLAG flips true; subsequent trips are silent.
GstHwVideoBuffer(GstSample *sample, const GstVideoInfo &videoInfo, QVideoFrameFormat format)
MapData map(QVideoFrame::MapMode mode) override
~GstHwVideoBuffer() override
QVideoFrameFormat format() const override
QVideoFrameFormat _format
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.
QVideoFrameTexturesUPtr fail(HwVideoBufferPath path) noexcept
Records a map failure for path and returns the empty bundle mapTextures() reports it with.
@ MapFailures
mapTextures() returned an invalid bundle (GPU import failed).
void record(HwVideoBufferPath path, Counter counter) noexcept
bool texturePadsPicture(QSize textureSize, QSize picture, bool evenSizes)
One-shot warning flags per failure cause; paths with extra causes (DMABuf, D3D, IOSurface) derive and...
std::atomic< bool > loggedNullSample
std::atomic< bool > loggedNullBuffer
std::atomic< bool > loggedBadBackend
std::atomic< bool > loggedWrongThread