X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=tools%2Fgst-launch.c;h=f19b0dc50a862e15d317e55dee991d6eb311c11a;hb=ffc85bf7f6e72f3758f833e552677afb568c8ec4;hp=006eeae90f4b123c9c355575f270760b4e2472c3;hpb=a837ff6581ba16180e89352a753296cd74a85a72;p=platform%2Fupstream%2Fgstreamer.git diff --git a/tools/gst-launch.c b/tools/gst-launch.c index 006eeae..f19b0dc 100644 --- a/tools/gst-launch.c +++ b/tools/gst-launch.c @@ -466,8 +466,11 @@ print_toc_entry (gpointer data, gpointer user_data) g_list_foreach (subentries, print_toc_entry, GUINT_TO_POINTER (indent)); } +#ifdef G_OS_UNIX +static guint signal_watch_hup_id; +#endif #if defined(G_OS_UNIX) || defined(G_OS_WIN32) -static guint signal_watch_id; +static guint signal_watch_intr_id; #if defined(G_OS_WIN32) static GstElement *intr_pipeline; #endif @@ -490,10 +493,31 @@ intr_handler (gpointer user_data) "message", G_TYPE_STRING, "Pipeline interrupted", NULL))); /* remove signal handler */ - signal_watch_id = 0; - return FALSE; + signal_watch_intr_id = 0; + return G_SOURCE_REMOVE; } +#ifdef G_OS_UNIX +static gboolean +hup_handler (gpointer user_data) +{ + GstElement *pipeline = (GstElement *) user_data; + + if (g_getenv ("GST_DEBUG_DUMP_DOT_DIR") != NULL) { + PRINT ("SIGHUP: dumping dot file snapshot ...\n"); + } else { + PRINT ("SIGHUP: not dumping dot file snapshot, GST_DEBUG_DUMP_DOT_DIR " + "environment variable not set.\n"); + } + + /* dump graph on hup */ + GST_DEBUG_BIN_TO_DOT_FILE_WITH_TS (GST_BIN (pipeline), + GST_DEBUG_GRAPH_SHOW_ALL, "gst-launch.snapshot"); + + return G_SOURCE_CONTINUE; +} +#endif + #if defined(G_OS_WIN32) /* G_OS_UNIX */ static BOOL WINAPI w32_intr_handler (DWORD dwCtrlType) @@ -521,8 +545,10 @@ event_loop (GstElement * pipeline, gboolean blocking, gboolean do_progress, bus = gst_element_get_bus (GST_ELEMENT (pipeline)); #ifdef G_OS_UNIX - signal_watch_id = + signal_watch_intr_id = g_unix_signal_add (SIGINT, (GSourceFunc) intr_handler, pipeline); + signal_watch_hup_id = + g_unix_signal_add (SIGHUP, (GSourceFunc) hup_handler, pipeline); #elif defined(G_OS_WIN32) intr_pipeline = NULL; if (SetConsoleCtrlHandler (w32_intr_handler, TRUE)) @@ -865,6 +891,8 @@ event_loop (GstElement * pipeline, gboolean blocking, gboolean do_progress, val_str = gst_caps_to_string (g_value_get_boxed (val)); else if (G_VALUE_TYPE (val) == GST_TYPE_TAG_LIST) val_str = gst_tag_list_to_string (g_value_get_boxed (val)); + else if (G_VALUE_TYPE (val) == GST_TYPE_STRUCTURE) + val_str = gst_structure_to_string (g_value_get_boxed (val)); else val_str = gst_value_serialize (val); } else { @@ -891,8 +919,10 @@ exit: gst_message_unref (message); gst_object_unref (bus); #ifdef G_OS_UNIX - if (signal_watch_id > 0) - g_source_remove (signal_watch_id); + if (signal_watch_intr_id > 0) + g_source_remove (signal_watch_intr_id); + if (signal_watch_hup_id > 0) + g_source_remove (signal_watch_hup_id); #elif defined(G_OS_WIN32) intr_pipeline = NULL; SetConsoleCtrlHandler (w32_intr_handler, FALSE); @@ -1005,6 +1035,8 @@ main (int argc, char *argv[]) #endif g_set_prgname ("gst-launch-" GST_API_VERSION); + /* Ensure XInitThreads() is called if/when needed */ + g_setenv ("GST_GL_XINITTHREADS", "1", TRUE); #ifndef GST_DISABLE_OPTION_PARSING ctx = g_option_context_new ("PIPELINE-DESCRIPTION");