blob: 60b8e0ea20e68a07bb8614e4d5e8468419b0df40 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#ifndef QQUICKSTREAMER_OBJECT_H
#define QQUICKSTREAMER_OBJECT_H
#include <QObject>
typedef struct _GParamSpec GParamSpec;
typedef struct _GstObject GstObject;
namespace QQuickStreamer {
class Object : public QObject
{
public:
Q_OBJECT_CHECK
template<class Wrapper, class Target>
friend Wrapper *wrap(Target *);
protected:
explicit Object(GstObject *target);
public:
~Object();
const QMetaObject *metaObject() const Q_DECL_OVERRIDE;
void *qt_metacast(const char *classname) Q_DECL_OVERRIDE;
int qt_metacall(QMetaObject::Call call, int id, void **args) Q_DECL_OVERRIDE;
protected:
int readProperty(int id, QVariant *value);
int writeProperty(int id, const QVariant &value);
static void emitPropertyChanged(Object *self, GParamSpec *pspec);
private:
GstObject *const m_target;
};
namespace Private {
void *findWrapper(void *object);
}
template<class Wrapper, class Target>
inline Wrapper *wrap(Target *target)
{
if (target == Q_NULLPTR)
return Q_NULLPTR;
Wrapper *wrapper = static_cast<Wrapper *>(Private::findWrapper(target));
if (wrapper == Q_NULLPTR)
wrapper = new Wrapper(target);
return wrapper;
}
} // namespace QQuickStreamer
#endif // QQUICKSTREAMEROBJECT_H
|