static void gst_iir_equalizer_3bands_set_property (GObject * object, guint prop_id, const GValue * value, GParamSpec * pspec) { GstIirEqualizer *equ = GST_IIR_EQUALIZER (object); switch (prop_id) { case ARG_BAND0: gst_child_proxy_set_property (GST_OBJECT (equ), "band0::gain", value); break; case ARG_BAND1: gst_child_proxy_set_property (GST_OBJECT (equ), "band1::gain", value); break; case ARG_BAND2: gst_child_proxy_set_property (GST_OBJECT (equ), "band2::gain", value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
/* load the presets of @name for the instance @preset. Returns %FALSE if something * failed. */ static gboolean gst_preset_default_load_preset (GstPreset * preset, const gchar * name) { GKeyFile *presets; gchar **props; guint i; GObjectClass *gclass; gboolean is_child_proxy; /* get the presets from the type */ if (!(presets = preset_get_keyfile (preset))) goto no_presets; /* get the preset name */ if (!g_key_file_has_group (presets, name)) goto no_group; GST_DEBUG_OBJECT (preset, "loading preset : '%s'", name); /* get the properties that we can configure in this element */ if (!(props = gst_preset_get_property_names (preset))) goto no_properties; gclass = G_OBJECT_CLASS (GST_ELEMENT_GET_CLASS (preset)); is_child_proxy = GST_IS_CHILD_PROXY (preset); /* for each of the property names, find the preset parameter and try to * configure the property with its value */ for (i = 0; props[i]; i++) { gchar *str; GValue gvalue = { 0, }; GParamSpec *property = NULL; /* check if we have a settings for this element property */ if (!(str = g_key_file_get_value (presets, name, props[i], NULL))) { /* the element has a property but the parameter is not in the keyfile */ GST_WARNING_OBJECT (preset, "parameter '%s' not in preset", props[i]); continue; } GST_DEBUG_OBJECT (preset, "setting value '%s' for property '%s'", str, props[i]); if (is_child_proxy) { gst_child_proxy_lookup ((GstChildProxy *) preset, props[i], NULL, &property); } else { property = g_object_class_find_property (gclass, props[i]); } if (!property) { /* the parameter was in the keyfile, the element said it supported it but * then the property was not found in the element. This should not happen. */ GST_WARNING_OBJECT (preset, "property '%s' not in object", props[i]); g_free (str); continue; } /* try to deserialize the property value from the keyfile and set it as * the object property */ g_value_init (&gvalue, property->value_type); if (gst_value_deserialize (&gvalue, str)) { if (is_child_proxy) { gst_child_proxy_set_property ((GstChildProxy *) preset, props[i], &gvalue); } else { g_object_set_property ((GObject *) preset, props[i], &gvalue); } } else { GST_WARNING_OBJECT (preset, "deserialization of value '%s' for property '%s' failed", str, props[i]); } g_value_unset (&gvalue); g_free (str); } g_strfreev (props); return TRUE; /* ERRORS */ no_presets: { GST_WARNING_OBJECT (preset, "no presets"); return FALSE; } no_group: { GST_WARNING_OBJECT (preset, "no preset named '%s'", name); return FALSE; } no_properties: { GST_INFO_OBJECT (preset, "no properties"); return FALSE; } }