summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@collabora.co.uk>2009-03-23 16:59:36 +0100
committerWim Taymans <wim.taymans@collabora.co.uk>2009-03-23 16:59:36 +0100
commit20d0351b76c71a3642ee72180515c431e32a20e3 (patch)
treef57733bef677f6df7ed7e8d7193505fe22da7357
parentd8003bea0637c59ac82aab7364f04a394299dd5b (diff)
tests: print some more info in the text example
Print both the position and the running_time when the subtitle becomes available in the application.
-rw-r--r--tests/icles/playbin-text.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/tests/icles/playbin-text.c b/tests/icles/playbin-text.c
index 63f9fa854..a98680482 100644
--- a/tests/icles/playbin-text.c
+++ b/tests/icles/playbin-text.c
@@ -95,8 +95,24 @@ have_subtitle (GstElement * appsink, App * app)
if (buffer) {
guint8 *data;
guint size;
+ GstFormat format;
+ gint64 position;
+ GstClock *clock;
+ GstClockTime base_time, running_time;
- g_message ("received a subtitle");
+ format = GST_FORMAT_TIME;
+ gst_element_query_position (appsink, &format, &position);
+
+ clock = gst_element_get_clock (appsink);
+ base_time = gst_element_get_base_time (appsink);
+
+ running_time = gst_clock_get_time (clock) - base_time;
+
+ gst_object_unref (clock);
+
+ g_message ("received a subtitle at position %" GST_TIME_FORMAT
+ ", running_time %" GST_TIME_FORMAT, GST_TIME_ARGS (position),
+ GST_TIME_ARGS (running_time));
data = GST_BUFFER_DATA (buffer);
size = GST_BUFFER_SIZE (buffer);
@@ -127,6 +143,7 @@ main (int argc, char *argv[])
/* set appsink to get the subtitles */
app->textsink = gst_element_factory_make ("appsink", "subtitle_sink");
g_object_set (G_OBJECT (app->textsink), "emit-signals", TRUE, NULL);
+ g_object_set (G_OBJECT (app->textsink), "ts-offset", 0 * GST_SECOND, NULL);
g_signal_connect (app->textsink, "new-buffer", G_CALLBACK (have_subtitle),
app);