mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-07 15:02:40 +00:00
qa-monitor: add parent relation for monitors
This is useful because Pad monitors will have to ask the parent element monitors for some element details for doing checks
This commit is contained in:
parent
d314df2040
commit
cb6b45d375
11 changed files with 48 additions and 27 deletions
|
@ -86,10 +86,11 @@ gst_qa_bin_monitor_init (GstQaBinMonitor * bin_monitor)
|
||||||
* @bin: (transfer-none): a #GstBin to run QA on
|
* @bin: (transfer-none): a #GstBin to run QA on
|
||||||
*/
|
*/
|
||||||
GstQaBinMonitor *
|
GstQaBinMonitor *
|
||||||
gst_qa_bin_monitor_new (GstBin * bin, GstQaRunner * runner)
|
gst_qa_bin_monitor_new (GstBin * bin, GstQaRunner * runner,
|
||||||
|
GstQaMonitor * parent)
|
||||||
{
|
{
|
||||||
GstQaBinMonitor *monitor = g_object_new (GST_TYPE_QA_BIN_MONITOR, "object",
|
GstQaBinMonitor *monitor = g_object_new (GST_TYPE_QA_BIN_MONITOR, "object",
|
||||||
bin, "qa-runner", runner, NULL);
|
bin, "qa-runner", runner, "qa-parent", parent, NULL);
|
||||||
|
|
||||||
if (GST_QA_MONITOR_GET_OBJECT (monitor) == NULL) {
|
if (GST_QA_MONITOR_GET_OBJECT (monitor) == NULL) {
|
||||||
g_object_unref (monitor);
|
g_object_unref (monitor);
|
||||||
|
@ -154,7 +155,7 @@ gst_qa_bin_monitor_wrap_element (GstQaBinMonitor * monitor,
|
||||||
|
|
||||||
element_monitor =
|
element_monitor =
|
||||||
gst_qa_monitor_factory_create (element,
|
gst_qa_monitor_factory_create (element,
|
||||||
GST_QA_MONITOR_GET_RUNNER (monitor));
|
GST_QA_MONITOR_GET_RUNNER (monitor), GST_QA_MONITOR_CAST (monitor));
|
||||||
g_return_if_fail (element_monitor != NULL);
|
g_return_if_fail (element_monitor != NULL);
|
||||||
|
|
||||||
GST_QA_MONITOR_LOCK (monitor);
|
GST_QA_MONITOR_LOCK (monitor);
|
||||||
|
|
|
@ -72,7 +72,7 @@ struct _GstQaBinMonitorClass {
|
||||||
/* normal GObject stuff */
|
/* normal GObject stuff */
|
||||||
GType gst_qa_bin_monitor_get_type (void);
|
GType gst_qa_bin_monitor_get_type (void);
|
||||||
|
|
||||||
GstQaBinMonitor * gst_qa_bin_monitor_new (GstBin * bin, GstQaRunner * runner);
|
GstQaBinMonitor * gst_qa_bin_monitor_new (GstBin * bin, GstQaRunner * runner, GstQaMonitor * parent);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -86,14 +86,15 @@ gst_qa_element_monitor_init (GstQaElementMonitor * element_monitor)
|
||||||
* @element: (transfer-none): a #GstElement to run QA on
|
* @element: (transfer-none): a #GstElement to run QA on
|
||||||
*/
|
*/
|
||||||
GstQaElementMonitor *
|
GstQaElementMonitor *
|
||||||
gst_qa_element_monitor_new (GstElement * element, GstQaRunner * runner)
|
gst_qa_element_monitor_new (GstElement * element, GstQaRunner * runner,
|
||||||
|
GstQaMonitor * parent)
|
||||||
{
|
{
|
||||||
GstQaElementMonitor *monitor;
|
GstQaElementMonitor *monitor;
|
||||||
|
|
||||||
g_return_val_if_fail (element != NULL, NULL);
|
g_return_val_if_fail (element != NULL, NULL);
|
||||||
|
|
||||||
monitor = g_object_new (GST_TYPE_QA_ELEMENT_MONITOR, "object", element,
|
monitor = g_object_new (GST_TYPE_QA_ELEMENT_MONITOR, "object", element,
|
||||||
"qa-runner", runner, NULL);
|
"qa-runner", runner, "qa-parent", parent, NULL);
|
||||||
|
|
||||||
if (GST_QA_ELEMENT_MONITOR_GET_ELEMENT (monitor) == NULL) {
|
if (GST_QA_ELEMENT_MONITOR_GET_ELEMENT (monitor) == NULL) {
|
||||||
g_object_unref (monitor);
|
g_object_unref (monitor);
|
||||||
|
@ -172,7 +173,8 @@ gst_qa_element_monitor_wrap_pad (GstQaElementMonitor * monitor, GstPad * pad)
|
||||||
GST_DEBUG_OBJECT (monitor, "Wrapping pad %s:%s", GST_DEBUG_PAD_NAME (pad));
|
GST_DEBUG_OBJECT (monitor, "Wrapping pad %s:%s", GST_DEBUG_PAD_NAME (pad));
|
||||||
|
|
||||||
pad_monitor =
|
pad_monitor =
|
||||||
gst_qa_pad_monitor_new (pad, GST_QA_MONITOR_GET_RUNNER (monitor));
|
gst_qa_pad_monitor_new (pad, GST_QA_MONITOR_GET_RUNNER (monitor),
|
||||||
|
monitor);
|
||||||
g_return_if_fail (pad_monitor != NULL);
|
g_return_if_fail (pad_monitor != NULL);
|
||||||
|
|
||||||
GST_QA_MONITOR_LOCK (monitor);
|
GST_QA_MONITOR_LOCK (monitor);
|
||||||
|
|
|
@ -73,7 +73,7 @@ struct _GstQaElementMonitorClass {
|
||||||
/* normal GObject stuff */
|
/* normal GObject stuff */
|
||||||
GType gst_qa_element_monitor_get_type (void);
|
GType gst_qa_element_monitor_get_type (void);
|
||||||
|
|
||||||
GstQaElementMonitor * gst_qa_element_monitor_new (GstElement * element, GstQaRunner * runner);
|
GstQaElementMonitor * gst_qa_element_monitor_new (GstElement * element, GstQaRunner * runner, GstQaMonitor * parent);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -23,15 +23,16 @@
|
||||||
#include "gst-qa-bin-monitor.h"
|
#include "gst-qa-bin-monitor.h"
|
||||||
|
|
||||||
GstQaElementMonitor *
|
GstQaElementMonitor *
|
||||||
gst_qa_monitor_factory_create (GstElement * element, GstQaRunner * runner)
|
gst_qa_monitor_factory_create (GstElement * element, GstQaRunner * runner,
|
||||||
|
GstQaMonitor * parent)
|
||||||
{
|
{
|
||||||
g_return_val_if_fail (element != NULL, NULL);
|
g_return_val_if_fail (element != NULL, NULL);
|
||||||
|
|
||||||
if (GST_IS_BIN (element)) {
|
if (GST_IS_BIN (element)) {
|
||||||
return
|
return
|
||||||
GST_QA_ELEMENT_MONITOR_CAST (gst_qa_bin_monitor_new (GST_BIN_CAST
|
GST_QA_ELEMENT_MONITOR_CAST (gst_qa_bin_monitor_new (GST_BIN_CAST
|
||||||
(element), runner));
|
(element), runner, parent));
|
||||||
}
|
}
|
||||||
|
|
||||||
return gst_qa_element_monitor_new (element, runner);
|
return gst_qa_element_monitor_new (element, runner, parent);
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
GstQaElementMonitor * gst_qa_monitor_factory_create (GstElement * element, GstQaRunner * runner);
|
GstQaElementMonitor * gst_qa_monitor_factory_create (GstElement * element, GstQaRunner * runner, GstQaMonitor * parent);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ enum
|
||||||
PROP_0,
|
PROP_0,
|
||||||
PROP_OBJECT,
|
PROP_OBJECT,
|
||||||
PROP_RUNNER,
|
PROP_RUNNER,
|
||||||
|
PROP_QA_PARENT,
|
||||||
PROP_LAST
|
PROP_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -64,8 +65,8 @@ gst_qa_monitor_dispose (GObject * object)
|
||||||
|
|
||||||
g_mutex_clear (&monitor->mutex);
|
g_mutex_clear (&monitor->mutex);
|
||||||
|
|
||||||
if (monitor->object)
|
if (monitor->target)
|
||||||
g_object_unref (monitor->object);
|
g_object_unref (monitor->target);
|
||||||
|
|
||||||
G_OBJECT_CLASS (parent_class)->dispose (object);
|
G_OBJECT_CLASS (parent_class)->dispose (object);
|
||||||
}
|
}
|
||||||
|
@ -92,6 +93,11 @@ gst_qa_monitor_class_init (GstQaMonitorClass * klass)
|
||||||
g_param_spec_object ("qa-runner", "QA Runner", "The QA runner to "
|
g_param_spec_object ("qa-runner", "QA Runner", "The QA runner to "
|
||||||
"report errors to", GST_TYPE_QA_RUNNER,
|
"report errors to", GST_TYPE_QA_RUNNER,
|
||||||
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
|
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
|
||||||
|
|
||||||
|
g_object_class_install_property (gobject_class, PROP_QA_PARENT,
|
||||||
|
g_param_spec_object ("qa-parent", "QA parent monitor", "The QA monitor "
|
||||||
|
"that is the parent of this one", GST_TYPE_QA_MONITOR,
|
||||||
|
G_PARAM_CONSTRUCT_ONLY | G_PARAM_READWRITE));
|
||||||
}
|
}
|
||||||
|
|
||||||
static GObject *
|
static GObject *
|
||||||
|
@ -155,14 +161,17 @@ gst_qa_monitor_set_property (GObject * object, guint prop_id,
|
||||||
|
|
||||||
switch (prop_id) {
|
switch (prop_id) {
|
||||||
case PROP_OBJECT:
|
case PROP_OBJECT:
|
||||||
g_assert (monitor->object == NULL);
|
g_assert (monitor->target == NULL);
|
||||||
monitor->object = g_value_dup_object (value);
|
monitor->target = g_value_dup_object (value);
|
||||||
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,
|
||||||
* no ref taken */
|
* no ref taken */
|
||||||
monitor->runner = g_value_get_object (value);
|
monitor->runner = g_value_get_object (value);
|
||||||
break;
|
break;
|
||||||
|
case PROP_QA_PARENT:
|
||||||
|
monitor->parent = g_value_get_object (value);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -182,10 +191,10 @@ gst_qa_monitor_get_property (GObject * object, guint prop_id,
|
||||||
g_value_set_object (value, GST_QA_MONITOR_GET_OBJECT (monitor));
|
g_value_set_object (value, GST_QA_MONITOR_GET_OBJECT (monitor));
|
||||||
break;
|
break;
|
||||||
case PROP_RUNNER:
|
case PROP_RUNNER:
|
||||||
if (GST_QA_MONITOR_GET_RUNNER (monitor))
|
|
||||||
g_value_set_object (value, GST_QA_MONITOR_GET_RUNNER (monitor));
|
g_value_set_object (value, GST_QA_MONITOR_GET_RUNNER (monitor));
|
||||||
else
|
break;
|
||||||
g_value_set_object (value, NULL);
|
case PROP_QA_PARENT:
|
||||||
|
g_value_set_object (value, GST_QA_MONITOR_GET_PARENT (monitor));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
|
|
|
@ -38,8 +38,9 @@ G_BEGIN_DECLS
|
||||||
#define GST_QA_MONITOR_CAST(obj) ((GstQaMonitor*)(obj))
|
#define GST_QA_MONITOR_CAST(obj) ((GstQaMonitor*)(obj))
|
||||||
#define GST_QA_MONITOR_CLASS_CAST(klass) ((GstQaMonitorClass*)(klass))
|
#define GST_QA_MONITOR_CLASS_CAST(klass) ((GstQaMonitorClass*)(klass))
|
||||||
|
|
||||||
#define GST_QA_MONITOR_GET_OBJECT(m) (GST_QA_MONITOR_CAST (m)->object)
|
#define GST_QA_MONITOR_GET_OBJECT(m) (GST_QA_MONITOR_CAST (m)->target)
|
||||||
#define GST_QA_MONITOR_GET_RUNNER(m) (GST_QA_MONITOR_CAST (m)->runner)
|
#define GST_QA_MONITOR_GET_RUNNER(m) (GST_QA_MONITOR_CAST (m)->runner)
|
||||||
|
#define GST_QA_MONITOR_GET_PARENT(m) (GST_QA_MONITOR_CAST (m)->parent)
|
||||||
#define GST_QA_MONITOR_LOCK(m) (g_mutex_lock (&GST_QA_MONITOR_CAST(m)->mutex))
|
#define GST_QA_MONITOR_LOCK(m) (g_mutex_lock (&GST_QA_MONITOR_CAST(m)->mutex))
|
||||||
#define GST_QA_MONITOR_UNLOCK(m) (g_mutex_unlock (&GST_QA_MONITOR_CAST(m)->mutex))
|
#define GST_QA_MONITOR_UNLOCK(m) (g_mutex_unlock (&GST_QA_MONITOR_CAST(m)->mutex))
|
||||||
|
|
||||||
|
@ -54,11 +55,13 @@ typedef struct _GstQaMonitorClass GstQaMonitorClass;
|
||||||
* Class that wraps a #GObject for QA checks
|
* Class that wraps a #GObject for QA checks
|
||||||
*/
|
*/
|
||||||
struct _GstQaMonitor {
|
struct _GstQaMonitor {
|
||||||
GObject parent;
|
GObject object;
|
||||||
|
|
||||||
GstObject *object;
|
GstObject *target;
|
||||||
GMutex mutex;
|
GMutex mutex;
|
||||||
|
|
||||||
|
GstQaMonitor *parent;
|
||||||
|
|
||||||
GstQaRunner *runner;
|
GstQaRunner *runner;
|
||||||
|
|
||||||
/*< private >*/
|
/*< private >*/
|
||||||
|
|
|
@ -77,10 +77,12 @@ gst_qa_pad_monitor_init (GstQaPadMonitor * pad_monitor)
|
||||||
* @pad: (transfer-none): a #GstPad to run QA on
|
* @pad: (transfer-none): a #GstPad to run QA on
|
||||||
*/
|
*/
|
||||||
GstQaPadMonitor *
|
GstQaPadMonitor *
|
||||||
gst_qa_pad_monitor_new (GstPad * pad, GstQaRunner * runner)
|
gst_qa_pad_monitor_new (GstPad * pad, GstQaRunner * runner,
|
||||||
|
GstQaElementMonitor * parent)
|
||||||
{
|
{
|
||||||
GstQaPadMonitor *monitor = g_object_new (GST_TYPE_QA_PAD_MONITOR,
|
GstQaPadMonitor *monitor = g_object_new (GST_TYPE_QA_PAD_MONITOR,
|
||||||
"object", pad, "qa-runner", runner, NULL);
|
"object", pad, "qa-runner", runner, "qa-parent",
|
||||||
|
parent, NULL);
|
||||||
|
|
||||||
if (GST_QA_PAD_MONITOR_GET_PAD (monitor) == NULL) {
|
if (GST_QA_PAD_MONITOR_GET_PAD (monitor) == NULL) {
|
||||||
g_object_unref (monitor);
|
g_object_unref (monitor);
|
||||||
|
|
|
@ -53,6 +53,8 @@ typedef struct _GstQaPadMonitorClass GstQaPadMonitorClass;
|
||||||
struct _GstQaPadMonitor {
|
struct _GstQaPadMonitor {
|
||||||
GstQaMonitor parent;
|
GstQaMonitor parent;
|
||||||
|
|
||||||
|
GstQaElementMonitor *element_monitor;
|
||||||
|
|
||||||
gboolean setup;
|
gboolean setup;
|
||||||
GstPad *pad;
|
GstPad *pad;
|
||||||
|
|
||||||
|
@ -88,7 +90,7 @@ struct _GstQaPadMonitorClass {
|
||||||
/* normal GObject stuff */
|
/* normal GObject stuff */
|
||||||
GType gst_qa_pad_monitor_get_type (void);
|
GType gst_qa_pad_monitor_get_type (void);
|
||||||
|
|
||||||
GstQaPadMonitor * gst_qa_pad_monitor_new (GstPad * pad, GstQaRunner * runner);
|
GstQaPadMonitor * gst_qa_pad_monitor_new (GstPad * pad, GstQaRunner * runner, GstQaElementMonitor *element_monitor);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,8 @@ gst_qa_runner_setup (GstQaRunner * runner)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
GST_INFO_OBJECT (runner, "Starting QA Runner setup");
|
GST_INFO_OBJECT (runner, "Starting QA Runner setup");
|
||||||
runner->monitor = gst_qa_monitor_factory_create (runner->pipeline, runner);
|
runner->monitor =
|
||||||
|
gst_qa_monitor_factory_create (runner->pipeline, runner, NULL);
|
||||||
if (runner->monitor == NULL) {
|
if (runner->monitor == NULL) {
|
||||||
GST_WARNING_OBJECT (runner, "Setup failed");
|
GST_WARNING_OBJECT (runner, "Setup failed");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
Loading…
Reference in a new issue