QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GstD3DContextBridge.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/qglobal.h>
4
5#if defined(QGC_HAS_GST_D3D11_GPU_PATH) || defined(QGC_HAS_GST_D3D12_GPU_PATH)
6
7#include <gst/gst.h>
8
10
15class GstD3DContextBridge : public GstContextBridgeBase
16{
17public:
19 GstObject* refDevice();
20
22 static gint64 readAdapterLuid(gpointer device);
23
24protected:
27 constexpr GstD3DContextBridge(const char* api, std::span<const char* const> contextTypes,
28 const QLoggingCategory& (*logCategory)(), int qrhiBackend,
29 int secondQrhiBackend = -1) noexcept
30 : GstContextBridgeBase(api, contextTypes, logCategory)
31 , _qrhiBackend(qrhiBackend)
32 , _secondQrhiBackend(secondQrhiBackend)
33 {}
34
35 ~GstD3DContextBridge() = default;
36
38 virtual GstObject* createDevice() = 0;
39
41 virtual GstContext* makeDeviceContext(GstObject* device) = 0;
42
44 void logAdapterMatch(gint64 expectedLuid, gpointer gstDevice) const;
45
46private:
47 bool primeLocked() final;
48 GstObject* refObject(const char* contextType) final;
49 GstContext* buildContext(const char* contextType, GstObject* object) final;
50 void clearLocked() final;
51
53 bool snapshotBackendMatches();
55 static void onDeviceRemoved(GObject* device, GParamSpec* property, gpointer bridge);
56
57 int _qrhiBackend;
58 int _secondQrhiBackend;
59 GstObject* _device = nullptr;
61 gulong _removalHandler = 0;
62 bool _warnedWrongBackend = false;
63};
64
65#endif // QGC_HAS_GST_D3D11_GPU_PATH || QGC_HAS_GST_D3D12_GPU_PATH