[gst-cvs] gstreamer: example: print step_done message and sync

Wim Taymans wtay at kemper.freedesktop.org
Mon Jun 1 04:41:53 PDT 2009


Module: gstreamer
Branch: master
Commit: 67752e5adb126319a6d26f402f7230c050f3239e
URL:    http://cgit.freedesktop.org/gstreamer/gstreamer/commit/?id=67752e5adb126319a6d26f402f7230c050f3239e

Author: Wim Taymans <wim.taymans at collabora.co.uk>
Date:   Fri May 15 12:02:02 2009 +0200

example: print step_done message and sync

Dump the step_done message contents.
Sync against the clock when going to PLAYING.

---

 tests/examples/stepping/framestep1.c |   26 +++++++++++++++++++++++---
 1 files changed, 23 insertions(+), 3 deletions(-)

diff --git a/tests/examples/stepping/framestep1.c b/tests/examples/stepping/framestep1.c
index 6bf7dba..ee98157 100644
--- a/tests/examples/stepping/framestep1.c
+++ b/tests/examples/stepping/framestep1.c
@@ -20,7 +20,8 @@ event_loop (GstElement * pipe)
         gst_message_unref (message);
         return;
       case GST_MESSAGE_WARNING:
-      case GST_MESSAGE_ERROR:{
+      case GST_MESSAGE_ERROR:
+      {
         GError *gerror;
         gchar *debug;
 
@@ -31,6 +32,22 @@ event_loop (GstElement * pipe)
         g_free (debug);
         return;
       }
+      case GST_MESSAGE_STEP_DONE:
+      {
+        GstFormat format;
+        guint64 amount;
+        gdouble rate;
+        guint64 duration;
+        gboolean intermediate;
+
+        gst_message_parse_step_done (message, &format, &amount, &rate,
+            &duration, &intermediate);
+
+        g_message ("step done: %" GST_TIME_FORMAT " skipped in %"
+            G_GUINT64_FORMAT " frames", GST_TIME_ARGS (duration), amount);
+
+        return;
+      }
       default:
         gst_message_unref (message);
         break;
@@ -72,7 +89,7 @@ main (int argc, char *argv[])
   appsink = gst_element_factory_make ("appsink", "appsink");
   g_assert (appsink);
   g_object_set (appsink, "emit-signals", TRUE, NULL);
-  g_object_set (appsink, "sync", FALSE, NULL);
+  g_object_set (appsink, "sync", TRUE, NULL);
   g_signal_connect (appsink, "new-preroll", (GCallback) new_preroll, NULL);
 
   /* add objects to the main pipeline */
@@ -92,7 +109,10 @@ main (int argc, char *argv[])
   g_assert (gst_element_send_event (bin,
           gst_event_new_step (GST_FORMAT_BUFFERS, 2, 1.0, TRUE, FALSE)));
 
-  /* wait for step to complete */
+  /* blocks and returns when we received the step done message */
+  event_loop (bin);
+
+  /* wait for step to really complete */
   gst_element_get_state (bin, NULL, NULL, -1);
 
   g_message ("stepped two frames");





More information about the Gstreamer-commits mailing list