1 /*
2 * GStreamer
3 * Copyright (C) 2017 Collabora Inc.
4 * Author: Nicolas Dufresne <nicolas.dufresne@collabora.com>
5 *
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.
10 *
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.
15 *
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.
20 */
21
22 #include "gstfakesinkutils.h"
23 #include <gst/base/gstbasesink.h>
24
25 /* TODO complete the types */
26 void
gst_fake_sink_proxy_properties(GstElement * self,GstElement * child,guint property_id_offset)27 gst_fake_sink_proxy_properties (GstElement * self,
28 GstElement * child, guint property_id_offset)
29 {
30 GObjectClass *object_class;
31 GParamSpec **properties;
32 guint n_properties, i;
33
34 object_class = G_OBJECT_CLASS (GST_ELEMENT_GET_CLASS (self));
35 properties = g_object_class_list_properties (G_OBJECT_GET_CLASS (child),
36 &n_properties);
37
38 for (i = 0; i < n_properties; i++) {
39 guint property_id = i + property_id_offset;
40
41 if (properties[i]->owner_type != G_OBJECT_TYPE (child) &&
42 properties[i]->owner_type != GST_TYPE_BASE_SINK)
43 continue;
44
45 if (G_IS_PARAM_SPEC_BOOLEAN (properties[i])) {
46 GParamSpecBoolean *prop = G_PARAM_SPEC_BOOLEAN (properties[i]);
47 g_object_class_install_property (object_class, property_id,
48 g_param_spec_boolean (g_param_spec_get_name (properties[i]),
49 g_param_spec_get_nick (properties[i]),
50 g_param_spec_get_blurb (properties[i]),
51 prop->default_value, properties[i]->flags));
52 } else if (G_IS_PARAM_SPEC_INT (properties[i])) {
53 GParamSpecInt *prop = G_PARAM_SPEC_INT (properties[i]);
54 g_object_class_install_property (object_class, property_id,
55 g_param_spec_int (g_param_spec_get_name (properties[i]),
56 g_param_spec_get_nick (properties[i]),
57 g_param_spec_get_blurb (properties[i]),
58 prop->minimum, prop->maximum, prop->default_value,
59 properties[i]->flags));
60 } else if (G_IS_PARAM_SPEC_UINT (properties[i])) {
61 GParamSpecUInt *prop = G_PARAM_SPEC_UINT (properties[i]);
62 g_object_class_install_property (object_class, property_id,
63 g_param_spec_uint (g_param_spec_get_name (properties[i]),
64 g_param_spec_get_nick (properties[i]),
65 g_param_spec_get_blurb (properties[i]),
66 prop->minimum, prop->maximum, prop->default_value,
67 properties[i]->flags));
68 } else if (G_IS_PARAM_SPEC_INT64 (properties[i])) {
69 GParamSpecInt64 *prop = G_PARAM_SPEC_INT64 (properties[i]);
70 g_object_class_install_property (object_class, property_id,
71 g_param_spec_int64 (g_param_spec_get_name (properties[i]),
72 g_param_spec_get_nick (properties[i]),
73 g_param_spec_get_blurb (properties[i]),
74 prop->minimum, prop->maximum, prop->default_value,
75 properties[i]->flags));
76 } else if (G_IS_PARAM_SPEC_UINT64 (properties[i])) {
77 GParamSpecUInt64 *prop = G_PARAM_SPEC_UINT64 (properties[i]);
78 g_object_class_install_property (object_class, property_id,
79 g_param_spec_uint64 (g_param_spec_get_name (properties[i]),
80 g_param_spec_get_nick (properties[i]),
81 g_param_spec_get_blurb (properties[i]),
82 prop->minimum, prop->maximum, prop->default_value,
83 properties[i]->flags));
84 } else if (G_IS_PARAM_SPEC_ENUM (properties[i])) {
85 GParamSpecEnum *prop = G_PARAM_SPEC_ENUM (properties[i]);
86 g_object_class_install_property (object_class, property_id,
87 g_param_spec_enum (g_param_spec_get_name (properties[i]),
88 g_param_spec_get_nick (properties[i]),
89 g_param_spec_get_blurb (properties[i]),
90 properties[i]->value_type, prop->default_value,
91 properties[i]->flags));
92 } else if (G_IS_PARAM_SPEC_STRING (properties[i])) {
93 GParamSpecString *prop = G_PARAM_SPEC_STRING (properties[i]);
94 g_object_class_install_property (object_class, property_id,
95 g_param_spec_string (g_param_spec_get_name (properties[i]),
96 g_param_spec_get_nick (properties[i]),
97 g_param_spec_get_blurb (properties[i]),
98 prop->default_value, properties[i]->flags));
99 } else if (G_IS_PARAM_SPEC_BOXED (properties[i])) {
100 g_object_class_install_property (object_class, property_id,
101 g_param_spec_boxed (g_param_spec_get_name (properties[i]),
102 g_param_spec_get_nick (properties[i]),
103 g_param_spec_get_blurb (properties[i]),
104 properties[i]->value_type, properties[i]->flags));
105 }
106 }
107
108 g_free (properties);
109 }
110