static void gst_iir_equalizer_3bands_get_property (GObject * object, guint prop_id, GValue * value, GParamSpec * pspec) { GstIirEqualizer *equ = GST_IIR_EQUALIZER (object); switch (prop_id) { case ARG_BAND0: gst_child_proxy_get_property (GST_OBJECT (equ), "band0::gain", value); break; case ARG_BAND1: gst_child_proxy_get_property (GST_OBJECT (equ), "band1::gain", value); break; case ARG_BAND2: gst_child_proxy_get_property (GST_OBJECT (equ), "band2::gain", value); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } }
/* save the preset with the given name */ static gboolean gst_preset_default_save_preset (GstPreset * preset, const gchar * name) { GKeyFile *presets; gchar **props; guint i; GObjectClass *gclass; gboolean is_child_proxy; GST_INFO_OBJECT (preset, "saving new preset: %s", name); /* get the presets from the type */ if (!(presets = preset_get_keyfile (preset))) goto no_presets; /* take copies of current gobject properties from preset */ 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); /* loop over the object properties and store the property value in the * keyfile */ for (i = 0; props[i]; i++) { GValue gvalue = { 0, }; gchar *str; GParamSpec *property = NULL; 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 element said it supported the property but then it does not have * that property. This should not happen. */ GST_WARNING_OBJECT (preset, "property '%s' not in object", props[i]); continue; } g_value_init (&gvalue, property->value_type); if (is_child_proxy) { gst_child_proxy_get_property ((GstChildProxy *) preset, props[i], &gvalue); } else { g_object_get_property ((GObject *) preset, props[i], &gvalue); } if ((str = gst_value_serialize (&gvalue))) { g_key_file_set_string (presets, name, props[i], (gpointer) str); g_free (str); } else { GST_WARNING_OBJECT (preset, "serialization for property '%s' failed", props[i]); } g_value_unset (&gvalue); } GST_INFO_OBJECT (preset, " saved"); g_strfreev (props); /* save updated version */ return gst_preset_default_save_presets_file (preset); /* ERRORS */ no_presets: { GST_WARNING_OBJECT (preset, "no presets"); return FALSE; } no_properties: { GST_INFO_OBJECT (preset, "no properties"); return FALSE; } }