3 * Copyright (C) 2013 Collabora Ltd.
4 * Author: Thiago Sousa Santos <thiago.sousa.santos@collabora.com>
6 * gst-validate-monitor-factory.c - Validate Element monitors factory utility functions
8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either
11 * version 2.1 of the License, or (at your option) any later version.
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Library General Public License for more details.
18 * You should have received a copy of the GNU Library General Public
19 * License along with this library; if not, write to the
20 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
21 * Boston, MA 02111-1307, USA.
25 * SECTION:gst-validate-monitor-factory
26 * @title: GstValidateMonitorFactory
27 * @short_description: Lets you start monitoring a #GstObject with GstValidate
29 * To start monitoring and thus run GstValidate tests on a #GstPipeline, the only thing to
30 * do is to instanciate a #GstValidateRunner and then attach a #GstValidateMonitor
31 * to it with #gst_validate_monitor_factory_create
38 #include "gst-validate-monitor-factory.h"
39 #include "gst-validate-bin-monitor.h"
40 #include "gst-validate-pipeline-monitor.h"
41 #include "gst-validate-pad-monitor.h"
42 #include "gst-validate-override-registry.h"
45 * gst_validate_monitor_factory_create:
46 * @target: The #GstObject to create a #GstValidateMonitor for
47 * @runner: The #GstValidateRunner to use for the new monitor
48 * @parent: (nullable): The parent of the new monitor
50 * Create a new monitor for @target and starts monitoring it.
52 * Returns: (transfer full): The newly created #GstValidateMonitor
55 gst_validate_monitor_factory_create (GstObject * target,
56 GstValidateRunner * runner, GstValidateMonitor * parent)
58 GstValidateMonitor *monitor = NULL;
59 g_return_val_if_fail (target != NULL, NULL);
61 monitor = g_object_get_data ((GObject *) target, "validate-monitor");
63 GST_INFO_OBJECT (target, "Is already monitored by %" GST_PTR_FORMAT,
66 return g_object_ref (monitor);
69 if (GST_IS_PAD (target)) {
71 GST_VALIDATE_MONITOR_CAST (gst_validate_pad_monitor_new (GST_PAD_CAST
72 (target), runner, GST_VALIDATE_ELEMENT_MONITOR_CAST (parent)));
73 } else if (GST_IS_PIPELINE (target)) {
75 GST_VALIDATE_MONITOR_CAST (gst_validate_pipeline_monitor_new
76 (GST_PIPELINE_CAST (target), runner, parent));
77 } else if (GST_IS_BIN (target)) {
79 GST_VALIDATE_MONITOR_CAST (gst_validate_bin_monitor_new (GST_BIN_CAST
80 (target), runner, parent));
81 } else if (GST_IS_ELEMENT (target)) {
83 GST_VALIDATE_MONITOR_CAST (gst_validate_element_monitor_new
84 (GST_ELEMENT_CAST (target), runner, parent));
86 g_assert_not_reached ();