mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-04-26 06:54:49 +00:00
lv2: simpify property registration
Avoid type cheking casts for each property. Use a running index.
This commit is contained in:
parent
6bff8711d0
commit
1658472183
1 changed files with 9 additions and 12 deletions
|
@ -476,7 +476,8 @@ gst_lv2_class_init (GstLV2Class * klass, SLV2Plugin lv2plugin)
|
||||||
{
|
{
|
||||||
GObjectClass *gobject_class;
|
GObjectClass *gobject_class;
|
||||||
GstSignalProcessorClass *gsp_class;
|
GstSignalProcessorClass *gsp_class;
|
||||||
gint i;
|
GParamSpec *p;
|
||||||
|
gint i, ix;
|
||||||
|
|
||||||
GST_DEBUG ("class_init %p", klass);
|
GST_DEBUG ("class_init %p", klass);
|
||||||
|
|
||||||
|
@ -493,27 +494,23 @@ gst_lv2_class_init (GstLV2Class * klass, SLV2Plugin lv2plugin)
|
||||||
|
|
||||||
klass->plugin = lv2plugin;
|
klass->plugin = lv2plugin;
|
||||||
|
|
||||||
|
/* properties have an offset of 1 */
|
||||||
|
ix = 1;
|
||||||
|
|
||||||
/* register properties */
|
/* register properties */
|
||||||
|
|
||||||
for (i = 0; i < gsp_class->num_control_in; i++) {
|
for (i = 0; i < gsp_class->num_control_in; i++, ix++) {
|
||||||
GParamSpec *p;
|
|
||||||
|
|
||||||
p = gst_lv2_class_get_param_spec (klass,
|
p = gst_lv2_class_get_param_spec (klass,
|
||||||
g_array_index (klass->control_in_ports, GstLV2Port, i).index);
|
g_array_index (klass->control_in_ports, GstLV2Port, i).index);
|
||||||
|
|
||||||
/* properties have an offset of 1 */
|
g_object_class_install_property (gobject_class, ix, p);
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass), i + 1, p);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < gsp_class->num_control_out; i++) {
|
for (i = 0; i < gsp_class->num_control_out; i++, ix++) {
|
||||||
GParamSpec *p;
|
|
||||||
|
|
||||||
p = gst_lv2_class_get_param_spec (klass,
|
p = gst_lv2_class_get_param_spec (klass,
|
||||||
g_array_index (klass->control_out_ports, GstLV2Port, i).index);
|
g_array_index (klass->control_out_ports, GstLV2Port, i).index);
|
||||||
|
|
||||||
/* properties have an offset of 1, and we already added num_control_in */
|
g_object_class_install_property (gobject_class, ix, p);
|
||||||
g_object_class_install_property (G_OBJECT_CLASS (klass),
|
|
||||||
gsp_class->num_control_in + i + 1, p);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue