libs/gst/controller/: Save last synced value from the list to continue searching from there in future syncs. This spe...

Original commit message from CVS:
reviewed by: Stefan Kost <ensonic@users.sf.net>
* libs/gst/controller/gstcontroller.c: (gst_controller_unset),
(gst_controller_unset_all):
* libs/gst/controller/gstcontrollerprivate.h:
* libs/gst/controller/gstinterpolation.c:
(gst_controlled_property_find_control_point_node):
Save last synced value from the list to continue searching from there
in future syncs. This speeds everything up a bit.
This commit is contained in:
Sebastian Dröge 2007-05-17 17:16:09 +00:00
parent b92d7dc076
commit 3b7871d993
4 changed files with 28 additions and 19 deletions

View file

@ -1,3 +1,15 @@
2007-05-17 Sebastian Dröge <slomo@circular-chaos.org>
reviewed by: Stefan Kost <ensonic@users.sf.net>
* libs/gst/controller/gstcontroller.c: (gst_controller_unset),
(gst_controller_unset_all):
* libs/gst/controller/gstcontrollerprivate.h:
* libs/gst/controller/gstinterpolation.c:
(gst_controlled_property_find_control_point_node):
Save last synced value from the list to continue searching from there
in future syncs. This speeds everything up a bit.
2007-05-17 Sebastian Dröge <slomo@circular-chaos.org>
reviewed by: Stefan Kost <ensonic@users.sf.net>

View file

@ -853,6 +853,8 @@ gst_controller_unset (GstController * self, gchar * property_name,
/* check if a control point for the timestamp exists */
if ((node = g_list_find_custom (prop->values, &timestamp,
gst_control_point_find))) {
if (node == prop->last_requested_value)
prop->last_requested_value = NULL;
gst_control_point_free (node->data); /* free GstControlPoint */
prop->values = g_list_delete_link (prop->values, node);
res = TRUE;
@ -888,6 +890,7 @@ gst_controller_unset_all (GstController * self, gchar * property_name)
/* free GstControlPoint structures */
g_list_foreach (prop->values, (GFunc) gst_control_point_free, NULL);
g_list_free (prop->values);
prop->last_requested_value = NULL;
prop->values = NULL;
res = TRUE;
}

View file

@ -106,9 +106,7 @@ typedef struct _GstControlledProperty
InterpolateGetValueArray get_value_array;
GList *values; /* List of GstControlPoint */
/* TODO keep the last search result to be able to continue
GList *last_value; // last search result, can be used for incremental searches
*/
GList *last_requested_value; /* last search result, can be used for incremental searches */
/*< private >*/
gpointer _gst_reserved[GST_PADDING];

View file

@ -44,23 +44,20 @@ GList *
gst_controlled_property_find_control_point_node (GstControlledProperty * prop,
GstClockTime timestamp)
{
/* GList *prev_node = NULL; */
GList *prev_node = g_list_last (prop->values);
GList *node;
GstControlPoint *cp;
/*
if((prop->last_value) &&
(timestamp>((GstTimedValue *)(prop->last_value->data))->timestamp)) {
node=prop->last_value;
}
else {
node=prop->values;
}
*/
node = prop->values;
if (prop->last_requested_value) {
GstControlPoint *last_cp = prop->last_requested_value->data;
if (timestamp > last_cp->timestamp)
node = prop->last_requested_value;
}
/* iterate over timed value list */
for (node = prop->values; node; node = g_list_next (node)) {
for (; node; node = g_list_next (node)) {
cp = node->data;
/* this timestamp is newer that the one we look for */
if (timestamp < cp->timestamp) {
@ -69,11 +66,10 @@ gst_controlled_property_find_control_point_node (GstControlledProperty * prop,
break;
}
}
/*
if(node) {
prop->last_value=prev_node;
}
*/
if (prev_node)
prop->last_requested_value = prev_node;
return (prev_node);
}