QTime GStreamerPipeline::getPosition()
{
    QGst::PositionQueryPtr quary = QGst::PositionQuery::create( QGst::FormatTime );
    if( mPipeline->query(quary) ) {
        mPosition = QGst::ClockTime(quary->position()).toTime();
    }
    else {
        //qDebug() << "Failed to quary position of pipeline!";
    }
    return mPosition;
}
Esempio n. 2
0
QTime Player::position() const
{
    if (m_pipeline) {
        //here we query the pipeline about its position
        //and we request that the result is returned in time format
        QGst::PositionQueryPtr query = QGst::PositionQuery::create(QGst::FormatTime);
        m_pipeline->query(query);
        return QGst::ClockTime(query->position()).toTime();
    } else {
        return QTime();
    }
}
Esempio n. 3
0
void GstExporter::progressPercent() {
  float result = -1;  // if not active

  if (m_pipeline) {
    QGst::PositionQueryPtr currentPosition =
        QGst::PositionQuery::create(QGst::FormatPercent);
    m_pipeline->query(currentPosition);
    qint64 currentPos = currentPosition->position();
    result = 1.0 * currentPos / 10000;
  }

  emit progressChanged(result);
  qDebug() << "Querying time, result: " << result << "%";

  return;
}
Esempio n. 4
0
void QueryTest::positionTest()
{
    QGst::PositionQueryPtr query = QGst::PositionQuery::create(QGst::FormatBytes);
    QVERIFY(query->type()==QGst::QueryPosition);
    QCOMPARE(query->typeName(), QString("position"));
    QVERIFY(query->format()==QGst::FormatBytes);

    query->setValues(QGst::FormatBytes, 1234567);
    QCOMPARE(query->position(), static_cast<qint64>(1234567));
}
Esempio n. 5
0
void QueryTest::baseTest()
{
    QGst::PositionQueryPtr query = QGst::PositionQuery::create(QGst::FormatBytes);
    QGst::StructureConstPtr ss = query->internalStructure();
    QVERIFY(ss->isValid());
}