mirror of https://github.com/ErsatzTV/ErsatzTV.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
690 B
26 lines
690 B
using ErsatzTV.FFmpeg.State; |
|
|
|
namespace ErsatzTV.FFmpeg.Filter; |
|
|
|
public class WatermarkScaleFilter : BaseFilter |
|
{ |
|
private readonly FrameSize _resolution; |
|
private readonly WatermarkState _watermarkState; |
|
|
|
public WatermarkScaleFilter(WatermarkState watermarkState, FrameSize resolution) |
|
{ |
|
_watermarkState = watermarkState; |
|
_resolution = resolution; |
|
} |
|
|
|
public override string Filter |
|
{ |
|
get |
|
{ |
|
double width = Math.Round(_watermarkState.WidthPercent / 100.0 * _resolution.Width); |
|
return $"scale={width}:-1"; |
|
} |
|
} |
|
|
|
public override FrameState NextState(FrameState currentState) => currentState; |
|
}
|
|
|