public void Should_Return_Watermark( bool alignAudio, bool deinterlace, bool intermittent, WatermarkLocation location, bool scaled, int opacity, string expectedVideoFilter, string expectedAudioLabel, string expectedVideoLabel) { var watermark = new ChannelWatermark { Mode = intermittent ? ChannelWatermarkMode.Intermittent : ChannelWatermarkMode.Permanent, DurationSeconds = intermittent ? 15 : 0, FrequencyMinutes = intermittent ? 10 : 0, Location = location, Size = scaled ? WatermarkSize.Scaled : WatermarkSize.ActualSize, WidthPercent = scaled ? 20 : 0, Opacity = opacity, HorizontalMarginPercent = 7, VerticalMarginPercent = 5 }; Option <List <FadePoint> > maybeFadePoints = watermark.Mode == ChannelWatermarkMode.Intermittent ? Some( WatermarkCalculator.CalculateFadePoints( new DateTimeOffset(2022, 01, 31, 12, 25, 0, TimeSpan.FromHours(-5)), TimeSpan.Zero, TimeSpan.FromMinutes(55), TimeSpan.Zero, watermark.FrequencyMinutes, watermark.DurationSeconds)) : None; FFmpegComplexFilterBuilder builder = new FFmpegComplexFilterBuilder() .WithWatermark( Some(watermark), maybeFadePoints, new Resolution { Width = 1920, Height = 1080 }, None) .WithDeinterlace(deinterlace) .WithAlignedAudio(alignAudio ? Some(TimeSpan.FromMinutes(55)) : None); Option <FFmpegComplexFilter> result = builder.Build(false, 0, 0, 0, 1, false); result.IsSome.Should().BeTrue(); result.IfSome( filter => { filter.ComplexFilter.Should().Be(expectedVideoFilter); filter.AudioLabel.Should().Be(expectedAudioLabel); filter.VideoLabel.Should().Be(expectedVideoLabel); }); }
public static WatermarkViewModel ProjectToViewModel(ChannelWatermark watermark) =>