summaryrefslogtreecommitdiff
path: root/src/lib
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2026-04-08 23:41:34 +0200
committerCarl Hetherington <cth@carlh.net>2026-04-08 23:41:34 +0200
commitf06ad30918394cf1fdd614b2c8403752841adc51 (patch)
treed7d1cf6ff1c6f3f98b19affe361dde18f7636831 /src/lib
parentd5ec98da90b81a57cc4c885facf320c2c9b3eb5b (diff)
Fix incorrect fade outs (#3145).
Diffstat (limited to 'src/lib')
-rw-r--r--src/lib/video_content.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/lib/video_content.cc b/src/lib/video_content.cc
index b6e350d34..25c0fac62 100644
--- a/src/lib/video_content.cc
+++ b/src/lib/video_content.cc
@@ -435,8 +435,10 @@ VideoContent::fade(shared_ptr<const Film> film, ContentTime time) const
auto const fade_out_time = ContentTime::from_frames(fade_out(), vfr);
auto const end = ContentTime::from_frames(length(), vfr) - _parent->trim_end();
auto const time_after_end_fade_start = time - (end - fade_out_time);
+ /* The first frame of the fade (at time 0) must have some fade */
+ auto const fade_amount = time_after_end_fade_start + ContentTime::from_frames(1, vfr);
if (time_after_end_fade_start > ContentTime()) {
- return std::max(0.0, 1 - static_cast<double>(time_after_end_fade_start.get()) / fade_out_time.get());
+ return std::max(0.0, 1 - static_cast<double>(fade_amount.get()) / fade_out_time.get());
}
return {};