mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
libs/gst/controller/: Keep last-value and only call set_property if value has changed. This supresses all the g_objec...
Original commit message from CVS: * libs/gst/controller/gstcontroller.c: * libs/gst/controller/gstcontrollerprivate.h: Keep last-value and only call set_property if value has changed. This supresses all the g_object_notifies we would trigger otherwise. It also allows the user to chage the value while there is no controller change.
This commit is contained in:
parent
d27aea0391
commit
627c40985b
3 changed files with 17 additions and 1 deletions
|
@ -1,3 +1,12 @@
|
|||
2008-11-17 Stefan Kost <ensonic@users.sf.net>
|
||||
|
||||
* libs/gst/controller/gstcontroller.c:
|
||||
* libs/gst/controller/gstcontrollerprivate.h:
|
||||
Keep last-value and only call set_property if value has changed. This
|
||||
supresses all the g_object_notifies we would trigger otherwise. It
|
||||
also allows the user to chage the value while there is no controller
|
||||
change.
|
||||
|
||||
2008-11-17 Stefan Kost <ensonic@users.sf.net>
|
||||
|
||||
* gst/gstvalue.c:
|
||||
|
|
|
@ -146,6 +146,8 @@ gst_controlled_property_new (GObject * object, const gchar * name)
|
|||
prop->pspec = pspec;
|
||||
prop->name = pspec->name;
|
||||
prop->disabled = FALSE;
|
||||
memset (&prop->last_value, 0, sizeof (GValue));
|
||||
g_value_init (&prop->last_value, G_PARAM_SPEC_VALUE_TYPE (prop->pspec));
|
||||
}
|
||||
} else {
|
||||
GST_WARNING ("class '%s' has no property '%s'", G_OBJECT_TYPE_NAME (object),
|
||||
|
@ -166,6 +168,7 @@ gst_controlled_property_free (GstControlledProperty * prop)
|
|||
{
|
||||
if (prop->csource)
|
||||
g_object_unref (prop->csource);
|
||||
g_value_unset (&prop->last_value);
|
||||
g_free (prop);
|
||||
}
|
||||
|
||||
|
@ -691,7 +694,10 @@ gst_controller_sync_values (GstController * self, GstClockTime timestamp)
|
|||
g_value_init (&value, G_PARAM_SPEC_VALUE_TYPE (prop->pspec));
|
||||
ret = gst_control_source_get_value (prop->csource, timestamp, &value);
|
||||
if (G_LIKELY (ret)) {
|
||||
g_object_set_property (self->object, prop->name, &value);
|
||||
if (gst_value_compare (&value, &prop->last_value) != GST_VALUE_EQUAL) {
|
||||
g_object_set_property (self->object, prop->name, &value);
|
||||
g_value_copy (&value, &prop->last_value);
|
||||
}
|
||||
} else {
|
||||
GST_LOG ("no control value");
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ typedef struct _GstControlledProperty
|
|||
gchar *name; /* name of the property */
|
||||
GstControlSource *csource; /* GstControlSource for this property */
|
||||
gboolean disabled;
|
||||
GValue last_value;
|
||||
} GstControlledProperty;
|
||||
|
||||
#define GST_CONTROLLED_PROPERTY(obj) ((GstControlledProperty *)(obj))
|
||||
|
|
Loading…
Reference in a new issue