gst-launch: Print the path string for message sources

This reduces confusion if the message source is a pad
and only "src" is printed as source.
This commit is contained in:
Sebastian Dröge 2009-05-14 12:30:04 +02:00
parent bebfde7502
commit 18f5b1a59e

View file

@ -408,15 +408,23 @@ event_loop (GstElement * pipeline, gboolean blocking, GstState target_state)
if (messages) { if (messages) {
const GstStructure *s; const GstStructure *s;
guint32 seqnum; guint32 seqnum;
gchar *src_name;
seqnum = gst_message_get_seqnum (message); seqnum = gst_message_get_seqnum (message);
s = gst_message_get_structure (message); s = gst_message_get_structure (message);
src_name =
GST_MESSAGE_SRC (message) ?
gst_object_get_path_string (GST_MESSAGE_SRC (message)) : NULL;
g_print (_("Got Message #%" G_GUINT32_FORMAT g_print (_("Got Message #%" G_GUINT32_FORMAT
" from element \"%s\" (%s): "), seqnum, " from object \"%s\" (%s): "), seqnum,
GST_STR_NULL (GST_ELEMENT_NAME (GST_MESSAGE_SRC (message))), GST_STR_NULL (src_name),
gst_message_type_get_name (GST_MESSAGE_TYPE (message))); gst_message_type_get_name (GST_MESSAGE_TYPE (message)));
g_free (src_name);
if (s) { if (s) {
gchar *sstr; gchar *sstr;
@ -448,21 +456,26 @@ event_loop (GstElement * pipeline, gboolean blocking, GstState target_state)
gst_element_set_state (pipeline, GST_STATE_PLAYING); gst_element_set_state (pipeline, GST_STATE_PLAYING);
#endif #endif
break; break;
case GST_MESSAGE_EOS: case GST_MESSAGE_EOS:{
gchar *src_name = GST_MESSAGE_SRC (message) ?
gst_object_get_path_string (GST_MESSAGE_SRC (message)) : NULL;
waiting_eos = FALSE; waiting_eos = FALSE;
g_print (_ g_print (_("Got EOS from object \"%s\".\n"), GST_STR_NULL (src_name));
("Got EOS from element \"%s\".\n"), g_free (src_name);
GST_STR_NULL (GST_ELEMENT_NAME (GST_MESSAGE_SRC (message))));
goto exit; goto exit;
}
case GST_MESSAGE_TAG: case GST_MESSAGE_TAG:
if (tags) { if (tags) {
GstTagList *tags; GstTagList *tags;
gchar *src_name = GST_MESSAGE_SRC (message) ?
gst_object_get_path_string (GST_MESSAGE_SRC (message)) : NULL;
gst_message_parse_tag (message, &tags); gst_message_parse_tag (message, &tags);
g_print (_("FOUND TAG : found by element \"%s\".\n"), g_print (_("FOUND TAG : found by object \"%s\".\n"),
GST_STR_NULL (GST_ELEMENT_NAME (GST_MESSAGE_SRC (message)))); GST_STR_NULL (src_name));
gst_tag_list_foreach (tags, print_tag, NULL); gst_tag_list_foreach (tags, print_tag, NULL);
gst_tag_list_free (tags); gst_tag_list_free (tags);
g_free (src_name);
} }
break; break;
case GST_MESSAGE_INFO:{ case GST_MESSAGE_INFO:{