summaryrefslogtreecommitdiff
path: root/gst/debugutils/gstfakesinkutils.c
blob: 46ac9830f4823ec243156126ae1261c231da520f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
/*
 * GStreamer
 * Copyright (C) 2017 Collabora Inc.
 *   Author: Nicolas Dufresne <nicolas.dufresne@collabora.com>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public
 * License along with this library; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#include "gstfakesinkutils.h"
#include <gst/base/gstbasesink.h>

/* TODO complete the types */
void
gst_fake_sink_proxy_properties (GstElement * self,
    GstElement * child, guint property_id_offset)
{
  GObjectClass *object_class;
  GParamSpec **properties;
  guint n_properties, i;

  object_class = G_OBJECT_CLASS (GST_ELEMENT_GET_CLASS (self));
  properties = g_object_class_list_properties (G_OBJECT_GET_CLASS (child),
      &n_properties);

  for (i = 0; i < n_properties; i++) {
    guint property_id = i + property_id_offset;

    if (properties[i]->owner_type != G_OBJECT_TYPE (child) &&
        properties[i]->owner_type != GST_TYPE_BASE_SINK)
      continue;

    if (G_IS_PARAM_SPEC_BOOLEAN (properties[i])) {
      GParamSpecBoolean *prop = G_PARAM_SPEC_BOOLEAN (properties[i]);
      g_object_class_install_property (object_class, property_id,
          g_param_spec_boolean (g_param_spec_get_name (properties[i]),
              g_param_spec_get_nick (properties[i]),
              g_param_spec_get_blurb (properties[i]),
              prop->default_value, properties[i]->flags));
    } else if (G_IS_PARAM_SPEC_INT (properties[i])) {
      GParamSpecInt *prop = G_PARAM_SPEC_INT (properties[i]);
      g_object_class_install_property (object_class, property_id,
          g_param_spec_int (g_param_spec_get_name (properties[i]),
              g_param_spec_get_nick (properties[i]),
              g_param_spec_get_blurb (properties[i]),
              prop->minimum, prop->maximum, prop->default_value,
              properties[i]->flags));
    } else if (G_IS_PARAM_SPEC_UINT (properties[i])) {
      GParamSpecUInt *prop = G_PARAM_SPEC_UINT (properties[i]);
      g_object_class_install_property (object_class, property_id,
          g_param_spec_uint (g_param_spec_get_name (properties[i]),
              g_param_spec_get_nick (properties[i]),
              g_param_spec_get_blurb (properties[i]),
              prop->minimum, prop->maximum, prop->default_value,
              properties[i]->flags));
    } else if (G_IS_PARAM_SPEC_INT64 (properties[i])) {
      GParamSpecInt64 *prop = G_PARAM_SPEC_INT64 (properties[i]);
      g_object_class_install_property (object_class, property_id,
          g_param_spec_int64 (g_param_spec_get_name (properties[i]),
              g_param_spec_get_nick (properties[i]),
              g_param_spec_get_blurb (properties[i]),
              prop->minimum, prop->maximum, prop->default_value,
              properties[i]->flags));
    } else if (G_IS_PARAM_SPEC_UINT64 (properties[i])) {
      GParamSpecUInt64 *prop = G_PARAM_SPEC_UINT64 (properties[i]);
      g_object_class_install_property (object_class, property_id,
          g_param_spec_uint64 (g_param_spec_get_name (properties[i]),
              g_param_spec_get_nick (properties[i]),
              g_param_spec_get_blurb (properties[i]),
              prop->minimum, prop->maximum, prop->default_value,
              properties[i]->flags));
    } else if (G_IS_PARAM_SPEC_ENUM (properties[i])) {
      GParamSpecEnum *prop = G_PARAM_SPEC_ENUM (properties[i]);
      g_object_class_install_property (object_class, property_id,
          g_param_spec_enum (g_param_spec_get_name (properties[i]),
              g_param_spec_get_nick (properties[i]),
              g_param_spec_get_blurb (properties[i]),
              properties[i]->value_type, prop->default_value,
              properties[i]->flags));
    } else if (G_IS_PARAM_SPEC_STRING (properties[i])) {
      GParamSpecString *prop = G_PARAM_SPEC_STRING (properties[i]);
      g_object_class_install_property (object_class, property_id,
          g_param_spec_string (g_param_spec_get_name (properties[i]),
              g_param_spec_get_nick (properties[i]),
              g_param_spec_get_blurb (properties[i]),
              prop->default_value, properties[i]->flags));
    } else if (G_IS_PARAM_SPEC_BOXED (properties[i])) {
      g_object_class_install_property (object_class, property_id,
          g_param_spec_boxed (g_param_spec_get_name (properties[i]),
              g_param_spec_get_nick (properties[i]),
              g_param_spec_get_blurb (properties[i]),
              properties[i]->value_type, properties[i]->flags));
    }
  }

  g_free (properties);
}