/* convenience macro so we don't have to litter the code with if(!quiet) */
#define PRINT if(!quiet)g_print
-#if !defined(GST_DISABLE_LOADSAVE) && !defined(GST_REMOVE_DEPRECATED)
-static GstElement *
-xmllaunch_parse_cmdline (const gchar ** argv)
-{
- GstElement *pipeline = NULL, *e;
- GstXML *xml;
- gboolean err;
- const gchar *arg;
- gchar *element, *property, *value;
- GList *l;
- gint i = 0;
-
- if (!(arg = argv[0])) {
- g_printerr ("%s",
- _("Usage: gst-xmllaunch <file.xml> [ element.property=value ... ]\n"));
- exit (1);
- }
-
- xml = gst_xml_new ();
- /* FIXME guchar from gstxml.c */
- err = gst_xml_parse_file (xml, (guchar *) arg, NULL);
-
- if (err != TRUE) {
- g_printerr (_("ERROR: parse of xml file '%s' failed.\n"), arg);
- exit (1);
- }
-
- l = gst_xml_get_topelements (xml);
- if (!l) {
- g_printerr (_("ERROR: no toplevel pipeline element in file '%s'.\n"), arg);
- exit (1);
- }
-
- if (l->next) {
- g_printerr ("%s",
- _("WARNING: only one toplevel element is supported at this time.\n"));
- }
-
- pipeline = GST_ELEMENT (l->data);
-
- while ((arg = argv[++i])) {
- element = g_strdup (arg);
- property = strchr (element, '.');
- value = strchr (element, '=');
-
- if (!(element < property && property < value)) {
- g_printerr (_("ERROR: could not parse command line argument %d: %s.\n"),
- i, element);
- g_free (element);
- exit (1);
- }
-
- *property++ = '\0';
- *value++ = '\0';
-
- e = gst_bin_get_by_name (GST_BIN (pipeline), element);
- if (!e) {
- g_printerr (_("WARNING: element named '%s' not found.\n"), element);
- } else {
- gst_util_set_object_arg (G_OBJECT (e), property, value);
- }
- g_free (element);
- }
-
- if (!l)
- return NULL;
-
- gst_object_ref (pipeline);
- gst_object_unref (xml);
- return pipeline;
-}
-#endif
-
#ifndef DISABLE_FAULT_HANDLER
#ifndef USE_SIGINFO
static void
}
#endif /* DISABLE_FAULT_HANDLER */
+#if 0
typedef struct _GstIndexStats
{
gint id;
}
}
}
+#endif
+
+/* Kids, use the functions from libgstpbutils in gst-plugins-base in your
+ * own code (we can't do that here because it would introduce a circular
+ * dependency) */
+static gboolean
+gst_is_missing_plugin_message (GstMessage * msg)
+{
+ if (GST_MESSAGE_TYPE (msg) != GST_MESSAGE_ELEMENT
+ || gst_message_get_structure (msg) == NULL)
+ return FALSE;
+
+ return gst_structure_has_name (gst_message_get_structure (msg),
+ "missing-plugin");
+}
+
+static const gchar *
+gst_missing_plugin_message_get_description (GstMessage * msg)
+{
+ return gst_structure_get_string (gst_message_get_structure (msg), "name");
+}
static void
print_error_message (GstMessage * msg)
if (img) {
gchar *caps_str;
- caps_str = GST_BUFFER_CAPS (img) ?
- gst_caps_to_string (GST_BUFFER_CAPS (img)) : g_strdup ("unknown");
- str = g_strdup_printf ("buffer of %u bytes, type: %s",
- GST_BUFFER_SIZE (img), caps_str);
+ caps_str = g_strdup ("unknown");
+ str = g_strdup_printf ("buffer of %" G_GSIZE_FORMAT " bytes, type: %s",
+ gst_buffer_get_size (img), caps_str);
g_free (caps_str);
} else {
str = g_strdup ("NULL buffer");
sigaction (SIGINT, &action, NULL);
}
-
-/* FIXME 0.11: remove SIGUSR handling (also from man page) */
-static void
-play_handler (int signum)
-{
- switch (signum) {
- case SIGUSR1:
- PRINT ("Caught SIGUSR1 - Play request.\n");
- gst_element_set_state (pipeline, GST_STATE_PLAYING);
- break;
- case SIGUSR2:
- PRINT ("Caught SIGUSR2 - Stop request.\n");
- gst_element_set_state (pipeline, GST_STATE_NULL);
- break;
- }
-}
-
-static void
-play_signal_setup (void)
-{
- struct sigaction action;
-
- memset (&action, 0, sizeof (action));
- action.sa_handler = play_handler;
- sigaction (SIGUSR1, &action, NULL);
- sigaction (SIGUSR2, &action, NULL);
-}
#endif /* DISABLE_FAULT_HANDLER */
/* returns ELR_ERROR if there was an error
res = ELR_INTERRUPT;
goto exit;
}
+ break;
+ }
+ case GST_MESSAGE_ELEMENT:{
+ if (gst_is_missing_plugin_message (message)) {
+ const gchar *desc;
+
+ desc = gst_missing_plugin_message_get_description (message);
+ PRINT (_("Missing element: %s\n"), desc ? desc : "(no description)");
+ }
+ break;
}
default:
/* just be quiet by default */
/* options */
gboolean verbose = FALSE;
gboolean no_fault = FALSE;
- gboolean no_sigusr_handler = FALSE;
gboolean trace = FALSE;
gboolean eos_on_shutdown = FALSE;
+#if 0
gboolean check_index = FALSE;
+#endif
gchar *savefile = NULL;
gchar *exclude_args = NULL;
#ifndef GST_DISABLE_OPTION_PARSING
N_("Output messages"), NULL},
{"exclude", 'X', 0, G_OPTION_ARG_NONE, &exclude_args,
N_("Do not output status information of TYPE"), N_("TYPE1,TYPE2,...")},
-#if !defined(GST_DISABLE_LOADSAVE) && !defined(GST_REMOVE_DEPRECATED)
- {"output", 'o', 0, G_OPTION_ARG_STRING, &savefile,
- N_("Save xml representation of pipeline to FILE and exit"), N_("FILE")},
-#endif
{"no-fault", 'f', 0, G_OPTION_ARG_NONE, &no_fault,
N_("Do not install a fault handler"), NULL},
- {"no-sigusr-handler", '\0', 0, G_OPTION_ARG_NONE, &no_sigusr_handler,
- N_("Do not install signal handlers for SIGUSR1 and SIGUSR2"), NULL},
{"trace", 'T', 0, G_OPTION_ARG_NONE, &trace,
N_("Print alloc trace (if enabled at compile time)"), NULL},
{"eos-on-shutdown", 'e', 0, G_OPTION_ARG_NONE, &eos_on_shutdown,
N_("Force EOS on sources before shutting the pipeline down"), NULL},
+#if 0
{"index", 'i', 0, G_OPTION_ARG_NONE, &check_index,
N_("Gather and print index statistics"), NULL},
+#endif
GST_TOOLS_GOPTION_VERSION,
{NULL}
};
GOptionContext *ctx;
GError *err = NULL;
#endif
+#if 0
GstIndex *index;
GPtrArray *index_stats = NULL;
+#endif
gchar **argvn;
GError *error = NULL;
gint res = 0;
textdomain (GETTEXT_PACKAGE);
#endif
+#if !GLIB_CHECK_VERSION (2, 31, 0)
g_thread_init (NULL);
+#endif
gst_tools_set_prgname ("gst-launch");
fault_setup ();
sigint_setup ();
-
- if (!no_sigusr_handler)
- play_signal_setup ();
#endif
if (trace) {
/* make a null-terminated version of argv */
argvn = g_new0 (char *, argc);
memcpy (argvn, argv + 1, sizeof (char *) * (argc - 1));
-#if !defined(GST_DISABLE_LOADSAVE) && !defined(GST_REMOVE_DEPRECATED)
- if (strstr (argv[0], "gst-xmllaunch")) {
- /* FIXME 0.11: remove xmllaunch entirely */
- g_warning ("gst-xmllaunch is deprecated and broken for all but the most "
- "simple pipelines. It will most likely be removed in future. Don't "
- "use it.\n");
- pipeline = xmllaunch_parse_cmdline ((const gchar **) argvn);
- } else
-#endif
{
pipeline =
(GstElement *) gst_parse_launchv ((const gchar **) argvn, &error);
g_signal_connect (pipeline, "deep-notify",
G_CALLBACK (gst_object_default_deep_notify), exclude_list);
}
-#if !defined(GST_DISABLE_LOADSAVE) && !defined(GST_REMOVE_DEPRECATED)
- if (savefile) {
- g_warning ("Pipeline serialization to XML is deprecated and broken for "
- "all but the most simple pipelines. It will most likely be removed "
- "in future. Don't use it.\n");
-
- gst_xml_write_file (GST_ELEMENT (pipeline), fopen (savefile, "w"));
- }
-#endif
if (!savefile) {
GstState state, pending;
gst_bin_add (GST_BIN (real_pipeline), pipeline);
pipeline = real_pipeline;
}
-
+#if 0
if (check_index) {
/* gst_index_new() creates a null-index, it does not store anything, but
* the entry-added signal works and this is what we use to build the
gst_element_set_index (pipeline, index);
}
}
+#endif
bus = gst_element_get_bus (pipeline);
gst_bus_set_sync_handler (bus, bus_sync_handler, (gpointer) pipeline);
gst_element_set_state (pipeline, GST_STATE_READY);
gst_element_get_state (pipeline, &state, &pending, GST_CLOCK_TIME_NONE);
+#if 0
if (check_index) {
print_index_stats (index_stats);
g_ptr_array_free (index_stats, TRUE);
}
+#endif
end:
PRINT (_("Setting pipeline to NULL ...\n"));