validate-reporter: Add some methods

+ gst_validate_reporter_get_reports
+ gst_validate_reporter_get_reports_count
This commit is contained in:
Mathieu Duponchelle 2014-10-01 18:28:33 +02:00 committed by Mathieu Duponchelle
parent 222a517384
commit f001777cc6
2 changed files with 55 additions and 0 deletions

View file

@ -275,3 +275,56 @@ gst_validate_reporter_set_handle_g_logs (GstValidateReporter * reporter)
g_log_handler = gst_validate_reporter_get_priv (reporter);
}
/**
* gst_validate_reporter_get_reports:
* @reporter: a #GstValidateReporter
*
* Get the list of reports present in the reporter.
*
* Returns: (transfer full) (element-type GstValidateReport): the list of
* #GstValidateReport present in the reporter.
* The caller should unref each report once it is done with them.
*/
GList *
gst_validate_reporter_get_reports (GstValidateReporter *reporter)
{
GstValidateReporterPrivate *priv;
GList *reports, *tmp;
GList *ret = NULL;
priv = g_object_get_data (G_OBJECT (reporter), REPORTER_PRIVATE);
GST_VALIDATE_REPORTER_REPORTS_LOCK (reporter);
reports = g_hash_table_get_values (priv->reports);
for (tmp = reports; tmp; tmp = tmp->next) {
ret = g_list_append (ret, gst_validate_report_ref ((GstValidateReport *) (tmp->data)));
}
g_list_free (reports);
GST_VALIDATE_REPORTER_REPORTS_UNLOCK (reporter);
return ret;
}
/**
* gst_validate_reporter_get_reports_count:
* @reporter: a #GstValidateReporter
*
* Get the number of reports present in the reporter.
*
* Returns: the number of reports currently present in @reporter.
*/
gint
gst_validate_reporter_get_reports_count (GstValidateReporter *reporter)
{
GstValidateReporterPrivate *priv;
gint ret;
priv = g_object_get_data (G_OBJECT (reporter), REPORTER_PRIVATE);
GST_VALIDATE_REPORTER_REPORTS_LOCK (reporter);
ret = g_hash_table_size (priv->reports);
GST_VALIDATE_REPORTER_REPORTS_UNLOCK (reporter);
return ret;
}

View file

@ -96,6 +96,8 @@ void gst_validate_reporter_set_runner (GstValidateReporter * reporter,
void gst_validate_reporter_set_handle_g_logs (GstValidateReporter * reporter);
GstValidateReport * gst_validate_reporter_get_report (GstValidateReporter *reporter,
GstValidateIssueId issue_id);
GList * gst_validate_reporter_get_reports (GstValidateReporter * reporter);
gint gst_validate_reporter_get_reports_count (GstValidateReporter *reporter);
G_END_DECLS
#endif /* _GST_VALIDATE_REPORTER_ */