Browse Source

fix subtitle graphics element path and fonts (#2650)

pull/2651/head
Jason Dove 1 month ago committed by GitHub
parent
commit
fdf1e70e0d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      CHANGELOG.md
  2. 16
      ErsatzTV.Infrastructure/Streaming/Graphics/Subtitle/SubtitleElement.cs

1
CHANGELOG.md

@ -82,6 +82,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). @@ -82,6 +82,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- This should improve performance of library scans
- Add toggle to hide/show disabled channels in channel list
- Add disabled text color and `(D)` and `(H)` labels for disabled and hidden channels in channel list
- Graphics engine: fix subtitle path escaping and font loading
### Changed
- Classic schedules: `Refresh` classic playouts from playout list; do not `Reset` them

16
ErsatzTV.Infrastructure/Streaming/Graphics/Subtitle/SubtitleElement.cs

@ -1,5 +1,6 @@ @@ -1,5 +1,6 @@
using System.Buffers;
using System.IO.Pipelines;
using System.Runtime.InteropServices;
using CliWrap;
using ErsatzTV.Core;
using ErsatzTV.Core.FFmpeg;
@ -84,12 +85,25 @@ public class SubtitleElement( @@ -84,12 +85,25 @@ public class SubtitleElement(
await File.WriteAllTextAsync(subtitleTemplateFile, textToRender, cancellationToken);
string subtitleFile = Path.GetFileName(subtitleTemplateFile);
string fontsDir = FileSystemLayout.ResourcesCacheFolder;
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
fontsDir = fontsDir
.Replace(@"\", @"/\")
.Replace(@":/", @"\\:/");
subtitleFile = subtitleFile
.Replace(@"\", @"/\")
.Replace(@":/", @"\\:/");
}
List<string> arguments =
[
"-nostdin", "-hide_banner", "-nostats", "-loglevel", "error",
"-f", "lavfi",
"-i",
$"color=c=black@0.0:s={context.FrameSize.Width}x{context.FrameSize.Height}:r={context.FrameRate},format=bgra,subtitles='{subtitleFile}':alpha=1",
$"color=c=black@0.0:s={context.FrameSize.Width}x{context.FrameSize.Height}:r={context.FrameRate},format=bgra,subtitles={subtitleFile}:fontsdir={fontsDir}:alpha=1",
"-f", "image2pipe",
"-pix_fmt", "bgra",
"-vcodec", "rawvideo",

Loading…
Cancel
Save