2008-12-09 Stefan Kost <ensonic@users.sf.net>
+ * libs/gst/controller/gstcontroller.c:
+ Aggregate return value for gst_controller_sync_values(). More info in
+ logging. Always set values on first sync-call.
+
+ * libs/gst/controller/gstcontrolsource.c:
+ Microoptimizations.
+
+ * libs/gst/controller/gsthelper.c:
+ Fix return code and comment.
+
+
+2008-12-09 Stefan Kost <ensonic@users.sf.net>
+
* tools/gst-launch.1.in:
Fix description of how to specify a type in caps. Fixes #553873.
Also ranges and list contain values and not property-assignments.
* Gets the value for the given controller-handled property at the requested
* time.
*
- * Returns: the GValue of the property at the given time, or %NULL if the property isn't handled by the controller
+ * Returns: the GValue of the property at the given time, or %NULL if the
+ * property isn't handled by the controller
*/
GValue *
gst_controller_get (GstController * self, gchar * property_name,
* Sets the properties of the element, according to the controller that (maybe)
* handles them and for the given timestamp.
*
+ * If this function fails, it is most likely the application developers fault.
+ * Most probably the control sources are not setup correctly.
+ *
* Returns: %TRUE if the controller values could be applied to the object
* properties, %FALSE otherwise
*/
{
GstControlledProperty *prop;
GList *node;
- gboolean ret = FALSE;
+ gboolean ret = TRUE, val_ret;
GValue value = { 0, };
g_return_val_if_fail (GST_IS_CONTROLLER (self), FALSE);
for (node = self->properties; node; node = g_list_next (node)) {
prop = node->data;
- GST_LOG ("property '%s' at ts=%" G_GUINT64_FORMAT, prop->name, timestamp);
-
if (!prop->csource || prop->disabled)
continue;
+ GST_LOG ("property '%s' at ts=%" G_GUINT64_FORMAT, prop->name, timestamp);
+
/* we can make this faster
* http://bugzilla.gnome.org/show_bug.cgi?id=536939
*/
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)) {
- if (gst_value_compare (&value, &prop->last_value) != GST_VALUE_EQUAL) {
+ val_ret = gst_control_source_get_value (prop->csource, timestamp, &value);
+ if (G_LIKELY (val_ret)) {
+ /* always set the value for first time, but then only if it changed
+ * this should limit g_object_notify invocations.
+ * FIXME: can we detect negative playback rates?
+ */
+ if ((timestamp < self->priv->last_sync) ||
+ 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");
+ GST_DEBUG ("no control value for param %s", prop->name);
}
g_value_unset (&value);
+ ret &= val_ret;
}
self->priv->last_sync = timestamp;
g_object_thaw_notify (self->object);
{
g_return_val_if_fail (GST_IS_CONTROL_SOURCE (self), FALSE);
- if (self->get_value) {
+ if (G_LIKELY (self->get_value)) {
return self->get_value (self, timestamp, value);
} else {
GST_ERROR ("Not bound to a specific property yet!");
{
g_return_val_if_fail (GST_IS_CONTROL_SOURCE (self), FALSE);
- if (self->get_value_array) {
+ if (G_LIKELY (self->get_value_array)) {
return self->get_value_array (self, timestamp, value_array);
} else {
GST_ERROR ("Not bound to a specific property yet!");