QGroundControl
Ground Control Station for MAVLink Drones
Loading...
Searching...
No Matches
GstScoped.h
Go to the documentation of this file.
1#pragma once
2
3#include <gst/gst.h>
4#include <memory>
5
8namespace GStreamer {
9
11{
12 // gst_object_unref takes gpointer; the wrapper keeps the pointer types clean at call sites.
13 void operator()(gpointer obj) const noexcept { gst_object_unref(obj); }
14};
15
17{
18 void operator()(GstQuery* query) const noexcept { gst_query_unref(query); }
19};
20
21using GstObjectPtr = std::unique_ptr<GstObject, GstObjectDeleter>;
22using GstFactoryPtr = std::unique_ptr<GstElementFactory, GstObjectDeleter>;
23using GstFeaturePtr = std::unique_ptr<GstPluginFeature, GstObjectDeleter>;
24using GstQueryPtr = std::unique_ptr<GstQuery, GstQueryDeleter>;
25
26inline GstFactoryPtr adoptFactory(GstElementFactory* factory) noexcept
27{
28 return GstFactoryPtr(factory);
29}
30
31inline GstFeaturePtr adoptFeature(GstPluginFeature* feature) noexcept
32{
33 return GstFeaturePtr(feature);
34}
35
36inline GstQueryPtr adoptQuery(GstQuery* query) noexcept
37{
38 return GstQueryPtr(query);
39}
40
41} // namespace GStreamer
GstQueryPtr adoptQuery(GstQuery *query) noexcept
Definition GstScoped.h:36
std::unique_ptr< GstElementFactory, GstObjectDeleter > GstFactoryPtr
Definition GstScoped.h:22
GstFactoryPtr adoptFactory(GstElementFactory *factory) noexcept
Definition GstScoped.h:26
std::unique_ptr< GstObject, GstObjectDeleter > GstObjectPtr
Definition GstScoped.h:21
GstFeaturePtr adoptFeature(GstPluginFeature *feature) noexcept
Definition GstScoped.h:31
std::unique_ptr< GstPluginFeature, GstObjectDeleter > GstFeaturePtr
Definition GstScoped.h:23
std::unique_ptr< GstQuery, GstQueryDeleter > GstQueryPtr
Definition GstScoped.h:24
void operator()(gpointer obj) const noexcept
Definition GstScoped.h:13
void operator()(GstQuery *query) const noexcept
Definition GstScoped.h:18