[gst-cvs] gst-plugins-bad: lv2: simpify property registration
Stefan Kost
ensonic at kemper.freedesktop.org
Sun Jan 31 14:37:25 PST 2010
Module: gst-plugins-bad
Branch: master
Commit: 165847218302194d993e42822f4307cb5518a03d
URL: http://cgit.freedesktop.org/gstreamer/gst-plugins-bad/commit/?id=165847218302194d993e42822f4307cb5518a03d
Author: Stefan Kost <ensonic at users.sf.net>
Date: Sun Jan 31 22:21:42 2010 +0200
lv2: simpify property registration
Avoid type cheking casts for each property. Use a running index.
---
ext/lv2/gstlv2.c | 21 +++++++++------------
1 files changed, 9 insertions(+), 12 deletions(-)
diff --git a/ext/lv2/gstlv2.c b/ext/lv2/gstlv2.c
index cfc2f69..2dc157e 100644
--- a/ext/lv2/gstlv2.c
+++ b/ext/lv2/gstlv2.c
@@ -476,7 +476,8 @@ gst_lv2_class_init (GstLV2Class * klass, SLV2Plugin lv2plugin)
{
GObjectClass *gobject_class;
GstSignalProcessorClass *gsp_class;
- gint i;
+ GParamSpec *p;
+ gint i, ix;
GST_DEBUG ("class_init %p", klass);
@@ -493,27 +494,23 @@ gst_lv2_class_init (GstLV2Class * klass, SLV2Plugin lv2plugin)
klass->plugin = lv2plugin;
- /* register properties */
+ /* properties have an offset of 1 */
+ ix = 1;
- for (i = 0; i < gsp_class->num_control_in; i++) {
- GParamSpec *p;
+ /* register properties */
+ for (i = 0; i < gsp_class->num_control_in; i++, ix++) {
p = gst_lv2_class_get_param_spec (klass,
g_array_index (klass->control_in_ports, GstLV2Port, i).index);
- /* properties have an offset of 1 */
- g_object_class_install_property (G_OBJECT_CLASS (klass), i + 1, p);
+ g_object_class_install_property (gobject_class, ix, p);
}
- for (i = 0; i < gsp_class->num_control_out; i++) {
- GParamSpec *p;
-
+ for (i = 0; i < gsp_class->num_control_out; i++, ix++) {
p = gst_lv2_class_get_param_spec (klass,
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 (G_OBJECT_CLASS (klass),
- gsp_class->num_control_in + i + 1, p);
+ g_object_class_install_property (gobject_class, ix, p);
}
}
More information about the Gstreamer-commits
mailing list