validate: prettify output of results

Makes the result a bit more readable than a compact multi-line list.

FIXME: Figure out how to print the description of the issues (which can
spawn multiple lines) in a nice way.
This commit is contained in:
Edward Hervey 2013-08-25 19:53:27 +02:00 committed by Thiago Santos
parent adca72b069
commit 78e1cb82da
2 changed files with 23 additions and 11 deletions

View file

@ -337,6 +337,14 @@ gst_validate_report_ref (GstValidateReport * report)
void
gst_validate_report_printf (GstValidateReport * report)
{
g_print ("%" GST_VALIDATE_ERROR_REPORT_PRINT_FORMAT "\n",
GST_VALIDATE_REPORT_PRINT_ARGS (report));
g_print ("%10s : %s\n", gst_validate_report_level_get_name (report->level),
report->issue->summary);
g_print ("%*s Detected on <%s> at %" GST_TIME_FORMAT "\n", 12, "",
gst_validate_reporter_get_name (report->reporter),
GST_TIME_ARGS (report->timestamp));
if (report->message)
g_print ("%*s Details : %s\n", 12, "", report->message);
if (report->issue->description)
g_print ("%*s Description : %s\n", 12, "", report->issue->description);
g_print ("\n");
}

View file

@ -191,18 +191,22 @@ main (int argc, gchar ** argv)
g_print ("Pipeline started\n");
g_main_loop_run (mainloop);
for (tmp = gst_validate_runner_get_reports (runner); tmp; tmp = tmp->next) {
GstValidateReport *report = tmp->data;
tmp = gst_validate_runner_get_reports (runner);
tmp = g_slist_reverse (tmp);
gst_validate_report_printf (report);
if (ret == 0 && report->level == GST_VALIDATE_REPORT_LEVEL_CRITICAL) {
g_printerr ("Got critical error %s, setting return value to -1\n",
((GstValidateReport *) (tmp->data))->message);
ret = -1;
g_print ("Pipeline finished\n");
count = g_slist_length (tmp);
if (count) {
g_print ("\nFound %u issues\n", count);
for (; tmp; tmp = tmp->next) {
GstValidateReport *report = tmp->data;
gst_validate_report_printf (report);
if (ret == 0 && report->level == GST_VALIDATE_REPORT_LEVEL_CRITICAL)
ret = -1;
}
count++;
}
g_print ("Pipeline finished, issues found: %u\n", count);
exit:
gst_element_set_state (pipeline, GST_STATE_NULL);