[clutter-gst] video-texture: filter out non-changing state events



commit ee3c0d66cb7731d318375f5307fc46240f1f38f3
Author: Lionel Landwerlin <lionel g landwerlin linux intel com>
Date:   Sat Mar 26 23:02:30 2011 +0000

    video-texture: filter out non-changing state events
    
    Signed-off-by: Lionel Landwerlin <lionel g landwerlin linux intel com>

 clutter-gst/clutter-gst-video-texture.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/clutter-gst/clutter-gst-video-texture.c b/clutter-gst/clutter-gst-video-texture.c
index ec4ace0..cbc3111 100644
--- a/clutter-gst/clutter-gst-video-texture.c
+++ b/clutter-gst/clutter-gst-video-texture.c
@@ -123,6 +123,26 @@ G_DEFINE_TYPE_WITH_CODE (ClutterGstVideoTexture,
                          G_IMPLEMENT_INTERFACE (CLUTTER_TYPE_MEDIA,
                                                 clutter_media_init));
 
+static const gchar *
+gst_state_to_string (GstState state)
+{
+  switch (state)
+    {
+    case GST_STATE_VOID_PENDING:
+      return "pending";
+    case GST_STATE_NULL:
+      return "null";
+    case GST_STATE_READY:
+      return "ready";
+    case GST_STATE_PAUSED:
+      return "paused";
+    case GST_STATE_PLAYING:
+      return "playing";
+    }
+
+  return "Unknown state";
+}
+
 /* Clutter 1.4 has this symbol, we don't want to depend on 1.4 just for that
  * just yet */
 static void
@@ -1204,6 +1224,13 @@ bus_message_state_change_cb (GstBus                 *bus,
 
   gst_message_parse_state_changed (message, &old_state, &new_state, NULL);
 
+  CLUTTER_GST_NOTE (MEDIA, "state change:  %s -> %s",
+                    gst_state_to_string (old_state),
+                    gst_state_to_string (new_state));
+
+  if (old_state == new_state)
+    return;
+
   if (old_state == GST_STATE_READY &&
       new_state == GST_STATE_PAUSED)
     {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]