qa-report: expose API for adding custom issues
authorThiago Santos <thiago.sousa.santos@collabora.com>
Tue, 30 Jul 2013 20:07:13 +0000 (17:07 -0300)
committerThiago Santos <thiago.sousa.santos@collabora.com>
Tue, 30 Jul 2013 20:07:13 +0000 (17:07 -0300)
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

validate/gst/qa/gst-qa-report.c
validate/gst/qa/gst-qa-report.h

index 3a29bc9703f5283b6ca8ede9c15dac12f1d9202c..00580efdf2d15d7edd8d0632966805afe1467f5c 100644 (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";
   }
index 993fee059a07611180aa6112c6829ed3a6cda2ef..db33802bb85af2bb30cd6d92b646cec04e4e46aa 100644 (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);