mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-20 15:27:07 +00:00
qa-report: Make it a boxed type
And make it refcounted, in 1.0 it should become a GstMiniObject, for now, it is enough that way. The goal is to be able to use it in signals
This commit is contained in:
parent
440d20ed00
commit
5f62fd2e2a
4 changed files with 26 additions and 7 deletions
|
@ -221,7 +221,7 @@ gst_qa_monitor_do_report_valist (GstQaMonitor * monitor,
|
|||
if (GST_QA_MONITOR_GET_RUNNER (monitor)) {
|
||||
gst_qa_runner_add_report (GST_QA_MONITOR_GET_RUNNER (monitor), report);
|
||||
} else {
|
||||
gst_qa_report_free (report);
|
||||
gst_qa_report_unref (report);
|
||||
}
|
||||
|
||||
g_free (message);
|
||||
|
|
|
@ -25,6 +25,9 @@
|
|||
|
||||
static GstClockTime _gst_qa_report_start_time = 0;
|
||||
|
||||
G_DEFINE_BOXED_TYPE (GstQaReport, gst_qa_report,
|
||||
(GBoxedCopyFunc) gst_qa_report_ref, (GBoxedFreeFunc) gst_qa_report_unref);
|
||||
|
||||
void
|
||||
gst_qa_report_init (void)
|
||||
{
|
||||
|
@ -159,12 +162,22 @@ gst_qa_report_new (GstObject * source, GstQaReportLevel level,
|
|||
}
|
||||
|
||||
void
|
||||
gst_qa_report_free (GstQaReport * report)
|
||||
gst_qa_report_unref (GstQaReport * report)
|
||||
{
|
||||
if (G_UNLIKELY (g_atomic_int_dec_and_test (&report->refcount))) {
|
||||
g_free (report->message);
|
||||
g_object_unref (report->source);
|
||||
g_slice_free (GstQaReport, report);
|
||||
}
|
||||
}
|
||||
|
||||
GstQaReport *
|
||||
gst_qa_report_ref (GstQaReport * report)
|
||||
{
|
||||
g_atomic_int_inc (&report->refcount);
|
||||
|
||||
return report;
|
||||
}
|
||||
|
||||
void
|
||||
gst_qa_report_printf (GstQaReport * report)
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GType gst_qa_report_get_type (void);
|
||||
#define GST_TYPE_QA_REPORT (gst_qa_report_get_type ())
|
||||
|
||||
typedef enum {
|
||||
GST_QA_REPORT_LEVEL_CRITICAL,
|
||||
GST_QA_REPORT_LEVEL_WARNING,
|
||||
|
@ -73,6 +76,8 @@ typedef enum {
|
|||
} GstQaReportAreaCapsNegotiation;
|
||||
|
||||
typedef struct {
|
||||
gint refcount;
|
||||
|
||||
GstQaReportLevel level;
|
||||
GstQaReportArea area;
|
||||
gint subarea;
|
||||
|
@ -93,7 +98,8 @@ typedef struct {
|
|||
void gst_qa_report_init (void);
|
||||
GstQaReport * gst_qa_report_new (GstObject * source, GstQaReportLevel level, GstQaReportArea area,
|
||||
gint subarea, const gchar * message);
|
||||
void gst_qa_report_free (GstQaReport * report);
|
||||
void gst_qa_report_unref (GstQaReport * report);
|
||||
GstQaReport * gst_qa_report_ref (GstQaReport * report);
|
||||
|
||||
void gst_qa_report_printf (GstQaReport * report);
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ gst_qa_runner_dispose (GObject * object)
|
|||
if (runner->pipeline)
|
||||
gst_object_unref (runner->pipeline);
|
||||
|
||||
g_slist_free_full (runner->reports, (GDestroyNotify) gst_qa_report_free);
|
||||
g_slist_free_full (runner->reports, (GDestroyNotify) gst_qa_report_unref);
|
||||
|
||||
if (runner->monitor)
|
||||
g_object_unref (runner->monitor);
|
||||
|
|
Loading…
Reference in a new issue