validate: Add getters for ValidateReports
authorThibault Saunier <tsaunier@igalia.com>
Thu, 3 Mar 2022 01:21:40 +0000 (22:21 -0300)
committerPhilippe Normand <philn@igalia.com>
Thu, 17 Mar 2022 14:48:34 +0000 (14:48 +0000)
Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1810>

subprojects/gst-devtools/validate/gst/validate/gst-validate-report.c
subprojects/gst-devtools/validate/gst/validate/gst-validate-report.h
subprojects/gst-devtools/validate/gst/validate/gst-validate-runner.c

index 50df68c..6797d99 100644 (file)
@@ -115,6 +115,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_validate_report_debug);
   (g_mutex_unlock (&((GstValidateReport *) r)->shadow_reports_lock));          \
   } G_STMT_END
 
+
 static GstValidateIssue *
 gst_validate_issue_ref (GstValidateIssue * issue)
 {
@@ -150,6 +151,79 @@ gst_validate_issue_get_id (GstValidateIssue * issue)
   return issue->issue_id;
 }
 
+#define MAKE_GETTER_COPY(type, field, copier) \
+  type gst_validate_report_get_##field(GstValidateReport *report) { return copier(report->field); }
+
+#define MAKE_GETTER(type, field) \
+  type gst_validate_report_get_##field(GstValidateReport *report) { return report->field; }
+
+/**
+ * gst_validate_report_get_level:
+ *
+ * Returns: report level
+ * Since: 1.22
+ */
+MAKE_GETTER (GstValidateReportLevel, level);
+/**
+ * gst_validate_report_get_timestamp:
+ *
+ * Returns: report timestamp
+ * Since: 1.22
+ */
+MAKE_GETTER (GstClockTime, timestamp);
+/**
+ * gst_validate_report_get_reporting_level:
+ *
+ * Returns: reporting level
+ * Since: 1.22
+ */
+MAKE_GETTER (GstValidateReportingDetails, reporting_level);
+/**
+ * gst_validate_report_get_issue:
+ *
+ * Returns: (transfer full): report issue
+ * Since: 1.22
+ */
+MAKE_GETTER_COPY (GstValidateIssue *, issue, gst_validate_issue_ref);
+/**
+ * gst_validate_report_get_reporter:
+ *
+ * Returns: (transfer full): report reporter
+ * Since: 1.22
+ */
+MAKE_GETTER_COPY (GstValidateReporter *, reporter, gst_object_ref);
+/**
+ * gst_validate_report_get_message:
+ *
+ * Returns: (transfer full): report message
+ * Since: 1.22
+ */
+MAKE_GETTER_COPY (gchar *, message, g_strdup);
+/**
+ * gst_validate_report_get_reporter_name:
+ *
+ * Returns: (transfer full): report issue
+ * Since: 1.22
+ */
+MAKE_GETTER_COPY (gchar *, reporter_name, g_strdup);
+/**
+ * gst_validate_report_get_trace:
+ *
+ * Returns: (transfer full): report backtrace
+ * Since: 1.22
+ */
+MAKE_GETTER_COPY (gchar *, trace, g_strdup);
+/**
+ * gst_validate_report_get_dotfile_name:
+ *
+ * Returns: (transfer full): report dot file name
+ * Since: 1.22
+ */
+MAKE_GETTER_COPY (gchar *, dotfile_name, g_strdup);
+
+#undef MAKE_GETTER
+#undef MAKE_GETTER_COPY
+
 /**
  * gst_validate_issue_new_full:
  * @issue_id: The ID of the issue, should be a GQuark
index dbc39d3..180064f 100644 (file)
@@ -150,7 +150,7 @@ typedef enum {
 /**
  * GstValidateIssueFlags:
  * GST_VALIDATE_ISSUE_FLAGS_NONE: No special flags for the issue type
- * GST_VALIDATE_ISSUE_FLAGS_FULL_DETAILS: Always show all accurences of the issue in full details
+ * GST_VALIDATE_ISSUE_FLAGS_FULL_DETAILS: Always show all occurrences of the issue in full details
  * GST_VALIDATE_ISSUE_FLAGS_NO_BACKTRACE: Do not generate backtrace for the issue type
  */
 typedef enum {
@@ -238,6 +238,33 @@ struct _GstValidateReport {
   gpointer _gst_reserved[GST_PADDING - 2];
 };
 
+GST_VALIDATE_API
+GstValidateIssue * gst_validate_report_get_issue (GstValidateReport * report);
+
+GST_VALIDATE_API
+GstValidateReportLevel gst_validate_report_get_level (GstValidateReport * report);
+
+GST_VALIDATE_API
+GstValidateReporter * gst_validate_report_get_reporter (GstValidateReport * report);
+
+GST_VALIDATE_API
+GstClockTime gst_validate_report_get_timestamp (GstValidateReport * report);
+
+GST_VALIDATE_API
+gchar * gst_validate_report_get_message (GstValidateReport * report);
+
+GST_VALIDATE_API
+GstValidateReportingDetails gst_validate_report_get_reporting_level (GstValidateReport * report);
+
+GST_VALIDATE_API
+gchar * gst_validate_report_get_reporter_name (GstValidateReport * report);
+
+GST_VALIDATE_API
+gchar * gst_validate_report_get_trace (GstValidateReport * report);
+
+GST_VALIDATE_API
+gchar * gst_validate_report_get_dotfile_name (GstValidateReport * report);
+
 void gst_validate_report_add_message (GstValidateReport *report,
     const gchar *message);
 
index a45da8e..8cf64f2 100644 (file)
@@ -780,7 +780,7 @@ gst_validate_runner_get_reports_count (GstValidateRunner * runner)
  * gst_validate_runner_get_reports:
  * @runner: The #GstValidateRunner
  *
- * Returns: (element-type GstValidateReport) (transfer full): All the reports in a #GList of #GstValidateReportg
+ * Returns: (element-type GstValidateReport) (transfer full): The list of reports
  */
 GList *
 gst_validate_runner_get_reports (GstValidateRunner * runner)