timeline: add API to get sources neighbouring a position.
@meh
Submitted by Mathieu Duponchelle Link to original bug (#737504)
Description
My use case was removing gaps in a timeline, the least complex algorithm I came up with was : find out if a clip overlaps with other clips, if not find the next source and ripple it towards you.
These functions implement the second step correctly with a low complexity (not very theoretically versed but we use a sequence_search so I would guess a logarithmic complexity).
The new API is generic enough (allows to filter by track types and search for either clips ending or starting before or after you), and can come in pretty handy for script writers (or plugin writers for pitivi).
It is extensively tested and the tests obviously pass :)
In the future we could reuse these functions to handle the snapping mechanism internally.