6#include <gst/video/video-info.h>
7#include <private/qhwvideobuffer_p.h>
9#include <QtCore/QLoggingCategory>
10#include <QtCore/QSize>
11#include <QtCore/qglobal.h>
12#include <QtMultimedia/QVideoFrame>
13#include <QtMultimedia/QVideoFrameFormat>
39 flag->store(
false, std::memory_order_relaxed);
45static_assert(
sizeof(MapDiagnostics) == 6 *
sizeof(std::atomic<bool>),
"MapDiagnostics::reset() must list every flag");
62#define QGC_HW_WARN_ONCE(LOGCAT, FLAG, ...) \
64 if (!(FLAG).exchange(true, std::memory_order_relaxed)) { \
65 qCWarning(LOGCAT) << __VA_ARGS__; \
82 MapData
map(QVideoFrame::MapMode mode)
override;
83 void unmap()
override;
95 template <
class PlanePred>
100 GstBuffer* buffer = gst_sample_get_buffer(
_sample);
103 const int memCount = (std::min) (
int(gst_buffer_n_memory(buffer)),
GstHw::kMaxPlanes);
106 for (
int i = 0; i < memCount; ++i) {
107 GstMemory* mem = gst_buffer_peek_memory(buffer, i);
125 QVideoFrameFormat::PixelFormat _memoryPixelFormat;
HwVideoBufferPath
GPU zero-copy path a frame is imported through; None means the frame takes the CPU path.
GstHwVideoBuffer(GstSample *sample, const GstVideoInfo &videoInfo, QVideoFrameFormat format)
MapData map(QVideoFrame::MapMode mode) override
~GstHwVideoBuffer() override
QVideoFrameFormat format() const override
GstSample * refSample() noexcept
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.
bool validatePlanes(PlanePred &&planePred) const
Validate each plane satisfies planePred; predicate runs once per plane on the streaming thread.
virtual bool validatePlaneHandles() const
Streaming-thread sanity check on per-plane handles; failure routes to CPU memcpy.
QVideoFrameTexturesUPtr fail(HwVideoBufferPath path) noexcept
Records a map failure for path and returns the empty bundle mapTextures() reports it with.
Defined only in builds with the DMABuf path (QGC_HAS_GST_DMABUF_GPU_PATH) on GStreamer 1....
bool texturePadsPicture(QSize textureSize, QSize picture, bool evenSizes)
constexpr int kMaxPlanes
Matches GST_VIDEO_MAX_PLANES (gst-video pins it at 4); single source of truth for every per-platform ...
One-shot warning flags per failure cause; paths with extra causes (DMABuf, D3D, IOSurface) derive and...
std::atomic< bool > loggedNullSample
std::atomic< bool > loggedTextureCreateFail
std::atomic< bool > loggedNullBuffer
std::atomic< bool > loggedBadBackend
std::atomic< bool > loggedFirstSuccess
std::atomic< bool > loggedWrongThread