qgstreamermediaplayer.h 5.25 KB
Newer Older
Val Doroshchuk's avatar
Init  
Val Doroshchuk committed
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
/****************************************************************************
**
** Copyright (C) 2018 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 3 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL3 included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 3 requirements
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 2.0 or (at your option) the GNU General
** Public license version 3 or any later version approved by the KDE Free
** Qt Foundation. The licenses are as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
** https://www.gnu.org/licenses/gpl-3.0.html.
**
** $QT_END_LICENSE$
**
****************************************************************************/

40 41
#ifndef QGSTREAMERMEDIAPLAYER_H
#define QGSTREAMERMEDIAPLAYER_H
Val Doroshchuk's avatar
Init  
Val Doroshchuk committed
42

43 44 45
#include <QObject>
#include <QVariantMap>
#include <QtMultimedia/qtmultimediaglobal.h>
46
#include <QUrl>
Val Doroshchuk's avatar
Init  
Val Doroshchuk committed
47 48 49

QT_BEGIN_NAMESPACE

50 51 52
class QMediaObject;
class QGstreamerMediaPlayerPrivate;
class Q_MULTIMEDIA_EXPORT QGstreamerMediaPlayer : public QObject
Val Doroshchuk's avatar
Init  
Val Doroshchuk committed
53 54
{
    Q_OBJECT
55 56 57 58
    Q_PROPERTY(QObject* source READ source WRITE setSource NOTIFY sourceChanged)
    Q_PROPERTY(QMediaObject* mediaObject READ mediaObject NOTIFY mediaObjectChanged SCRIPTABLE false DESIGNABLE false)
    Q_PROPERTY(QString pipeline READ pipeline WRITE setPipeline NOTIFY pipelineChanged)
    Q_PROPERTY(QString videoSink READ videoSink WRITE setVideoSink NOTIFY videoSinkChanged)
Val Doroshchuk's avatar
Init  
Val Doroshchuk committed
59 60 61 62 63 64 65 66 67 68 69
    Q_PROPERTY(bool showText READ showText WRITE setShowText NOTIFY showTextChanged)
    Q_PROPERTY(QUrl textUri READ textUri WRITE setTextUri NOTIFY textUriChanged)
    Q_PROPERTY(QString textFont READ textFont WRITE setTextFont NOTIFY textFontChanged)
    Q_PROPERTY(int audioStreamsCount READ audioStreamsCount NOTIFY audioStreamsCountChanged)
    Q_PROPERTY(int audioStream READ audioStream WRITE setAudioStream NOTIFY audioStreamChanged)
    Q_PROPERTY(int videoStreamsCount READ videoStreamsCount NOTIFY videoStreamsCountChanged)
    Q_PROPERTY(int videoStream READ videoStream WRITE setVideoStream NOTIFY videoStreamChanged)
    Q_PROPERTY(int textStreamsCount READ textStreamsCount NOTIFY textStreamsCountChanged)
    Q_PROPERTY(int textStream READ textStream WRITE setTextStream NOTIFY textStreamChanged)

public:
70 71
    QGstreamerMediaPlayer(QMediaObject *player, QObject *parent = nullptr);
    QGstreamerMediaPlayer(QObject *parent = nullptr);
Val Doroshchuk's avatar
Val Doroshchuk committed
72
    ~QGstreamerMediaPlayer();
73 74 75 76 77 78 79 80 81 82 83 84

    QObject *source() const;
    void setSource(QObject *source);

    QMediaObject *mediaObject() const;
    void setMediaObject(QMediaObject *source);

    QString pipeline() const;
    void setPipeline(const QString &name);

    QString videoSink() const;
    void setVideoSink(const QString &name);
Val Doroshchuk's avatar
Init  
Val Doroshchuk committed
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109

    bool showText() const;
    void setShowText(bool show);

    QUrl textUri() const;
    void setTextUri(const QUrl &url);

    QString textFont() const;
    void setTextFont(const QString &str);

    int audioStreamsCount() const;
    int audioStream() const;
    void setAudioStream(int i);
    Q_INVOKABLE QVariantMap audioStreamProperties(int i);

    int videoStreamsCount() const;
    int videoStream() const;
    void setVideoStream(int i);
    Q_INVOKABLE QVariantMap videoStreamProperties(int i);

    int textStreamsCount() const;
    int textStream() const;
    void setTextStream(int i);
    Q_INVOKABLE QVariantMap textStreamProperties(int i);

Val Doroshchuk's avatar
test  
Val Doroshchuk committed
110
    Q_INVOKABLE bool set(const QString &elementName, const QVariantMap& map);
111

Val Doroshchuk's avatar
Init  
Val Doroshchuk committed
112
Q_SIGNALS:
113 114 115 116
    void sourceChanged();
    void mediaObjectChanged();
    void pipelineChanged();
    void videoSinkChanged();
Val Doroshchuk's avatar
Init  
Val Doroshchuk committed
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
    void showTextChanged();
    void textUriChanged();
    void textFontChanged();

    void audioStreamsCountChanged();
    void audioStreamChanged();
    void audioStreamPropertiesChanged();

    void videoStreamsCountChanged();
    void videoStreamChanged();
    void videoStreamPropertiesChanged();

    void textStreamsCountChanged();
    void textStreamChanged();
    void textStreamPropertiesChanged();

private:
134 135 136 137
    Q_DISABLE_COPY(QGstreamerMediaPlayer)
    Q_DECLARE_PRIVATE(QGstreamerMediaPlayer)

    QGstreamerMediaPlayerPrivate *d_ptr = nullptr;
Val Doroshchuk's avatar
Init  
Val Doroshchuk committed
138 139 140 141
};

QT_END_NAMESPACE

142
#endif  // QGSTREAMERMEDIAPLAYER_H