sync: masked waveform correlation, stretch sync, manual start time

- Waveform sync no longer treats uncached waveform regions as silence:
  the envelope extraction now reports a per-window validity mask and the
  correlation skips invalid windows on either side, improving accuracy
  for partially cached clips
- Add stretch/speed sync: AudioWaveformSync::EstimateStretchAndOffset
  searches a playback-rate range plus offset, and a new timeline
  context action 'Synchronize by Waveform (Adjust Speed)' applies the
  estimated rate as a clip speed change (with undo) when plain offset
  alignment is inconclusive
- Footage properties dialog gains a Source Start Time field so the
  value used by source-time sync can be viewed and edited manually
  instead of relying solely on auto-detected metadata; applied via an
  undo command, with Footage::ClearSourceStartTime() for removal
- Regression tests for masked correlation, stretch estimation, the
  envelope validity mask, and source-start-time set/clear
This commit is contained in:
2026-07-16 23:09:12 +08:00
parent 547c2480e0
commit caafac4203
13 changed files with 544 additions and 26 deletions
+29
View File
@@ -129,3 +129,32 @@ TEST(TimecodeMetadata, FootagePersistsSourceStartTime)
EXPECT_EQ(footage.source_start_time(), olive::core::rational(3600));
EXPECT_EQ(footage.source_start_time_source(), QStringLiteral("timecode"));
}
TEST(TimecodeMetadata, FootageClearSourceStartTime)
{
olive::Footage footage;
footage.SetSourceStartTime(olive::core::rational(3600),
QStringLiteral("manual"));
ASSERT_TRUE(footage.HasSourceStartTime());
footage.ClearSourceStartTime();
EXPECT_FALSE(footage.HasSourceStartTime());
EXPECT_EQ(footage.source_start_time(), olive::core::rational());
EXPECT_TRUE(footage.source_start_time_source().isEmpty());
}
TEST(TimecodeMetadata, FootageSetSourceStartTimeOverridesPreviousValue)
{
olive::Footage footage;
footage.SetSourceStartTime(olive::core::rational(3600),
QStringLiteral("timecode"));
// A manual edit replaces both the value and the recorded source
footage.SetSourceStartTime(olive::core::rational(1800),
QStringLiteral("manual"));
EXPECT_TRUE(footage.HasSourceStartTime());
EXPECT_EQ(footage.source_start_time(), olive::core::rational(1800));
EXPECT_EQ(footage.source_start_time_source(), QStringLiteral("manual"));
}