libs/gst/controller/gstcontroller.c: Aggregate return value for gst_controller_sync_values(). More info in logging. A...

Original commit message from CVS:
* 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.
This commit is contained in:
Stefan Kost 2008-12-09 09:56:25 +00:00
parent 38077f85ab
commit 1f8d758f27
4 changed files with 37 additions and 11 deletions

View file

@ -1,3 +1,16 @@
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:

View file

@ -586,7 +586,8 @@ gst_controller_get_control_source (GstController * self, gchar * property_name)
* 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,
@ -661,6 +662,9 @@ gst_controller_suggest_next_sync (GstController * self)
* 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
*/
@ -669,7 +673,7 @@ gst_controller_sync_values (GstController * self, GstClockTime timestamp)
{
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);
@ -683,25 +687,31 @@ gst_controller_sync_values (GstController * self, GstClockTime timestamp)
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);

View file

@ -92,7 +92,7 @@ gst_control_source_get_value (GstControlSource * self, GstClockTime timestamp,
{
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!");
@ -122,7 +122,7 @@ gst_control_source_get_value_array (GstControlSource * self,
{
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!");

View file

@ -186,7 +186,10 @@ gst_object_sync_values (GObject * object, GstClockTime timestamp)
if ((ctrl = g_object_get_qdata (object, priv_gst_controller_key))) {
return gst_controller_sync_values (ctrl, timestamp);
}
return (FALSE);
/* this is no failure, its called by elements regardless if there is a
* controller assigned or not
*/
return (TRUE);
}
/**