summaryrefslogtreecommitdiff
path: root/src/QuickStreamer/item.h
blob: 2a2830c748f0fd8aad35dd3867d6161ddfadce0f (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
61
62
63
64
65
66
67
68
69
70
// QtQuickStreamer, QML bindings for the GStreamer multimedia framework
// Copyright (C) 2013 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  US
//
// Author: Mathias Hasselmann <mathias@taschenorakel.de>
//
#ifndef QQUICKSTREAMER_ITEM_H
#define QQUICKSTREAMER_ITEM_H

#include <QObject>
#include <QQmlListProperty>
#include <QQmlParserStatus>

typedef unsigned long               GType;
typedef struct _GParamSpec          GParamSpec;
typedef struct _GstElementFactory   GstElementFactory;
typedef struct _GstObject           GstObject;

namespace QQuickStreamer {

class Item : public QObject, public QQmlParserStatus

{
public:
    Q_OBJECT_CHECK
    Q_INTERFACES(QQmlParserStatus)

    explicit Item(GstObject *target, QObject *parent = Q_NULLPTR);
    Item(const Item &other);

    ~Item();

    static bool registerElementFactory(const QByteArray &name);
    static bool registerElementFactory(GstElementFactory *factory);
    static bool registerObjectClass(GType type);

    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;

    void classBegin() Q_DECL_OVERRIDE;
    void componentComplete() Q_DECL_OVERRIDE;

    GstObject *target() const;

protected:
    static void emitPropertyChanged(Item *self, GParamSpec *pspec);

private:
    GstObject *const m_target;
};

} // namespace QQuickStreamer

Q_DECLARE_METATYPE(QQmlListProperty<QQuickStreamer::Item>)

#endif // QQUICKSTREAMER_ITEM_H