diff options
author | Stefan Kost <ensonic@users.sf.net> | 2010-01-31 22:21:42 +0200 |
---|---|---|
committer | Stefan Kost <ensonic@users.sf.net> | 2010-01-31 22:25:52 +0200 |
commit | 165847218302194d993e42822f4307cb5518a03d (patch) | |
tree | d24bdd7993d587a1b46cacd31c7a2bb06e4d289c | |
parent | 6bff8711d0e087e8b20507dd92c25850cdff3c18 (diff) | |
download | gstreamer-plugins-bad-165847218302194d993e42822f4307cb5518a03d.tar.gz |
lv2: simpify property registration
Avoid type cheking casts for each property. Use a running index.
-rw-r--r-- | 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 cfc2f69b2..2dc157ec4 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); } } |