mirror of
https://github.com/brunoherbelin/vimix.git
synced 2025-12-12 10:49:59 +01:00
Bugfix computation time with gaps
This commit is contained in:
17
Timeline.cpp
17
Timeline.cpp
@@ -258,11 +258,10 @@ bool Timeline::removeGaptAt(GstClockTime t)
|
|||||||
|
|
||||||
GstClockTime Timeline::sectionsDuration() const
|
GstClockTime Timeline::sectionsDuration() const
|
||||||
{
|
{
|
||||||
GstClockTime d = 0;
|
|
||||||
|
|
||||||
// compute the sum of durations of gaps
|
// compute the sum of durations of gaps
|
||||||
for (auto it = gaps_.begin(); it != gaps_.end(); ++it)
|
GstClockTime d = 0;
|
||||||
d += (*it).end - (*it).begin;
|
for (auto g = gaps_.begin(); g != gaps_.end(); ++g)
|
||||||
|
d+= g->duration();
|
||||||
|
|
||||||
// remove sum of gaps from actual duration
|
// remove sum of gaps from actual duration
|
||||||
return duration() - d;
|
return duration() - d;
|
||||||
@@ -271,15 +270,13 @@ GstClockTime Timeline::sectionsDuration() const
|
|||||||
|
|
||||||
GstClockTime Timeline::sectionsTimeAt(GstClockTime t) const
|
GstClockTime Timeline::sectionsTimeAt(GstClockTime t) const
|
||||||
{
|
{
|
||||||
// target time
|
|
||||||
GstClockTime d = t;
|
|
||||||
|
|
||||||
// loop over gaps
|
// loop over gaps
|
||||||
for (auto it = gaps_.begin(); it != gaps_.end(); ++it) {
|
GstClockTime d = t;
|
||||||
|
for (auto g = gaps_.begin(); g != gaps_.end(); ++g) {
|
||||||
// gap before target?
|
// gap before target?
|
||||||
if ( (*it).end < d ) {
|
if ( g->begin < d ) {
|
||||||
// increment target
|
// increment target
|
||||||
d += (*it).end - (*it).begin;
|
d += g->duration();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// done
|
// done
|
||||||
|
|||||||
Reference in New Issue
Block a user