예제 #1
0
QTime Player::length() const
{
    if (m_pipeline) {
        //here we query the pipeline about the content's duration
        //and we request that the result is returned in time format
        QGst::DurationQueryPtr query = QGst::DurationQuery::create(QGst::FormatTime);
        m_pipeline->query(query);
        return QGst::ClockTime(query->duration()).toTime();
    } else {
        return QTime();
    }
}
예제 #2
0
QTime GStreamerPipeline::getLenght()
{
    QGst::DurationQueryPtr quary = QGst::DurationQuery::create( QGst::FormatTime );

    // We store the last known lenght in a member since sometimes the quary fails.
    // most noticable right after a seek.
    if( mPipeline->query(quary) ) {
        mLenght = QGst::ClockTime(quary->duration()).toTime();
    }
    else {
        //qDebug() << "Failed to quary duration of pipeline!";
    }
    return mLenght;
}
예제 #3
0
void QueryTest::durationTest()
{
    QGst::DurationQueryPtr query = QGst::DurationQuery::create(QGst::FormatTime);
    QVERIFY(query->type()==QGst::QueryDuration);
    QCOMPARE(query->typeName(), QString("duration"));
    QVERIFY(query->format()==QGst::FormatTime);

    query->setValues(QGst::FormatTime, 1234567);
    QVERIFY(query->format()==QGst::FormatTime);
    QCOMPARE(query->duration(), static_cast<qint64>(1234567));
}