Totally dump messages in -launch with the -m option.

Original commit message from CVS:
* gst/gstmessage.c: (gst_message_new_state_changed):
* tools/gst-launch.c: (event_loop), (main):
Totally dump messages in -launch with the -m option.
Fix message name for State messages,
This commit is contained in:
Wim Taymans 2005-07-15 10:30:49 +00:00
parent 40a158fa44
commit a8d8310819
3 changed files with 26 additions and 5 deletions

View file

@ -1,3 +1,10 @@
2005-07-15 Wim Taymans <wim@fluendo.com>
* gst/gstmessage.c: (gst_message_new_state_changed):
* tools/gst-launch.c: (event_loop), (main):
Totally dump messages in -launch with the -m option.
Fix message name for State messages,
2005-07-14 Wim Taymans <wim@fluendo.com>
* gst/base/gstbasesrc.c: (gst_base_src_loop):

View file

@ -305,7 +305,7 @@ gst_message_new_state_changed (GstObject * src, GstElementState old,
message = gst_message_new (GST_MESSAGE_STATE_CHANGED, src);
s = gst_structure_new ("GstMessageError", "old-state", G_TYPE_INT, (gint) old,
s = gst_structure_new ("GstMessageState", "old-state", G_TYPE_INT, (gint) old,
"new-state", G_TYPE_INT, (gint) new, NULL);
gst_structure_set_parent_refcount (s, &message->mini_object.refcount);
message->structure = s;

View file

@ -60,9 +60,10 @@ static void sigint_restore (void);
static gint max_iterations = 0;
static GstElement *pipeline;
gboolean caught_intr = FALSE;
gboolean caught_error = FALSE;
gboolean tags = FALSE;
static gboolean caught_intr = FALSE;
static gboolean caught_error = FALSE;
static gboolean tags = FALSE;
static gboolean messages = FALSE;
#ifndef GST_DISABLE_LOADSAVE
@ -374,10 +375,21 @@ event_loop (GstElement * pipeline, gboolean blocking)
message = gst_bus_pop (bus);
g_return_val_if_fail (message != NULL, TRUE);
if (messages) {
gchar *sstr;
const GstStructure *s;
s = gst_message_get_structure (message);
sstr = gst_structure_to_string (s);
g_print (_("Got Message from element \"%s\": %s\n"),
GST_STR_NULL (GST_ELEMENT_NAME (GST_MESSAGE_SRC (message))), sstr);
g_free (sstr);
}
switch (revent) {
case GST_MESSAGE_EOS:
g_print (_
("GOT EOS from element \"%s\".\n"),
("Got EOS from element \"%s\".\n"),
GST_STR_NULL (GST_ELEMENT_NAME (GST_MESSAGE_SRC (message))));
gst_message_unref (message);
gst_object_unref (bus);
@ -465,6 +477,8 @@ main (int argc, char *argv[])
struct poptOption options[] = {
{"tags", 't', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &tags, 0,
N_("Output tags (also known as metadata)"), NULL},
{"messages", 'm', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &messages, 0,
N_("Output messages"), NULL},
{"verbose", 'v', POPT_ARG_NONE | POPT_ARGFLAG_STRIP, &verbose, 0,
N_("Output status information and property notifications"), NULL},
{"exclude", 'X', POPT_ARG_STRING | POPT_ARGFLAG_STRIP, &exclude_args, 0,