From a29c066e150768ad65fcf63ce5445e7240b41067 Mon Sep 17 00:00:00 2001 From: Debarshi Ray Date: Wed, 10 Oct 2012 15:54:15 +0200 Subject: 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(-) (limited to 'src') diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index 831872032..d9e60e5bf 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 a66a05825..f26f33b49 100644 --- a/src/empathy-call-window.ui +++ b/src/empathy-call-window.ui @@ -70,6 +70,18 @@ _Debug + + + menudebuggst + _GStreamer + + + + + menudebugtp + _Telepathy + + gtk-about @@ -114,7 +126,10 @@ - + + + + diff --git a/src/empathy-call.c b/src/empathy-call.c index 5b50f9572..2d6aab0b1 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 */ -- cgit v1.2.3