qa-report: expose API for adding custom issues

expose gst_qa_issue_register and gst_qa_issue_new to allow applications
to register their own custom issues.

Issues IDs should use Areas higher than GST_QA_AREA_OTHER for custom
areas. And to add more issues to existing areas, the IDs should be
higher than GST_QA_ISSUE_ID_CUSTOM_FIRST.

Custom issues registering should be done at startup and from the same
thread as there is no locking around the issues hashtable
This commit is contained in:
Thiago Santos 2013-07-30 17:07:13 -03:00
parent 2034fb11d9
commit 76679b1c7e
2 changed files with 12 additions and 3 deletions

View file

@ -43,7 +43,7 @@ gst_qa_issue_get_id (GstQaIssue * issue)
return issue->issue_id;
}
static GstQaIssue *
GstQaIssue *
gst_qa_issue_new (GstQaIssueId issue_id, gchar * summary,
gchar * description, GstQaReportLevel default_level)
{
@ -65,9 +65,12 @@ gst_qa_issue_free (GstQaIssue * issue)
g_slice_free (GstQaIssue, issue);
}
static void
void
gst_qa_issue_register (GstQaIssue * issue)
{
g_return_if_fail (g_hash_table_lookup (_gst_qa_issues,
(gpointer) gst_qa_issue_get_id (issue)) != NULL);
g_hash_table_insert (_gst_qa_issues, (gpointer) gst_qa_issue_get_id (issue),
issue);
}
@ -207,6 +210,8 @@ gst_qa_report_level_get_name (GstQaReportLevel level)
return "warning";
case GST_QA_REPORT_LEVEL_ISSUE:
return "issue";
case GST_QA_REPORT_LEVEL_IGNORE:
return "ignore";
default:
return "unknown";
}

View file

@ -61,6 +61,7 @@ typedef guintptr GstQaIssueId;
#define GST_QA_ISSUE_ID_UNKNOWN 0
#define GST_QA_ISSUE_ID_SHIFT 16
#define GST_QA_ISSUE_ID_CUSTOM_FIRST (2 << 15)
#define GST_QA_ISSUE_ID_BUFFER_BEFORE_SEGMENT (((GstQaIssueId) GST_QA_AREA_BUFFER) << GST_QA_ISSUE_ID_SHIFT | 1)
#define GST_QA_ISSUE_ID_BUFFER_IS_OUT_OF_SEGMENT (((GstQaIssueId) GST_QA_AREA_BUFFER) << GST_QA_ISSUE_ID_SHIFT | 2)
@ -144,6 +145,10 @@ typedef struct {
void gst_qa_report_init (void);
GstQaIssue * gst_qa_issue_from_id (GstQaIssueId issue_id);
GstQaIssueId gst_qa_issue_get_id (GstQaIssue * issue);
void gst_qa_issue_register (GstQaIssue * issue);
GstQaIssue * gst_qa_issue_new (GstQaIssueId issue_id, gchar * summary,
gchar * description,
GstQaReportLevel default_level);
GstQaReport * gst_qa_report_new (GstQaIssue * issue,
GstQaReporter * reporter,
@ -156,7 +161,6 @@ GstQaIssueId gst_qa_report_get_issue_id (GstQaReport * report);
void gst_qa_report_check_abort (GstQaReport * report);
void gst_qa_report_printf (GstQaReport * report);
const gchar * gst_qa_report_level_get_name (GstQaReportLevel level);
const gchar * gst_qa_report_area_get_name (GstQaReportArea area);
const gchar * gst_qa_report_subarea_get_name (GstQaReportArea area, gint subarea);