mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-01 21:18:52 +00:00
qa-reporter: add function for intercepting reports
after report creation, this function is called and implementers can modify the report to their liking before it is posted to the runner
This commit is contained in:
parent
6e19324584
commit
79e7392a9c
4 changed files with 27 additions and 10 deletions
|
@ -234,14 +234,14 @@ gst_qa_report_area_get_name (GstQaReportArea area)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
void
|
||||
gst_qa_report_check_abort (GstQaReport * report)
|
||||
{
|
||||
if ((report->issue->default_level == GST_QA_REPORT_LEVEL_ISSUE &&
|
||||
if ((report->level == GST_QA_REPORT_LEVEL_ISSUE &&
|
||||
_gst_qa_flags & GST_QA_FATAL_ISSUES) ||
|
||||
(report->issue->default_level == GST_QA_REPORT_LEVEL_WARNING &&
|
||||
(report->level == GST_QA_REPORT_LEVEL_WARNING &&
|
||||
_gst_qa_flags & GST_QA_FATAL_WARNINGS) ||
|
||||
(report->issue->default_level == GST_QA_REPORT_LEVEL_CRITICAL &&
|
||||
(report->level == GST_QA_REPORT_LEVEL_CRITICAL &&
|
||||
_gst_qa_flags & GST_QA_FATAL_CRITICALS)) {
|
||||
g_error ("Fatal report received: %" GST_QA_ERROR_REPORT_PRINT_FORMAT,
|
||||
GST_QA_REPORT_PRINT_ARGS (report));
|
||||
|
@ -264,9 +264,7 @@ gst_qa_report_new (GstQaIssue * issue, GstQaReporter * reporter,
|
|||
report->reporter = reporter; /* TODO should we ref? */
|
||||
report->message = g_strdup (message);
|
||||
report->timestamp = gst_util_get_timestamp () - _gst_qa_report_start_time;
|
||||
|
||||
/* we might abort here if asked */
|
||||
gst_qa_report_check_abort (report);
|
||||
report->level = issue->default_level;
|
||||
|
||||
return report;
|
||||
}
|
||||
|
|
|
@ -116,6 +116,8 @@ typedef struct {
|
|||
/* issue: The issue this report corresponds to (to get dsecription, summary,...) */
|
||||
GstQaIssue *issue;
|
||||
|
||||
GstQaReportLevel level;
|
||||
|
||||
/* The reporter that reported the issue (to get names, info, ...) */
|
||||
GstQaReporter *reporter;
|
||||
|
||||
|
@ -151,6 +153,7 @@ GstQaReport * gst_qa_report_ref (GstQaReport * report);
|
|||
|
||||
GstQaIssueId gst_qa_report_get_issue_id (GstQaReport * report);
|
||||
|
||||
void gst_qa_report_check_abort (GstQaReport * report);
|
||||
void gst_qa_report_printf (GstQaReport * report);
|
||||
|
||||
|
||||
|
|
|
@ -71,6 +71,17 @@ gst_qa_reporter_get_priv (GstQaReporter * reporter)
|
|||
return priv;
|
||||
}
|
||||
|
||||
static void
|
||||
gst_qa_reporter_intercept_report (GstQaReporter * reporter,
|
||||
GstQaReport * report)
|
||||
{
|
||||
GstQaReporterInterface *iface = GST_QA_REPORTER_GET_INTERFACE (reporter);
|
||||
|
||||
if (iface->intercept_report) {
|
||||
iface->intercept_report (reporter, report);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
gst_qa_report_valist (GstQaReporter * reporter,
|
||||
GstQaIssueId issue_id, const gchar * format, va_list var_args)
|
||||
|
@ -87,6 +98,8 @@ gst_qa_report_valist (GstQaReporter * reporter,
|
|||
message = g_strdup_vprintf (format, var_args);
|
||||
report = gst_qa_report_new (issue, reporter, message);
|
||||
|
||||
gst_qa_reporter_intercept_report (reporter, report);
|
||||
|
||||
if (issue->repeat == FALSE) {
|
||||
GstQaIssueId issue_id = gst_qa_issue_get_id (issue);
|
||||
|
||||
|
@ -98,11 +111,11 @@ gst_qa_report_valist (GstQaReporter * reporter,
|
|||
g_hash_table_insert (priv->reports, (gpointer) issue_id, report);
|
||||
}
|
||||
|
||||
if (issue->default_level == GST_QA_REPORT_LEVEL_CRITICAL)
|
||||
if (report->level == GST_QA_REPORT_LEVEL_CRITICAL)
|
||||
GST_ERROR ("<%s>: %s", priv->name, message);
|
||||
else if (issue->default_level == GST_QA_REPORT_LEVEL_WARNING)
|
||||
else if (report->level == GST_QA_REPORT_LEVEL_WARNING)
|
||||
GST_WARNING ("<%s>: %s", priv->name, message);
|
||||
else if (issue->default_level == GST_QA_REPORT_LEVEL_ISSUE)
|
||||
else if (report->level == GST_QA_REPORT_LEVEL_ISSUE)
|
||||
GST_LOG ("<%s>: %s", priv->name, message);
|
||||
else
|
||||
GST_DEBUG ("<%s>: %s", priv->name, message);
|
||||
|
@ -110,6 +123,7 @@ gst_qa_report_valist (GstQaReporter * reporter,
|
|||
GST_INFO_OBJECT (reporter, "Received error report %" GST_QA_ISSUE_FORMAT
|
||||
" : %s", GST_QA_ISSUE_ARGS (issue), message);
|
||||
gst_qa_report_printf (report);
|
||||
gst_qa_report_check_abort (report);
|
||||
|
||||
if (priv->runner) {
|
||||
gst_qa_runner_add_report (priv->runner, report);
|
||||
|
|
|
@ -61,6 +61,8 @@ GType gst_qa_reporter_get_type (void);
|
|||
struct _GstQaReporterInterface
|
||||
{
|
||||
GTypeInterface parent;
|
||||
|
||||
void (*intercept_report)(GstQaReporter * reporter, GstQaReport * report);
|
||||
};
|
||||
|
||||
void gst_qa_reporter_set_name (GstQaReporter * reporter,
|
||||
|
|
Loading…
Reference in a new issue