graphics engine: add scaled resolution and place within source content (#2606)

This commit is contained in:
Jason Dove
2025-11-06 14:15:55 -06:00
committed by GitHub
parent d87561d140
commit e6824cf251
5 changed files with 8 additions and 1 deletions
+2
View File
@@ -10,6 +10,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Add `MediaItem_Resolution` template data (the current `Resolution` variable is the FFmpeg Profile resolution)
- Add `MediaItem_Start` template data (DateTimeOffset)
- Add `MediaItem_Stop` template data (DateTimeOffset)
- Add `ScaledResolution` (the final size of the frame before padding)
- Add `place_within_source_content` (true/false) field to image graphics element
- Classic schedules: add collection type `Search Query`
- This allows defining search queries directly on schedule items without creating smart collections beforehand
- As an example, this can be used to filter or combine existing smart collections
@@ -34,4 +34,7 @@ public class ImageGraphicsElement
[YamlMember(Alias = "scale_width_percent", ApplyNamingConventions = false)]
public double? ScaleWidthPercent { get; set; }
[YamlMember(Alias = "place_within_source_content", ApplyNamingConventions = false)]
public bool PlaceWithinSourceContent { get; set; }
}
@@ -3,4 +3,5 @@ namespace ErsatzTV.Core.Metadata;
public static class FFmpegProfileTemplateDataKey
{
public static readonly string Resolution = "Resolution";
public static readonly string ScaledResolution = "ScaledResolution";
}
@@ -176,6 +176,7 @@ public partial class GraphicsElementLoader(
var result = new Dictionary<string, object>
{
[FFmpegProfileTemplateDataKey.Resolution] = context.FrameSize,
[FFmpegProfileTemplateDataKey.ScaledResolution] = context.SquarePixelFrameSize,
[MediaItemTemplateDataKey.StreamSeek] = context.Seek,
[MediaItemTemplateDataKey.Start] = context.ContentStartTime,
[MediaItemTemplateDataKey.Stop] = context.ContentStartTime + context.Duration
@@ -42,7 +42,7 @@ public class ImageElement(ImageGraphicsElement imageGraphicsElement, ILogger log
imageGraphicsElement.ScaleWidthPercent,
imageGraphicsElement.HorizontalMarginPercent,
imageGraphicsElement.VerticalMarginPercent,
false,
imageGraphicsElement.PlaceWithinSourceContent,
cancellationToken);
}
catch (Exception ex)