Files
ersatztv/ErsatzTV.Application/Streaming/PtsTime.cs
T
Jason DoveandGitHub 2ef2b0299a switch back from fmp4 to ts segments (#2554)
* restore pts offset calculation

* use ts segments again

* update changelog
2025-10-21 12:17:05 -05:00

21 lines
571 B
C#

using System.Globalization;
namespace ErsatzTV.Application.Streaming;
public record PtsTime(TimeSpan Value)
{
public static readonly PtsTime Zero = new(TimeSpan.Zero);
public static PtsTime From(string ffprobeLine)
{
string[] split = ffprobeLine.Split("|");
var ptsTime = double.Parse(split[0], CultureInfo.InvariantCulture);
if (double.TryParse(split[1], CultureInfo.InvariantCulture, out double duration))
{
ptsTime += duration;
}
return new PtsTime(TimeSpan.FromSeconds(ptsTime));
}
}