summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorMauricio Piacentini <mauricio.piacentini@collabora.co.uk>2010-10-13 16:49:28 -0300
committerMauricio Piacentini <mauricio.piacentini@collabora.co.uk>2010-10-18 11:05:06 -0200
commit7a45e53e7b319cb6f985a8aa536ec67ded334a57 (patch)
treeb9eb77e2b4acaf85ee703403743d2930d7e888e4 /examples
parent213b6da6d3d97bf2949dc6379a1076c0fbbd5219 (diff)
GstQuery implementation and tests
Diffstat (limited to 'examples')
-rw-r--r--examples/player/main.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/examples/player/main.cpp b/examples/player/main.cpp
index 2bebe52..522dd90 100644
--- a/examples/player/main.cpp
+++ b/examples/player/main.cpp
@@ -26,6 +26,7 @@
#include <QGst/Structure>
#include <QGst/Bus>
#include <QGst/Message>
+#include <QGst/Query>
/* This is a simple example of a command-line audio player. It accepts the filename of
* an audio file as the first command line argument and then constructs a pipeline
@@ -94,6 +95,16 @@ void Player::onBusSyncMessage(const QGst::MessagePtr & message)
* in the main thread has reached the event loop. */
QCoreApplication::quit();
break;
+ case QGst::MessageAsyncDone:
+ {
+ //File prerolled, queries the pipeline to get the file duration
+ QGst::DurationQueryPtr query = QGst::DurationQuery::create(QGst::FormatTime);
+ //This will create a temporary (cast to query).
+ m_pipeline->query(query);
+
+ qDebug() << query->duration();
+ }
+ break;
default:
break;
}