snap footage imports to the timeline timebase

Earlier, footage that was not the same frame rate as the sequence had the chance
of their length value falling between a frame. This doesn't really help anything
with video since a frame is a discrete point in time, and only led to confusion
while navigating the timeline.
This commit is contained in:
itsmattkc
2019-12-18 01:21:25 +11:00
parent aae756b44c
commit be0d857e38
+8 -2
View File
@@ -117,8 +117,14 @@ void TimelineWidget::ImportTool::DragEnter(TimelineViewMouseEvent *event)
footage_duration = Config::Current()["DefaultStillLength"].value<rational>();
} else {
// Use duration from file
footage_duration = rational(stream->timebase().numerator() * stream->duration(),
stream->timebase().denominator());
int64_t stream_duration = stream->duration();
// Rescale to timeline timebase
stream_duration = qCeil(static_cast<double>(stream_duration) * stream->timebase().toDouble() / parent()->timebase_dbl());
// Convert to rational time
footage_duration = rational(parent()->timebase().numerator() * stream_duration,
parent()->timebase().denominator());
}
ghost->SetIn(ghost_start);