validate: Add an option to describe issue types

Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-devtools/-/merge_requests/185>
This commit is contained in:
Thibault Saunier 2020-04-28 23:26:13 -04:00
parent 66d29a31fd
commit 0e85d15da0
3 changed files with 34 additions and 1 deletions

View file

@ -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);
}

View file

@ -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

View file

@ -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);