3 * Copyright (C) 2017 Collabora Inc.
4 * Author: Nicolas Dufresne <nicolas.dufresne@collabora.com>
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
19 * Boston, MA 02110-1301, USA.
22 #include "gstfakesinkutils.h"
23 #include <gst/base/gstbasesink.h>
25 /* TODO complete the types */
27 gst_util_proxy_class_properties (GObjectClass * object_class,
28 GObjectClass * target_class, guint property_id_offset)
30 GParamSpec **properties;
31 guint n_properties, i;
33 properties = g_object_class_list_properties (G_OBJECT_CLASS (target_class),
36 for (i = 0; i < n_properties; i++) {
37 guint property_id = i + property_id_offset;
39 if (properties[i]->owner_type == G_TYPE_OBJECT
40 || properties[i]->owner_type == GST_TYPE_OBJECT)
43 if (G_IS_PARAM_SPEC_BOOLEAN (properties[i])) {
44 GParamSpecBoolean *prop = G_PARAM_SPEC_BOOLEAN (properties[i]);
45 g_object_class_install_property (object_class, property_id,
46 g_param_spec_boolean (g_param_spec_get_name (properties[i]),
47 g_param_spec_get_nick (properties[i]),
48 g_param_spec_get_blurb (properties[i]),
49 prop->default_value, properties[i]->flags));
50 } else if (G_IS_PARAM_SPEC_INT (properties[i])) {
51 GParamSpecInt *prop = G_PARAM_SPEC_INT (properties[i]);
52 g_object_class_install_property (object_class, property_id,
53 g_param_spec_int (g_param_spec_get_name (properties[i]),
54 g_param_spec_get_nick (properties[i]),
55 g_param_spec_get_blurb (properties[i]),
56 prop->minimum, prop->maximum, prop->default_value,
57 properties[i]->flags));
58 } else if (G_IS_PARAM_SPEC_UINT (properties[i])) {
59 GParamSpecUInt *prop = G_PARAM_SPEC_UINT (properties[i]);
60 g_object_class_install_property (object_class, property_id,
61 g_param_spec_uint (g_param_spec_get_name (properties[i]),
62 g_param_spec_get_nick (properties[i]),
63 g_param_spec_get_blurb (properties[i]),
64 prop->minimum, prop->maximum, prop->default_value,
65 properties[i]->flags));
66 } else if (G_IS_PARAM_SPEC_INT64 (properties[i])) {
67 GParamSpecInt64 *prop = G_PARAM_SPEC_INT64 (properties[i]);
68 g_object_class_install_property (object_class, property_id,
69 g_param_spec_int64 (g_param_spec_get_name (properties[i]),
70 g_param_spec_get_nick (properties[i]),
71 g_param_spec_get_blurb (properties[i]),
72 prop->minimum, prop->maximum, prop->default_value,
73 properties[i]->flags));
74 } else if (G_IS_PARAM_SPEC_UINT64 (properties[i])) {
75 GParamSpecUInt64 *prop = G_PARAM_SPEC_UINT64 (properties[i]);
76 g_object_class_install_property (object_class, property_id,
77 g_param_spec_uint64 (g_param_spec_get_name (properties[i]),
78 g_param_spec_get_nick (properties[i]),
79 g_param_spec_get_blurb (properties[i]),
80 prop->minimum, prop->maximum, prop->default_value,
81 properties[i]->flags));
82 } else if (G_IS_PARAM_SPEC_ENUM (properties[i])) {
83 GParamSpecEnum *prop = G_PARAM_SPEC_ENUM (properties[i]);
84 g_object_class_install_property (object_class, property_id,
85 g_param_spec_enum (g_param_spec_get_name (properties[i]),
86 g_param_spec_get_nick (properties[i]),
87 g_param_spec_get_blurb (properties[i]),
88 properties[i]->value_type, prop->default_value,
89 properties[i]->flags));
90 } else if (G_IS_PARAM_SPEC_STRING (properties[i])) {
91 GParamSpecString *prop = G_PARAM_SPEC_STRING (properties[i]);
92 g_object_class_install_property (object_class, property_id,
93 g_param_spec_string (g_param_spec_get_name (properties[i]),
94 g_param_spec_get_nick (properties[i]),
95 g_param_spec_get_blurb (properties[i]),
96 prop->default_value, properties[i]->flags));
97 } else if (G_IS_PARAM_SPEC_BOXED (properties[i])) {
98 g_object_class_install_property (object_class, property_id,
99 g_param_spec_boxed (g_param_spec_get_name (properties[i]),
100 g_param_spec_get_nick (properties[i]),
101 g_param_spec_get_blurb (properties[i]),
102 properties[i]->value_type, properties[i]->flags));