add image graphics element (#2288)

This commit is contained in:
Jason Dove
2025-08-09 17:42:23 +00:00
committed by GitHub
parent 908125f8a9
commit df0801f2c6
10 changed files with 281 additions and 5 deletions
@@ -380,7 +380,9 @@ public class FFmpegLibraryProcessService : IFFmpegProcessService
switch (playoutItemGraphicsElement.GraphicsElement.Kind)
{
case GraphicsElementKind.Text:
var maybeElement = await TextGraphicsElement.FromFile(playoutItemGraphicsElement.GraphicsElement.Path);
{
var maybeElement =
await TextGraphicsElement.FromFile(playoutItemGraphicsElement.GraphicsElement.Path);
if (maybeElement.IsNone)
{
_logger.LogWarning(
@@ -399,7 +401,34 @@ public class FFmpegLibraryProcessService : IFFmpegProcessService
graphicsElementContexts.Add(new TextElementContext(element, variables));
}
break;
}
case GraphicsElementKind.Image:
{
var maybeElement =
await ImageGraphicsElement.FromFile(playoutItemGraphicsElement.GraphicsElement.Path);
if (maybeElement.IsNone)
{
_logger.LogWarning(
"Failed to load image graphics element from file {Path}; ignoring",
playoutItemGraphicsElement.GraphicsElement.Path);
}
foreach (var element in maybeElement)
{
// var variables = new Dictionary<string, string>();
// if (!string.IsNullOrWhiteSpace(playoutItemGraphicsElement.Variables))
// {
// variables = JsonConvert.DeserializeObject<Dictionary<string, string>>(
// playoutItemGraphicsElement.Variables);
// }
graphicsElementContexts.Add(new ImageElementContext(element));
}
break;
}
default:
_logger.LogInformation(
"Ignoring unsupported graphics element kind {Kind}",