summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDebarshi Ray <debarshir@src.gnome.org>2012-10-10 15:54:15 +0200
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2012-10-12 15:52:08 +0200
commita29c066e150768ad65fcf63ce5445e7240b41067 (patch)
tree733f1d41b6374e7bf9bedad53222e47fb2e0b7a9 /src
parent956b705f5a34bbdc58aa65891ccf671722c70163 (diff)
downloadempathy-a29c066e150768ad65fcf63ce5445e7240b41067.tar.gz
empathy-call: Add a debug option to dump the GStreamer pipeline
Fixes: https://bugzilla.gnome.org/685888
Diffstat (limited to 'src')
-rw-r--r--src/empathy-call-window.c63
-rw-r--r--src/empathy-call-window.ui17
-rw-r--r--src/empathy-call.c2
3 files changed, 79 insertions, 3 deletions
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
@@ -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 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 */