From 0e85d15da05f2a37f8376778384ecef388240c70 Mon Sep 17 00:00:00 2001 From: Thibault Saunier Date: Tue, 28 Apr 2020 23:26:13 -0400 Subject: [PATCH] validate: Add an option to describe issue types Part-of: --- validate/gst/validate/gst-validate-report.c | 24 +++++++++++++++++++++ validate/gst/validate/gst-validate-report.h | 1 + validate/tools/gst-validate.c | 10 ++++++++- 3 files changed, 34 insertions(+), 1 deletion(-) diff --git a/validate/gst/validate/gst-validate-report.c b/validate/gst/validate/gst-validate-report.c index d3cdf00639..ea64dbc808 100644 --- a/validate/gst/validate/gst-validate-report.c +++ b/validate/gst/validate/gst-validate-report.c @@ -1274,3 +1274,27 @@ gst_validate_print_position (GstClockTime position, GstClockTime duration, g_free (extra_info); } + +static void +print_issue (gpointer key, GstValidateIssue * issue, gpointer user_data) +{ + gst_validate_printf (NULL, "\n# `%s` (%" G_GUINTPTR_FORMAT ")\n\n", + g_quark_to_string (issue->issue_id), issue->issue_id); + gst_validate_printf (NULL, "%c%s\n\n", g_ascii_toupper (issue->summary[0]), + &issue->summary[1]); + if (issue->description) + gst_validate_printf (NULL, "%c%s\n\n", + g_ascii_toupper (issue->description[0]), &issue->description[1]); + gst_validate_printf (NULL, "Area: %s\n", issue->area); + gst_validate_printf (NULL, "Name: %s\n", issue->name); + gst_validate_printf (NULL, "Default severity: %s\n\n", + gst_validate_report_level_get_name (issue->default_level)); +} + +void +gst_validate_print_issues (void) +{ + g_return_if_fail (_gst_validate_issues); + + g_hash_table_foreach (_gst_validate_issues, (GHFunc) print_issue, NULL); +} diff --git a/validate/gst/validate/gst-validate-report.h b/validate/gst/validate/gst-validate-report.h index 898e57c2a0..c211e2516b 100644 --- a/validate/gst/validate/gst-validate-report.h +++ b/validate/gst/validate/gst-validate-report.h @@ -311,6 +311,7 @@ GST_VALIDATE_API GstValidateReportLevel gst_validate_report_level_from_name (const gchar *level_name); GST_VALIDATE_API void gst_validate_print_position(GstClockTime position, GstClockTime duration, gdouble rate, gchar* extra_info); +GST_VALIDATE_API void gst_validate_print_issues (void); G_END_DECLS diff --git a/validate/tools/gst-validate.c b/validate/tools/gst-validate.c index 1ac5bed460..0825748a3a 100644 --- a/validate/tools/gst-validate.c +++ b/validate/tools/gst-validate.c @@ -338,7 +338,7 @@ main (int argc, gchar ** argv) gchar *scenario = NULL, *configs = NULL, *media_info = NULL, *verbosity = NULL, *testfile = NULL; gboolean list_scenarios = FALSE, monitor_handles_state, - inspect_action_type = FALSE; + inspect_action_type = FALSE, print_issue_types = FALSE; GstStateChangeReturn sret; gchar *output_file = NULL; BusCallbackData bus_callback_data = { 0, }; @@ -375,6 +375,9 @@ main (int argc, gchar ** argv) "Note that passing \"all\" as action type name, makes it output the" " full documentation for all types.", NULL}, + {"print-issue-types", '\0', 0, G_OPTION_ARG_NONE, &print_issue_types, + "List all known issue types and their descriptions.", + NULL}, {"set-media-info", '\0', 0, G_OPTION_ARG_FILENAME, &media_info, "Set a media_info XML file descriptor to share information about the" " media file that will be reproduced.", @@ -458,6 +461,11 @@ main (int argc, gchar ** argv) return 0; } + if (print_issue_types) { + gst_validate_print_issues (); + return 0; + } + if (argc == 1) { g_print ("%s", g_option_context_get_help (ctx, FALSE, NULL)); g_option_context_free (ctx);