validate: Add getters for ValidateReports

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/1810>
This commit is contained in:
Thibault Saunier 2022-03-02 22:21:40 -03:00 committed by Philippe Normand
parent 5ea0c20a33
commit 2ef203e659
3 changed files with 103 additions and 2 deletions

View file

@ -115,6 +115,7 @@ GST_DEBUG_CATEGORY_STATIC (gst_validate_report_debug);
(g_mutex_unlock (&((GstValidateReport *) r)->shadow_reports_lock)); \ (g_mutex_unlock (&((GstValidateReport *) r)->shadow_reports_lock)); \
} G_STMT_END } G_STMT_END
static GstValidateIssue * static GstValidateIssue *
gst_validate_issue_ref (GstValidateIssue * issue) gst_validate_issue_ref (GstValidateIssue * issue)
{ {
@ -150,6 +151,79 @@ gst_validate_issue_get_id (GstValidateIssue * issue)
return issue->issue_id; 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: * gst_validate_issue_new_full:
* @issue_id: The ID of the issue, should be a GQuark * @issue_id: The ID of the issue, should be a GQuark

View file

@ -150,7 +150,7 @@ typedef enum {
/** /**
* GstValidateIssueFlags: * GstValidateIssueFlags:
* GST_VALIDATE_ISSUE_FLAGS_NONE: No special flags for the issue type * 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 * GST_VALIDATE_ISSUE_FLAGS_NO_BACKTRACE: Do not generate backtrace for the issue type
*/ */
typedef enum { typedef enum {
@ -238,6 +238,33 @@ struct _GstValidateReport {
gpointer _gst_reserved[GST_PADDING - 2]; 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, void gst_validate_report_add_message (GstValidateReport *report,
const gchar *message); const gchar *message);

View file

@ -780,7 +780,7 @@ gst_validate_runner_get_reports_count (GstValidateRunner * runner)
* gst_validate_runner_get_reports: * gst_validate_runner_get_reports:
* @runner: The #GstValidateRunner * @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 * GList *
gst_validate_runner_get_reports (GstValidateRunner * runner) gst_validate_runner_get_reports (GstValidateRunner * runner)