QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
BranchContext.h
Go to the documentation of this file.
1#pragma once
2
3#include <functional>
4#include <gst/gst.h>
5
6#include <QtCore/QString>
7
8#include "GstScoped.h"
9
11class StreamWatchdog;
12
13namespace GStreamer {
14
22
23inline GQuark pipelineBranchQuark()
24{
25 static const GQuark quark = g_quark_from_static_string("qgc-pipeline-branch");
26 return quark;
27}
28
30inline void markBranch(GstElement* element, PipelineBranch branch)
31{
32 g_object_set_qdata(G_OBJECT(element), pipelineBranchQuark(), GINT_TO_POINTER(static_cast<int>(branch)));
33}
34
36inline PipelineBranch branchOf(GstObject* object)
37{
38 GstObjectPtr current = object ? adoptObject(GST_OBJECT(gst_object_ref(object))) : nullptr;
39 while (current) {
40 if (const gpointer mark = g_object_get_qdata(G_OBJECT(current.get()), pipelineBranchQuark())) {
41 return static_cast<PipelineBranch>(GPOINTER_TO_INT(mark));
42 }
43 current = adoptObject(gst_object_get_parent(current.get()));
44 }
46}
47
48} // namespace GStreamer
49
53{
54 GstElement* pipeline = nullptr;
55 GstElement* tee = nullptr;
57 QString redactedUri;
58 const PipelineDotDumper* dotDumper = nullptr;
61 std::function<void(std::function<void()>)> post;
62};
struct _GstElement GstElement
std::unique_ptr< GstObject, GstObjectDeleter > GstObjectPtr
Definition GstScoped.h:59
void markBranch(GstElement *element, PipelineBranch branch)
Marks element and everything inside it as part of branch.
PipelineBranch
The tee branch a pipeline element belongs to, so a bus message can be blamed on the part that failed.
@ None
The source, the tee, or the pipeline itself.
PipelineBranch branchOf(GstObject *object)
The branch of object's nearest marked ancestor (itself included). Thread-safe.
GstObjectPtr adoptObject(GstObject *object) noexcept
Definition GstScoped.h:74
GQuark pipelineBranchQuark()
StreamWatchdog * watchdog
GstElement * tee
GstElement * pipeline
const PipelineDotDumper * dotDumper
QString redactedUri
For logs: the stream's URI without credentials.
std::function< void(std::function< void()>)> post
Runs a task on the worker thread unless the session is gone by then.