mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-30 04:00:37 +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)) {
|
if (GST_QA_MONITOR_GET_RUNNER (monitor)) {
|
||||||
gst_qa_runner_add_report (GST_QA_MONITOR_GET_RUNNER (monitor), report);
|
gst_qa_runner_add_report (GST_QA_MONITOR_GET_RUNNER (monitor), report);
|
||||||
} else {
|
} else {
|
||||||
gst_qa_report_free (report);
|
gst_qa_report_unref (report);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_free (message);
|
g_free (message);
|
||||||
|
|
|
@ -25,6 +25,9 @@
|
||||||
|
|
||||||
static GstClockTime _gst_qa_report_start_time = 0;
|
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
|
void
|
||||||
gst_qa_report_init (void)
|
gst_qa_report_init (void)
|
||||||
{
|
{
|
||||||
|
@ -159,11 +162,21 @@ gst_qa_report_new (GstObject * source, GstQaReportLevel level,
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
gst_qa_report_free (GstQaReport * report)
|
gst_qa_report_unref (GstQaReport * report)
|
||||||
{
|
{
|
||||||
g_free (report->message);
|
if (G_UNLIKELY (g_atomic_int_dec_and_test (&report->refcount))) {
|
||||||
g_object_unref (report->source);
|
g_free (report->message);
|
||||||
g_slice_free (GstQaReport, report);
|
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
|
void
|
||||||
|
|
|
@ -27,6 +27,9 @@
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
|
GType gst_qa_report_get_type (void);
|
||||||
|
#define GST_TYPE_QA_REPORT (gst_qa_report_get_type ())
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
GST_QA_REPORT_LEVEL_CRITICAL,
|
GST_QA_REPORT_LEVEL_CRITICAL,
|
||||||
GST_QA_REPORT_LEVEL_WARNING,
|
GST_QA_REPORT_LEVEL_WARNING,
|
||||||
|
@ -73,6 +76,8 @@ typedef enum {
|
||||||
} GstQaReportAreaCapsNegotiation;
|
} GstQaReportAreaCapsNegotiation;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
gint refcount;
|
||||||
|
|
||||||
GstQaReportLevel level;
|
GstQaReportLevel level;
|
||||||
GstQaReportArea area;
|
GstQaReportArea area;
|
||||||
gint subarea;
|
gint subarea;
|
||||||
|
@ -93,7 +98,8 @@ typedef struct {
|
||||||
void gst_qa_report_init (void);
|
void gst_qa_report_init (void);
|
||||||
GstQaReport * gst_qa_report_new (GstObject * source, GstQaReportLevel level, GstQaReportArea area,
|
GstQaReport * gst_qa_report_new (GstObject * source, GstQaReportLevel level, GstQaReportArea area,
|
||||||
gint subarea, const gchar * message);
|
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);
|
void gst_qa_report_printf (GstQaReport * report);
|
||||||
|
|
||||||
|
|
|
@ -44,7 +44,7 @@ gst_qa_runner_dispose (GObject * object)
|
||||||
if (runner->pipeline)
|
if (runner->pipeline)
|
||||||
gst_object_unref (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)
|
if (runner->monitor)
|
||||||
g_object_unref (runner->monitor);
|
g_object_unref (runner->monitor);
|
||||||
|
|
Loading…
Reference in a new issue