QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GstDmaBufVideoBuffer.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/qglobal.h>
4
5#if defined(QGC_HAS_GST_DMABUF_GPU_PATH)
6
7#include <EGL/egl.h>
8#include <EGL/eglext.h>
9
10#include "GstHwVideoBuffer.h"
11
12class QRhi;
13
16class GstDmaBufVideoBuffer final : public GstHwVideoBuffer
17{
18public:
19 GstDmaBufVideoBuffer(GstSample* sample, const GstVideoInfo& videoInfo, const QVideoFrameFormat& format,
20 EGLDisplay eglDisplay);
21
22 bool isDmaBuf() const override { return true; }
23
24 QVideoFrameTexturesUPtr mapTextures(QRhi& rhi, QVideoFrameTexturesUPtr& oldTextures) override;
25 bool validatePlaneHandles() const override;
26
27 const char* storageTag() const override { return "DMABuf"; }
28
29 static void resetCachedState() noexcept;
30
31#ifdef QGC_GST_BUILD_TESTING
32 static bool singleFdImportEnabledForTest() noexcept;
33 static bool directGlImportAllowedForTest(bool hasModifiersExt, guint64 drmModifier) noexcept;
34 static bool texStorageImportAllowedForTest(bool contextIsOpenGles, bool hasTexStorageExt,
35 guint64 drmModifier) noexcept;
36#endif
37
38private:
39#if defined(QGC_HAS_GST_VULKAN_GPU_PATH)
40 QVideoFrameTexturesUPtr importVulkan(QRhi& rhi);
41#endif
42
43 EGLDisplay _eglDisplay = EGL_NO_DISPLAY;
44 guint64 _drmModifier = 0; // 0 = LINEAR / non-DRM; parsed once from caps in the ctor
45};
46
47#endif // QGC_HAS_GST_DMABUF_GPU_PATH
Common base for GStreamer-backed QHwVideoBuffer subclasses.
virtual const char * storageTag() const
Human-readable GPU path identifier (e.g. "DMABuf"); string literal, safe from any thread.
virtual bool validatePlaneHandles() const
Streaming-thread sanity check on per-plane handles; failure routes to CPU memcpy.