3#include <QtCore/qglobal.h>
5#if defined(QGC_HAS_ANY_GPU_PATH)
8#include <gst/video/video-info.h>
9#include <initializer_list>
14#include <QtMultimedia/QVideoFrameFormat>
18class GstContextBridgeBase;
24struct HwPathDescriptor
31 bool (*matches)(GstMemory* mem) =
nullptr;
35 bool (*admits)(GstMemory* mem,
const HwVideoBufferContext& context) =
nullptr;
38 std::unique_ptr<GstHwVideoBuffer> (*construct)(GstSample* sample,
const GstVideoInfo& info,
40 const HwVideoBufferContext& context) =
nullptr;
44 void (*prepareContext)(HwVideoBufferContext& context) =
nullptr;
48 void (*probeDevice)(QRhi& rhi) =
nullptr;
51 void (*resetCaches)() =
nullptr;
55 bool (*proposePool)(GstQuery* query, GstCaps* caps,
const GstVideoInfo* info, gsize size,
56 guint minBuffers) =
nullptr;
59 GstContextBridgeBase& (*bridge)() =
nullptr;
66template <
class Buffer>
67std::unique_ptr<GstHwVideoBuffer> construct(GstSample* sample,
const GstVideoInfo& info, QVideoFrameFormat format,
68 const HwVideoBufferContext& )
70 return std::make_unique<Buffer>(sample, info, format);
73extern const HwPathDescriptor kCuda;
74extern const HwPathDescriptor kDmaBuf;
75extern const HwPathDescriptor kGlMemory;
76extern const HwPathDescriptor kD3D11;
77extern const HwPathDescriptor kD3D12;
78extern const HwPathDescriptor kVulkan;
79extern const HwPathDescriptor kIOSurface;
80extern const HwPathDescriptor kAHardwareBuffer;
88std::span<const HwPathDescriptor* const>
paths() noexcept;
93#ifdef QGC_UNITTEST_BUILD
95class ScopedPathsForTest
98 explicit ScopedPathsForTest(std::initializer_list<const HwPathDescriptor*> paths);
99 ~ScopedPathsForTest();
100 ScopedPathsForTest(
const ScopedPathsForTest&) =
delete;
101 ScopedPathsForTest& operator=(
const ScopedPathsForTest&) =
delete;
104 std::vector<const HwPathDescriptor*> _paths;
105 const std::vector<const HwPathDescriptor*>* _previous =
nullptr;
HwVideoBufferPath
GPU zero-copy path a frame is imported through; None means the frame takes the CPU path.
Common base for GStreamer-backed QHwVideoBuffer subclasses.
bool has(HwVideoBufferPath path) noexcept
std::span< const HwPathDescriptor *const > paths() noexcept