fix watermark opacity filter (#820)
This commit is contained in:
@@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||
## [Unreleased]
|
||||
### Fixed
|
||||
- Additional fix for duplicate `Other Videos` entries; trash may need to be emptied one last time after upgrading
|
||||
- Fix watermark opacity in cultures where `,` is a decimal separator
|
||||
|
||||
### Added
|
||||
- Enable QSV hardware acceleration for vaapi docker images
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
using System.Collections.Generic;
|
||||
using ErsatzTV.FFmpeg.Filter;
|
||||
using ErsatzTV.FFmpeg.State;
|
||||
using FluentAssertions;
|
||||
using LanguageExt;
|
||||
using NUnit.Framework;
|
||||
|
||||
namespace ErsatzTV.FFmpeg.Tests.Filter;
|
||||
|
||||
[TestFixture]
|
||||
public class WatermarkOpacityFilterTests
|
||||
{
|
||||
[Test]
|
||||
// this needs to be a culture where ',' is a decimal separator
|
||||
[SetCulture("it-IT")]
|
||||
public void Should_Return_Filter_With_Period_Decimal_Unlike_Local_Culture()
|
||||
{
|
||||
var filter = new WatermarkOpacityFilter(
|
||||
new WatermarkState(
|
||||
Option<List<WatermarkFadePoint>>.None,
|
||||
WatermarkLocation.BottomRight,
|
||||
WatermarkSize.ActualSize,
|
||||
50,
|
||||
50,
|
||||
50,
|
||||
75));
|
||||
|
||||
filter.Filter.Should().Be("colorchannelmixer=aa=0.75");
|
||||
}
|
||||
|
||||
[Test]
|
||||
[SetCulture("en-US")]
|
||||
public void Should_Return_Filter_With_Period_Decimal()
|
||||
{
|
||||
var filter = new WatermarkOpacityFilter(
|
||||
new WatermarkState(
|
||||
Option<List<WatermarkFadePoint>>.None,
|
||||
WatermarkLocation.BottomRight,
|
||||
WatermarkSize.ActualSize,
|
||||
50,
|
||||
50,
|
||||
50,
|
||||
75));
|
||||
|
||||
filter.Filter.Should().Be("colorchannelmixer=aa=0.75");
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
using ErsatzTV.FFmpeg.State;
|
||||
using System.Globalization;
|
||||
using ErsatzTV.FFmpeg.State;
|
||||
|
||||
namespace ErsatzTV.FFmpeg.Filter;
|
||||
|
||||
@@ -13,7 +14,7 @@ public class WatermarkOpacityFilter : BaseFilter
|
||||
get
|
||||
{
|
||||
double opacity = _desiredState.Opacity / 100.0;
|
||||
return $"colorchannelmixer=aa={opacity:F2}";
|
||||
return $"colorchannelmixer=aa={opacity.ToString("F2", NumberFormatInfo.InvariantInfo)}";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user