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>
+
* libs/gst/controller/gstcontroller.c: (gst_control_point_compare),
(gst_control_point_find), (gst_controlled_property_new),
(gst_control_point_free), (gst_controlled_property_free),
/* check if a control point for the timestamp exists */
if ((node = g_list_find_custom (prop->values, ×tamp,
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;
/* 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;
}
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];
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) {
break;
}
}
- /*
- if(node) {
- prop->last_value=prev_node;
- }
- */
+
+ if (prev_node)
+ prop->last_requested_value = prev_node;
+
return (prev_node);
}