Commit aa59614b authored by Val Doroshchuk's avatar Val Doroshchuk

pipeline to pub

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