summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Dröge <sebastian.droege@collabora.co.uk>2009-06-27 09:51:01 +0200
committerSebastian Dröge <sebastian.droege@collabora.co.uk>2009-06-27 09:52:22 +0200
commitcd6422a37272bfd47ce24c9762e4edb1b7b5e682 (patch)
tree7995ad4a1c71eb2e8c6f66243ea71f7aa5cd4c90
parent3d6d1c2ed25e338ce340da098bad0459298cc117 (diff)
downloadgst-plugins-bad-cd6422a37272bfd47ce24c9762e4edb1b7b5e682.tar.gz
gst-plugins-bad-cd6422a37272bfd47ce24c9762e4edb1b7b5e682.tar.bz2
gst-plugins-bad-cd6422a37272bfd47ce24c9762e4edb1b7b5e682.zip
frei0r: Set the default property values correctly
-rw-r--r--gst/frei0r/gstfrei0r.c47
1 files changed, 38 insertions, 9 deletions
diff --git a/gst/frei0r/gstfrei0r.c b/gst/frei0r/gstfrei0r.c
index 0f7ba5c5..3cfc939b 100644
--- a/gst/frei0r/gstfrei0r.c
+++ b/gst/frei0r/gstfrei0r.c
@@ -86,51 +86,71 @@ gst_frei0r_klass_install_properties (GObjectClass * gobject_class,
case F0R_PARAM_BOOL:
g_object_class_install_property (gobject_class, count++,
g_param_spec_boolean (prop_name, param_info->name,
- param_info->explanation, FALSE,
+ param_info->explanation, properties[i].default_value.data.b,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
properties[i].n_prop_ids = 1;
break;
- case F0R_PARAM_DOUBLE:
+ case F0R_PARAM_DOUBLE:{
+ gdouble def = properties[i].default_value.data.d;
+
+ /* If the default is NAN, +-INF we use 0.0 */
+ if (!(def <= G_MAXDOUBLE && def >= -G_MAXDOUBLE))
+ def = 0.0;
+
g_object_class_install_property (gobject_class, count++,
g_param_spec_double (prop_name, param_info->name,
- param_info->explanation, -G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
+ param_info->explanation, -G_MAXDOUBLE, G_MAXDOUBLE, def,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
properties[i].n_prop_ids = 1;
break;
+ }
case F0R_PARAM_STRING:
g_object_class_install_property (gobject_class, count++,
g_param_spec_string (prop_name, param_info->name,
- param_info->explanation, NULL,
+ param_info->explanation, properties[i].default_value.data.s,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
properties[i].n_prop_ids = 1;
break;
case F0R_PARAM_COLOR:{
gchar *prop_name_full;
gchar *prop_nick_full;
+ gdouble def;
+ def = properties[i].default_value.data.color.r;
+ /* If the default is out of range we use 0.0 */
+ if (!(def <= 1.0 && def >= 0.0))
+ def = 0.0;
prop_name_full = g_strconcat (prop_name, "-r", NULL);
prop_nick_full = g_strconcat (param_info->name, "-R", NULL);
g_object_class_install_property (gobject_class, count++,
g_param_spec_float (prop_name_full, prop_nick_full,
- param_info->explanation, 0.0, 1.0, 0.0,
+ param_info->explanation, 0.0, 1.0, def,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_free (prop_name_full);
g_free (prop_nick_full);
+ def = properties[i].default_value.data.color.g;
+ /* If the default is out of range we use 0.0 */
+ if (!(def <= 1.0 && def >= 0.0))
+ def = 0.0;
prop_name_full = g_strconcat (prop_name, "-g", NULL);
prop_nick_full = g_strconcat (param_info->name, "-G", NULL);
g_object_class_install_property (gobject_class, count++,
g_param_spec_float (prop_name_full, param_info->name,
- param_info->explanation, 0.0, 1.0, 0.0,
+ param_info->explanation, 0.0, 1.0, def,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_free (prop_name_full);
g_free (prop_nick_full);
+ def = properties[i].default_value.data.color.b;
+ /* If the default is out of range we use 0.0 */
+ if (!(def <= 1.0 && def >= 0.0))
+ def = 0.0;
prop_name_full = g_strconcat (prop_name, "-b", NULL);
prop_nick_full = g_strconcat (param_info->name, "-B", NULL);
g_object_class_install_property (gobject_class, count++,
g_param_spec_float (prop_name_full, param_info->name,
- param_info->explanation, 0.0, 1.0, 0.0,
+ param_info->explanation, 0.0, 1.0, def,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_free (prop_name_full);
g_free (prop_nick_full);
@@ -141,21 +161,30 @@ gst_frei0r_klass_install_properties (GObjectClass * gobject_class,
case F0R_PARAM_POSITION:{
gchar *prop_name_full;
gchar *prop_nick_full;
+ gdouble def;
+ def = properties[i].default_value.data.position.x;
+ /* If the default is out of range we use 0.0 */
+ if (!(def <= 1.0 && def >= 0.0))
+ def = 0.0;
prop_name_full = g_strconcat (prop_name, "-x", NULL);
prop_nick_full = g_strconcat (param_info->name, "-X", NULL);
g_object_class_install_property (gobject_class, count++,
g_param_spec_double (prop_name_full, param_info->name,
- param_info->explanation, 0.0, 1.0, 0.0,
+ param_info->explanation, 0.0, 1.0, def,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_free (prop_name_full);
g_free (prop_nick_full);
+ def = properties[i].default_value.data.position.y;
+ /* If the default is out of range we use 0.0 */
+ if (!(def <= 1.0 && def >= 0.0))
+ def = 0.0;
prop_name_full = g_strconcat (prop_name, "-Y", NULL);
prop_nick_full = g_strconcat (param_info->name, "-X", NULL);
g_object_class_install_property (gobject_class, count++,
g_param_spec_double (prop_name_full, param_info->name,
- param_info->explanation, 0.0, 1.0, 0.0,
+ param_info->explanation, 0.0, 1.0, def,
G_PARAM_READWRITE | GST_PARAM_CONTROLLABLE));
g_free (prop_name_full);
g_free (prop_nick_full);