mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-27 10:40:34 +00:00
qa-monitor: Add a target name field that can be used even when the target is freed
This commit is contained in:
parent
d1508ce651
commit
cb4792a8e5
2 changed files with 28 additions and 0 deletions
|
@ -79,6 +79,16 @@ gst_qa_monitor_dispose (GObject * object)
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
gst_qa_monitor_finalize (GObject * object)
|
||||||
|
{
|
||||||
|
GstQaMonitor *monitor = GST_QA_MONITOR_CAST (object);
|
||||||
|
|
||||||
|
gst_qa_monitor_set_target_name (monitor, NULL);
|
||||||
|
|
||||||
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_qa_monitor_class_init (GstQaMonitorClass * klass)
|
gst_qa_monitor_class_init (GstQaMonitorClass * klass)
|
||||||
{
|
{
|
||||||
|
@ -89,6 +99,7 @@ gst_qa_monitor_class_init (GstQaMonitorClass * klass)
|
||||||
gobject_class->get_property = gst_qa_monitor_get_property;
|
gobject_class->get_property = gst_qa_monitor_get_property;
|
||||||
gobject_class->set_property = gst_qa_monitor_set_property;
|
gobject_class->set_property = gst_qa_monitor_set_property;
|
||||||
gobject_class->dispose = gst_qa_monitor_dispose;
|
gobject_class->dispose = gst_qa_monitor_dispose;
|
||||||
|
gobject_class->finalize = gst_qa_monitor_finalize;
|
||||||
gobject_class->constructor = gst_qa_monitor_constructor;
|
gobject_class->constructor = gst_qa_monitor_constructor;
|
||||||
|
|
||||||
klass->setup = gst_qa_monitor_do_setup;
|
klass->setup = gst_qa_monitor_do_setup;
|
||||||
|
@ -173,6 +184,10 @@ gst_qa_monitor_set_property (GObject * object, guint prop_id,
|
||||||
monitor->target = g_value_get_object (value);
|
monitor->target = g_value_get_object (value);
|
||||||
g_object_weak_ref (G_OBJECT (monitor->target),
|
g_object_weak_ref (G_OBJECT (monitor->target),
|
||||||
(GWeakNotify) _target_freed_cb, monitor);
|
(GWeakNotify) _target_freed_cb, monitor);
|
||||||
|
|
||||||
|
if (monitor->target)
|
||||||
|
gst_qa_monitor_set_target_name (monitor, g_strdup
|
||||||
|
(GST_OBJECT_NAME (monitor->target)));
|
||||||
break;
|
break;
|
||||||
case PROP_RUNNER:
|
case PROP_RUNNER:
|
||||||
/* we assume the runner is valid as long as this monitor is,
|
/* we assume the runner is valid as long as this monitor is,
|
||||||
|
@ -249,3 +264,12 @@ gst_qa_monitor_do_report (GstQaMonitor * monitor,
|
||||||
var_args);
|
var_args);
|
||||||
va_end (var_args);
|
va_end (var_args);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
gst_qa_monitor_set_target_name (GstQaMonitor * monitor, gchar * target_name)
|
||||||
|
{
|
||||||
|
if (monitor->target_name)
|
||||||
|
g_free (monitor->target_name);
|
||||||
|
|
||||||
|
monitor->target_name = target_name;
|
||||||
|
}
|
||||||
|
|
|
@ -125,6 +125,7 @@ struct _GstQaMonitor {
|
||||||
|
|
||||||
GstObject *target;
|
GstObject *target;
|
||||||
GMutex mutex;
|
GMutex mutex;
|
||||||
|
gchar *target_name;
|
||||||
|
|
||||||
GstQaMonitor *parent;
|
GstQaMonitor *parent;
|
||||||
|
|
||||||
|
@ -157,6 +158,9 @@ void gst_qa_monitor_do_report_valist (GstQaMonitor * monitor,
|
||||||
gint subarea, const gchar *format,
|
gint subarea, const gchar *format,
|
||||||
va_list var_args);
|
va_list var_args);
|
||||||
|
|
||||||
|
void gst_qa_monitor_set_target_name (GstQaMonitor *monitor,
|
||||||
|
gchar *target_name);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
#endif /* __GST_QA_MONITOR_H__ */
|
#endif /* __GST_QA_MONITOR_H__ */
|
||||||
|
|
Loading…
Reference in a new issue