]> git.0d.be Git - empathy.git/commitdiff
empathy-call: Add a debug option to dump the GStreamer pipeline
authorDebarshi Ray <debarshir@src.gnome.org>
Wed, 10 Oct 2012 13:54:15 +0000 (15:54 +0200)
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>
Fri, 12 Oct 2012 13:52:08 +0000 (15:52 +0200)
Fixes: https://bugzilla.gnome.org/685888
src/empathy-call-window.c
src/empathy-call-window.ui
src/empathy-call.c

index 83187203229349125e686a7425b7a159be0d2520..d9e60e5bff85f78cad221582f32e9cf440835754 100644 (file)
@@ -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,
index a66a05825fa0954bbc3763f92b378bdfb47b11b4..f26f33b49312fb16a040c726746ee1acbc149970 100644 (file)
             <property name="label" translatable="yes">_Debug</property>
           </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>
         </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>
index 5b50f9572998cb3c49387b18db22b6ce6e5034d0..2d6aab0b183f2460c29df423410f18c04cb425b7 100644 (file)
@@ -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 */