From 4909c6489daff87f8831c97a81050162477afca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Dr=C3=B6ge?= Date: Mon, 24 Sep 2012 11:29:39 +0200 Subject: [PATCH] Catch DURATION message and query new duration on the next UI refresh This makes sure we always show the latest, real duration. Might help with OGV streaming. --- gst-sdk/tutorials/android-tutorial-1/jni/tutorial-1.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gst-sdk/tutorials/android-tutorial-1/jni/tutorial-1.c b/gst-sdk/tutorials/android-tutorial-1/jni/tutorial-1.c index e8937ec30e..9c992e41ae 100755 --- a/gst-sdk/tutorials/android-tutorial-1/jni/tutorial-1.c +++ b/gst-sdk/tutorials/android-tutorial-1/jni/tutorial-1.c @@ -151,6 +151,10 @@ static void eos_cb (GstBus *bus, GstMessage *msg, CustomData *data) { execute_seek (0, data); } +static void duration_cb (GstBus *bus, GstMessage *msg, CustomData *data) { + data->duration = GST_CLOCK_TIME_NONE; +} + static void state_changed_cb (GstBus *bus, GstMessage *msg, CustomData *data) { JNIEnv *env = get_jni_env (); GstState old_state, new_state, pending_state; @@ -222,6 +226,7 @@ static void *app_function (void *userdata) { g_signal_connect (G_OBJECT (bus), "message::error", (GCallback)error_cb, data); g_signal_connect (G_OBJECT (bus), "message::eos", (GCallback)eos_cb, data); g_signal_connect (G_OBJECT (bus), "message::state-changed", (GCallback)state_changed_cb, data); + g_signal_connect (G_OBJECT (bus), "message::duration", (GCallback)duration_cb, data); gst_object_unref (bus); /* Register a function that GLib will call 4 times per second */