static gboolean messages = FALSE;
static gboolean is_live = FALSE;
static gboolean waiting_eos = FALSE;
+static gchar **exclude_args = NULL;
/* convenience macro so we don't have to litter the code with if(!quiet) */
-#define PRINT if(!quiet)g_print
+#define PRINT if(!quiet)gst_print
#ifdef G_OS_UNIX
static void
name = gst_object_get_path_string (msg->src);
gst_message_parse_error (msg, &err, &debug);
- g_printerr (_("ERROR: from element %s: %s\n"), name, err->message);
+ gst_printerr (_("ERROR: from element %s: %s\n"), name, err->message);
if (debug != NULL)
- g_printerr (_("Additional debug info:\n%s\n"), debug);
+ gst_printerr (_("Additional debug info:\n%s\n"), debug);
g_clear_error (&err);
g_free (debug);
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
"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
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))
gst_context_unref (context);
break;
}
+ case GST_MESSAGE_PROPERTY_NOTIFY:{
+ const GValue *val;
+ const gchar *name;
+ GstObject *obj;
+ gchar *val_str = NULL;
+ gchar **ex_prop, *obj_name;
+
+ if (quiet)
+ break;
+
+ gst_message_parse_property_notify (message, &obj, &name, &val);
+
+ /* Let's not print anything for excluded properties... */
+ ex_prop = exclude_args;
+ while (ex_prop != NULL && *ex_prop != NULL) {
+ if (strcmp (name, *ex_prop) == 0)
+ break;
+ ex_prop++;
+ }
+ if (ex_prop != NULL && *ex_prop != NULL)
+ break;
+
+ obj_name = gst_object_get_path_string (GST_OBJECT (obj));
+ if (val != NULL) {
+ if (G_VALUE_HOLDS_STRING (val))
+ val_str = g_value_dup_string (val);
+ else if (G_VALUE_TYPE (val) == GST_TYPE_CAPS)
+ 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 {
+ val_str = g_strdup ("(no value)");
+ }
+
+ g_print ("%s: %s = %s\n", obj_name, name, val_str);
+ g_free (obj_name);
+ g_free (val_str);
+ break;
+ }
default:
/* just be quiet by default */
break;
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);
gboolean check_index = FALSE;
#endif
gchar *savefile = NULL;
- gchar **exclude_args = NULL;
#ifndef GST_DISABLE_OPTION_PARSING
GOptionEntry options[] = {
{"tags", 't', 0, G_OPTION_ARG_NONE, &tags,
#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");
g_option_context_add_group (ctx, gst_init_get_option_group ());
if (!g_option_context_parse (ctx, &argc, &argv, &err)) {
if (err)
- g_printerr ("Error initializing: %s\n", GST_STR_NULL (err->message));
+ gst_printerr ("Error initializing: %s\n", GST_STR_NULL (err->message));
else
- g_printerr ("Error initializing: Unknown error!\n");
- g_clear_error (&error);
+ gst_printerr ("Error initializing: Unknown error!\n");
+ g_clear_error (&err);
g_option_context_free (ctx);
exit (1);
}
if (!pipeline) {
if (error) {
- g_printerr (_("ERROR: pipeline could not be constructed: %s.\n"),
+ gst_printerr (_("ERROR: pipeline could not be constructed: %s.\n"),
GST_STR_NULL (error->message));
g_clear_error (&error);
} else {
- g_printerr (_("ERROR: pipeline could not be constructed.\n"));
+ gst_printerr (_("ERROR: pipeline could not be constructed.\n"));
}
return 1;
} else if (error) {
- g_printerr (_("WARNING: erroneous pipeline: %s\n"),
+ gst_printerr (_("WARNING: erroneous pipeline: %s\n"),
GST_STR_NULL (error->message));
g_clear_error (&error);
return 1;
GstElement *real_pipeline = gst_element_factory_make ("pipeline", NULL);
if (real_pipeline == NULL) {
- g_printerr (_("ERROR: the 'pipeline' element wasn't found.\n"));
+ gst_printerr (_("ERROR: the 'pipeline' element wasn't found.\n"));
return 1;
}
gst_bin_add (GST_BIN (real_pipeline), pipeline);
pipeline = real_pipeline;
}
if (verbose) {
- deep_notify_id = g_signal_connect (pipeline, "deep-notify",
- G_CALLBACK (gst_object_default_deep_notify), exclude_args);
+ deep_notify_id =
+ gst_element_add_property_deep_notify_watch (pipeline, NULL, TRUE);
}
#if 0
if (check_index) {
switch (ret) {
case GST_STATE_CHANGE_FAILURE:
- g_printerr (_("ERROR: Pipeline doesn't want to pause.\n"));
+ gst_printerr (_("ERROR: Pipeline doesn't want to pause.\n"));
res = -1;
event_loop (pipeline, FALSE, FALSE, GST_STATE_VOID_PENDING);
goto end;
PRINT (_("Pipeline is PREROLLING ...\n"));
caught_error = event_loop (pipeline, TRUE, TRUE, GST_STATE_PAUSED);
if (caught_error) {
- g_printerr (_("ERROR: pipeline doesn't want to preroll.\n"));
+ gst_printerr (_("ERROR: pipeline doesn't want to preroll.\n"));
res = caught_error;
goto end;
}
caught_error = event_loop (pipeline, FALSE, TRUE, GST_STATE_PLAYING);
if (caught_error) {
- g_printerr (_("ERROR: pipeline doesn't want to preroll.\n"));
+ gst_printerr (_("ERROR: pipeline doesn't want to preroll.\n"));
res = caught_error;
} else {
GstClockTime tfthen, tfnow;
GstMessage *err_msg;
GstBus *bus;
- g_printerr (_("ERROR: pipeline doesn't want to play.\n"));
+ gst_printerr (_("ERROR: pipeline doesn't want to play.\n"));
bus = gst_element_get_bus (pipeline);
if ((err_msg = gst_bus_poll (bus, GST_MESSAGE_ERROR, 0))) {
print_error_message (err_msg);
tfthen = gst_util_get_timestamp ();
caught_error = event_loop (pipeline, TRUE, FALSE, GST_STATE_PLAYING);
+ res = caught_error;
if (eos_on_shutdown && caught_error != ELR_NO_ERROR) {
gboolean ignore_errors;
gst_element_set_state (pipeline, GST_STATE_READY);
gst_element_get_state (pipeline, &state, &pending, GST_CLOCK_TIME_NONE);
- res = caught_error;
-
#if 0
if (check_index) {
print_index_stats (index_stats);