From: Wim Taymans Date: Fri, 15 Jul 2005 10:30:49 +0000 (+0000) Subject: Totally dump messages in -launch with the -m option. X-Git-Tag: RELEASE-0_9_2~238 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a8d831081946cf2d6f02aef953a07f638e4622c2;p=platform%2Fupstream%2Fgstreamer.git 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, --- diff --git a/ChangeLog b/ChangeLog index d670559..ac10dbe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-07-15 Wim Taymans + + * 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 * gst/base/gstbasesrc.c: (gst_base_src_loop): diff --git a/gst/gstmessage.c b/gst/gstmessage.c index ce0402f..b5300df 100644 --- a/gst/gstmessage.c +++ b/gst/gstmessage.c @@ -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; diff --git a/tools/gst-launch.c b/tools/gst-launch.c index 95951a1..9fc6c73 100644 --- a/tools/gst-launch.c +++ b/tools/gst-launch.c @@ -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,