Commit aa59614b authored by Val Doroshchuk's avatar Val Doroshchuk

pipeline to pub

parent 26a95b21
...@@ -49,11 +49,6 @@ QGstreamerVideoRendererInterface *QGstreamerPipelinePrivate::renderer() const ...@@ -49,11 +49,6 @@ QGstreamerVideoRendererInterface *QGstreamerPipelinePrivate::renderer() const
return session ? session->renderer() : nullptr; return session ? session->renderer() : nullptr;
} }
GstElement *QGstreamerPipelinePrivate::pipeline() const
{
return session ? session->pipeline() : nullptr;
}
QGstreamerPipeline::QGstreamerPipeline(QObject *parent) QGstreamerPipeline::QGstreamerPipeline(QObject *parent)
: QGstreamerPipeline(new QGstreamerPipelinePrivate(this), nullptr, parent) : QGstreamerPipeline(new QGstreamerPipelinePrivate(this), nullptr, parent)
{ {
...@@ -144,7 +139,7 @@ void QGstreamerPipeline::setMediaPlayer(QMediaPlayer *src) ...@@ -144,7 +139,7 @@ void QGstreamerPipeline::setMediaPlayer(QMediaPlayer *src)
setPipeline(d->pendingPipelineDesc); setPipeline(d->pendingPipelineDesc);
} }
QString QGstreamerPipeline::pipeline() const QString QGstreamerPipeline::pipelineDesc() const
{ {
return d_func()->pipelineDesc; return d_func()->pipelineDesc;
} }
...@@ -167,6 +162,11 @@ void QGstreamerPipeline::setPipeline(const QString &desc) ...@@ -167,6 +162,11 @@ void QGstreamerPipeline::setPipeline(const QString &desc)
d->pendingPipelineDesc.clear(); d->pendingPipelineDesc.clear();
} }
GstElement *QGstreamerPipeline::pipeline() const
{
return d_ptr->session ? d_ptr->session->pipeline() : nullptr;
}
template <class T> template <class T>
static void setGstProperty(GstElement *element, const QString &name, T v) static void setGstProperty(GstElement *element, const QString &name, T v)
{ {
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
#include <QtMultimedia/qtmultimediaglobal.h> #include <QtMultimedia/qtmultimediaglobal.h>
#include <QVariantMap> #include <QVariantMap>
#include <QUrl> #include <QUrl>
#include <gst/gst.h>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
...@@ -53,7 +54,7 @@ class Q_MULTIMEDIA_EXPORT QGstreamerPipeline : public QObject ...@@ -53,7 +54,7 @@ class Q_MULTIMEDIA_EXPORT QGstreamerPipeline : public QObject
Q_OBJECT Q_OBJECT
Q_PROPERTY(QObject* source READ source WRITE setSource NOTIFY sourceChanged) Q_PROPERTY(QObject* source READ source WRITE setSource NOTIFY sourceChanged)
Q_PROPERTY(QMediaPlayer* mediaPlayer READ mediaPlayer NOTIFY mediaPlayerChanged SCRIPTABLE false DESIGNABLE false) Q_PROPERTY(QMediaPlayer* mediaPlayer READ mediaPlayer NOTIFY mediaPlayerChanged SCRIPTABLE false DESIGNABLE false)
Q_PROPERTY(QString pipeline READ pipeline WRITE setPipeline NOTIFY pipelineChanged) Q_PROPERTY(QString pipeline READ pipelineDesc WRITE setPipeline NOTIFY pipelineChanged)
public: public:
QGstreamerPipeline(QObject *parent = nullptr); QGstreamerPipeline(QObject *parent = nullptr);
...@@ -66,8 +67,9 @@ public: ...@@ -66,8 +67,9 @@ public:
QMediaPlayer *mediaPlayer() const; QMediaPlayer *mediaPlayer() const;
void setMediaPlayer(QMediaPlayer *source); void setMediaPlayer(QMediaPlayer *source);
QString pipeline() const; QString pipelineDesc() const;
void setPipeline(const QString &desc); void setPipeline(const QString &desc);
GstElement *pipeline() const;
Q_INVOKABLE bool set(const QString &elementName, const QVariantMap &map); Q_INVOKABLE bool set(const QString &elementName, const QVariantMap &map);
......
...@@ -69,7 +69,6 @@ public: ...@@ -69,7 +69,6 @@ public:
bool isReady() const { return session; } bool isReady() const { return session; }
QGstreamerVideoRendererInterface *renderer() const; QGstreamerVideoRendererInterface *renderer() const;
GstElement *pipeline() const;
protected: protected:
QGstreamerPipeline *q_ptr = nullptr; QGstreamerPipeline *q_ptr = nullptr;
......
...@@ -174,7 +174,7 @@ void QGstreamerPlaybinPrivate::streamsChanged() ...@@ -174,7 +174,7 @@ void QGstreamerPlaybinPrivate::streamsChanged()
{ {
Q_Q(QGstreamerPlaybin); Q_Q(QGstreamerPlaybin);
GstElement *playbin = pipeline(); GstElement *playbin = q->pipeline();
if (!playbin) if (!playbin)
return; return;
...@@ -279,7 +279,7 @@ void QGstreamerPlaybin::setShowText(bool show) ...@@ -279,7 +279,7 @@ void QGstreamerPlaybin::setShowText(bool show)
Q_D(QGstreamerPlaybin); Q_D(QGstreamerPlaybin);
d->pendingShowText = show; d->pendingShowText = show;
GstElement *playbin = d->pipeline(); GstElement *playbin = pipeline();
if (!playbin || d->showText == show) if (!playbin || d->showText == show)
return; return;
...@@ -306,7 +306,7 @@ void QGstreamerPlaybin::setTextUri(const QUrl &uri) ...@@ -306,7 +306,7 @@ void QGstreamerPlaybin::setTextUri(const QUrl &uri)
Q_D(QGstreamerPlaybin); Q_D(QGstreamerPlaybin);
d->pendingTextUri = uri; d->pendingTextUri = uri;
GstElement *playbin = d->pipeline(); GstElement *playbin = pipeline();
if (!playbin || d->textUri == uri) if (!playbin || d->textUri == uri)
return; return;
...@@ -327,7 +327,7 @@ void QGstreamerPlaybin::setTextFont(const QString &str) ...@@ -327,7 +327,7 @@ void QGstreamerPlaybin::setTextFont(const QString &str)
Q_D(QGstreamerPlaybin); Q_D(QGstreamerPlaybin);
d->pendingTextFont = str; d->pendingTextFont = str;
GstElement *playbin = d->pipeline(); GstElement *playbin = pipeline();
if (!playbin || d->textFont == str) if (!playbin || d->textFont == str)
return; return;
...@@ -351,7 +351,7 @@ void QGstreamerPlaybin::setAudioStream(int i) ...@@ -351,7 +351,7 @@ void QGstreamerPlaybin::setAudioStream(int i)
Q_D(QGstreamerPlaybin); Q_D(QGstreamerPlaybin);
d->pendingAudioStream = i; d->pendingAudioStream = i;
GstElement *playbin = d->pipeline(); GstElement *playbin = pipeline();
if (!playbin || d->audioStream == i) if (!playbin || d->audioStream == i)
return; return;
...@@ -380,7 +380,7 @@ void QGstreamerPlaybin::setVideoStream(int i) ...@@ -380,7 +380,7 @@ void QGstreamerPlaybin::setVideoStream(int i)
Q_D(QGstreamerPlaybin); Q_D(QGstreamerPlaybin);
d->pendingVideoStream = i; d->pendingVideoStream = i;
GstElement *playbin = d->pipeline(); GstElement *playbin = pipeline();
if (!playbin || d->videoStream == i) if (!playbin || d->videoStream == i)
return; return;
...@@ -409,7 +409,7 @@ void QGstreamerPlaybin::setTextStream(int i) ...@@ -409,7 +409,7 @@ void QGstreamerPlaybin::setTextStream(int i)
Q_D(QGstreamerPlaybin); Q_D(QGstreamerPlaybin);
d->pendingTextStream = i; d->pendingTextStream = i;
GstElement *playbin = d->pipeline(); GstElement *playbin = pipeline();
if (!playbin || d->textStream == i) if (!playbin || d->textStream == i)
return; return;
......
...@@ -87,7 +87,8 @@ void tst_QGstreamerPipeline::testPipeline() ...@@ -87,7 +87,8 @@ void tst_QGstreamerPipeline::testPipeline()
p.setPipeline(pl); p.setPipeline(pl);
QTRY_COMPARE(spy.count(), 1); QTRY_COMPARE(spy.count(), 1);
QCOMPARE(mediaPlayer.error(), QMediaPlayer::NoError); QCOMPARE(mediaPlayer.error(), QMediaPlayer::NoError);
QCOMPARE(p.pipeline(), pl); QCOMPARE(p.pipelineDesc(), pl);
QVERIFY(p.pipeline());
} }
void tst_QGstreamerPipeline::testPipelineSurface() void tst_QGstreamerPipeline::testPipelineSurface()
...@@ -105,7 +106,8 @@ void tst_QGstreamerPipeline::testPipelineSurface() ...@@ -105,7 +106,8 @@ void tst_QGstreamerPipeline::testPipelineSurface()
QTRY_COMPARE(spy.count(), 1); QTRY_COMPARE(spy.count(), 1);
QCOMPARE(mediaPlayer.error(), QMediaPlayer::NoError); QCOMPARE(mediaPlayer.error(), QMediaPlayer::NoError);
QCOMPARE(p.pipeline(), pl); QCOMPARE(p.pipelineDesc(), pl);
QVERIFY(p.pipeline());
} }
void tst_QGstreamerPipeline::testPipelineWidget() void tst_QGstreamerPipeline::testPipelineWidget()
...@@ -123,7 +125,8 @@ void tst_QGstreamerPipeline::testPipelineWidget() ...@@ -123,7 +125,8 @@ void tst_QGstreamerPipeline::testPipelineWidget()
QTRY_COMPARE(spy.count(), 1); QTRY_COMPARE(spy.count(), 1);
QCOMPARE(mediaPlayer.error(), QMediaPlayer::NoError); QCOMPARE(mediaPlayer.error(), QMediaPlayer::NoError);
QCOMPARE(p.pipeline(), pl); QCOMPARE(p.pipelineDesc(), pl);
QVERIFY(p.pipeline());
} }
void tst_QGstreamerPipeline::testSetProperty() void tst_QGstreamerPipeline::testSetProperty()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment