[empathy] empathy-call: Add a debug option to dump the GStreamer pipeline



commit a29c066e150768ad65fcf63ce5445e7240b41067
Author: Debarshi Ray <debarshir src gnome org>
Date:   Wed Oct 10 15:54:15 2012 +0200

    empathy-call: Add a debug option to dump the GStreamer pipeline
    
    Fixes: https://bugzilla.gnome.org/685888

 src/empathy-call-window.c  |   63 ++++++++++++++++++++++++++++++++++++++++++-
 src/empathy-call-window.ui |   17 +++++++++++-
 src/empathy-call.c         |    2 +
 3 files changed, 79 insertions(+), 3 deletions(-)
---
diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c
index 8318720..d9e60e5 100644
--- a/src/empathy-call-window.c
+++ b/src/empathy-call-window.c
@@ -1364,7 +1364,65 @@ empathy_call_window_contents_cb (GtkAction *action,
 }
 
 static void
-empathy_call_window_debug_cb (GtkAction *action,
+show_png (GPid pid, gint status, gpointer user_data)
+{
+  gtk_show_uri (NULL, (gchar *) user_data, GDK_CURRENT_TIME, NULL);
+  g_spawn_close_pid (pid);
+  g_free (user_data);
+}
+
+static void
+empathy_call_window_debug_gst_cb (GtkAction *action,
+    EmpathyCallWindow *self)
+{
+  EmpathyCallWindowPriv *priv = GET_PRIV (self);
+  GDateTime *date_time;
+  GPid dot_pid;
+  const gchar *dot_dir;
+  const gchar *prgname;
+  gchar *dot_cmd;
+  gchar *filename;
+  gchar **argv;
+  gint argc;
+
+  if (priv->pipeline == NULL)
+    DEBUG ("No pipeline");
+
+  date_time = g_date_time_new_now_utc ();
+  prgname = g_get_prgname ();
+  filename = g_strdup_printf ("%s-%" G_GINT64_FORMAT, prgname,
+      g_date_time_to_unix (date_time));
+
+  gst_debug_bin_to_dot_file (GST_BIN (priv->pipeline),
+      GST_DEBUG_GRAPH_SHOW_ALL, filename);
+
+  dot_dir = g_getenv ("GST_DEBUG_DUMP_DOT_DIR");
+  dot_cmd = g_strdup_printf ("dot -Tpng -o %s.png %s.dot",
+      filename,
+      filename);
+  g_shell_parse_argv (dot_cmd, &argc, &argv, NULL);
+
+  if (g_spawn_async (dot_dir,
+          argv,
+          NULL,
+          G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH,
+          NULL,
+          NULL,
+          &dot_pid,
+          NULL))
+    {
+      gchar *uri = g_strdup_printf ("file://%s/%s.png", dot_dir, filename);
+      g_child_watch_add (dot_pid, show_png, uri);
+    }
+
+  g_strfreev (argv);
+  g_free (dot_cmd);
+  g_free (filename);
+  g_date_time_unref (date_time);
+}
+
+static void
+empathy_call_window_debug_tp_cb (GtkAction *action,
     EmpathyCallWindow *self)
 {
   empathy_launch_program (BIN_DIR, "empathy-debugger", "-s Empathy.Call");
@@ -1619,7 +1677,8 @@ empathy_call_window_init (EmpathyCallWindow *self)
     "menufullscreen", "activate", empathy_call_window_fullscreen_cb,
     "menusettings", "activate", empathy_call_window_settings_cb,
     "menucontents", "activate", empathy_call_window_contents_cb,
-    "menudebug", "activate", empathy_call_window_debug_cb,
+    "menudebuggst", "activate", empathy_call_window_debug_gst_cb,
+    "menudebugtp", "activate", empathy_call_window_debug_tp_cb,
     "menuabout", "activate", empathy_call_window_about_cb,
     "menupreviewdisable", "activate", empathy_call_window_disable_camera_cb,
     "menupreviewminimise", "activate", empathy_call_window_minimise_camera_cb,
diff --git a/src/empathy-call-window.ui b/src/empathy-call-window.ui
index a66a058..f26f33b 100644
--- a/src/empathy-call-window.ui
+++ b/src/empathy-call-window.ui
@@ -71,6 +71,18 @@
           </object>
         </child>
         <child>
+          <object class="GtkAction" id="menudebuggst">
+            <property name="name">menudebuggst</property>
+            <property name="label" translatable="yes">_GStreamer</property>
+          </object>
+        </child>
+        <child>
+          <object class="GtkAction" id="menudebugtp">
+            <property name="name">menudebugtp</property>
+            <property name="label" translatable="yes">_Telepathy</property>
+          </object>
+        </child>
+        <child>
           <object class="GtkAction" id="menuabout">
             <property name="stock_id">gtk-about</property>
             <property name="name">menuabout</property>
@@ -114,7 +126,10 @@
         </menu>
         <menu action="help">
           <menuitem name="menucontents" action="menucontents"/>
-          <menuitem name="menudebug" action="menudebug"/>
+          <menu name="menudebug" action="menudebug">
+            <menuitem action="menudebuggst"/>
+            <menuitem action="menudebugtp"/>
+          </menu>
           <menuitem name="menuabout" action="menuabout"/>
         </menu>
       </menubar>
diff --git a/src/empathy-call.c b/src/empathy-call.c
index 5b50f95..2d6aab0 100644
--- a/src/empathy-call.c
+++ b/src/empathy-call.c
@@ -184,6 +184,8 @@ main (int argc,
   gint retval;
   GtkSettings *gtk_settings;
 
+  g_setenv ("GST_DEBUG_DUMP_DOT_DIR", g_get_tmp_dir (), FALSE);
+
 #ifdef GDK_WINDOWING_X11
   /* We can't call clutter_gst_init() before gtk_clutter_init(), so no choice
    * but to intiialise X11 threading ourself */



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