QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GstD3DContextBridgeCommon.h
Go to the documentation of this file.
1#pragma once
2
3#include <QtCore/qglobal.h>
4
5#if defined(Q_OS_WIN) && (defined(QGC_HAS_GST_D3D11_GPU_PATH) || defined(QGC_HAS_GST_D3D12_GPU_PATH))
6
7#include <QtCore/QLoggingCategory>
8#include <QtCore/QMutex>
9#include <atomic>
10#include <gst/gst.h>
11
14namespace GstD3DContextBridgeCommon {
15
17struct BridgeState
18{
19 QMutex mutex;
20 bool primed = false;
21 bool warnedWrongBackend = false;
22 std::atomic<bool> loggedFirstHandoff{false};
23 GstObject* device = nullptr;
24};
25
28struct BridgeOps
29{
30 const char* apiName;
31 const char* contextType;
32 const QLoggingCategory& (*cat)();
33 int qrhiBackend;
34 GstObject* (*createDevice)(const QLoggingCategory&);
35 GstContext* (*makeContext)(GstObject* device);
36};
37
40bool checkSnapshotBackend(BridgeState& state, const QLoggingCategory& cat, int expectedBackend,
41 const char* backendName);
42
44void logHandoff(BridgeState& state, const QLoggingCategory& cat, GstElement* element, const char* apiName);
45
47gint64 readAdapterLuid(gpointer device);
48
50void logAdapterMatch(gint64 expectedLuid, gpointer gstDevice, const QLoggingCategory& cat, const char* apiName);
51
53void registerBridge(const QLoggingCategory& cat, GstBusSyncReply (*handler)(GstMessage*), void (*reset)());
54
56bool prime(BridgeState& state, const BridgeOps& ops);
57
59GstObject* currentDevice(BridgeState& state);
60
62GstBusSyncReply handleSyncMessage(BridgeState& state, const BridgeOps& ops, GstMessage* message);
63
65bool answerContextQuery(BridgeState& state, const BridgeOps& ops, GstQuery* query);
66
68void reset(BridgeState& state, const BridgeOps& ops);
69
70} // namespace GstD3DContextBridgeCommon
71
72#endif // Q_OS_WIN && (QGC_HAS_GST_D3D11_GPU_PATH || QGC_HAS_GST_D3D12_GPU_PATH)
struct _GstElement GstElement